[llvm] [InstCombine] Fold isnan idioms (PR #101510)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 11:07:06 PDT 2024


================
@@ -237,12 +232,7 @@ define i1 @f32_fcnan(float %a) {
 define i1 @f32_fcnan_strictfp(float %a) strictfp {
 ; CHECK-LABEL: define i1 @f32_fcnan_strictfp(
 ; CHECK-SAME: float [[A:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[I32:%.*]] = bitcast float [[A]] to i32
-; CHECK-NEXT:    [[AND1:%.*]] = and i32 [[I32]], 2139095040
-; CHECK-NEXT:    [[CMP1:%.*]] = icmp eq i32 [[AND1]], 2139095040
-; CHECK-NEXT:    [[AND2:%.*]] = and i32 [[I32]], 8388607
-; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne i32 [[AND2]], 0
-; CHECK-NEXT:    [[RES:%.*]] = and i1 [[CMP1]], [[CMP2]]
+; CHECK-NEXT:    [[RES:%.*]] = fcmp uno float [[A]], 0.000000e+00
----------------
jcranmer-intel wrote:

Even if you did create a strict fcmp, it wouldn't be right, because now you're potentially introducing a floating-point exception that didn't previously exist.

https://github.com/llvm/llvm-project/pull/101510


More information about the llvm-commits mailing list