diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp index 78d5a1cad6c..a5277c0d2a6 100644 --- a/lib/Target/X86/InstSelectSimple.cpp +++ b/lib/Target/X86/InstSelectSimple.cpp @@ -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 diff --git a/lib/Target/X86/X86ISelSimple.cpp b/lib/Target/X86/X86ISelSimple.cpp index 78d5a1cad6c..a5277c0d2a6 100644 --- a/lib/Target/X86/X86ISelSimple.cpp +++ b/lib/Target/X86/X86ISelSimple.cpp @@ -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