[PATCH] D149587: InstSimplify: Simplifications for ldexp

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 06:28:09 PDT 2023


kpn added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:6106
+  if (C && C->isNaN())
+    return ConstantFP::get(Op0->getType(), C->makeQuiet());
+
----------------
arsenm wrote:
> foad wrote:
> > Why is this not strictfp-safe?
> > 
> > Maybe I just need a good description of what strictfp implies. The description in the langref mentions rounding mode, status flags and trapping, but says nothing about quieting NaNs.
> A signaling nan is supposed to raise an exception which quieting it would hide.
> 
> The [[https://llvm.org/docs/LangRef.html#floating-point-environment  | LangRef]] states signaling nans may not be quieted by non-constrained operations and constrained should handle them properly
With "maytrap' we are allowed to remove exceptions. That should make quieting an sNaN safe, no? Also, are callers checking for the default fp environment? That should behave the same as non-constrained operations.


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

https://reviews.llvm.org/D149587



More information about the llvm-commits mailing list