Codegen fabs/fabsf as FABS. Patch contributed by Morten Ofstad

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21607 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-04-28 21:48:42 +00:00
parent da6ba87d23
commit 3b6b63711e

View File

@ -1735,6 +1735,15 @@ void X86ISel::visitCallInst(CallInst &CI) {
if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) {
visitIntrinsicCall(ID, CI); // Special intrinsics are not handled here
return;
} else if (F->getName() == "fabs" || F->getName() == "fabsf") {
if (CI.getNumOperands() == 2 && // Basic sanity checks.
CI.getOperand(1)->getType()->isFloatingPoint() &&
CI.getType() == CI.getOperand(1)->getType()) {
unsigned op1Reg = getReg(CI.getOperand(1));
unsigned DestReg = getReg(CI);
BuildMI(BB, X86::FABS, 1, DestReg).addReg(op1Reg);
return;
}
}
// Emit a CALL instruction with PC-relative displacement.