[SLP][NFC] Add non-power-of-2 buildvector test#206332
Open
harrisonGPU wants to merge 1 commit into
Open
Conversation
|
@llvm/pr-subscribers-llvm-transforms Author: Harrison Hao (harrisonGPU) ChangesFor this PR: #206259 Full diff: https://github.com/llvm/llvm-project/pull/206332.diff 1 Files Affected:
diff --git a/llvm/test/Transforms/SLPVectorizer/non-power-of-2-buildvector.ll b/llvm/test/Transforms/SLPVectorizer/non-power-of-2-buildvector.ll
new file mode 100644
index 0000000000000..950a83f0bf4a8
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/non-power-of-2-buildvector.ll
@@ -0,0 +1,112 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -passes=slp-vectorizer -S -slp-vectorize-non-power-of-2 < %s | FileCheck %s
+
+define <15 x half> @func(ptr addrspace(1) %buffer) {
+; CHECK-LABEL: define <15 x half> @func(
+; CHECK-SAME: ptr addrspace(1) [[BUFFER:%.*]]) {
+; CHECK-NEXT: [[_ENTRY:.*:]]
+; CHECK-NEXT: [[DATA:%.*]] = load <15 x half>, ptr addrspace(1) [[BUFFER]], align 32
+; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <15 x half> [[DATA]], <15 x half> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; CHECK-NEXT: [[TMP1:%.*]] = fcmp olt <8 x half> [[TMP0]], zeroinitializer
+; CHECK-NEXT: [[TMP19:%.*]] = fmul reassoc nnan nsz arcp contract afn <8 x half> [[TMP0]], splat (half 1.000210e-02)
+; CHECK-NEXT: [[TMP3:%.*]] = select <8 x i1> [[TMP1]], <8 x half> [[TMP19]], <8 x half> [[TMP0]]
+; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <8 x half> [[TMP3]], <8 x half> poison, <15 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
+; CHECK-NEXT: [[DOT14_VEC_INSERT18211:%.*]] = shufflevector <15 x half> [[DATA]], <15 x half> [[TMP4]], <15 x i32> <i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14>
+; CHECK-NEXT: [[TMP5:%.*]] = extractelement <15 x half> [[DATA]], i64 8
+; CHECK-NEXT: [[TMP6:%.*]] = fcmp olt half [[TMP5]], 0.000000e+00
+; CHECK-NEXT: [[TMP7:%.*]] = fmul reassoc nnan nsz arcp contract afn half [[TMP5]], 1.000210e-02
+; CHECK-NEXT: [[TMP8:%.*]] = select i1 [[TMP6]], half [[TMP7]], half [[TMP5]]
+; CHECK-NEXT: [[DOT16_VEC_INSERT1823:%.*]] = insertelement <15 x half> [[DOT14_VEC_INSERT18211]], half [[TMP8]], i64 8
+; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <15 x half> [[DATA]], <15 x half> poison, <2 x i32> <i32 9, i32 10>
+; CHECK-NEXT: [[TMP10:%.*]] = fcmp olt <2 x half> [[TMP9]], zeroinitializer
+; CHECK-NEXT: [[TMP11:%.*]] = fmul reassoc nnan nsz arcp contract afn <2 x half> [[TMP9]], splat (half 1.000210e-02)
+; CHECK-NEXT: [[TMP12:%.*]] = select <2 x i1> [[TMP10]], <2 x half> [[TMP11]], <2 x half> [[TMP9]]
+; CHECK-NEXT: [[TMP13:%.*]] = shufflevector <2 x half> [[TMP12]], <2 x half> poison, <15 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
+; CHECK-NEXT: [[DOT20_VEC_INSERT18273:%.*]] = shufflevector <15 x half> [[DOT16_VEC_INSERT1823]], <15 x half> [[TMP13]], <15 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 15, i32 16, i32 11, i32 12, i32 13, i32 14>
+; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <15 x half> [[DATA]], <15 x half> poison, <4 x i32> <i32 11, i32 12, i32 13, i32 14>
+; CHECK-NEXT: [[TMP15:%.*]] = fcmp olt <4 x half> [[TMP14]], zeroinitializer
+; CHECK-NEXT: [[TMP16:%.*]] = fmul reassoc nnan nsz arcp contract afn <4 x half> [[TMP14]], splat (half 1.000210e-02)
+; CHECK-NEXT: [[TMP17:%.*]] = select <4 x i1> [[TMP15]], <4 x half> [[TMP16]], <4 x half> [[TMP14]]
+; CHECK-NEXT: [[TMP18:%.*]] = shufflevector <4 x half> [[TMP17]], <4 x half> poison, <15 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
+; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <15 x half> [[DOT20_VEC_INSERT18273]], <15 x half> [[TMP18]], <15 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 15, i32 16, i32 17, i32 18>
+; CHECK-NEXT: ret <15 x half> [[TMP2]]
+;
+.entry:
+ %data = load <15 x half>, ptr addrspace(1) %buffer, align 32
+ %0 = extractelement <15 x half> %data, i64 0
+ %1 = fcmp olt half %0, 0.000000e+00
+ %2 = fmul reassoc nnan nsz arcp contract afn half %0, 1.000210e-02
+ %3 = select i1 %1, half %2, half %0
+ %.0.vec.insert1807 = insertelement <15 x half> %data, half %3, i64 0
+ %4 = extractelement <15 x half> %data, i64 1
+ %5 = fcmp olt half %4, 0.000000e+00
+ %6 = fmul reassoc nnan nsz arcp contract afn half %4, 1.000210e-02
+ %7 = select i1 %5, half %6, half %4
+ %.2.vec.insert1809 = insertelement <15 x half> %.0.vec.insert1807, half %7, i64 1
+ %8 = extractelement <15 x half> %data, i64 2
+ %9 = fcmp olt half %8, 0.000000e+00
+ %10 = fmul reassoc nnan nsz arcp contract afn half %8, 1.000210e-02
+ %11 = select i1 %9, half %10, half %8
+ %.4.vec.insert1811 = insertelement <15 x half> %.2.vec.insert1809, half %11, i64 2
+ %12 = extractelement <15 x half> %data, i64 3
+ %13 = fcmp olt half %12, 0.000000e+00
+ %14 = fmul reassoc nnan nsz arcp contract afn half %12, 1.000210e-02
+ %15 = select i1 %13, half %14, half %12
+ %.6.vec.insert1813 = insertelement <15 x half> %.4.vec.insert1811, half %15, i64 3
+ %16 = extractelement <15 x half> %data, i64 4
+ %17 = fcmp olt half %16, 0.000000e+00
+ %18 = fmul reassoc nnan nsz arcp contract afn half %16, 1.000210e-02
+ %19 = select i1 %17, half %18, half %16
+ %.8.vec.insert1815 = insertelement <15 x half> %.6.vec.insert1813, half %19, i64 4
+ %20 = extractelement <15 x half> %data, i64 5
+ %21 = fcmp olt half %20, 0.000000e+00
+ %22 = fmul reassoc nnan nsz arcp contract afn half %20, 1.000210e-02
+ %23 = select i1 %21, half %22, half %20
+ %.10.vec.insert1817 = insertelement <15 x half> %.8.vec.insert1815, half %23, i64 5
+ %24 = extractelement <15 x half> %data, i64 6
+ %25 = fcmp olt half %24, 0.000000e+00
+ %26 = fmul reassoc nnan nsz arcp contract afn half %24, 1.000210e-02
+ %27 = select i1 %25, half %26, half %24
+ %.12.vec.insert1819 = insertelement <15 x half> %.10.vec.insert1817, half %27, i64 6
+ %28 = extractelement <15 x half> %data, i64 7
+ %29 = fcmp olt half %28, 0.000000e+00
+ %30 = fmul reassoc nnan nsz arcp contract afn half %28, 1.000210e-02
+ %31 = select i1 %29, half %30, half %28
+ %.14.vec.insert1821 = insertelement <15 x half> %.12.vec.insert1819, half %31, i64 7
+ %32 = extractelement <15 x half> %data, i64 8
+ %33 = fcmp olt half %32, 0.000000e+00
+ %34 = fmul reassoc nnan nsz arcp contract afn half %32, 1.000210e-02
+ %35 = select i1 %33, half %34, half %32
+ %.16.vec.insert1823 = insertelement <15 x half> %.14.vec.insert1821, half %35, i64 8
+ %36 = extractelement <15 x half> %data, i64 9
+ %37 = fcmp olt half %36, 0.000000e+00
+ %38 = fmul reassoc nnan nsz arcp contract afn half %36, 1.000210e-02
+ %39 = select i1 %37, half %38, half %36
+ %.18.vec.insert1825 = insertelement <15 x half> %.16.vec.insert1823, half %39, i64 9
+ %40 = extractelement <15 x half> %data, i64 10
+ %41 = fcmp olt half %40, 0.000000e+00
+ %42 = fmul reassoc nnan nsz arcp contract afn half %40, 1.000210e-02
+ %43 = select i1 %41, half %42, half %40
+ %.20.vec.insert1827 = insertelement <15 x half> %.18.vec.insert1825, half %43, i64 10
+ %44 = extractelement <15 x half> %data, i64 11
+ %45 = fcmp olt half %44, 0.000000e+00
+ %46 = fmul reassoc nnan nsz arcp contract afn half %44, 1.000210e-02
+ %47 = select i1 %45, half %46, half %44
+ %.22.vec.insert1829 = insertelement <15 x half> %.20.vec.insert1827, half %47, i64 11
+ %48 = extractelement <15 x half> %data, i64 12
+ %49 = fcmp olt half %48, 0.000000e+00
+ %50 = fmul reassoc nnan nsz arcp contract afn half %48, 1.000210e-02
+ %51 = select i1 %49, half %50, half %48
+ %.24.vec.insert1831 = insertelement <15 x half> %.22.vec.insert1829, half %51, i64 12
+ %52 = extractelement <15 x half> %data, i64 13
+ %53 = fcmp olt half %52, 0.000000e+00
+ %54 = fmul reassoc nnan nsz arcp contract afn half %52, 1.000210e-02
+ %55 = select i1 %53, half %54, half %52
+ %.26.vec.insert1833 = insertelement <15 x half> %.24.vec.insert1831, half %55, i64 13
+ %56 = extractelement <15 x half> %data, i64 14
+ %57 = fcmp olt half %56, 0.000000e+00
+ %58 = fmul reassoc nnan nsz arcp contract afn half %56, 1.000210e-02
+ %59 = select i1 %57, half %58, half %56
+ %.28.vec.insert1835 = insertelement <15 x half> %.26.vec.insert1833, half %59, i64 14
+ ret <15 x half> %.28.vec.insert1835
+}
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For this PR: #206259