summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/InstSelectSimple.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-02 19:31:38 +0000
committerChris Lattner <sabre@nondot.org>2004-02-02 19:31:38 +0000
commit30d26ac56127770f0b65917575c431a7e773b846 (patch)
treec2ea0d2f1524c22724240e790f6329c9e8a35e26 /llvm/lib/Target/X86/InstSelectSimple.cpp
parent7af8ad64441ea1d33f4301e2fa85d83202085a69 (diff)
downloadbcm5719-llvm-30d26ac56127770f0b65917575c431a7e773b846.tar.gz
bcm5719-llvm-30d26ac56127770f0b65917575c431a7e773b846.zip
Generate the fchs instruction to negate a floating point number
llvm-svn: 11078
Diffstat (limited to 'llvm/lib/Target/X86/InstSelectSimple.cpp')
-rw-r--r--llvm/lib/Target/X86/InstSelectSimple.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/InstSelectSimple.cpp b/llvm/lib/Target/X86/InstSelectSimple.cpp
index fd4c44f99e0..abfcad15668 100644
--- a/llvm/lib/Target/X86/InstSelectSimple.cpp
+++ b/llvm/lib/Target/X86/InstSelectSimple.cpp
@@ -1227,7 +1227,13 @@ void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB,
return;
}
}
- }
+ } else if (ConstantFP *CFP = dyn_cast<ConstantFP>(Op0))
+ if (CFP->isExactlyValue(-0.0)) {
+ // -0.0 - X === -X
+ unsigned op1Reg = getReg(Op1, MBB, IP);
+ BMI(MBB, IP, X86::FCHS, 1, DestReg).addReg(op1Reg);
+ return;
+ }
if (!isa<ConstantInt>(Op1) || Class == cLong) {
static const unsigned OpcodeTab[][4] = {
OpenPOWER on IntegriCloud