diff options
author | Dale Johannesen <dalej@apple.com> | 2007-09-24 21:06:09 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-09-24 21:06:09 +0000 |
commit | 236811313a7f25912abdb02c0569918480de3809 (patch) | |
tree | bb052c32953b529ebd052d245474090e33bf8078 /lib/VMCore/ConstantFold.cpp | |
parent | e7ba1beb28280d8b51b2484bd6166c482bc58193 (diff) | |
download | external_llvm-236811313a7f25912abdb02c0569918480de3809.tar.gz external_llvm-236811313a7f25912abdb02c0569918480de3809.tar.bz2 external_llvm-236811313a7f25912abdb02c0569918480de3809.zip |
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
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 0c1d7f73ae..d8b8566193 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<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); |