Implement cast fp -> bool
authorChris Lattner <sabre@nondot.org>
Mon, 23 Feb 2004 03:21:41 +0000 (03:21 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 23 Feb 2004 03:21:41 +0000 (03:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11728 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/InstSelectSimple.cpp
lib/Target/X86/X86ISelSimple.cpp

index 78d5a1cad6cd0fe724caaa538e70702a116a0979..a5277c0d2a6686067de41ced72cdbd7600a82b3e 100644 (file)
@@ -1978,8 +1978,10 @@ void ISel::emitCastOperation(MachineBasicBlock *BB,
       break;
     }
     case cFP:
-      assert(0 && "FIXME: implement cast FP to bool");
-      abort();
+      BMI(BB, IP, X86::FTST, 1).addReg(SrcReg);
+      BMI(BB, IP, X86::FNSTSWr8, 0);
+      BMI(BB, IP, X86::SAHF, 1);
+      break;
     }
 
     // If the zero flag is not set, then the value is true, set the byte to
index 78d5a1cad6cd0fe724caaa538e70702a116a0979..a5277c0d2a6686067de41ced72cdbd7600a82b3e 100644 (file)
@@ -1978,8 +1978,10 @@ void ISel::emitCastOperation(MachineBasicBlock *BB,
       break;
     }
     case cFP:
-      assert(0 && "FIXME: implement cast FP to bool");
-      abort();
+      BMI(BB, IP, X86::FTST, 1).addReg(SrcReg);
+      BMI(BB, IP, X86::FNSTSWr8, 0);
+      BMI(BB, IP, X86::SAHF, 1);
+      break;
     }
 
     // If the zero flag is not set, then the value is true, set the byte to