mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
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
This commit is contained in:
parent
189f80dc25
commit
6b92942c9c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user