float->int conversion rounds toward 0. Duh.
[oota-llvm.git] / lib / VMCore / ConstantFold.cpp
index 0c1d7f73ae1cec2b75f9470d9385f5f1d8002ae2..d8b8566193aedd95f6fe1d89844c8e443e1246fc 100644 (file)
@@ -196,7 +196,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
       uint32_t DestBitWidth = cast<IntegerType>(DestTy)->getBitWidth();
       APFloat::opStatus status = V.convertToInteger(x, DestBitWidth, 
                              opc==Instruction::FPToSI,
-                             APFloat::rmNearestTiesToEven);
+                             APFloat::rmTowardZero);
       if (status!=APFloat::opOK && status!=APFloat::opInexact)
         return 0; // give up
       APInt Val(DestBitWidth, 2, x);