[PATCH] D139032: InstCombine: Handle folding some negated is_fpclass mask test cases
Joshua Cranmer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 15:04:41 PST 2022
jcranmer-intel added a comment.
If DAZ mode is semantically "denormals are non-canonical zero", then `isfpclass(denormal, Zero)` arguably should be true in DAZ mode, so lowering that to `fcmp 0.0` would be legal. On the other hand, the actual lowering of an unoptimized `isfpclass` is likely to rely on bit patterns which would ignore the current dynamic value of DAZ. On the other other hand, there's no clear indication of what `isfpclass` returns for noncanonical values... and on the other other other hand, leaving the result of `isfpclass` as unspecified behavior for noncanonical inputs is incredibly unfriendly to users.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:854
+ if (Mask == (~fcZero & fcAllFlags) && !IsStrict) {
+ // Equivalent of !(x == 0).
+ Value *FCmp =
----------------
foad wrote:
> That's also equivalent to `!= 0` - at least for the usual mapping of C-like comparison operators onto fp predicates.
They're not equivalent: `!(x == 0)` is true if x is NaN, and `x != 0` is false if x is NaN.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139032/new/
https://reviews.llvm.org/D139032
More information about the llvm-commits
mailing list