From 6b92942c9c5c2cc94bffe0850b41afce3b3e991f Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Mon, 24 Sep 2007 21:06:09 +0000 Subject: [PATCH] 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 --- lib/VMCore/ConstantFold.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.34.1