[llvm] b611329 - InstCombine: Add baseline tests for negated is_fpclass
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 06:13:35 PST 2022
Author: Matt Arsenault
Date: 2022-11-30T09:13:30-05:00
New Revision: b611329491e53276d49511ab48695ba3492dabfe
URL: https://github.com/llvm/llvm-project/commit/b611329491e53276d49511ab48695ba3492dabfe
DIFF: https://github.com/llvm/llvm-project/commit/b611329491e53276d49511ab48695ba3492dabfe.diff
LOG: InstCombine: Add baseline tests for negated 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 6edaa124cb96..af51a4b0482d 100644
--- a/llvm/test/Transforms/InstCombine/is_fpclass.ll
+++ b/llvm/test/Transforms/InstCombine/is_fpclass.ll
@@ -115,7 +115,7 @@ define i1 @test_class_isnan_f32(float %x) {
define i1 @test_class_isnan_f32_strict(float %x) {
; CHECK-LABEL: @test_class_isnan_f32_strict(
-; CHECK-NEXT: [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 3) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT: [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 3) #[[ATTR1:[0-9]+]]
; CHECK-NEXT: ret i1 [[VAL]]
;
%val = call i1 @llvm.is.fpclass.f32(float %x, i32 3) strictfp
@@ -133,7 +133,7 @@ define i1 @test_class_is_p0_n0_f32(float %x) {
define i1 @test_class_is_p0_n0_f32_strict(float %x) {
; CHECK-LABEL: @test_class_is_p0_n0_f32_strict(
-; CHECK-NEXT: [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 96) #[[ATTR2]]
+; CHECK-NEXT: [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 96) #[[ATTR1]]
; CHECK-NEXT: ret i1 [[VAL]]
;
%val = call i1 @llvm.is.fpclass.f32(float %x, i32 96) strictfp
@@ -391,7 +391,89 @@ define i1 @test_class_is_nan_other_nnan_src(float %x) {
ret i1 %class
}
+; --------------------------------------------------------------------
+; Negation of llvm.is.fpclass
+; --------------------------------------------------------------------
+
+define i1 @test_class_not_is_nan(float %x) {
+; CHECK-LABEL: @test_class_not_is_nan(
+; CHECK-NEXT: [[CLASS:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 3)
+; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[CLASS]], true
+; CHECK-NEXT: ret i1 [[NOT]]
+;
+ %class = call i1 @llvm.is.fpclass.f32(float %x, i32 3)
+ %not = xor i1 %class, true
+ ret i1 %not
+}
+
+define i1 @test_class_not_is_nan_multi_use(float %x, ptr %ptr) {
+; CHECK-LABEL: @test_class_not_is_nan_multi_use(
+; CHECK-NEXT: [[CLASS:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 3)
+; CHECK-NEXT: store i1 [[CLASS]], ptr [[PTR:%.*]], align 1
+; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[CLASS]], true
+; CHECK-NEXT: ret i1 [[NOT]]
+;
+ %class = call i1 @llvm.is.fpclass.f32(float %x, i32 3)
+ store i1 %class, ptr %ptr
+ %not = xor i1 %class, true
+ ret i1 %not
+}
+
+define i1 @test_class_not_is_inf_nan(float %x) {
+; CHECK-LABEL: @test_class_not_is_inf_nan(
+; CHECK-NEXT: [[CLASS:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 519)
+; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[CLASS]], true
+; CHECK-NEXT: ret i1 [[NOT]]
+;
+ %class = call i1 @llvm.is.fpclass.f32(float %x, i32 519)
+ %not = xor i1 %class, true
+ ret i1 %not
+}
+
+define i1 @test_class_not_is_normal(float %x) {
+; CHECK-LABEL: @test_class_not_is_normal(
+; CHECK-NEXT: [[CLASS:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 264)
+; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[CLASS]], true
+; CHECK-NEXT: ret i1 [[NOT]]
+;
+ %class = call i1 @llvm.is.fpclass.f32(float %x, i32 264)
+ %not = xor i1 %class, true
+ ret i1 %not
+}
+
+define i1 @test_class_xor_false(float %x) {
+; CHECK-LABEL: @test_class_xor_false(
+; CHECK-NEXT: [[CLASS:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 33)
+; CHECK-NEXT: ret i1 [[CLASS]]
+;
+ %class = call i1 @llvm.is.fpclass.f32(float %x, i32 33)
+ %not = xor i1 %class, false
+ ret i1 %not
+}
+
+define <2 x i1> @test_class_not_vector(<2 x float> %x) {
+; CHECK-LABEL: @test_class_not_vector(
+; CHECK-NEXT: [[CLASS:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[X:%.*]], i32 33)
+; CHECK-NEXT: [[NOT:%.*]] = xor <2 x i1> [[CLASS]], <i1 true, i1 true>
+; CHECK-NEXT: ret <2 x i1> [[NOT]]
+;
+ %class = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %x, i32 33)
+ %not = xor <2 x i1> %class, <i1 true, i1 true>
+ ret <2 x i1> %not
+}
+
+define <2 x i1> @test_class_xor_vector(<2 x float> %x) {
+; CHECK-LABEL: @test_class_xor_vector(
+; CHECK-NEXT: [[CLASS:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[X:%.*]], i32 33)
+; CHECK-NEXT: [[NOT:%.*]] = xor <2 x i1> [[CLASS]], <i1 true, i1 false>
+; CHECK-NEXT: ret <2 x i1> [[NOT]]
+;
+ %class = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %x, i32 33)
+ %not = xor <2 x i1> %class, <i1 true, i1 false>
+ ret <2 x i1> %not
+}
declare i1 @llvm.is.fpclass.f32(float, i32 immarg)
declare i1 @llvm.is.fpclass.f64(double, i32 immarg)
+declare <2 x i1> @llvm.is.fpclass.v2f32(<2 x float>, i32 immarg)
More information about the llvm-commits
mailing list