[llvm] e1fcf99 - [InstCombine] Add splat vector test for asymmetric masked icmp fold

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 01:57:37 PDT 2022


Author: Nikita Popov
Date: 2022-05-24T10:57:28+02:00
New Revision: e1fcf998dc95f832da440ce9227c83fa6af96011

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

LOG: [InstCombine] Add splat vector test for asymmetric masked icmp fold
(NFC)

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 4bdecea2dc56..cd15f5a088d1 100644
--- a/llvm/test/Transforms/InstCombine/icmp-logical.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-logical.ll
@@ -457,6 +457,23 @@ define i1 @masked_icmps_mask_notallzeros_bmask_mixed_1(i32 %x) {
   ret i1 %t5
 }
 
+define <2 x i1> @masked_icmps_mask_notallzeros_bmask_mixed_1_vector(<2 x i32> %x) {
+; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_1_vector(
+; CHECK-NEXT:    [[T1:%.*]] = and <2 x i32> [[X:%.*]], <i32 12, i32 12>
+; CHECK-NEXT:    [[T2:%.*]] = icmp ne <2 x i32> [[T1]], zeroinitializer
+; CHECK-NEXT:    [[T3:%.*]] = and <2 x i32> [[X]], <i32 7, i32 7>
+; CHECK-NEXT:    [[T4:%.*]] = icmp eq <2 x i32> [[T3]], <i32 1, i32 1>
+; CHECK-NEXT:    [[T5:%.*]] = and <2 x i1> [[T2]], [[T4]]
+; CHECK-NEXT:    ret <2 x i1> [[T5]]
+;
+  %t1 = and <2 x i32> %x, <i32 12, i32 12>
+  %t2 = icmp ne <2 x i32> %t1, zeroinitializer
+  %t3 = and <2 x i32> %x, <i32 7, i32 7>
+  %t4 = icmp eq <2 x i32> %t3, <i32 1, i32 1>
+  %t5 = and <2 x i1> %t2, %t4
+  ret <2 x i1> %t5
+}
+
 define i1 @masked_icmps_mask_notallzeros_bmask_mixed_1_logical(i32 %x) {
 ; CHECK-LABEL: @masked_icmps_mask_notallzeros_bmask_mixed_1_logical(
 ; CHECK-NEXT:    [[TMP1:%.*]] = and i32 [[X:%.*]], 15


        


More information about the llvm-commits mailing list