[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
Thu Dec 1 02:22:24 PST 2022


foad added a comment.

Seems OK. A more thorough handling of the ninf/nnan stuff could go like:

  BitsToIgnore = 0;
  if (isKnownNeverNaN)
    BitsToIgnore |= fcNan;
  if (isKnownNeverInfinity)
    BitsToIgnore |= fcInf;
  
  if ((Mask & ~BitsToIgnore) == 0) { convert to false }
  if ((Mask | BitsToIgnore) == fcAllFlags) { convert to true }
  if ((Mask & ~BitsToIgnore) == fcNan) { convert to isnan }
  if ((Mask | BitsToIgnore) == (~fcNan & fcAllFlags)) { convert to !isnan }
  if ((Mask & ~BitsToIgnore) == fcZero) { convert to == 0.0 }
  if ((Mask | BitsToIgnore) == (~fcZero & fcAllFlags)) { convert to != 0.0 }


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

https://reviews.llvm.org/D139032



More information about the llvm-commits mailing list