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

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 3 12:55:02 PST 2004


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.152 -> 1.153

---
Log message:

Generate ftst instructions for comparison against zero


---
Diffs of the changes:  (+9 -0)

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.152 llvm/lib/Target/X86/InstSelectSimple.cpp:1.153
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.152	Mon Feb  2 13:31:38 2004
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Tue Feb  3 12:54:04 2004
@@ -702,6 +702,15 @@
       return OpNum;
     }
 
+  // Special case handling of comparison against +/- 0.0
+  if (ConstantFP *CFP = dyn_cast<ConstantFP>(Op1))
+    if (CFP->isExactlyValue(+0.0) || CFP->isExactlyValue(-0.0)) {
+      BMI(MBB, IP, X86::FTST, 1).addReg(Op0r);
+      BMI(MBB, IP, X86::FNSTSWr8, 0);
+      BMI(MBB, IP, X86::SAHF, 1);
+      return OpNum;
+    }
+
   unsigned Op1r = getReg(Op1, MBB, IP);
   switch (Class) {
   default: assert(0 && "Unknown type class!");





More information about the llvm-commits mailing list