[llvm] 353720a - [InstCombine][NFC] Add tests with icmp splat vectors and B masks
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 00:59:53 PDT 2023
Author: John McIver
Date: 2023-04-11T08:59:34+01:00
New Revision: 353720a95b5d5ac05752f33ac220313e4d266cee
URL: https://github.com/llvm/llvm-project/commit/353720a95b5d5ac05752f33ac220313e4d266cee
DIFF: https://github.com/llvm/llvm-project/commit/353720a95b5d5ac05752f33ac220313e4d266cee.diff
LOG: [InstCombine][NFC] Add tests with icmp splat vectors and B masks
Add tests to verifying future support for splat vectors containing poison/undef in llvm::decomposeBitTestICmp.
Differential Revision: https://reviews.llvm.org/D143031
Added:
Modified:
llvm/test/Transforms/InstCombine/icmp-logical.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/icmp-logical.ll b/llvm/test/Transforms/InstCombine/icmp-logical.ll
index 62342fae5058d..98fa470427ff4 100644
--- a/llvm/test/Transforms/InstCombine/icmp-logical.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-logical.ll
@@ -377,6 +377,36 @@ define i1 @fold_mask_cmps_to_true_logical(i32 %x) {
ret i1 %t4
}
+define <2 x i1> @nomask_splat_and_B_allones(<2 x i32> %A) {
+; CHECK-LABEL: @nomask_splat_and_B_allones(
+; CHECK-NEXT: [[TST1:%.*]] = icmp slt <2 x i32> [[A:%.*]], <i32 0, i32 poison>
+; CHECK-NEXT: [[MASK2:%.*]] = and <2 x i32> [[A]], <i32 1879048192, i32 1879048192>
+; CHECK-NEXT: [[TST2:%.*]] = icmp eq <2 x i32> [[MASK2]], <i32 1879048192, i32 1879048192>
+; CHECK-NEXT: [[RES:%.*]] = and <2 x i1> [[TST1]], [[TST2]]
+; CHECK-NEXT: ret <2 x i1> [[RES]]
+;
+ %tst1 = icmp slt <2 x i32> %A, <i32 0, i32 poison>
+ %mask2 = and <2 x i32> %A, <i32 1879048192, i32 1879048192>
+ %tst2 = icmp eq <2 x i32> %mask2, <i32 1879048192, i32 1879048192>
+ %res = and <2 x i1> %tst1, %tst2
+ ret <2 x i1> %res
+}
+
+define <2 x i1> @nomask_splat_and_B_mixed(<2 x i32> %A) {
+; CHECK-LABEL: @nomask_splat_and_B_mixed(
+; CHECK-NEXT: [[TST1:%.*]] = icmp sgt <2 x i32> [[A:%.*]], <i32 -1, i32 poison>
+; CHECK-NEXT: [[MASK2:%.*]] = and <2 x i32> [[A]], <i32 1879048192, i32 1879048192>
+; CHECK-NEXT: [[TST2:%.*]] = icmp eq <2 x i32> [[MASK2]], <i32 1879048192, i32 1879048192>
+; CHECK-NEXT: [[RES:%.*]] = and <2 x i1> [[TST1]], [[TST2]]
+; CHECK-NEXT: ret <2 x i1> [[RES]]
+;
+ %tst1 = icmp sgt <2 x i32> %A, <i32 -1, i32 poison>
+ %mask2 = and <2 x i32> %A, <i32 1879048192, i32 1879048192>
+ %tst2 = icmp eq <2 x i32> %mask2, <i32 1879048192, i32 1879048192>
+ %res = and <2 x i1> %tst1, %tst2
+ ret <2 x i1> %res
+}
+
; PR32401 - https://bugs.llvm.org/show_bug.cgi?id=32401
define i1 @cmpeq_bitwise(i8 %a, i8 %b, i8 %c, i8 %d) {
More information about the llvm-commits
mailing list