mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-15 22:37:59 +00:00
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:
parent
da6ba87d23
commit
3b6b63711e
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user