forked from OSchip/llvm-project
float->int conversion rounds toward 0. Duh.
Fixes PR1698. llvm-svn: 42273
This commit is contained in:
parent
bd8331da87
commit
5026f4ba93
|
@ -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