[llvm] 9fcf053 - InstCombine: Add a few tests for daz behavior with is_fpclass

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 06:58:17 PST 2022


Author: Matt Arsenault
Date: 2022-12-13T09:58:01-05:00
New Revision: 9fcf05357b6fc0f1f8a639de3a2096780a481de6

URL: https://github.com/llvm/llvm-project/commit/9fcf05357b6fc0f1f8a639de3a2096780a481de6
DIFF: https://github.com/llvm/llvm-project/commit/9fcf05357b6fc0f1f8a639de3a2096780a481de6.diff

LOG: InstCombine: Add a few tests for daz behavior with is_fpclass

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/is_fpclass.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/is_fpclass.ll b/llvm/test/Transforms/InstCombine/is_fpclass.ll
index 68b65a9b94a66..e7bf4e224ed88 100644
--- a/llvm/test/Transforms/InstCombine/is_fpclass.ll
+++ b/llvm/test/Transforms/InstCombine/is_fpclass.ll
@@ -110,7 +110,7 @@ define i1 @test_class_is_p0_n0_f32(float %x) {
 ; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 96)
 ; CHECK-NEXT:    ret i1 [[VAL]]
 ;
-  %val = call i1 @llvm.is.fpclass.f32(float %x, i32 96)
+  %val = call i1 @llvm.is.fpclass.f32(float %x, i32 96) ; fcZero
   ret i1 %val
 }
 
@@ -123,6 +123,51 @@ define i1 @test_class_is_p0_n0_f32_strict(float %x) {
   ret i1 %val
 }
 
+define i1 @test_class_is_p0_n0_f32_daz(float %x) "denormal-fp-math"="ieee,preserve-sign" {
+; CHECK-LABEL: @test_class_is_p0_n0_f32_daz(
+; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 96)
+; CHECK-NEXT:    ret i1 [[VAL]]
+;
+  %val = call i1 @llvm.is.fpclass.f32(float %x, i32 96) ; fcZero
+  ret i1 %val
+}
+
+define i1 @test_class_is_p0_n0_f32_dapz(float %x) "denormal-fp-math"="ieee,positive-zero" {
+; CHECK-LABEL: @test_class_is_p0_n0_f32_dapz(
+; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 96)
+; CHECK-NEXT:    ret i1 [[VAL]]
+;
+  %val = call i1 @llvm.is.fpclass.f32(float %x, i32 96) ; fcZero
+  ret i1 %val
+}
+
+define i1 @test_class_is_p0_n0_psub_nsub_f32(float %x) {
+; CHECK-LABEL: @test_class_is_p0_n0_psub_nsub_f32(
+; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 240)
+; CHECK-NEXT:    ret i1 [[VAL]]
+;
+  %val = call i1 @llvm.is.fpclass.f32(float %x, i32 240) ; fcZero | fcSubnormal
+  ret i1 %val
+}
+
+define i1 @test_class_is_p0_n0_psub_nsub_f32_daz(float %x) "denormal-fp-math"="ieee,preserve-sign" {
+; CHECK-LABEL: @test_class_is_p0_n0_psub_nsub_f32_daz(
+; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 240)
+; CHECK-NEXT:    ret i1 [[VAL]]
+;
+  %val = call i1 @llvm.is.fpclass.f32(float %x, i32 240) ; fcZero | fcSubnormal
+  ret i1 %val
+}
+
+define i1 @test_class_is_p0_n0_psub_nsub_f32_dapz(float %x) "denormal-fp-math"="ieee,positive-zero" {
+; CHECK-LABEL: @test_class_is_p0_n0_psub_nsub_f32_dapz(
+; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 240)
+; CHECK-NEXT:    ret i1 [[VAL]]
+;
+  %val = call i1 @llvm.is.fpclass.f32(float %x, i32 240) ; fcZero | fcSubnormal
+  ret i1 %val
+}
+
 define i1 @test_constant_class_snan_test_snan_f64() {
 ; CHECK-LABEL: define {{[^@]+}}@test_constant_class_snan_test_snan_f64(
 ; CHECK-NEXT:    ret i1 true


        


More information about the llvm-commits mailing list