[PATCH] D143031: [InstCombine][NFC] Add tests with icmp splat vectors and B masks

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 01:00:03 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG353720a95b5d: [InstCombine][NFC] Add tests with icmp splat vectors and B masks (authored by jmciver, committed by RKSimon).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143031

Files:
  llvm/test/Transforms/InstCombine/icmp-logical.ll


Index: llvm/test/Transforms/InstCombine/icmp-logical.ll
===================================================================
--- llvm/test/Transforms/InstCombine/icmp-logical.ll
+++ llvm/test/Transforms/InstCombine/icmp-logical.ll
@@ -377,6 +377,36 @@
   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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143031.512356.patch
Type: text/x-patch
Size: 1837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230411/ed8e0e3d/attachment.bin>


More information about the llvm-commits mailing list