mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-04 01:42:09 +00:00
Add direct support for the isnan intrinsic, implementing test/Regression/CodeGen/X86/isnan.llx
testcase git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14141 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
665e661384
commit
b4fe76cbb5
@ -1628,6 +1628,7 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
|
||||
case Intrinsic::frameaddress:
|
||||
case Intrinsic::memcpy:
|
||||
case Intrinsic::memset:
|
||||
case Intrinsic::isnan:
|
||||
case Intrinsic::readport:
|
||||
case Intrinsic::writeport:
|
||||
// We directly implement these intrinsics
|
||||
@ -1636,19 +1637,19 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
|
||||
// On X86, memory operations are in-order. Lower this intrinsic
|
||||
// into a volatile load.
|
||||
Instruction *Before = CI->getPrev();
|
||||
LoadInst * LI = new LoadInst (CI->getOperand(1), "", true, CI);
|
||||
CI->replaceAllUsesWith (LI);
|
||||
BB->getInstList().erase (CI);
|
||||
LoadInst * LI = new LoadInst(CI->getOperand(1), "", true, CI);
|
||||
CI->replaceAllUsesWith(LI);
|
||||
BB->getInstList().erase(CI);
|
||||
break;
|
||||
}
|
||||
case Intrinsic::writeio: {
|
||||
// On X86, memory operations are in-order. Lower this intrinsic
|
||||
// into a volatile store.
|
||||
Instruction *Before = CI->getPrev();
|
||||
StoreInst * LI = new StoreInst (CI->getOperand(1),
|
||||
CI->getOperand(2), true, CI);
|
||||
CI->replaceAllUsesWith (LI);
|
||||
BB->getInstList().erase (CI);
|
||||
StoreInst *LI = new StoreInst(CI->getOperand(1),
|
||||
CI->getOperand(2), true, CI);
|
||||
CI->replaceAllUsesWith(LI);
|
||||
BB->getInstList().erase(CI);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1656,12 +1657,11 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
|
||||
Instruction *Before = CI->getPrev();
|
||||
TM.getIntrinsicLowering().LowerIntrinsicCall(CI);
|
||||
if (Before) { // Move iterator to instruction after call
|
||||
I = Before; ++I;
|
||||
I = Before; ++I;
|
||||
} else {
|
||||
I = BB->begin();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
@ -1698,6 +1698,19 @@ void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
}
|
||||
return;
|
||||
|
||||
case Intrinsic::isnan:
|
||||
TmpReg1 = getReg(CI.getOperand(1));
|
||||
if (0) { // for processors prior to the P6
|
||||
BuildMI(BB, X86::FpUCOM, 2).addReg(TmpReg1).addReg(TmpReg1);
|
||||
BuildMI(BB, X86::FNSTSW8r, 0);
|
||||
BuildMI(BB, X86::SAHF, 1);
|
||||
} else {
|
||||
BuildMI(BB, X86::FpUCOMI, 2).addReg(TmpReg1).addReg(TmpReg1);
|
||||
}
|
||||
TmpReg2 = getReg(CI);
|
||||
BuildMI(BB, X86::SETPr, 0, TmpReg2);
|
||||
return;
|
||||
|
||||
case Intrinsic::memcpy: {
|
||||
assert(CI.getNumOperands() == 5 && "Illegal llvm.memcpy call!");
|
||||
unsigned Align = 1;
|
||||
|
@ -1628,6 +1628,7 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
|
||||
case Intrinsic::frameaddress:
|
||||
case Intrinsic::memcpy:
|
||||
case Intrinsic::memset:
|
||||
case Intrinsic::isnan:
|
||||
case Intrinsic::readport:
|
||||
case Intrinsic::writeport:
|
||||
// We directly implement these intrinsics
|
||||
@ -1636,19 +1637,19 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
|
||||
// On X86, memory operations are in-order. Lower this intrinsic
|
||||
// into a volatile load.
|
||||
Instruction *Before = CI->getPrev();
|
||||
LoadInst * LI = new LoadInst (CI->getOperand(1), "", true, CI);
|
||||
CI->replaceAllUsesWith (LI);
|
||||
BB->getInstList().erase (CI);
|
||||
LoadInst * LI = new LoadInst(CI->getOperand(1), "", true, CI);
|
||||
CI->replaceAllUsesWith(LI);
|
||||
BB->getInstList().erase(CI);
|
||||
break;
|
||||
}
|
||||
case Intrinsic::writeio: {
|
||||
// On X86, memory operations are in-order. Lower this intrinsic
|
||||
// into a volatile store.
|
||||
Instruction *Before = CI->getPrev();
|
||||
StoreInst * LI = new StoreInst (CI->getOperand(1),
|
||||
CI->getOperand(2), true, CI);
|
||||
CI->replaceAllUsesWith (LI);
|
||||
BB->getInstList().erase (CI);
|
||||
StoreInst *LI = new StoreInst(CI->getOperand(1),
|
||||
CI->getOperand(2), true, CI);
|
||||
CI->replaceAllUsesWith(LI);
|
||||
BB->getInstList().erase(CI);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1656,12 +1657,11 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
|
||||
Instruction *Before = CI->getPrev();
|
||||
TM.getIntrinsicLowering().LowerIntrinsicCall(CI);
|
||||
if (Before) { // Move iterator to instruction after call
|
||||
I = Before; ++I;
|
||||
I = Before; ++I;
|
||||
} else {
|
||||
I = BB->begin();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
@ -1698,6 +1698,19 @@ void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
}
|
||||
return;
|
||||
|
||||
case Intrinsic::isnan:
|
||||
TmpReg1 = getReg(CI.getOperand(1));
|
||||
if (0) { // for processors prior to the P6
|
||||
BuildMI(BB, X86::FpUCOM, 2).addReg(TmpReg1).addReg(TmpReg1);
|
||||
BuildMI(BB, X86::FNSTSW8r, 0);
|
||||
BuildMI(BB, X86::SAHF, 1);
|
||||
} else {
|
||||
BuildMI(BB, X86::FpUCOMI, 2).addReg(TmpReg1).addReg(TmpReg1);
|
||||
}
|
||||
TmpReg2 = getReg(CI);
|
||||
BuildMI(BB, X86::SETPr, 0, TmpReg2);
|
||||
return;
|
||||
|
||||
case Intrinsic::memcpy: {
|
||||
assert(CI.getNumOperands() == 5 && "Illegal llvm.memcpy call!");
|
||||
unsigned Align = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user