[PATCH] D137811: InstCombine: Port amdgcn.class intrinsic combines to is.fpclass

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 22:30:21 PST 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:842
+    // Equivalent of isnan. Replace with standard fcmp.
+    Value *FCmp = Builder.CreateFCmpUNO(Src0, Src0);
+    FCmp->takeName(&II);
----------------
sepavloff wrote:
> This replacement is not valid in general case, only if FP exceptions are ignored. If the argument is a signaling NaN, compare instruction raises `Invalid` exception.
Isn't that implied by not being a constrained intrinsic?



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:849
+    // Equivalent of == 0.
+    Value *FCmp =
+        Builder.CreateFCmpOEQ(Src0, ConstantFP::get(Src0->getType(), 0.0));
----------------
sepavloff wrote:
> It also is not always valid, only if the argument is not a signaling NaN or FP exceptions are ignored..
Isn't that implied by not being a constrained intrinsic?


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

https://reviews.llvm.org/D137811



More information about the llvm-commits mailing list