[llvm] bb4e547 - [SLP][NFC]Add a test for buildvector with reused scalars and
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 29 11:54:40 PDT 2023
Author: Alexey Bataev
Date: 2023-06-29T11:52:12-07:00
New Revision: bb4e547a60c40b80254ea7edb4eb6abcfec0c866
URL: https://github.com/llvm/llvm-project/commit/bb4e547a60c40b80254ea7edb4eb6abcfec0c866
DIFF: https://github.com/llvm/llvm-project/commit/bb4e547a60c40b80254ea7edb4eb6abcfec0c866.diff
LOG: [SLP][NFC]Add a test for buildvector with reused scalars and
extractelements.
Added:
llvm/test/Transforms/SLPVectorizer/X86/buildvector-with-reuses.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/buildvector-with-reuses.ll b/llvm/test/Transforms/SLPVectorizer/X86/buildvector-with-reuses.ll
new file mode 100644
index 0000000000000..47d0e9eeaba95
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/buildvector-with-reuses.ll
@@ -0,0 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; RUN: opt -passes=slp-vectorizer -mtriple=x86_64 -mcpu=core-avx2 -S %s | FileCheck %s
+
+define <4 x double> @test(ptr %ia, ptr %ib, ptr %ic, ptr %id, ptr %ie, ptr %x) {
+; CHECK-LABEL: define <4 x double> @test
+; CHECK-SAME: (ptr [[IA:%.*]], ptr [[IB:%.*]], ptr [[IC:%.*]], ptr [[ID:%.*]], ptr [[IE:%.*]], ptr [[X:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: [[I4275:%.*]] = load double, ptr [[ID]], align 8
+; CHECK-NEXT: [[I4326:%.*]] = load <4 x double>, ptr [[X]], align 8
+; CHECK-NEXT: [[I4238:%.*]] = load double, ptr [[IA]], align 8
+; CHECK-NEXT: [[I4252:%.*]] = load double, ptr [[IB]], align 8
+; CHECK-NEXT: [[I4264:%.*]] = load double, ptr [[IC]], align 8
+; CHECK-NEXT: [[I4277:%.*]] = load double, ptr [[IE]], align 8
+; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[I4326]], <4 x double> poison, <2 x i32> <i32 0, i32 poison>
+; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x double> [[TMP1]], double [[I4275]], i32 1
+; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x double> [[TMP2]], <2 x double> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
+; CHECK-NEXT: [[TMP4:%.*]] = insertelement <4 x double> poison, double [[I4238]], i32 0
+; CHECK-NEXT: [[TMP5:%.*]] = insertelement <4 x double> [[TMP4]], double [[I4252]], i32 1
+; CHECK-NEXT: [[TMP6:%.*]] = insertelement <4 x double> [[TMP5]], double [[I4264]], i32 2
+; CHECK-NEXT: [[TMP7:%.*]] = insertelement <4 x double> [[TMP6]], double [[I4277]], i32 3
+; CHECK-NEXT: [[TMP8:%.*]] = fmul fast <4 x double> [[TMP3]], [[TMP7]]
+; CHECK-NEXT: ret <4 x double> [[TMP8]]
+;
+ %i4238 = load double, ptr %ia, align 8
+ %i4252 = load double, ptr %ib, align 8
+ %i4264 = load double, ptr %ic, align 8
+ %i4275 = load double, ptr %id, align 8
+
+ %i4277 = load double, ptr %ie, align 8
+
+ %i4326 = load <4 x double>, ptr %x, align 8
+
+ %i4330 = extractelement <4 x double> %i4326, i32 0
+
+ %i4332 = fmul fast double %i4330, %i4238
+ %i4333 = fmul fast double %i4330, %i4252
+ %i4334 = fmul fast double %i4330, %i4264
+ %i4278 = fmul fast double %i4275, %i4277
+
+
+ %i4425 = insertelement <4 x double> poison, double %i4332, i32 0
+ %i4426 = insertelement <4 x double> %i4425, double %i4333, i32 1
+ %i4427 = insertelement <4 x double> %i4426, double %i4334, i32 2
+ %i4428 = insertelement <4 x double> %i4427, double %i4278, i32 3
+ ret <4 x double> %i4428
+}
+
More information about the llvm-commits
mailing list