[llvm] 931bba2 - [SLP][NFC]Add a test with reused scalars in 3 tree nodes with different
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 2 10:51:52 PST 2023
Author: Alexey Bataev
Date: 2023-03-02T10:50:03-08:00
New Revision: 931bba2bc3f7292c57ca6f376061e48b34409ddd
URL: https://github.com/llvm/llvm-project/commit/931bba2bc3f7292c57ca6f376061e48b34409ddd
DIFF: https://github.com/llvm/llvm-project/commit/931bba2bc3f7292c57ca6f376061e48b34409ddd.diff
LOG: [SLP][NFC]Add a test with reused scalars in 3 tree nodes with different
VF, NFC.
Added:
llvm/test/Transforms/SLPVectorizer/X86/reused-scalars-in-buildvector.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/reused-scalars-in-buildvector.ll b/llvm/test/Transforms/SLPVectorizer/X86/reused-scalars-in-buildvector.ll
new file mode 100644
index 0000000000000..24334c43da684
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/reused-scalars-in-buildvector.ll
@@ -0,0 +1,43 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -passes=slp-vectorizer -S -mtriple=x86_64 < %s -mattr=+avx512vl | FileCheck %s
+
+define void @test(ptr %p, i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: [[S1:%.*]] = sub i32 [[A:%.*]], 1
+; CHECK-NEXT: [[S2:%.*]] = sub i32 [[B:%.*]], 1
+; CHECK-NEXT: [[M1:%.*]] = mul i32 [[S1]], [[E:%.*]]
+; CHECK-NEXT: [[M2:%.*]] = mul i32 [[S2]], [[F:%.*]]
+; CHECK-NEXT: [[M3:%.*]] = mul i32 [[S1]], [[C:%.*]]
+; CHECK-NEXT: [[M4:%.*]] = mul i32 [[S2]], [[D:%.*]]
+; CHECK-NEXT: [[A1:%.*]] = add i32 [[A]], [[M1]]
+; CHECK-NEXT: [[A2:%.*]] = add i32 [[B]], [[M2]]
+; CHECK-NEXT: [[A3:%.*]] = add i32 [[C]], [[M3]]
+; CHECK-NEXT: [[A4:%.*]] = add i32 [[D]], [[M4]]
+; CHECK-NEXT: store i32 [[A1]], ptr [[P:%.*]], align 4
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i32, ptr [[P]], i32 1
+; CHECK-NEXT: store i32 [[A2]], ptr [[GEP]], align 4
+; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i32, ptr [[P]], i32 2
+; CHECK-NEXT: store i32 [[A3]], ptr [[GEP1]], align 4
+; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, ptr [[P]], i32 3
+; CHECK-NEXT: store i32 [[A4]], ptr [[GEP2]], align 4
+; CHECK-NEXT: ret void
+;
+ %s1 = sub i32 %a, 1
+ %s2 = sub i32 %b, 1
+ %m1 = mul i32 %s1, %e
+ %m2 = mul i32 %s2, %f
+ %m3 = mul i32 %s1, %c
+ %m4 = mul i32 %s2, %d
+ %a1 = add i32 %a, %m1
+ %a2 = add i32 %b, %m2
+ %a3 = add i32 %c, %m3
+ %a4 = add i32 %d, %m4
+ store i32 %a1, ptr %p, align 4
+ %gep = getelementptr inbounds i32, ptr %p, i32 1
+ store i32 %a2, ptr %gep, align 4
+ %gep1 = getelementptr inbounds i32, ptr %p, i32 2
+ store i32 %a3, ptr %gep1, align 4
+ %gep2 = getelementptr inbounds i32, ptr %p, i32 3
+ store i32 %a4, ptr %gep2, align 4
+ ret void
+}
More information about the llvm-commits
mailing list