diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-02-02 18:56:30 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-02-02 18:56:30 +0000 |
| commit | 298fdd7eb1327f6a98a08d314621a70e4eab8778 (patch) | |
| tree | 31630498490959cae3f81d319e8b1dd88408d116 /llvm/lib/Target/X86/InstSelectSimple.cpp | |
| parent | 6fe75845f99dbe080f118a6fbf594c7f6d85e210 (diff) | |
| download | bcm5719-llvm-298fdd7eb1327f6a98a08d314621a70e4eab8778.tar.gz bcm5719-llvm-298fdd7eb1327f6a98a08d314621a70e4eab8778.zip | |
Codegen -0.0 correctly. Do not use fldz! This is another -0.0 == +0.0 problem, arg.
llvm-svn: 11070
Diffstat (limited to 'llvm/lib/Target/X86/InstSelectSimple.cpp')
| -rw-r--r-- | llvm/lib/Target/X86/InstSelectSimple.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/InstSelectSimple.cpp b/llvm/lib/Target/X86/InstSelectSimple.cpp index 5135385ddff..fd4c44f99e0 100644 --- a/llvm/lib/Target/X86/InstSelectSimple.cpp +++ b/llvm/lib/Target/X86/InstSelectSimple.cpp @@ -438,10 +438,9 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB, BMI(MBB, IP, IntegralOpcodeTab[Class], 1, R).addZImm(CI->getRawValue()); } } else if (ConstantFP *CFP = dyn_cast<ConstantFP>(C)) { - double Value = CFP->getValue(); - if (Value == +0.0) + if (CFP->isExactlyValue(+0.0)) BMI(MBB, IP, X86::FLD0, 0, R); - else if (Value == +1.0) + else if (CFP->isExactlyValue(+1.0)) BMI(MBB, IP, X86::FLD1, 0, R); else { // Otherwise we need to spill the constant to memory... @@ -1212,7 +1211,7 @@ void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, // sub 0, X -> neg X if (OperatorClass == 1 && Class != cLong) - if (ConstantInt *CI = dyn_cast<ConstantInt>(Op0)) + if (ConstantInt *CI = dyn_cast<ConstantInt>(Op0)) { if (CI->isNullValue()) { unsigned op1Reg = getReg(Op1, MBB, IP); switch (Class) { @@ -1228,6 +1227,7 @@ void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, return; } } + } if (!isa<ConstantInt>(Op1) || Class == cLong) { static const unsigned OpcodeTab[][4] = { |

