diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-02-12 14:54:54 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-02-12 14:54:54 +0000 |
commit | 996c66620ee22a795b1298a894eadaacda4efb01 (patch) | |
tree | 214ab9d4966f577ba70d38966c6df4b30407512c | |
parent | 1cf713664dac35f1224161fc074ec1c1100a06f5 (diff) | |
download | bcm5719-llvm-996c66620ee22a795b1298a894eadaacda4efb01.tar.gz bcm5719-llvm-996c66620ee22a795b1298a894eadaacda4efb01.zip |
GlobalISel: Use default rounding mode when extending fconstant
I don't think this matters since the values should all be exactly
representable.
llvm-svn: 353844
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp index d232bb7578d..b3170b039e7 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp @@ -1148,14 +1148,19 @@ LegalizerHelper::widenScalar(MachineInstr &MI, unsigned TypeIdx, LLT WideTy) { bool LosesInfo; switch (WideTy.getSizeInBits()) { case 32: - Val.convert(APFloat::IEEEsingle(), APFloat::rmTowardZero, &LosesInfo); + Val.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, + &LosesInfo); break; case 64: - Val.convert(APFloat::IEEEdouble(), APFloat::rmTowardZero, &LosesInfo); + Val.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, + &LosesInfo); break; default: - llvm_unreachable("Unhandled fp widen type"); + return UnableToLegalize; } + + assert(!LosesInfo && "extend should always be lossless"); + Observer.changingInstr(MI); SrcMO.setFPImm(ConstantFP::get(Ctx, Val)); |