[PATCH] D87115: [FPEnv][X86][SystemZ] Use different algorithms for i64->double uint_to_fp under strictfp to avoid producing -0.0 when rounding to negative infinity

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 09:06:06 PDT 2020


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:6468
+  // infinity. It produces -0.0 so disable under strictfp.
+  if (Node->isStrictFPOpcode())
+    return false;
----------------
uweigand wrote:
> Why is this testing isStrictFPOpcode?   The only difference between strict and non-strict operations is that the former respect exceptions (and current rounding mode, if applicable).  The behavior of signed zeros is not affected by those; even a non-strict UINT_TO_FP should never produce a negative zero (unless the NoSignedZero flags is set, I guess).
The issue only occurs if the rounding mode has been changed to FE_DOWNWARD. Since it’s undefined behavior to change rounding mode and use non-strict unit_to_fp, I didn’t change those.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87115/new/

https://reviews.llvm.org/D87115



More information about the llvm-commits mailing list