Skip to content

Commit 5d3eccb

Browse files
committed
[SLP]: Add precommit test
Change-Id: Ibc0e74804e40ad7c17dffc4f217a25d94f832cfe
1 parent 47918e7 commit 5d3eccb

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -passes=slp-vectorizer,instcombine -S < %s | FileCheck %s
3+
4+
define dso_local noundef i32 @_Z4testiPs(i32 noundef %a, ptr noundef readonly captures(none) %b) local_unnamed_addr #0 {
5+
; CHECK-LABEL: define dso_local noundef i32 @_Z4testiPs(
6+
; CHECK-SAME: i32 noundef [[A:%.*]], ptr noundef readonly captures(none) [[B:%.*]]) local_unnamed_addr {
7+
; CHECK-NEXT: [[ENTRY:.*:]]
8+
; CHECK-NEXT: [[SHR_1:%.*]] = lshr i32 [[A]], 1
9+
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i32> poison, i32 [[A]], i64 0
10+
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i32> [[TMP0]], <2 x i32> poison, <2 x i32> zeroinitializer
11+
; CHECK-NEXT: [[TMP2:%.*]] = lshr <2 x i32> [[TMP1]], <i32 2, i32 3>
12+
; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x i32> poison, i32 [[A]], i64 0
13+
; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <4 x i32> [[TMP3]], <4 x i32> poison, <4 x i32> zeroinitializer
14+
; CHECK-NEXT: [[TMP5:%.*]] = lshr <4 x i32> [[TMP4]], <i32 4, i32 5, i32 6, i32 7>
15+
; CHECK-NEXT: [[TMP6:%.*]] = insertelement <8 x i32> poison, i32 [[A]], i64 0
16+
; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <8 x i32> [[TMP6]], <8 x i32> poison, <8 x i32> zeroinitializer
17+
; CHECK-NEXT: [[TMP8:%.*]] = lshr <8 x i32> [[TMP7]], <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
18+
; CHECK-NEXT: [[TMP9:%.*]] = insertelement <16 x i32> poison, i32 [[A]], i64 0
19+
; CHECK-NEXT: [[TMP10:%.*]] = insertelement <16 x i32> [[TMP9]], i32 [[SHR_1]], i64 1
20+
; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <8 x i32> [[TMP8]], <8 x i32> poison, <16 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, i32 poison>
21+
; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <16 x i32> [[TMP10]], <16 x i32> [[TMP11]], <16 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
22+
; CHECK-NEXT: [[TMP13:%.*]] = shufflevector <4 x i32> [[TMP5]], <4 x i32> poison, <16 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, i32 poison>
23+
; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <16 x i32> [[TMP12]], <16 x i32> [[TMP13]], <16 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 16, i32 17, i32 18, i32 19, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
24+
; CHECK-NEXT: [[TMP15:%.*]] = shufflevector <2 x i32> [[TMP2]], <2 x i32> poison, <16 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, i32 poison>
25+
; CHECK-NEXT: [[TMP16:%.*]] = shufflevector <16 x i32> [[TMP14]], <16 x i32> [[TMP15]], <16 x i32> <i32 0, i32 1, i32 16, i32 17, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
26+
; CHECK-NEXT: [[TMP17:%.*]] = and <16 x i32> [[TMP16]], splat (i32 16)
27+
; CHECK-NEXT: [[TMP18:%.*]] = load <16 x i16>, ptr [[B]], align 2
28+
; CHECK-NEXT: [[TMP19:%.*]] = sext <16 x i16> [[TMP18]] to <16 x i32>
29+
; CHECK-NEXT: [[TMP20:%.*]] = or <16 x i32> [[TMP17]], [[TMP19]]
30+
; CHECK-NEXT: [[TMP21:%.*]] = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> [[TMP20]])
31+
; CHECK-NEXT: ret i32 [[TMP21]]
32+
;
33+
entry:
34+
%conv = and i32 %a, 16
35+
%0 = load i16, ptr %b, align 2
36+
%conv2 = sext i16 %0 to i32
37+
%or = or i32 %conv, %conv2
38+
%shr.1 = lshr i32 %a, 1
39+
%conv.1 = and i32 %shr.1, 16
40+
%arrayidx.1 = getelementptr inbounds nuw i8, ptr %b, i64 2
41+
%1 = load i16, ptr %arrayidx.1, align 2
42+
%conv2.1 = sext i16 %1 to i32
43+
%or.1 = or i32 %conv.1, %conv2.1
44+
%add.1 = add nsw i32 %or.1, %or
45+
%shr.2 = lshr i32 %a, 2
46+
%conv.2 = and i32 %shr.2, 16
47+
%arrayidx.2 = getelementptr inbounds nuw i8, ptr %b, i64 4
48+
%2 = load i16, ptr %arrayidx.2, align 2
49+
%conv2.2 = sext i16 %2 to i32
50+
%or.2 = or i32 %conv.2, %conv2.2
51+
%add.2 = add nsw i32 %or.2, %add.1
52+
%shr.3 = lshr i32 %a, 3
53+
%conv.3 = and i32 %shr.3, 16
54+
%arrayidx.3 = getelementptr inbounds nuw i8, ptr %b, i64 6
55+
%3 = load i16, ptr %arrayidx.3, align 2
56+
%conv2.3 = sext i16 %3 to i32
57+
%or.3 = or i32 %conv.3, %conv2.3
58+
%add.3 = add nsw i32 %or.3, %add.2
59+
%shr.4 = lshr i32 %a, 4
60+
%conv.4 = and i32 %shr.4, 16
61+
%arrayidx.4 = getelementptr inbounds nuw i8, ptr %b, i64 8
62+
%4 = load i16, ptr %arrayidx.4, align 2
63+
%conv2.4 = sext i16 %4 to i32
64+
%or.4 = or i32 %conv.4, %conv2.4
65+
%add.4 = add nsw i32 %or.4, %add.3
66+
%shr.5 = lshr i32 %a, 5
67+
%conv.5 = and i32 %shr.5, 16
68+
%arrayidx.5 = getelementptr inbounds nuw i8, ptr %b, i64 10
69+
%5 = load i16, ptr %arrayidx.5, align 2
70+
%conv2.5 = sext i16 %5 to i32
71+
%or.5 = or i32 %conv.5, %conv2.5
72+
%add.5 = add nsw i32 %or.5, %add.4
73+
%shr.6 = lshr i32 %a, 6
74+
%conv.6 = and i32 %shr.6, 16
75+
%arrayidx.6 = getelementptr inbounds nuw i8, ptr %b, i64 12
76+
%6 = load i16, ptr %arrayidx.6, align 2
77+
%conv2.6 = sext i16 %6 to i32
78+
%or.6 = or i32 %conv.6, %conv2.6
79+
%add.6 = add nsw i32 %or.6, %add.5
80+
%shr.7 = lshr i32 %a, 7
81+
%conv.7 = and i32 %shr.7, 16
82+
%arrayidx.7 = getelementptr inbounds nuw i8, ptr %b, i64 14
83+
%7 = load i16, ptr %arrayidx.7, align 2
84+
%conv2.7 = sext i16 %7 to i32
85+
%or.7 = or i32 %conv.7, %conv2.7
86+
%add.7 = add nsw i32 %or.7, %add.6
87+
%shr.8 = lshr i32 %a, 8
88+
%conv.8 = and i32 %shr.8, 16
89+
%arrayidx.8 = getelementptr inbounds nuw i8, ptr %b, i64 16
90+
%8 = load i16, ptr %arrayidx.8, align 2
91+
%conv2.8 = sext i16 %8 to i32
92+
%or.8 = or i32 %conv.8, %conv2.8
93+
%add.8 = add nsw i32 %or.8, %add.7
94+
%shr.9 = lshr i32 %a, 9
95+
%conv.9 = and i32 %shr.9, 16
96+
%arrayidx.9 = getelementptr inbounds nuw i8, ptr %b, i64 18
97+
%9 = load i16, ptr %arrayidx.9, align 2
98+
%conv2.9 = sext i16 %9 to i32
99+
%or.9 = or i32 %conv.9, %conv2.9
100+
%add.9 = add nsw i32 %or.9, %add.8
101+
%shr.10 = lshr i32 %a, 10
102+
%conv.10 = and i32 %shr.10, 16
103+
%arrayidx.10 = getelementptr inbounds nuw i8, ptr %b, i64 20
104+
%10 = load i16, ptr %arrayidx.10, align 2
105+
%conv2.10 = sext i16 %10 to i32
106+
%or.10 = or i32 %conv.10, %conv2.10
107+
%add.10 = add nsw i32 %or.10, %add.9
108+
%shr.11 = lshr i32 %a, 11
109+
%conv.11 = and i32 %shr.11, 16
110+
%arrayidx.11 = getelementptr inbounds nuw i8, ptr %b, i64 22
111+
%11 = load i16, ptr %arrayidx.11, align 2
112+
%conv2.11 = sext i16 %11 to i32
113+
%or.11 = or i32 %conv.11, %conv2.11
114+
%add.11 = add nsw i32 %or.11, %add.10
115+
%shr.12 = lshr i32 %a, 12
116+
%conv.12 = and i32 %shr.12, 16
117+
%arrayidx.12 = getelementptr inbounds nuw i8, ptr %b, i64 24
118+
%12 = load i16, ptr %arrayidx.12, align 2
119+
%conv2.12 = sext i16 %12 to i32
120+
%or.12 = or i32 %conv.12, %conv2.12
121+
%add.12 = add nsw i32 %or.12, %add.11
122+
%shr.13 = lshr i32 %a, 13
123+
%conv.13 = and i32 %shr.13, 16
124+
%arrayidx.13 = getelementptr inbounds nuw i8, ptr %b, i64 26
125+
%13 = load i16, ptr %arrayidx.13, align 2
126+
%conv2.13 = sext i16 %13 to i32
127+
%or.13 = or i32 %conv.13, %conv2.13
128+
%add.13 = add nsw i32 %or.13, %add.12
129+
%shr.14 = lshr i32 %a, 14
130+
%conv.14 = and i32 %shr.14, 16
131+
%arrayidx.14 = getelementptr inbounds nuw i8, ptr %b, i64 28
132+
%14 = load i16, ptr %arrayidx.14, align 2
133+
%conv2.14 = sext i16 %14 to i32
134+
%or.14 = or i32 %conv.14, %conv2.14
135+
%add.14 = add nsw i32 %or.14, %add.13
136+
%shr.15 = lshr i32 %a, 15
137+
%conv.15 = and i32 %shr.15, 16
138+
%arrayidx.15 = getelementptr inbounds nuw i8, ptr %b, i64 30
139+
%15 = load i16, ptr %arrayidx.15, align 2
140+
%conv2.15 = sext i16 %15 to i32
141+
%or.15 = or i32 %conv.15, %conv2.15
142+
%add.15 = add nsw i32 %or.15, %add.14
143+
ret i32 %add.15
144+
}

0 commit comments

Comments
 (0)