[PATCH] D58080: GlobalISel: Use default rounding mode when extending fconstant

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 11 15:44:27 PST 2019


arsenm created this revision.
arsenm added reviewers: aemerson, volkan, aditya_nandakumar, rtereshin, paquette.
Herald added subscribers: Petar.Avramovic, kristof.beyls, rovka, wdng.

I don't think this matters since the values should all be exactly representable.


https://reviews.llvm.org/D58080

Files:
  lib/CodeGen/GlobalISel/LegalizerHelper.cpp


Index: lib/CodeGen/GlobalISel/LegalizerHelper.cpp
===================================================================
--- lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -1229,13 +1229,15 @@
     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;
     }
     Observer.changingInstr(MI);
     SrcMO.setFPImm(ConstantFP::get(Ctx, Val));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58080.186353.patch
Type: text/x-patch
Size: 902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190211/c35a285d/attachment.bin>


More information about the llvm-commits mailing list