[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 2 12:57:02 PST 2004


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.150 -> 1.151

---
Log message:

Codegen -0.0 correctly.  Do not use fldz!  This is another -0.0 == +0.0 problem, arg.


---
Diffs of the changes:  (+4 -4)

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.150 llvm/lib/Target/X86/InstSelectSimple.cpp:1.151
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.150	Fri Jan 30 16:13:44 2004
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Mon Feb  2 12:56:30 2004
@@ -438,10 +438,9 @@
       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 @@
 
   // 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 @@
           return;
         }
       }
+    }
 
   if (!isa<ConstantInt>(Op1) || Class == cLong) {
     static const unsigned OpcodeTab[][4] = {





More information about the llvm-commits mailing list