[PATCH] D149587: InstSimplify: Simplifications for ldexp

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 02:42:25 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:2710
 
-      if (IntrinsicID == Intrinsic::amdgcn_ldexp) {
+      if (IntrinsicID == Intrinsic::ldexp) {
         // FIXME: Should flush denorms depending on FP mode, but that's ignored
----------------
This is dead code with the extra case you added above.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:6084
+    if (Q.isUndefValue(Op0))
+      return ConstantFP::getNaN(Op0->getType());
+
----------------
Why is this not strictfp-safe?


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:6106
+  if (C && C->isNaN())
+    return ConstantFP::get(Op0->getType(), C->makeQuiet());
+
----------------
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.


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

https://reviews.llvm.org/D149587



More information about the llvm-commits mailing list