[PATCH] D139032: InstCombine: Handle folding some negated is_fpclass mask test cases
    Jay Foad via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Nov 30 23:40:17 PST 2022
    
    
  
foad added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:854
+  if (Mask == (~fcZero & fcAllFlags) && !IsStrict) {
+    // Equivalent of !(x == 0).
+    Value *FCmp =
----------------
jcranmer-intel wrote:
> 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.
They are equivalent. The usual mapping is that `==` means `oeq` and `!=` means `une`. See for example F.9.3 in the C spec or https://github.com/llvm/llvm-project/blob/df43ec30ab66f5af7bbf87e121e0fe26aad478b4/clang/lib/CodeGen/CGExprScalar.cpp#L865
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139032/new/
https://reviews.llvm.org/D139032
    
    
More information about the llvm-commits
mailing list