From: Dale Johannesen Date: Mon, 24 Sep 2007 21:06:09 +0000 (+0000) Subject: float->int conversion rounds toward 0. Duh. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6b92942c9c5c2cc94bffe0850b41afce3b3e991f;p=oota-llvm.git float->int conversion rounds toward 0. Duh. Fixes PR1698. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42273 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 0c1d7f73ae1..d8b8566193a 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -196,7 +196,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V, uint32_t DestBitWidth = cast(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);