[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

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 09:44:10 PDT 2020


uweigand 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;
----------------
craig.topper wrote:
> 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.
Ah, I see.  Thanks!


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:6493
   // of performing rounding correctly, both in the default rounding mode
   // and in all alternate rounding modes.
   SDValue TwoP52 = DAG.getConstant(UINT64_C(0x4330000000000000), dl, SrcVT);
----------------
This comment  is not accurate, then?


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

https://reviews.llvm.org/D87115



More information about the llvm-commits mailing list