[llvm] 51c0b68 - [SLP][NFC]Add more tests for shuffles that can be optimized after SLP,

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 05:44:11 PST 2021


Author: Alexey Bataev
Date: 2021-11-16T05:42:18-08:00
New Revision: 51c0b6843a192ec3bb8d75047a74457a3171c6fc

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

LOG: [SLP][NFC]Add more tests for shuffles that can be optimized after SLP,
NFC.

Added: 
    

Modified: 
    llvm/test/Transforms/SLPVectorizer/X86/diamond_broadcast_extra_shuffle.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SLPVectorizer/X86/diamond_broadcast_extra_shuffle.ll b/llvm/test/Transforms/SLPVectorizer/X86/diamond_broadcast_extra_shuffle.ll
index accc40b927c4..3e23a4762777 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/diamond_broadcast_extra_shuffle.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/diamond_broadcast_extra_shuffle.ll
@@ -32,4 +32,65 @@ entry:
   ret i32 0
 }
 
+define i32 @diamond_broadcast2(i32* noalias nocapture %B, i32* noalias nocapture %A) {
+; CHECK-LABEL: @diamond_broadcast2(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[LD:%.*]] = load i32, i32* [[A:%.*]], align 4
+; CHECK-NEXT:    [[ARRAYIDX9:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], i64 1
+; CHECK-NEXT:    [[ARRAYIDX15:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 2
+; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <4 x i32> poison, i32 [[LD]], i32 0
+; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <4 x i32> [[TMP0]], <4 x i32> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 undef>
+; CHECK-NEXT:    [[SHUFFLE1:%.*]] = shufflevector <4 x i32> [[TMP0]], <4 x i32> poison, <4 x i32> zeroinitializer
+; CHECK-NEXT:    [[TMP1:%.*]] = mul <4 x i32> [[SHUFFLE]], [[SHUFFLE1]]
+; CHECK-NEXT:    [[ARRAYIDX21:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 3
+; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i32* [[B]] to <4 x i32>*
+; CHECK-NEXT:    store <4 x i32> [[TMP1]], <4 x i32>* [[TMP2]], align 4
+; CHECK-NEXT:    ret i32 0
+;
+entry:
+  %ld = load i32, i32* %A, align 4
+  %mul = mul i32 %ld, %ld
+  store i32 %mul, i32* %B, align 4
+  %mul8 = mul i32 %ld, %ld
+  %arrayidx9 = getelementptr inbounds i32, i32* %B, i64 1
+  store i32 %mul8, i32* %arrayidx9, align 4
+  %mul14 = mul i32 %ld, %ld
+  %arrayidx15 = getelementptr inbounds i32, i32* %B, i64 2
+  store i32 %mul14, i32* %arrayidx15, align 4
+  %mul20 = mul i32 undef, %ld
+  %arrayidx21 = getelementptr inbounds i32, i32* %B, i64 3
+  store i32 %mul20, i32* %arrayidx21, align 4
+  ret i32 0
+}
+
+define i32 @diamond_broadcast3(i32* noalias nocapture %B, i32* noalias nocapture %A) {
+; CHECK-LABEL: @diamond_broadcast3(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[LD:%.*]] = load i32, i32* [[A:%.*]], align 4
+; CHECK-NEXT:    [[ARRAYIDX9:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], i64 1
+; CHECK-NEXT:    [[ARRAYIDX15:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 2
+; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <4 x i32> poison, i32 [[LD]], i32 0
+; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <4 x i32> [[TMP0]], <4 x i32> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 undef>
+; CHECK-NEXT:    [[SHUFFLE1:%.*]] = shufflevector <4 x i32> [[TMP0]], <4 x i32> poison, <4 x i32> <i32 0, i32 0, i32 undef, i32 0>
+; CHECK-NEXT:    [[TMP1:%.*]] = mul <4 x i32> [[SHUFFLE]], [[SHUFFLE1]]
+; CHECK-NEXT:    [[ARRAYIDX21:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 3
+; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i32* [[B]] to <4 x i32>*
+; CHECK-NEXT:    store <4 x i32> [[TMP1]], <4 x i32>* [[TMP2]], align 4
+; CHECK-NEXT:    ret i32 0
+;
+entry:
+  %ld = load i32, i32* %A, align 4
+  %mul = mul i32 %ld, %ld
+  store i32 %mul, i32* %B, align 4
+  %mul8 = mul i32 %ld, %ld
+  %arrayidx9 = getelementptr inbounds i32, i32* %B, i64 1
+  store i32 %mul8, i32* %arrayidx9, align 4
+  %mul14 = mul i32 %ld, undef
+  %arrayidx15 = getelementptr inbounds i32, i32* %B, i64 2
+  store i32 %mul14, i32* %arrayidx15, align 4
+  %mul20 = mul i32 undef, %ld
+  %arrayidx21 = getelementptr inbounds i32, i32* %B, i64 3
+  store i32 %mul20, i32* %arrayidx21, align 4
+  ret i32 0
+}
 


        


More information about the llvm-commits mailing list