1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -slp-vectorizer -slp-threshold=-10000 < %s | FileCheck %s --check-prefixes=CHECK,THRESHOLD
3 ; RUN: opt -S -slp-vectorizer -slp-threshold=0 < %s | FileCheck %s --check-prefixes=CHECK,NOTHRESHOLD
4 ; RUN: opt -S -slp-vectorizer -slp-threshold=-10000 -slp-min-tree-size=0 < %s | FileCheck %s --check-prefixes=CHECK,MINTREESIZE
6 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-n8:16:32:64-S128"
7 target triple = "x86_64-apple-macosx10.8.0"
9 define <4 x float> @simple_select(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
10 ; CHECK-LABEL: @simple_select(
11 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <4 x i32> [[C:%.*]], zeroinitializer
12 ; CHECK-NEXT: [[TMP2:%.*]] = select <4 x i1> [[TMP1]], <4 x float> [[A:%.*]], <4 x float> [[B:%.*]]
13 ; CHECK-NEXT: ret <4 x float> [[TMP2]]
15 %c0 = extractelement <4 x i32> %c, i32 0
16 %c1 = extractelement <4 x i32> %c, i32 1
17 %c2 = extractelement <4 x i32> %c, i32 2
18 %c3 = extractelement <4 x i32> %c, i32 3
19 %a0 = extractelement <4 x float> %a, i32 0
20 %a1 = extractelement <4 x float> %a, i32 1
21 %a2 = extractelement <4 x float> %a, i32 2
22 %a3 = extractelement <4 x float> %a, i32 3
23 %b0 = extractelement <4 x float> %b, i32 0
24 %b1 = extractelement <4 x float> %b, i32 1
25 %b2 = extractelement <4 x float> %b, i32 2
26 %b3 = extractelement <4 x float> %b, i32 3
27 %cmp0 = icmp ne i32 %c0, 0
28 %cmp1 = icmp ne i32 %c1, 0
29 %cmp2 = icmp ne i32 %c2, 0
30 %cmp3 = icmp ne i32 %c3, 0
31 %s0 = select i1 %cmp0, float %a0, float %b0
32 %s1 = select i1 %cmp1, float %a1, float %b1
33 %s2 = select i1 %cmp2, float %a2, float %b2
34 %s3 = select i1 %cmp3, float %a3, float %b3
35 %ra = insertelement <4 x float> undef, float %s0, i32 0
36 %rb = insertelement <4 x float> %ra, float %s1, i32 1
37 %rc = insertelement <4 x float> %rb, float %s2, i32 2
38 %rd = insertelement <4 x float> %rc, float %s3, i32 3
42 define <8 x float> @simple_select2(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
43 ; CHECK-LABEL: @simple_select2(
44 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <4 x i32> [[C:%.*]], zeroinitializer
45 ; CHECK-NEXT: [[TMP2:%.*]] = select <4 x i1> [[TMP1]], <4 x float> [[A:%.*]], <4 x float> [[B:%.*]]
46 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x float> [[TMP2]], <4 x float> poison, <8 x i32> <i32 0, i32 undef, i32 1, i32 undef, i32 2, i32 undef, i32 undef, i32 3>
47 ; CHECK-NEXT: [[RD1:%.*]] = shufflevector <8 x float> undef, <8 x float> [[TMP3]], <8 x i32> <i32 8, i32 1, i32 10, i32 3, i32 12, i32 5, i32 6, i32 15>
48 ; CHECK-NEXT: ret <8 x float> [[RD1]]
50 %c0 = extractelement <4 x i32> %c, i32 0
51 %c1 = extractelement <4 x i32> %c, i32 1
52 %c2 = extractelement <4 x i32> %c, i32 2
53 %c3 = extractelement <4 x i32> %c, i32 3
54 %a0 = extractelement <4 x float> %a, i32 0
55 %a1 = extractelement <4 x float> %a, i32 1
56 %a2 = extractelement <4 x float> %a, i32 2
57 %a3 = extractelement <4 x float> %a, i32 3
58 %b0 = extractelement <4 x float> %b, i32 0
59 %b1 = extractelement <4 x float> %b, i32 1
60 %b2 = extractelement <4 x float> %b, i32 2
61 %b3 = extractelement <4 x float> %b, i32 3
62 %cmp0 = icmp ne i32 %c0, 0
63 %cmp1 = icmp ne i32 %c1, 0
64 %cmp2 = icmp ne i32 %c2, 0
65 %cmp3 = icmp ne i32 %c3, 0
66 %s0 = select i1 %cmp0, float %a0, float %b0
67 %s1 = select i1 %cmp1, float %a1, float %b1
68 %s2 = select i1 %cmp2, float %a2, float %b2
69 %s3 = select i1 %cmp3, float %a3, float %b3
70 %ra = insertelement <8 x float> undef, float %s0, i32 0
71 %rb = insertelement <8 x float> %ra, float %s1, i32 2
72 %rc = insertelement <8 x float> %rb, float %s2, i32 4
73 %rd = insertelement <8 x float> %rc, float %s3, i32 7
77 declare void @llvm.assume(i1) nounwind
79 ; This entire tree is ephemeral, don't vectorize any of it.
80 define <4 x float> @simple_select_eph(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
81 ; THRESHOLD-LABEL: @simple_select_eph(
82 ; THRESHOLD-NEXT: [[C0:%.*]] = extractelement <4 x i32> [[C:%.*]], i32 0
83 ; THRESHOLD-NEXT: [[C1:%.*]] = extractelement <4 x i32> [[C]], i32 1
84 ; THRESHOLD-NEXT: [[C2:%.*]] = extractelement <4 x i32> [[C]], i32 2
85 ; THRESHOLD-NEXT: [[C3:%.*]] = extractelement <4 x i32> [[C]], i32 3
86 ; THRESHOLD-NEXT: [[A0:%.*]] = extractelement <4 x float> [[A:%.*]], i32 0
87 ; THRESHOLD-NEXT: [[A1:%.*]] = extractelement <4 x float> [[A]], i32 1
88 ; THRESHOLD-NEXT: [[A2:%.*]] = extractelement <4 x float> [[A]], i32 2
89 ; THRESHOLD-NEXT: [[A3:%.*]] = extractelement <4 x float> [[A]], i32 3
90 ; THRESHOLD-NEXT: [[B0:%.*]] = extractelement <4 x float> [[B:%.*]], i32 0
91 ; THRESHOLD-NEXT: [[B1:%.*]] = extractelement <4 x float> [[B]], i32 1
92 ; THRESHOLD-NEXT: [[B2:%.*]] = extractelement <4 x float> [[B]], i32 2
93 ; THRESHOLD-NEXT: [[B3:%.*]] = extractelement <4 x float> [[B]], i32 3
94 ; THRESHOLD-NEXT: [[CMP0:%.*]] = icmp ne i32 [[C0]], 0
95 ; THRESHOLD-NEXT: [[CMP1:%.*]] = icmp ne i32 [[C1]], 0
96 ; THRESHOLD-NEXT: [[CMP2:%.*]] = icmp ne i32 [[C2]], 0
97 ; THRESHOLD-NEXT: [[CMP3:%.*]] = icmp ne i32 [[C3]], 0
98 ; THRESHOLD-NEXT: [[S0:%.*]] = select i1 [[CMP0]], float [[A0]], float [[B0]]
99 ; THRESHOLD-NEXT: [[S1:%.*]] = select i1 [[CMP1]], float [[A1]], float [[B1]]
100 ; THRESHOLD-NEXT: [[S2:%.*]] = select i1 [[CMP2]], float [[A2]], float [[B2]]
101 ; THRESHOLD-NEXT: [[S3:%.*]] = select i1 [[CMP3]], float [[A3]], float [[B3]]
102 ; THRESHOLD-NEXT: [[RA:%.*]] = insertelement <4 x float> undef, float [[S0]], i32 0
103 ; THRESHOLD-NEXT: [[RB:%.*]] = insertelement <4 x float> [[RA]], float [[S1]], i32 1
104 ; THRESHOLD-NEXT: [[RC:%.*]] = insertelement <4 x float> [[RB]], float [[S2]], i32 2
105 ; THRESHOLD-NEXT: [[RD:%.*]] = insertelement <4 x float> [[RC]], float [[S3]], i32 3
106 ; THRESHOLD-NEXT: [[Q0:%.*]] = extractelement <4 x float> [[RD]], i32 0
107 ; THRESHOLD-NEXT: [[Q1:%.*]] = extractelement <4 x float> [[RD]], i32 1
108 ; THRESHOLD-NEXT: [[Q2:%.*]] = extractelement <4 x float> [[RD]], i32 2
109 ; THRESHOLD-NEXT: [[Q3:%.*]] = extractelement <4 x float> [[RD]], i32 3
110 ; THRESHOLD-NEXT: [[Q4:%.*]] = fadd float [[Q0]], [[Q1]]
111 ; THRESHOLD-NEXT: [[Q5:%.*]] = fadd float [[Q2]], [[Q3]]
112 ; THRESHOLD-NEXT: [[Q6:%.*]] = fadd float [[Q4]], [[Q5]]
113 ; THRESHOLD-NEXT: [[QI:%.*]] = fcmp olt float [[Q6]], [[Q5]]
114 ; THRESHOLD-NEXT: call void @llvm.assume(i1 [[QI]])
115 ; THRESHOLD-NEXT: ret <4 x float> undef
117 ; NOTHRESHOLD-LABEL: @simple_select_eph(
118 ; NOTHRESHOLD-NEXT: [[C0:%.*]] = extractelement <4 x i32> [[C:%.*]], i32 0
119 ; NOTHRESHOLD-NEXT: [[C1:%.*]] = extractelement <4 x i32> [[C]], i32 1
120 ; NOTHRESHOLD-NEXT: [[C2:%.*]] = extractelement <4 x i32> [[C]], i32 2
121 ; NOTHRESHOLD-NEXT: [[C3:%.*]] = extractelement <4 x i32> [[C]], i32 3
122 ; NOTHRESHOLD-NEXT: [[A0:%.*]] = extractelement <4 x float> [[A:%.*]], i32 0
123 ; NOTHRESHOLD-NEXT: [[A1:%.*]] = extractelement <4 x float> [[A]], i32 1
124 ; NOTHRESHOLD-NEXT: [[A2:%.*]] = extractelement <4 x float> [[A]], i32 2
125 ; NOTHRESHOLD-NEXT: [[A3:%.*]] = extractelement <4 x float> [[A]], i32 3
126 ; NOTHRESHOLD-NEXT: [[B0:%.*]] = extractelement <4 x float> [[B:%.*]], i32 0
127 ; NOTHRESHOLD-NEXT: [[B1:%.*]] = extractelement <4 x float> [[B]], i32 1
128 ; NOTHRESHOLD-NEXT: [[B2:%.*]] = extractelement <4 x float> [[B]], i32 2
129 ; NOTHRESHOLD-NEXT: [[B3:%.*]] = extractelement <4 x float> [[B]], i32 3
130 ; NOTHRESHOLD-NEXT: [[CMP0:%.*]] = icmp ne i32 [[C0]], 0
131 ; NOTHRESHOLD-NEXT: [[CMP1:%.*]] = icmp ne i32 [[C1]], 0
132 ; NOTHRESHOLD-NEXT: [[CMP2:%.*]] = icmp ne i32 [[C2]], 0
133 ; NOTHRESHOLD-NEXT: [[CMP3:%.*]] = icmp ne i32 [[C3]], 0
134 ; NOTHRESHOLD-NEXT: [[S0:%.*]] = select i1 [[CMP0]], float [[A0]], float [[B0]]
135 ; NOTHRESHOLD-NEXT: [[S1:%.*]] = select i1 [[CMP1]], float [[A1]], float [[B1]]
136 ; NOTHRESHOLD-NEXT: [[S2:%.*]] = select i1 [[CMP2]], float [[A2]], float [[B2]]
137 ; NOTHRESHOLD-NEXT: [[S3:%.*]] = select i1 [[CMP3]], float [[A3]], float [[B3]]
138 ; NOTHRESHOLD-NEXT: [[RA:%.*]] = insertelement <4 x float> undef, float [[S0]], i32 0
139 ; NOTHRESHOLD-NEXT: [[RB:%.*]] = insertelement <4 x float> [[RA]], float [[S1]], i32 1
140 ; NOTHRESHOLD-NEXT: [[RC:%.*]] = insertelement <4 x float> [[RB]], float [[S2]], i32 2
141 ; NOTHRESHOLD-NEXT: [[RD:%.*]] = insertelement <4 x float> [[RC]], float [[S3]], i32 3
142 ; NOTHRESHOLD-NEXT: [[Q0:%.*]] = extractelement <4 x float> [[RD]], i32 0
143 ; NOTHRESHOLD-NEXT: [[Q1:%.*]] = extractelement <4 x float> [[RD]], i32 1
144 ; NOTHRESHOLD-NEXT: [[Q2:%.*]] = extractelement <4 x float> [[RD]], i32 2
145 ; NOTHRESHOLD-NEXT: [[Q3:%.*]] = extractelement <4 x float> [[RD]], i32 3
146 ; NOTHRESHOLD-NEXT: [[Q4:%.*]] = fadd float [[Q0]], [[Q1]]
147 ; NOTHRESHOLD-NEXT: [[Q5:%.*]] = fadd float [[Q2]], [[Q3]]
148 ; NOTHRESHOLD-NEXT: [[Q6:%.*]] = fadd float [[Q4]], [[Q5]]
149 ; NOTHRESHOLD-NEXT: [[QI:%.*]] = fcmp olt float [[Q6]], [[Q5]]
150 ; NOTHRESHOLD-NEXT: call void @llvm.assume(i1 [[QI]])
151 ; NOTHRESHOLD-NEXT: ret <4 x float> undef
153 ; MINTREESIZE-LABEL: @simple_select_eph(
154 ; MINTREESIZE-NEXT: [[C0:%.*]] = extractelement <4 x i32> [[C:%.*]], i32 0
155 ; MINTREESIZE-NEXT: [[C1:%.*]] = extractelement <4 x i32> [[C]], i32 1
156 ; MINTREESIZE-NEXT: [[C2:%.*]] = extractelement <4 x i32> [[C]], i32 2
157 ; MINTREESIZE-NEXT: [[C3:%.*]] = extractelement <4 x i32> [[C]], i32 3
158 ; MINTREESIZE-NEXT: [[A0:%.*]] = extractelement <4 x float> [[A:%.*]], i32 0
159 ; MINTREESIZE-NEXT: [[A1:%.*]] = extractelement <4 x float> [[A]], i32 1
160 ; MINTREESIZE-NEXT: [[A2:%.*]] = extractelement <4 x float> [[A]], i32 2
161 ; MINTREESIZE-NEXT: [[A3:%.*]] = extractelement <4 x float> [[A]], i32 3
162 ; MINTREESIZE-NEXT: [[B0:%.*]] = extractelement <4 x float> [[B:%.*]], i32 0
163 ; MINTREESIZE-NEXT: [[B1:%.*]] = extractelement <4 x float> [[B]], i32 1
164 ; MINTREESIZE-NEXT: [[B2:%.*]] = extractelement <4 x float> [[B]], i32 2
165 ; MINTREESIZE-NEXT: [[B3:%.*]] = extractelement <4 x float> [[B]], i32 3
166 ; MINTREESIZE-NEXT: [[CMP0:%.*]] = icmp ne i32 [[C0]], 0
167 ; MINTREESIZE-NEXT: [[CMP1:%.*]] = icmp ne i32 [[C1]], 0
168 ; MINTREESIZE-NEXT: [[CMP2:%.*]] = icmp ne i32 [[C2]], 0
169 ; MINTREESIZE-NEXT: [[CMP3:%.*]] = icmp ne i32 [[C3]], 0
170 ; MINTREESIZE-NEXT: [[S0:%.*]] = select i1 [[CMP0]], float [[A0]], float [[B0]]
171 ; MINTREESIZE-NEXT: [[S1:%.*]] = select i1 [[CMP1]], float [[A1]], float [[B1]]
172 ; MINTREESIZE-NEXT: [[S2:%.*]] = select i1 [[CMP2]], float [[A2]], float [[B2]]
173 ; MINTREESIZE-NEXT: [[S3:%.*]] = select i1 [[CMP3]], float [[A3]], float [[B3]]
174 ; MINTREESIZE-NEXT: [[RA:%.*]] = insertelement <4 x float> undef, float [[S0]], i32 0
175 ; MINTREESIZE-NEXT: [[RB:%.*]] = insertelement <4 x float> [[RA]], float [[S1]], i32 1
176 ; MINTREESIZE-NEXT: [[RC:%.*]] = insertelement <4 x float> [[RB]], float [[S2]], i32 2
177 ; MINTREESIZE-NEXT: [[RD:%.*]] = insertelement <4 x float> [[RC]], float [[S3]], i32 3
178 ; MINTREESIZE-NEXT: [[Q0:%.*]] = extractelement <4 x float> [[RD]], i32 0
179 ; MINTREESIZE-NEXT: [[Q1:%.*]] = extractelement <4 x float> [[RD]], i32 1
180 ; MINTREESIZE-NEXT: [[Q2:%.*]] = extractelement <4 x float> [[RD]], i32 2
181 ; MINTREESIZE-NEXT: [[Q3:%.*]] = extractelement <4 x float> [[RD]], i32 3
182 ; MINTREESIZE-NEXT: [[TMP1:%.*]] = insertelement <2 x float> poison, float [[Q2]], i32 0
183 ; MINTREESIZE-NEXT: [[TMP2:%.*]] = insertelement <2 x float> [[TMP1]], float [[Q3]], i32 1
184 ; MINTREESIZE-NEXT: [[Q4:%.*]] = fadd float [[Q0]], [[Q1]]
185 ; MINTREESIZE-NEXT: [[Q5:%.*]] = fadd float [[Q2]], [[Q3]]
186 ; MINTREESIZE-NEXT: [[TMP3:%.*]] = insertelement <2 x float> poison, float [[Q4]], i32 0
187 ; MINTREESIZE-NEXT: [[TMP4:%.*]] = insertelement <2 x float> [[TMP3]], float [[Q5]], i32 1
188 ; MINTREESIZE-NEXT: [[Q6:%.*]] = fadd float [[Q4]], [[Q5]]
189 ; MINTREESIZE-NEXT: [[TMP5:%.*]] = insertelement <2 x float> poison, float [[Q6]], i32 0
190 ; MINTREESIZE-NEXT: [[TMP6:%.*]] = insertelement <2 x float> [[TMP5]], float [[Q5]], i32 1
191 ; MINTREESIZE-NEXT: [[QI:%.*]] = fcmp olt float [[Q6]], [[Q5]]
192 ; MINTREESIZE-NEXT: call void @llvm.assume(i1 [[QI]])
193 ; MINTREESIZE-NEXT: ret <4 x float> undef
195 %c0 = extractelement <4 x i32> %c, i32 0
196 %c1 = extractelement <4 x i32> %c, i32 1
197 %c2 = extractelement <4 x i32> %c, i32 2
198 %c3 = extractelement <4 x i32> %c, i32 3
199 %a0 = extractelement <4 x float> %a, i32 0
200 %a1 = extractelement <4 x float> %a, i32 1
201 %a2 = extractelement <4 x float> %a, i32 2
202 %a3 = extractelement <4 x float> %a, i32 3
203 %b0 = extractelement <4 x float> %b, i32 0
204 %b1 = extractelement <4 x float> %b, i32 1
205 %b2 = extractelement <4 x float> %b, i32 2
206 %b3 = extractelement <4 x float> %b, i32 3
207 %cmp0 = icmp ne i32 %c0, 0
208 %cmp1 = icmp ne i32 %c1, 0
209 %cmp2 = icmp ne i32 %c2, 0
210 %cmp3 = icmp ne i32 %c3, 0
211 %s0 = select i1 %cmp0, float %a0, float %b0
212 %s1 = select i1 %cmp1, float %a1, float %b1
213 %s2 = select i1 %cmp2, float %a2, float %b2
214 %s3 = select i1 %cmp3, float %a3, float %b3
215 %ra = insertelement <4 x float> undef, float %s0, i32 0
216 %rb = insertelement <4 x float> %ra, float %s1, i32 1
217 %rc = insertelement <4 x float> %rb, float %s2, i32 2
218 %rd = insertelement <4 x float> %rc, float %s3, i32 3
219 %q0 = extractelement <4 x float> %rd, i32 0
220 %q1 = extractelement <4 x float> %rd, i32 1
221 %q2 = extractelement <4 x float> %rd, i32 2
222 %q3 = extractelement <4 x float> %rd, i32 3
223 %q4 = fadd float %q0, %q1
224 %q5 = fadd float %q2, %q3
225 %q6 = fadd float %q4, %q5
226 %qi = fcmp olt float %q6, %q5
227 call void @llvm.assume(i1 %qi)
228 ret <4 x float> undef
231 ; Insert in an order different from the vector indices to make sure it
233 define <4 x float> @simple_select_insert_out_of_order(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
234 ; CHECK-LABEL: @simple_select_insert_out_of_order(
235 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <4 x i32> [[C:%.*]], zeroinitializer
236 ; CHECK-NEXT: [[TMP2:%.*]] = select <4 x i1> [[TMP1]], <4 x float> [[A:%.*]], <4 x float> [[B:%.*]]
237 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x float> [[TMP2]], <4 x float> poison, <4 x i32> <i32 2, i32 1, i32 0, i32 3>
238 ; CHECK-NEXT: ret <4 x float> [[TMP3]]
240 %c0 = extractelement <4 x i32> %c, i32 0
241 %c1 = extractelement <4 x i32> %c, i32 1
242 %c2 = extractelement <4 x i32> %c, i32 2
243 %c3 = extractelement <4 x i32> %c, i32 3
244 %a0 = extractelement <4 x float> %a, i32 0
245 %a1 = extractelement <4 x float> %a, i32 1
246 %a2 = extractelement <4 x float> %a, i32 2
247 %a3 = extractelement <4 x float> %a, i32 3
248 %b0 = extractelement <4 x float> %b, i32 0
249 %b1 = extractelement <4 x float> %b, i32 1
250 %b2 = extractelement <4 x float> %b, i32 2
251 %b3 = extractelement <4 x float> %b, i32 3
252 %cmp0 = icmp ne i32 %c0, 0
253 %cmp1 = icmp ne i32 %c1, 0
254 %cmp2 = icmp ne i32 %c2, 0
255 %cmp3 = icmp ne i32 %c3, 0
256 %s0 = select i1 %cmp0, float %a0, float %b0
257 %s1 = select i1 %cmp1, float %a1, float %b1
258 %s2 = select i1 %cmp2, float %a2, float %b2
259 %s3 = select i1 %cmp3, float %a3, float %b3
260 %ra = insertelement <4 x float> undef, float %s0, i32 2
261 %rb = insertelement <4 x float> %ra, float %s1, i32 1
262 %rc = insertelement <4 x float> %rb, float %s2, i32 0
263 %rd = insertelement <4 x float> %rc, float %s3, i32 3
267 declare void @v4f32_user(<4 x float>) #0
268 declare void @f32_user(float) #0
270 ; Multiple users of the final constructed vector
271 define <4 x float> @simple_select_users(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
272 ; CHECK-LABEL: @simple_select_users(
273 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <4 x i32> [[C:%.*]], zeroinitializer
274 ; CHECK-NEXT: [[TMP2:%.*]] = select <4 x i1> [[TMP1]], <4 x float> [[A:%.*]], <4 x float> [[B:%.*]]
275 ; CHECK-NEXT: call void @v4f32_user(<4 x float> [[TMP2]]) #[[ATTR0:[0-9]+]]
276 ; CHECK-NEXT: ret <4 x float> [[TMP2]]
278 %c0 = extractelement <4 x i32> %c, i32 0
279 %c1 = extractelement <4 x i32> %c, i32 1
280 %c2 = extractelement <4 x i32> %c, i32 2
281 %c3 = extractelement <4 x i32> %c, i32 3
282 %a0 = extractelement <4 x float> %a, i32 0
283 %a1 = extractelement <4 x float> %a, i32 1
284 %a2 = extractelement <4 x float> %a, i32 2
285 %a3 = extractelement <4 x float> %a, i32 3
286 %b0 = extractelement <4 x float> %b, i32 0
287 %b1 = extractelement <4 x float> %b, i32 1
288 %b2 = extractelement <4 x float> %b, i32 2
289 %b3 = extractelement <4 x float> %b, i32 3
290 %cmp0 = icmp ne i32 %c0, 0
291 %cmp1 = icmp ne i32 %c1, 0
292 %cmp2 = icmp ne i32 %c2, 0
293 %cmp3 = icmp ne i32 %c3, 0
294 %s0 = select i1 %cmp0, float %a0, float %b0
295 %s1 = select i1 %cmp1, float %a1, float %b1
296 %s2 = select i1 %cmp2, float %a2, float %b2
297 %s3 = select i1 %cmp3, float %a3, float %b3
298 %ra = insertelement <4 x float> undef, float %s0, i32 0
299 %rb = insertelement <4 x float> %ra, float %s1, i32 1
300 %rc = insertelement <4 x float> %rb, float %s2, i32 2
301 %rd = insertelement <4 x float> %rc, float %s3, i32 3
302 call void @v4f32_user(<4 x float> %rd) #0
306 ; Unused insertelement
307 define <4 x float> @simple_select_no_users(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
308 ; CHECK-LABEL: @simple_select_no_users(
309 ; CHECK-NEXT: [[C0:%.*]] = extractelement <4 x i32> [[C:%.*]], i32 0
310 ; CHECK-NEXT: [[C1:%.*]] = extractelement <4 x i32> [[C]], i32 1
311 ; CHECK-NEXT: [[C2:%.*]] = extractelement <4 x i32> [[C]], i32 2
312 ; CHECK-NEXT: [[C3:%.*]] = extractelement <4 x i32> [[C]], i32 3
313 ; CHECK-NEXT: [[A0:%.*]] = extractelement <4 x float> [[A:%.*]], i32 0
314 ; CHECK-NEXT: [[A1:%.*]] = extractelement <4 x float> [[A]], i32 1
315 ; CHECK-NEXT: [[A2:%.*]] = extractelement <4 x float> [[A]], i32 2
316 ; CHECK-NEXT: [[A3:%.*]] = extractelement <4 x float> [[A]], i32 3
317 ; CHECK-NEXT: [[B0:%.*]] = extractelement <4 x float> [[B:%.*]], i32 0
318 ; CHECK-NEXT: [[B1:%.*]] = extractelement <4 x float> [[B]], i32 1
319 ; CHECK-NEXT: [[B2:%.*]] = extractelement <4 x float> [[B]], i32 2
320 ; CHECK-NEXT: [[B3:%.*]] = extractelement <4 x float> [[B]], i32 3
321 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> poison, i32 [[C0]], i32 0
322 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[C1]], i32 1
323 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne <2 x i32> [[TMP2]], zeroinitializer
324 ; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x i32> poison, i32 [[C2]], i32 0
325 ; CHECK-NEXT: [[TMP5:%.*]] = insertelement <2 x i32> [[TMP4]], i32 [[C3]], i32 1
326 ; CHECK-NEXT: [[TMP6:%.*]] = icmp ne <2 x i32> [[TMP5]], zeroinitializer
327 ; CHECK-NEXT: [[TMP7:%.*]] = insertelement <2 x float> poison, float [[A0]], i32 0
328 ; CHECK-NEXT: [[TMP8:%.*]] = insertelement <2 x float> [[TMP7]], float [[A1]], i32 1
329 ; CHECK-NEXT: [[TMP9:%.*]] = insertelement <2 x float> poison, float [[B0]], i32 0
330 ; CHECK-NEXT: [[TMP10:%.*]] = insertelement <2 x float> [[TMP9]], float [[B1]], i32 1
331 ; CHECK-NEXT: [[TMP11:%.*]] = select <2 x i1> [[TMP3]], <2 x float> [[TMP8]], <2 x float> [[TMP10]]
332 ; CHECK-NEXT: [[TMP12:%.*]] = insertelement <2 x float> poison, float [[A2]], i32 0
333 ; CHECK-NEXT: [[TMP13:%.*]] = insertelement <2 x float> [[TMP12]], float [[A3]], i32 1
334 ; CHECK-NEXT: [[TMP14:%.*]] = insertelement <2 x float> poison, float [[B2]], i32 0
335 ; CHECK-NEXT: [[TMP15:%.*]] = insertelement <2 x float> [[TMP14]], float [[B3]], i32 1
336 ; CHECK-NEXT: [[TMP16:%.*]] = select <2 x i1> [[TMP6]], <2 x float> [[TMP13]], <2 x float> [[TMP15]]
337 ; CHECK-NEXT: [[TMP17:%.*]] = shufflevector <2 x float> [[TMP11]], <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
338 ; CHECK-NEXT: [[TMP18:%.*]] = shufflevector <2 x float> [[TMP16]], <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
339 ; CHECK-NEXT: [[RD1:%.*]] = shufflevector <4 x float> undef, <4 x float> [[TMP18]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
340 ; CHECK-NEXT: ret <4 x float> [[RD1]]
342 %c0 = extractelement <4 x i32> %c, i32 0
343 %c1 = extractelement <4 x i32> %c, i32 1
344 %c2 = extractelement <4 x i32> %c, i32 2
345 %c3 = extractelement <4 x i32> %c, i32 3
346 %a0 = extractelement <4 x float> %a, i32 0
347 %a1 = extractelement <4 x float> %a, i32 1
348 %a2 = extractelement <4 x float> %a, i32 2
349 %a3 = extractelement <4 x float> %a, i32 3
350 %b0 = extractelement <4 x float> %b, i32 0
351 %b1 = extractelement <4 x float> %b, i32 1
352 %b2 = extractelement <4 x float> %b, i32 2
353 %b3 = extractelement <4 x float> %b, i32 3
354 %cmp0 = icmp ne i32 %c0, 0
355 %cmp1 = icmp ne i32 %c1, 0
356 %cmp2 = icmp ne i32 %c2, 0
357 %cmp3 = icmp ne i32 %c3, 0
358 %s0 = select i1 %cmp0, float %a0, float %b0
359 %s1 = select i1 %cmp1, float %a1, float %b1
360 %s2 = select i1 %cmp2, float %a2, float %b2
361 %s3 = select i1 %cmp3, float %a3, float %b3
362 %ra = insertelement <4 x float> undef, float %s0, i32 0
363 %rb = insertelement <4 x float> %ra, float %s1, i32 1
364 %rc = insertelement <4 x float> undef, float %s2, i32 2
365 %rd = insertelement <4 x float> %rc, float %s3, i32 3
369 ; Make sure infinite loop doesn't happen which I ran into when trying
370 ; to do this backwards this backwards
371 define <4 x i32> @reconstruct(<4 x i32> %c) #0 {
372 ; CHECK-LABEL: @reconstruct(
373 ; CHECK-NEXT: [[C0:%.*]] = extractelement <4 x i32> [[C:%.*]], i32 0
374 ; CHECK-NEXT: [[C1:%.*]] = extractelement <4 x i32> [[C]], i32 1
375 ; CHECK-NEXT: [[C2:%.*]] = extractelement <4 x i32> [[C]], i32 2
376 ; CHECK-NEXT: [[C3:%.*]] = extractelement <4 x i32> [[C]], i32 3
377 ; CHECK-NEXT: [[RA:%.*]] = insertelement <4 x i32> undef, i32 [[C0]], i32 0
378 ; CHECK-NEXT: [[RB:%.*]] = insertelement <4 x i32> [[RA]], i32 [[C1]], i32 1
379 ; CHECK-NEXT: [[RC:%.*]] = insertelement <4 x i32> [[RB]], i32 [[C2]], i32 2
380 ; CHECK-NEXT: [[RD:%.*]] = insertelement <4 x i32> [[RC]], i32 [[C3]], i32 3
381 ; CHECK-NEXT: ret <4 x i32> [[RD]]
383 %c0 = extractelement <4 x i32> %c, i32 0
384 %c1 = extractelement <4 x i32> %c, i32 1
385 %c2 = extractelement <4 x i32> %c, i32 2
386 %c3 = extractelement <4 x i32> %c, i32 3
387 %ra = insertelement <4 x i32> undef, i32 %c0, i32 0
388 %rb = insertelement <4 x i32> %ra, i32 %c1, i32 1
389 %rc = insertelement <4 x i32> %rb, i32 %c2, i32 2
390 %rd = insertelement <4 x i32> %rc, i32 %c3, i32 3
394 define <2 x float> @simple_select_v2(<2 x float> %a, <2 x float> %b, <2 x i32> %c) #0 {
395 ; CHECK-LABEL: @simple_select_v2(
396 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <2 x i32> [[C:%.*]], zeroinitializer
397 ; CHECK-NEXT: [[TMP2:%.*]] = select <2 x i1> [[TMP1]], <2 x float> [[A:%.*]], <2 x float> [[B:%.*]]
398 ; CHECK-NEXT: ret <2 x float> [[TMP2]]
400 %c0 = extractelement <2 x i32> %c, i32 0
401 %c1 = extractelement <2 x i32> %c, i32 1
402 %a0 = extractelement <2 x float> %a, i32 0
403 %a1 = extractelement <2 x float> %a, i32 1
404 %b0 = extractelement <2 x float> %b, i32 0
405 %b1 = extractelement <2 x float> %b, i32 1
406 %cmp0 = icmp ne i32 %c0, 0
407 %cmp1 = icmp ne i32 %c1, 0
408 %s0 = select i1 %cmp0, float %a0, float %b0
409 %s1 = select i1 %cmp1, float %a1, float %b1
410 %ra = insertelement <2 x float> undef, float %s0, i32 0
411 %rb = insertelement <2 x float> %ra, float %s1, i32 1
415 ; Make sure when we construct partial vectors, we don't keep
416 ; re-visiting the insertelement chains starting with undef
417 ; (low cost threshold needed to force this to happen)
418 define <4 x float> @simple_select_partial_vector(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
419 ; CHECK-LABEL: @simple_select_partial_vector(
420 ; CHECK-NEXT: [[C0:%.*]] = extractelement <4 x i32> [[C:%.*]], i32 0
421 ; CHECK-NEXT: [[C1:%.*]] = extractelement <4 x i32> [[C]], i32 1
422 ; CHECK-NEXT: [[A0:%.*]] = extractelement <4 x float> [[A:%.*]], i32 0
423 ; CHECK-NEXT: [[A1:%.*]] = extractelement <4 x float> [[A]], i32 1
424 ; CHECK-NEXT: [[B0:%.*]] = extractelement <4 x float> [[B:%.*]], i32 0
425 ; CHECK-NEXT: [[B1:%.*]] = extractelement <4 x float> [[B]], i32 1
426 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> undef, i32 [[C0]], i32 0
427 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[C1]], i32 1
428 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne <2 x i32> [[TMP2]], zeroinitializer
429 ; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x float> undef, float [[A0]], i32 0
430 ; CHECK-NEXT: [[TMP5:%.*]] = insertelement <2 x float> [[TMP4]], float [[A1]], i32 1
431 ; CHECK-NEXT: [[TMP6:%.*]] = insertelement <2 x float> undef, float [[B0]], i32 0
432 ; CHECK-NEXT: [[TMP7:%.*]] = insertelement <2 x float> [[TMP6]], float [[B1]], i32 1
433 ; CHECK-NEXT: [[TMP8:%.*]] = select <2 x i1> [[TMP3]], <2 x float> [[TMP5]], <2 x float> [[TMP7]]
434 ; CHECK-NEXT: [[TMP9:%.*]] = extractelement <2 x float> [[TMP8]], i32 0
435 ; CHECK-NEXT: [[RA:%.*]] = insertelement <4 x float> undef, float [[TMP9]], i32 0
436 ; CHECK-NEXT: [[TMP10:%.*]] = extractelement <2 x float> [[TMP8]], i32 1
437 ; CHECK-NEXT: [[RB:%.*]] = insertelement <4 x float> [[RA]], float [[TMP10]], i32 1
438 ; CHECK-NEXT: ret <4 x float> [[RB]]
440 %c0 = extractelement <4 x i32> %c, i32 0
441 %c1 = extractelement <4 x i32> %c, i32 1
442 %a0 = extractelement <4 x float> %a, i32 0
443 %a1 = extractelement <4 x float> %a, i32 1
444 %b0 = extractelement <4 x float> %b, i32 0
445 %b1 = extractelement <4 x float> %b, i32 1
446 %1 = insertelement <2 x i32> undef, i32 %c0, i32 0
447 %2 = insertelement <2 x i32> %1, i32 %c1, i32 1
448 %3 = icmp ne <2 x i32> %2, zeroinitializer
449 %4 = insertelement <2 x float> undef, float %a0, i32 0
450 %5 = insertelement <2 x float> %4, float %a1, i32 1
451 %6 = insertelement <2 x float> undef, float %b0, i32 0
452 %7 = insertelement <2 x float> %6, float %b1, i32 1
453 %8 = select <2 x i1> %3, <2 x float> %5, <2 x float> %7
454 %9 = extractelement <2 x float> %8, i32 0
455 %ra = insertelement <4 x float> undef, float %9, i32 0
456 %10 = extractelement <2 x float> %8, i32 1
457 %rb = insertelement <4 x float> %ra, float %10, i32 1
461 ; Make sure that vectorization happens even if insertelements operations
462 ; must be rescheduled. The case here is from compiling Julia.
463 define <4 x float> @reschedule_extract(<4 x float> %a, <4 x float> %b) {
464 ; THRESHOLD-LABEL: @reschedule_extract(
465 ; THRESHOLD-NEXT: [[TMP1:%.*]] = fadd <4 x float> [[A:%.*]], [[B:%.*]]
466 ; THRESHOLD-NEXT: ret <4 x float> [[TMP1]]
468 ; NOTHRESHOLD-LABEL: @reschedule_extract(
469 ; NOTHRESHOLD-NEXT: [[TMP1:%.*]] = fadd <4 x float> [[A:%.*]], [[B:%.*]]
470 ; NOTHRESHOLD-NEXT: ret <4 x float> [[TMP1]]
472 ; MINTREESIZE-LABEL: @reschedule_extract(
473 ; MINTREESIZE-NEXT: [[TMP1:%.*]] = extractelement <4 x float> [[B:%.*]], i32 3
474 ; MINTREESIZE-NEXT: [[TMP2:%.*]] = extractelement <4 x float> [[B]], i32 2
475 ; MINTREESIZE-NEXT: [[TMP3:%.*]] = extractelement <4 x float> [[B]], i32 1
476 ; MINTREESIZE-NEXT: [[TMP4:%.*]] = extractelement <4 x float> [[B]], i32 0
477 ; MINTREESIZE-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[A:%.*]], i32 3
478 ; MINTREESIZE-NEXT: [[TMP6:%.*]] = extractelement <4 x float> [[A]], i32 2
479 ; MINTREESIZE-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[A]], i32 1
480 ; MINTREESIZE-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[A]], i32 0
481 ; MINTREESIZE-NEXT: [[TMP9:%.*]] = insertelement <2 x float> poison, float [[TMP8]], i32 0
482 ; MINTREESIZE-NEXT: [[TMP10:%.*]] = insertelement <2 x float> [[TMP9]], float [[TMP4]], i32 1
483 ; MINTREESIZE-NEXT: [[TMP11:%.*]] = fadd <4 x float> [[A]], [[B]]
484 ; MINTREESIZE-NEXT: [[TMP12:%.*]] = insertelement <2 x float> poison, float [[TMP7]], i32 0
485 ; MINTREESIZE-NEXT: [[TMP13:%.*]] = insertelement <2 x float> [[TMP12]], float [[TMP3]], i32 1
486 ; MINTREESIZE-NEXT: [[TMP14:%.*]] = insertelement <2 x float> poison, float [[TMP6]], i32 0
487 ; MINTREESIZE-NEXT: [[TMP15:%.*]] = insertelement <2 x float> [[TMP14]], float [[TMP2]], i32 1
488 ; MINTREESIZE-NEXT: [[TMP16:%.*]] = insertelement <2 x float> poison, float [[TMP5]], i32 0
489 ; MINTREESIZE-NEXT: [[TMP17:%.*]] = insertelement <2 x float> [[TMP16]], float [[TMP1]], i32 1
490 ; MINTREESIZE-NEXT: ret <4 x float> [[TMP11]]
492 %a0 = extractelement <4 x float> %a, i32 0
493 %b0 = extractelement <4 x float> %b, i32 0
494 %c0 = fadd float %a0, %b0
495 %v0 = insertelement <4 x float> undef, float %c0, i32 0
496 %a1 = extractelement <4 x float> %a, i32 1
497 %b1 = extractelement <4 x float> %b, i32 1
498 %c1 = fadd float %a1, %b1
499 %v1 = insertelement <4 x float> %v0, float %c1, i32 1
500 %a2 = extractelement <4 x float> %a, i32 2
501 %b2 = extractelement <4 x float> %b, i32 2
502 %c2 = fadd float %a2, %b2
503 %v2 = insertelement <4 x float> %v1, float %c2, i32 2
504 %a3 = extractelement <4 x float> %a, i32 3
505 %b3 = extractelement <4 x float> %b, i32 3
506 %c3 = fadd float %a3, %b3
507 %v3 = insertelement <4 x float> %v2, float %c3, i32 3
511 ; Check that cost model for vectorization takes credit for
512 ; instructions that are erased.
513 define <4 x float> @take_credit(<4 x float> %a, <4 x float> %b) {
514 ; THRESHOLD-LABEL: @take_credit(
515 ; THRESHOLD-NEXT: [[TMP1:%.*]] = fadd <4 x float> [[A:%.*]], [[B:%.*]]
516 ; THRESHOLD-NEXT: ret <4 x float> [[TMP1]]
518 ; NOTHRESHOLD-LABEL: @take_credit(
519 ; NOTHRESHOLD-NEXT: [[TMP1:%.*]] = fadd <4 x float> [[A:%.*]], [[B:%.*]]
520 ; NOTHRESHOLD-NEXT: ret <4 x float> [[TMP1]]
522 ; MINTREESIZE-LABEL: @take_credit(
523 ; MINTREESIZE-NEXT: [[TMP1:%.*]] = extractelement <4 x float> [[B:%.*]], i32 3
524 ; MINTREESIZE-NEXT: [[TMP2:%.*]] = extractelement <4 x float> [[B]], i32 2
525 ; MINTREESIZE-NEXT: [[TMP3:%.*]] = extractelement <4 x float> [[B]], i32 1
526 ; MINTREESIZE-NEXT: [[TMP4:%.*]] = extractelement <4 x float> [[B]], i32 0
527 ; MINTREESIZE-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[A:%.*]], i32 3
528 ; MINTREESIZE-NEXT: [[TMP6:%.*]] = extractelement <4 x float> [[A]], i32 2
529 ; MINTREESIZE-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[A]], i32 1
530 ; MINTREESIZE-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[A]], i32 0
531 ; MINTREESIZE-NEXT: [[TMP9:%.*]] = insertelement <2 x float> poison, float [[TMP8]], i32 0
532 ; MINTREESIZE-NEXT: [[TMP10:%.*]] = insertelement <2 x float> [[TMP9]], float [[TMP4]], i32 1
533 ; MINTREESIZE-NEXT: [[TMP11:%.*]] = insertelement <2 x float> poison, float [[TMP7]], i32 0
534 ; MINTREESIZE-NEXT: [[TMP12:%.*]] = insertelement <2 x float> [[TMP11]], float [[TMP3]], i32 1
535 ; MINTREESIZE-NEXT: [[TMP13:%.*]] = insertelement <2 x float> poison, float [[TMP6]], i32 0
536 ; MINTREESIZE-NEXT: [[TMP14:%.*]] = insertelement <2 x float> [[TMP13]], float [[TMP2]], i32 1
537 ; MINTREESIZE-NEXT: [[TMP15:%.*]] = insertelement <2 x float> poison, float [[TMP5]], i32 0
538 ; MINTREESIZE-NEXT: [[TMP16:%.*]] = insertelement <2 x float> [[TMP15]], float [[TMP1]], i32 1
539 ; MINTREESIZE-NEXT: [[TMP17:%.*]] = fadd <4 x float> [[A]], [[B]]
540 ; MINTREESIZE-NEXT: ret <4 x float> [[TMP17]]
542 %a0 = extractelement <4 x float> %a, i32 0
543 %b0 = extractelement <4 x float> %b, i32 0
544 %c0 = fadd float %a0, %b0
545 %a1 = extractelement <4 x float> %a, i32 1
546 %b1 = extractelement <4 x float> %b, i32 1
547 %c1 = fadd float %a1, %b1
548 %a2 = extractelement <4 x float> %a, i32 2
549 %b2 = extractelement <4 x float> %b, i32 2
550 %c2 = fadd float %a2, %b2
551 %a3 = extractelement <4 x float> %a, i32 3
552 %b3 = extractelement <4 x float> %b, i32 3
553 %c3 = fadd float %a3, %b3
554 %v0 = insertelement <4 x float> undef, float %c0, i32 0
555 %v1 = insertelement <4 x float> %v0, float %c1, i32 1
556 %v2 = insertelement <4 x float> %v1, float %c2, i32 2
557 %v3 = insertelement <4 x float> %v2, float %c3, i32 3
561 ; Make sure we handle multiple trees that feed one build vector correctly.
562 define <4 x double> @multi_tree(double %w, double %x, double %y, double %z) {
563 ; CHECK-LABEL: @multi_tree(
564 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x double> poison, double [[Z:%.*]], i32 0
565 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x double> [[TMP1]], double [[Y:%.*]], i32 1
566 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x double> [[TMP2]], double [[X:%.*]], i32 2
567 ; CHECK-NEXT: [[TMP4:%.*]] = insertelement <4 x double> [[TMP3]], double [[W:%.*]], i32 3
568 ; CHECK-NEXT: [[TMP5:%.*]] = fadd <4 x double> [[TMP4]], <double 3.000000e+00, double 2.000000e+00, double 1.000000e+00, double 0.000000e+00>
569 ; CHECK-NEXT: [[TMP6:%.*]] = fmul <4 x double> [[TMP5]], <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
570 ; CHECK-NEXT: ret <4 x double> [[TMP6]]
572 %t0 = fadd double %w , 0.000000e+00
573 %t1 = fadd double %x , 1.000000e+00
574 %t2 = fadd double %y , 2.000000e+00
575 %t3 = fadd double %z , 3.000000e+00
576 %t4 = fmul double %t0, 1.000000e+00
577 %i1 = insertelement <4 x double> undef, double %t4, i32 3
578 %t5 = fmul double %t1, 1.000000e+00
579 %i2 = insertelement <4 x double> %i1, double %t5, i32 2
580 %t6 = fmul double %t2, 1.000000e+00
581 %i3 = insertelement <4 x double> %i2, double %t6, i32 1
582 %t7 = fmul double %t3, 1.000000e+00
583 %i4 = insertelement <4 x double> %i3, double %t7, i32 0
587 define <8 x float> @_vadd256(<8 x float> %a, <8 x float> %b) local_unnamed_addr #0 {
588 ; THRESHOLD-LABEL: @_vadd256(
589 ; THRESHOLD-NEXT: [[TMP1:%.*]] = fadd <8 x float> [[A:%.*]], [[B:%.*]]
590 ; THRESHOLD-NEXT: ret <8 x float> [[TMP1]]
592 ; NOTHRESHOLD-LABEL: @_vadd256(
593 ; NOTHRESHOLD-NEXT: [[TMP1:%.*]] = fadd <8 x float> [[A:%.*]], [[B:%.*]]
594 ; NOTHRESHOLD-NEXT: ret <8 x float> [[TMP1]]
596 ; MINTREESIZE-LABEL: @_vadd256(
597 ; MINTREESIZE-NEXT: [[TMP1:%.*]] = extractelement <8 x float> [[B:%.*]], i32 7
598 ; MINTREESIZE-NEXT: [[TMP2:%.*]] = extractelement <8 x float> [[B]], i32 6
599 ; MINTREESIZE-NEXT: [[TMP3:%.*]] = extractelement <8 x float> [[B]], i32 5
600 ; MINTREESIZE-NEXT: [[TMP4:%.*]] = extractelement <8 x float> [[B]], i32 4
601 ; MINTREESIZE-NEXT: [[TMP5:%.*]] = extractelement <8 x float> [[B]], i32 3
602 ; MINTREESIZE-NEXT: [[TMP6:%.*]] = extractelement <8 x float> [[B]], i32 2
603 ; MINTREESIZE-NEXT: [[TMP7:%.*]] = extractelement <8 x float> [[B]], i32 1
604 ; MINTREESIZE-NEXT: [[TMP8:%.*]] = extractelement <8 x float> [[B]], i32 0
605 ; MINTREESIZE-NEXT: [[TMP9:%.*]] = extractelement <8 x float> [[A:%.*]], i32 7
606 ; MINTREESIZE-NEXT: [[TMP10:%.*]] = extractelement <8 x float> [[A]], i32 6
607 ; MINTREESIZE-NEXT: [[TMP11:%.*]] = extractelement <8 x float> [[A]], i32 5
608 ; MINTREESIZE-NEXT: [[TMP12:%.*]] = extractelement <8 x float> [[A]], i32 4
609 ; MINTREESIZE-NEXT: [[TMP13:%.*]] = extractelement <8 x float> [[A]], i32 3
610 ; MINTREESIZE-NEXT: [[TMP14:%.*]] = extractelement <8 x float> [[A]], i32 2
611 ; MINTREESIZE-NEXT: [[TMP15:%.*]] = extractelement <8 x float> [[A]], i32 1
612 ; MINTREESIZE-NEXT: [[TMP16:%.*]] = extractelement <8 x float> [[A]], i32 0
613 ; MINTREESIZE-NEXT: [[TMP17:%.*]] = insertelement <2 x float> poison, float [[TMP16]], i32 0
614 ; MINTREESIZE-NEXT: [[TMP18:%.*]] = insertelement <2 x float> [[TMP17]], float [[TMP8]], i32 1
615 ; MINTREESIZE-NEXT: [[TMP19:%.*]] = insertelement <2 x float> poison, float [[TMP15]], i32 0
616 ; MINTREESIZE-NEXT: [[TMP20:%.*]] = insertelement <2 x float> [[TMP19]], float [[TMP7]], i32 1
617 ; MINTREESIZE-NEXT: [[TMP21:%.*]] = insertelement <2 x float> poison, float [[TMP14]], i32 0
618 ; MINTREESIZE-NEXT: [[TMP22:%.*]] = insertelement <2 x float> [[TMP21]], float [[TMP6]], i32 1
619 ; MINTREESIZE-NEXT: [[TMP23:%.*]] = insertelement <2 x float> poison, float [[TMP13]], i32 0
620 ; MINTREESIZE-NEXT: [[TMP24:%.*]] = insertelement <2 x float> [[TMP23]], float [[TMP5]], i32 1
621 ; MINTREESIZE-NEXT: [[TMP25:%.*]] = insertelement <2 x float> poison, float [[TMP12]], i32 0
622 ; MINTREESIZE-NEXT: [[TMP26:%.*]] = insertelement <2 x float> [[TMP25]], float [[TMP4]], i32 1
623 ; MINTREESIZE-NEXT: [[TMP27:%.*]] = insertelement <2 x float> poison, float [[TMP11]], i32 0
624 ; MINTREESIZE-NEXT: [[TMP28:%.*]] = insertelement <2 x float> [[TMP27]], float [[TMP3]], i32 1
625 ; MINTREESIZE-NEXT: [[TMP29:%.*]] = insertelement <2 x float> poison, float [[TMP10]], i32 0
626 ; MINTREESIZE-NEXT: [[TMP30:%.*]] = insertelement <2 x float> [[TMP29]], float [[TMP2]], i32 1
627 ; MINTREESIZE-NEXT: [[TMP31:%.*]] = insertelement <2 x float> poison, float [[TMP9]], i32 0
628 ; MINTREESIZE-NEXT: [[TMP32:%.*]] = insertelement <2 x float> [[TMP31]], float [[TMP1]], i32 1
629 ; MINTREESIZE-NEXT: [[TMP33:%.*]] = fadd <8 x float> [[A]], [[B]]
630 ; MINTREESIZE-NEXT: ret <8 x float> [[TMP33]]
632 %vecext = extractelement <8 x float> %a, i32 0
633 %vecext1 = extractelement <8 x float> %b, i32 0
634 %add = fadd float %vecext, %vecext1
635 %vecext2 = extractelement <8 x float> %a, i32 1
636 %vecext3 = extractelement <8 x float> %b, i32 1
637 %add4 = fadd float %vecext2, %vecext3
638 %vecext5 = extractelement <8 x float> %a, i32 2
639 %vecext6 = extractelement <8 x float> %b, i32 2
640 %add7 = fadd float %vecext5, %vecext6
641 %vecext8 = extractelement <8 x float> %a, i32 3
642 %vecext9 = extractelement <8 x float> %b, i32 3
643 %add10 = fadd float %vecext8, %vecext9
644 %vecext11 = extractelement <8 x float> %a, i32 4
645 %vecext12 = extractelement <8 x float> %b, i32 4
646 %add13 = fadd float %vecext11, %vecext12
647 %vecext14 = extractelement <8 x float> %a, i32 5
648 %vecext15 = extractelement <8 x float> %b, i32 5
649 %add16 = fadd float %vecext14, %vecext15
650 %vecext17 = extractelement <8 x float> %a, i32 6
651 %vecext18 = extractelement <8 x float> %b, i32 6
652 %add19 = fadd float %vecext17, %vecext18
653 %vecext20 = extractelement <8 x float> %a, i32 7
654 %vecext21 = extractelement <8 x float> %b, i32 7
655 %add22 = fadd float %vecext20, %vecext21
656 %vecinit.i = insertelement <8 x float> undef, float %add, i32 0
657 %vecinit1.i = insertelement <8 x float> %vecinit.i, float %add4, i32 1
658 %vecinit2.i = insertelement <8 x float> %vecinit1.i, float %add7, i32 2
659 %vecinit3.i = insertelement <8 x float> %vecinit2.i, float %add10, i32 3
660 %vecinit4.i = insertelement <8 x float> %vecinit3.i, float %add13, i32 4
661 %vecinit5.i = insertelement <8 x float> %vecinit4.i, float %add16, i32 5
662 %vecinit6.i = insertelement <8 x float> %vecinit5.i, float %add19, i32 6
663 %vecinit7.i = insertelement <8 x float> %vecinit6.i, float %add22, i32 7
664 ret <8 x float> %vecinit7.i
667 attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }