[llvm] 3731bbc - [SLP]Add a test for geps with non-const indeces in scatter vectorize
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 08:03:39 PDT 2022
Author: Alexey Bataev
Date: 2022-06-07T08:02:14-07:00
New Revision: 3731bbc4251075525db3e7d75292d4df2075f656
URL: https://github.com/llvm/llvm-project/commit/3731bbc4251075525db3e7d75292d4df2075f656
DIFF: https://github.com/llvm/llvm-project/commit/3731bbc4251075525db3e7d75292d4df2075f656.diff
LOG: [SLP]Add a test for geps with non-const indeces in scatter vectorize
nodes, NFC.
Added:
llvm/test/Transforms/SLPVectorizer/X86/split-load8_2_unord_geps.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/split-load8_2_unord_geps.ll b/llvm/test/Transforms/SLPVectorizer/X86/split-load8_2_unord_geps.ll
new file mode 100644
index 0000000000000..4f813ce7d5f32
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/split-load8_2_unord_geps.ll
@@ -0,0 +1,185 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mcpu=skylake-avx512 | FileCheck %s
+
+define void @test(i32* noalias %p, i32* noalias %addr, i32* noalias %s) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[IDX1:%.*]] = load i32, i32* [[ADDR:%.*]], align 8
+; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[P:%.*]], i32 [[IDX1]]
+; CHECK-NEXT: [[I:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
+; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 1
+; CHECK-NEXT: [[IDX2:%.*]] = load i32, i32* [[GEP2]], align 8
+; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX2]]
+; CHECK-NEXT: [[I1:%.*]] = load i32, i32* [[ARRAYIDX1]], align 4
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[I1]], [[I]]
+; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, i32* [[S:%.*]], i32 0
+; CHECK-NEXT: store i32 [[ADD]], i32* [[ARRAYIDX2]], align 4
+; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 2
+; CHECK-NEXT: [[IDX3:%.*]] = load i32, i32* [[GEP3]], align 8
+; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX3]]
+; CHECK-NEXT: [[I2:%.*]] = load i32, i32* [[ARRAYIDX4]], align 4
+; CHECK-NEXT: [[GEP4:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 3
+; CHECK-NEXT: [[IDX4:%.*]] = load i32, i32* [[GEP4]], align 8
+; CHECK-NEXT: [[ARRAYIDX6:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX4]]
+; CHECK-NEXT: [[I3:%.*]] = load i32, i32* [[ARRAYIDX6]], align 4
+; CHECK-NEXT: [[ADD7:%.*]] = add nsw i32 [[I3]], [[I2]]
+; CHECK-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds i32, i32* [[S]], i32 1
+; CHECK-NEXT: store i32 [[ADD7]], i32* [[ARRAYIDX9]], align 4
+; CHECK-NEXT: [[GEP5:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 4
+; CHECK-NEXT: [[IDX5:%.*]] = load i32, i32* [[GEP5]], align 8
+; CHECK-NEXT: [[ARRAYIDX11:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX5]]
+; CHECK-NEXT: [[I4:%.*]] = load i32, i32* [[ARRAYIDX11]], align 4
+; CHECK-NEXT: [[GEP6:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 5
+; CHECK-NEXT: [[IDX6:%.*]] = load i32, i32* [[GEP6]], align 8
+; CHECK-NEXT: [[ARRAYIDX13:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX6]]
+; CHECK-NEXT: [[I5:%.*]] = load i32, i32* [[ARRAYIDX13]], align 4
+; CHECK-NEXT: [[ADD14:%.*]] = add nsw i32 [[I5]], [[I4]]
+; CHECK-NEXT: [[ARRAYIDX16:%.*]] = getelementptr inbounds i32, i32* [[S]], i32 2
+; CHECK-NEXT: store i32 [[ADD14]], i32* [[ARRAYIDX16]], align 4
+; CHECK-NEXT: [[GEP7:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 6
+; CHECK-NEXT: [[IDX7:%.*]] = load i32, i32* [[GEP7]], align 8
+; CHECK-NEXT: [[ARRAYIDX18:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX7]]
+; CHECK-NEXT: [[I6:%.*]] = load i32, i32* [[ARRAYIDX18]], align 4
+; CHECK-NEXT: [[GEP8:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 7
+; CHECK-NEXT: [[IDX8:%.*]] = load i32, i32* [[GEP8]], align 8
+; CHECK-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX8]]
+; CHECK-NEXT: [[I7:%.*]] = load i32, i32* [[ARRAYIDX20]], align 4
+; CHECK-NEXT: [[ADD21:%.*]] = add nsw i32 [[I7]], [[I6]]
+; CHECK-NEXT: [[ARRAYIDX23:%.*]] = getelementptr inbounds i32, i32* [[S]], i32 3
+; CHECK-NEXT: store i32 [[ADD21]], i32* [[ARRAYIDX23]], align 4
+; CHECK-NEXT: [[GEP9:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 8
+; CHECK-NEXT: [[IDX9:%.*]] = load i32, i32* [[GEP9]], align 8
+; CHECK-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX9]]
+; CHECK-NEXT: [[I8:%.*]] = load i32, i32* [[ARRAYIDX25]], align 4
+; CHECK-NEXT: [[GEP10:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 9
+; CHECK-NEXT: [[IDX10:%.*]] = load i32, i32* [[GEP10]], align 8
+; CHECK-NEXT: [[ARRAYIDX27:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX10]]
+; CHECK-NEXT: [[I9:%.*]] = load i32, i32* [[ARRAYIDX27]], align 4
+; CHECK-NEXT: [[ADD28:%.*]] = add nsw i32 [[I9]], [[I8]]
+; CHECK-NEXT: [[ARRAYIDX30:%.*]] = getelementptr inbounds i32, i32* [[S]], i32 4
+; CHECK-NEXT: store i32 [[ADD28]], i32* [[ARRAYIDX30]], align 4
+; CHECK-NEXT: [[GEP11:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 10
+; CHECK-NEXT: [[IDX11:%.*]] = load i32, i32* [[GEP11]], align 8
+; CHECK-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX11]]
+; CHECK-NEXT: [[I10:%.*]] = load i32, i32* [[ARRAYIDX32]], align 4
+; CHECK-NEXT: [[GEP12:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 11
+; CHECK-NEXT: [[IDX12:%.*]] = load i32, i32* [[GEP12]], align 8
+; CHECK-NEXT: [[ARRAYIDX34:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX12]]
+; CHECK-NEXT: [[I11:%.*]] = load i32, i32* [[ARRAYIDX34]], align 4
+; CHECK-NEXT: [[ADD35:%.*]] = add nsw i32 [[I11]], [[I10]]
+; CHECK-NEXT: [[ARRAYIDX37:%.*]] = getelementptr inbounds i32, i32* [[S]], i32 5
+; CHECK-NEXT: store i32 [[ADD35]], i32* [[ARRAYIDX37]], align 4
+; CHECK-NEXT: [[GEP13:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 12
+; CHECK-NEXT: [[IDX13:%.*]] = load i32, i32* [[GEP13]], align 8
+; CHECK-NEXT: [[ARRAYIDX39:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX13]]
+; CHECK-NEXT: [[I12:%.*]] = load i32, i32* [[ARRAYIDX39]], align 4
+; CHECK-NEXT: [[GEP14:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 13
+; CHECK-NEXT: [[IDX14:%.*]] = load i32, i32* [[GEP14]], align 8
+; CHECK-NEXT: [[ARRAYIDX41:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX14]]
+; CHECK-NEXT: [[I13:%.*]] = load i32, i32* [[ARRAYIDX41]], align 4
+; CHECK-NEXT: [[ADD42:%.*]] = add nsw i32 [[I13]], [[I12]]
+; CHECK-NEXT: [[ARRAYIDX44:%.*]] = getelementptr inbounds i32, i32* [[S]], i32 6
+; CHECK-NEXT: store i32 [[ADD42]], i32* [[ARRAYIDX44]], align 4
+; CHECK-NEXT: [[GEP15:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 14
+; CHECK-NEXT: [[IDX15:%.*]] = load i32, i32* [[GEP15]], align 8
+; CHECK-NEXT: [[ARRAYIDX46:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX15]]
+; CHECK-NEXT: [[I14:%.*]] = load i32, i32* [[ARRAYIDX46]], align 4
+; CHECK-NEXT: [[GEP16:%.*]] = getelementptr inbounds i32, i32* [[ADDR]], i32 15
+; CHECK-NEXT: [[IDX16:%.*]] = load i32, i32* [[GEP16]], align 8
+; CHECK-NEXT: [[ARRAYIDX48:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 [[IDX16]]
+; CHECK-NEXT: [[I15:%.*]] = load i32, i32* [[ARRAYIDX48]], align 4
+; CHECK-NEXT: [[ADD49:%.*]] = add nsw i32 [[I15]], [[I14]]
+; CHECK-NEXT: [[ARRAYIDX51:%.*]] = getelementptr inbounds i32, i32* [[S]], i32 7
+; CHECK-NEXT: store i32 [[ADD49]], i32* [[ARRAYIDX51]], align 4
+; CHECK-NEXT: ret void
+;
+entry:
+ %idx1 = load i32, i32 *%addr, align 8
+ %arrayidx = getelementptr inbounds i32, i32* %p, i32 %idx1
+ %i = load i32, i32* %arrayidx, align 4
+ %gep2 = getelementptr inbounds i32, i32* %addr, i32 1
+ %idx2 = load i32, i32 *%gep2, align 8
+ %arrayidx1 = getelementptr inbounds i32, i32* %p, i32 %idx2
+ %i1 = load i32, i32* %arrayidx1, align 4
+ %add = add nsw i32 %i1, %i
+ %arrayidx2 = getelementptr inbounds i32, i32* %s, i32 0
+ store i32 %add, i32* %arrayidx2, align 4
+ %gep3 = getelementptr inbounds i32, i32* %addr, i32 2
+ %idx3 = load i32, i32 *%gep3, align 8
+ %arrayidx4 = getelementptr inbounds i32, i32* %p, i32 %idx3
+ %i2 = load i32, i32* %arrayidx4, align 4
+ %gep4 = getelementptr inbounds i32, i32* %addr, i32 3
+ %idx4 = load i32, i32 *%gep4, align 8
+ %arrayidx6 = getelementptr inbounds i32, i32* %p, i32 %idx4
+ %i3 = load i32, i32* %arrayidx6, align 4
+ %add7 = add nsw i32 %i3, %i2
+ %arrayidx9 = getelementptr inbounds i32, i32* %s, i32 1
+ store i32 %add7, i32* %arrayidx9, align 4
+ %gep5 = getelementptr inbounds i32, i32* %addr, i32 4
+ %idx5 = load i32, i32 *%gep5, align 8
+ %arrayidx11 = getelementptr inbounds i32, i32* %p, i32 %idx5
+ %i4 = load i32, i32* %arrayidx11, align 4
+ %gep6 = getelementptr inbounds i32, i32* %addr, i32 5
+ %idx6 = load i32, i32 *%gep6, align 8
+ %arrayidx13 = getelementptr inbounds i32, i32* %p, i32 %idx6
+ %i5 = load i32, i32* %arrayidx13, align 4
+ %add14 = add nsw i32 %i5, %i4
+ %arrayidx16 = getelementptr inbounds i32, i32* %s, i32 2
+ store i32 %add14, i32* %arrayidx16, align 4
+ %gep7 = getelementptr inbounds i32, i32* %addr, i32 6
+ %idx7 = load i32, i32 *%gep7, align 8
+ %arrayidx18 = getelementptr inbounds i32, i32* %p, i32 %idx7
+ %i6 = load i32, i32* %arrayidx18, align 4
+ %gep8 = getelementptr inbounds i32, i32* %addr, i32 7
+ %idx8 = load i32, i32 *%gep8, align 8
+ %arrayidx20 = getelementptr inbounds i32, i32* %p, i32 %idx8
+ %i7 = load i32, i32* %arrayidx20, align 4
+ %add21 = add nsw i32 %i7, %i6
+ %arrayidx23 = getelementptr inbounds i32, i32* %s, i32 3
+ store i32 %add21, i32* %arrayidx23, align 4
+ %gep9 = getelementptr inbounds i32, i32* %addr, i32 8
+ %idx9 = load i32, i32 *%gep9, align 8
+ %arrayidx25 = getelementptr inbounds i32, i32* %p, i32 %idx9
+ %i8 = load i32, i32* %arrayidx25, align 4
+ %gep10 = getelementptr inbounds i32, i32* %addr, i32 9
+ %idx10 = load i32, i32 *%gep10, align 8
+ %arrayidx27 = getelementptr inbounds i32, i32* %p, i32 %idx10
+ %i9 = load i32, i32* %arrayidx27, align 4
+ %add28 = add nsw i32 %i9, %i8
+ %arrayidx30 = getelementptr inbounds i32, i32* %s, i32 4
+ store i32 %add28, i32* %arrayidx30, align 4
+ %gep11 = getelementptr inbounds i32, i32* %addr, i32 10
+ %idx11 = load i32, i32 *%gep11, align 8
+ %arrayidx32 = getelementptr inbounds i32, i32* %p, i32 %idx11
+ %i10 = load i32, i32* %arrayidx32, align 4
+ %gep12 = getelementptr inbounds i32, i32* %addr, i32 11
+ %idx12 = load i32, i32 *%gep12, align 8
+ %arrayidx34 = getelementptr inbounds i32, i32* %p, i32 %idx12
+ %i11 = load i32, i32* %arrayidx34, align 4
+ %add35 = add nsw i32 %i11, %i10
+ %arrayidx37 = getelementptr inbounds i32, i32* %s, i32 5
+ store i32 %add35, i32* %arrayidx37, align 4
+ %gep13 = getelementptr inbounds i32, i32* %addr, i32 12
+ %idx13 = load i32, i32 *%gep13, align 8
+ %arrayidx39 = getelementptr inbounds i32, i32* %p, i32 %idx13
+ %i12 = load i32, i32* %arrayidx39, align 4
+ %gep14 = getelementptr inbounds i32, i32* %addr, i32 13
+ %idx14 = load i32, i32 *%gep14, align 8
+ %arrayidx41 = getelementptr inbounds i32, i32* %p, i32 %idx14
+ %i13 = load i32, i32* %arrayidx41, align 4
+ %add42 = add nsw i32 %i13, %i12
+ %arrayidx44 = getelementptr inbounds i32, i32* %s, i32 6
+ store i32 %add42, i32* %arrayidx44, align 4
+ %gep15 = getelementptr inbounds i32, i32* %addr, i32 14
+ %idx15 = load i32, i32 *%gep15, align 8
+ %arrayidx46 = getelementptr inbounds i32, i32* %p, i32 %idx15
+ %i14 = load i32, i32* %arrayidx46, align 4
+ %gep16 = getelementptr inbounds i32, i32* %addr, i32 15
+ %idx16 = load i32, i32 *%gep16, align 8
+ %arrayidx48 = getelementptr inbounds i32, i32* %p, i32 %idx16
+ %i15 = load i32, i32* %arrayidx48, align 4
+ %add49 = add nsw i32 %i15, %i14
+ %arrayidx51 = getelementptr inbounds i32, i32* %s, i32 7
+ store i32 %add49, i32* %arrayidx51, align 4
+ ret void
+}
More information about the llvm-commits
mailing list