[llvm-commits] [llvm] r42273 - /llvm/trunk/lib/VMCore/ConstantFold.cpp

Dale Johannesen dalej at apple.com
Mon Sep 24 14:06:09 PDT 2007


Author: johannes
Date: Mon Sep 24 16:06:09 2007
New Revision: 42273

URL: http://llvm.org/viewvc/llvm-project?rev=42273&view=rev
Log:
float->int conversion rounds toward 0.  Duh.
Fixes PR1698.


Modified:
    llvm/trunk/lib/VMCore/ConstantFold.cpp

Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=42273&r1=42272&r2=42273&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Sep 24 16:06:09 2007
@@ -196,7 +196,7 @@
       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);





More information about the llvm-commits mailing list