[llvm] b3f4535 - [SLP][NFC]Add a test for bottom to top reordering.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 22 13:48:19 PST 2022
Author: Alexey Bataev
Date: 2022-02-22T13:46:34-08:00
New Revision: b3f4535a039918965adb21509700739afc25f9f1
URL: https://github.com/llvm/llvm-project/commit/b3f4535a039918965adb21509700739afc25f9f1
DIFF: https://github.com/llvm/llvm-project/commit/b3f4535a039918965adb21509700739afc25f9f1.diff
LOG: [SLP][NFC]Add a test for bottom to top reordering.
Added:
llvm/test/Transforms/SLPVectorizer/X86/bottom-to-top-reorder.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/bottom-to-top-reorder.ll b/llvm/test/Transforms/SLPVectorizer/X86/bottom-to-top-reorder.ll
new file mode 100644
index 000000000000..2ac4b7d83c41
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/bottom-to-top-reorder.ll
@@ -0,0 +1,98 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mattr=+avx < %s | FileCheck %s
+
+define void @test(i32* %0, i32* %1, i32* %2) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, i32* [[TMP0:%.*]], i64 4
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, i32* [[TMP1:%.*]], i64 1
+; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 1
+; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 5
+; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i64 2
+; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 2
+; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 6
+; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i64 3
+; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 3
+; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 7
+; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i32, i32* [[TMP2:%.*]], i64 2
+; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds i32, i32* [[TMP2]], i64 1
+; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i32, i32* [[TMP2]], i64 3
+; CHECK-NEXT: [[TMP17:%.*]] = bitcast i32* [[TMP1]] to <4 x i32>*
+; CHECK-NEXT: [[TMP18:%.*]] = load <4 x i32>, <4 x i32>* [[TMP17]], align 4
+; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <4 x i32> [[TMP18]], <4 x i32> poison, <4 x i32> <i32 2, i32 0, i32 1, i32 3>
+; CHECK-NEXT: [[TMP19:%.*]] = bitcast i32* [[TMP0]] to <4 x i32>*
+; CHECK-NEXT: [[TMP20:%.*]] = load <4 x i32>, <4 x i32>* [[TMP19]], align 4
+; CHECK-NEXT: [[TMP21:%.*]] = bitcast i32* [[TMP4]] to <4 x i32>*
+; CHECK-NEXT: [[TMP22:%.*]] = load <4 x i32>, <4 x i32>* [[TMP21]], align 4
+; CHECK-NEXT: [[SHUFFLE1:%.*]] = shufflevector <4 x i32> [[TMP22]], <4 x i32> poison, <4 x i32> <i32 2, i32 0, i32 1, i32 3>
+; CHECK-NEXT: [[TMP23:%.*]] = sub <4 x i32> <i32 0, i32 0, i32 undef, i32 0>, [[TMP20]]
+; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x i32> [[TMP23]], <4 x i32> poison, <4 x i32> <i32 2, i32 0, i32 1, i32 3>
+; CHECK-NEXT: [[TMP24:%.*]] = sub <4 x i32> [[SHUFFLE]], [[SHUFFLE1]]
+; CHECK-NEXT: [[TMP25:%.*]] = add <4 x i32> [[TMP24]], [[SHUFFLE2]]
+; CHECK-NEXT: [[TMP26:%.*]] = add <4 x i32> [[TMP25]], <i32 1, i32 0, i32 0, i32 0>
+; CHECK-NEXT: [[TMP27:%.*]] = sub <4 x i32> [[TMP25]], <i32 1, i32 0, i32 0, i32 0>
+; CHECK-NEXT: [[TMP28:%.*]] = shufflevector <4 x i32> [[TMP26]], <4 x i32> [[TMP27]], <4 x i32> <i32 0, i32 1, i32 2, i32 7>
+; CHECK-NEXT: [[TMP29:%.*]] = add <4 x i32> [[TMP28]], zeroinitializer
+; CHECK-NEXT: [[TMP30:%.*]] = sub <4 x i32> [[TMP28]], zeroinitializer
+; CHECK-NEXT: [[TMP31:%.*]] = shufflevector <4 x i32> [[TMP29]], <4 x i32> [[TMP30]], <4 x i32> <i32 0, i32 5, i32 6, i32 7>
+; CHECK-NEXT: [[TMP32:%.*]] = add <4 x i32> [[TMP31]], zeroinitializer
+; CHECK-NEXT: [[TMP33:%.*]] = sub <4 x i32> [[TMP31]], zeroinitializer
+; CHECK-NEXT: [[TMP34:%.*]] = shufflevector <4 x i32> [[TMP32]], <4 x i32> [[TMP33]], <4 x i32> <i32 0, i32 5, i32 6, i32 3>
+; CHECK-NEXT: [[TMP35:%.*]] = bitcast i32* [[TMP2]] to <4 x i32>*
+; CHECK-NEXT: store <4 x i32> [[TMP34]], <4 x i32>* [[TMP35]], align 4
+; CHECK-NEXT: ret void
+;
+ %4 = load i32, i32* %1, align 4
+ %5 = load i32, i32* %0, align 4
+ %6 = getelementptr inbounds i32, i32* %0, i64 4
+ %7 = load i32, i32* %6, align 4
+ %8 = getelementptr inbounds i32, i32* %1, i64 1
+ %9 = load i32, i32* %8, align 4
+ %10 = getelementptr inbounds i32, i32* %0, i64 1
+ %11 = load i32, i32* %10, align 4
+ %12 = getelementptr inbounds i32, i32* %0, i64 5
+ %13 = load i32, i32* %12, align 4
+ %14 = getelementptr inbounds i32, i32* %1, i64 2
+ %15 = load i32, i32* %14, align 4
+ %16 = getelementptr inbounds i32, i32* %0, i64 2
+ %17 = load i32, i32* %16, align 4
+ %18 = getelementptr inbounds i32, i32* %0, i64 6
+ %19 = load i32, i32* %18, align 4
+ %20 = getelementptr inbounds i32, i32* %1, i64 3
+ %21 = load i32, i32* %20, align 4
+ %22 = getelementptr inbounds i32, i32* %0, i64 3
+ %23 = load i32, i32* %22, align 4
+ %24 = getelementptr inbounds i32, i32* %0, i64 7
+ %25 = load i32, i32* %24, align 4
+ %26 = sub i32 0, %23
+ %27 = sub i32 %26, %25
+ %28 = add i32 %27, %21
+ %29 = sub i32 undef, %17
+ %30 = sub i32 %29, %19
+ %31 = add i32 %30, %15
+ %32 = sub i32 0, %11
+ %33 = sub i32 %32, %13
+ %34 = add i32 %33, %9
+ %35 = sub i32 0, %5
+ %36 = sub i32 %35, %7
+ %37 = add i32 %36, %4
+ %38 = add i32 %31, 1
+ %39 = add i32 %38, 0
+ %40 = add i32 %39, 0
+ store i32 %40, i32* %2, align 4
+ %41 = getelementptr inbounds i32, i32* %2, i64 2
+ %42 = add i32 0, %34
+ %43 = sub i32 %42, 0
+ %44 = sub i32 %43, 0
+ store i32 %44, i32* %41, align 4
+ %45 = getelementptr inbounds i32, i32* %2, i64 1
+ %46 = add i32 %37, 0
+ %47 = sub i32 %46, 0
+ %48 = sub i32 %47, 0
+ store i32 %48, i32* %45, align 4
+ %49 = getelementptr inbounds i32, i32* %2, i64 3
+ %50 = sub i32 %28, 0
+ %51 = sub i32 %50, 0
+ %52 = add i32 %51, 0
+ store i32 %52, i32* %49, align 4
+ ret void
+}
More information about the llvm-commits
mailing list