1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ssse3 | FileCheck %s --check-prefixes=SSE3,SSE3-SLOW
3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ssse3,fast-hops | FileCheck %s --check-prefixes=SSE3,SSE3-FAST
4 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX,AVX-SLOW,AVX1-SLOW
5 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx,fast-hops | FileCheck %s --check-prefixes=AVX,AVX-FAST,AVX1-FAST
6 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX-SLOW,AVX2-SLOW
7 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx2,fast-hops | FileCheck %s --check-prefixes=AVX,AVX-FAST,AVX2-FAST
8 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512vl | FileCheck %s --check-prefixes=AVX,AVX-SLOW,AVX512-SLOW
9 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512vl,fast-hops | FileCheck %s --check-prefixes=AVX,AVX-FAST,AVX512-FAST
11 ; 128-bit vectors, 16/32-bit, add/sub
13 define i32 @extract_extract01_v4i32_add_i32(<4 x i32> %x) {
14 ; SSE3-SLOW-LABEL: extract_extract01_v4i32_add_i32:
16 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
17 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
18 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
19 ; SSE3-SLOW-NEXT: addl %ecx, %eax
20 ; SSE3-SLOW-NEXT: retq
22 ; SSE3-FAST-LABEL: extract_extract01_v4i32_add_i32:
24 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
25 ; SSE3-FAST-NEXT: movd %xmm0, %eax
26 ; SSE3-FAST-NEXT: retq
28 ; AVX-SLOW-LABEL: extract_extract01_v4i32_add_i32:
30 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
31 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %eax
32 ; AVX-SLOW-NEXT: addl %ecx, %eax
35 ; AVX-FAST-LABEL: extract_extract01_v4i32_add_i32:
37 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
38 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
40 %x0 = extractelement <4 x i32> %x, i32 0
41 %x1 = extractelement <4 x i32> %x, i32 1
42 %x01 = add i32 %x0, %x1
46 define i32 @extract_extract23_v4i32_add_i32(<4 x i32> %x) {
47 ; SSE3-SLOW-LABEL: extract_extract23_v4i32_add_i32:
49 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
50 ; SSE3-SLOW-NEXT: movd %xmm1, %ecx
51 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
52 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
53 ; SSE3-SLOW-NEXT: addl %ecx, %eax
54 ; SSE3-SLOW-NEXT: retq
56 ; SSE3-FAST-LABEL: extract_extract23_v4i32_add_i32:
58 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
59 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
60 ; SSE3-FAST-NEXT: movd %xmm0, %eax
61 ; SSE3-FAST-NEXT: retq
63 ; AVX-SLOW-LABEL: extract_extract23_v4i32_add_i32:
65 ; AVX-SLOW-NEXT: vextractps $2, %xmm0, %ecx
66 ; AVX-SLOW-NEXT: vextractps $3, %xmm0, %eax
67 ; AVX-SLOW-NEXT: addl %ecx, %eax
70 ; AVX-FAST-LABEL: extract_extract23_v4i32_add_i32:
72 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
73 ; AVX-FAST-NEXT: vpextrd $1, %xmm0, %eax
75 %x0 = extractelement <4 x i32> %x, i32 2
76 %x1 = extractelement <4 x i32> %x, i32 3
77 %x01 = add i32 %x0, %x1
81 define i32 @extract_extract01_v4i32_add_i32_commute(<4 x i32> %x) {
82 ; SSE3-SLOW-LABEL: extract_extract01_v4i32_add_i32_commute:
84 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
85 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
86 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
87 ; SSE3-SLOW-NEXT: addl %ecx, %eax
88 ; SSE3-SLOW-NEXT: retq
90 ; SSE3-FAST-LABEL: extract_extract01_v4i32_add_i32_commute:
92 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
93 ; SSE3-FAST-NEXT: movd %xmm0, %eax
94 ; SSE3-FAST-NEXT: retq
96 ; AVX-SLOW-LABEL: extract_extract01_v4i32_add_i32_commute:
98 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
99 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %eax
100 ; AVX-SLOW-NEXT: addl %ecx, %eax
101 ; AVX-SLOW-NEXT: retq
103 ; AVX-FAST-LABEL: extract_extract01_v4i32_add_i32_commute:
105 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
106 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
107 ; AVX-FAST-NEXT: retq
108 %x0 = extractelement <4 x i32> %x, i32 0
109 %x1 = extractelement <4 x i32> %x, i32 1
110 %x01 = add i32 %x1, %x0
114 define i32 @extract_extract23_v4i32_add_i32_commute(<4 x i32> %x) {
115 ; SSE3-SLOW-LABEL: extract_extract23_v4i32_add_i32_commute:
116 ; SSE3-SLOW: # %bb.0:
117 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
118 ; SSE3-SLOW-NEXT: movd %xmm1, %ecx
119 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
120 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
121 ; SSE3-SLOW-NEXT: addl %ecx, %eax
122 ; SSE3-SLOW-NEXT: retq
124 ; SSE3-FAST-LABEL: extract_extract23_v4i32_add_i32_commute:
125 ; SSE3-FAST: # %bb.0:
126 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
127 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
128 ; SSE3-FAST-NEXT: movd %xmm0, %eax
129 ; SSE3-FAST-NEXT: retq
131 ; AVX-SLOW-LABEL: extract_extract23_v4i32_add_i32_commute:
133 ; AVX-SLOW-NEXT: vextractps $2, %xmm0, %ecx
134 ; AVX-SLOW-NEXT: vextractps $3, %xmm0, %eax
135 ; AVX-SLOW-NEXT: addl %ecx, %eax
136 ; AVX-SLOW-NEXT: retq
138 ; AVX-FAST-LABEL: extract_extract23_v4i32_add_i32_commute:
140 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
141 ; AVX-FAST-NEXT: vpextrd $1, %xmm0, %eax
142 ; AVX-FAST-NEXT: retq
143 %x0 = extractelement <4 x i32> %x, i32 2
144 %x1 = extractelement <4 x i32> %x, i32 3
145 %x01 = add i32 %x1, %x0
149 define i16 @extract_extract01_v8i16_add_i16(<8 x i16> %x) {
150 ; SSE3-SLOW-LABEL: extract_extract01_v8i16_add_i16:
151 ; SSE3-SLOW: # %bb.0:
152 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
153 ; SSE3-SLOW-NEXT: pextrw $1, %xmm0, %eax
154 ; SSE3-SLOW-NEXT: addl %ecx, %eax
155 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
156 ; SSE3-SLOW-NEXT: retq
158 ; SSE3-FAST-LABEL: extract_extract01_v8i16_add_i16:
159 ; SSE3-FAST: # %bb.0:
160 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
161 ; SSE3-FAST-NEXT: movd %xmm0, %eax
162 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
163 ; SSE3-FAST-NEXT: retq
165 ; AVX-SLOW-LABEL: extract_extract01_v8i16_add_i16:
167 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
168 ; AVX-SLOW-NEXT: vpextrw $1, %xmm0, %eax
169 ; AVX-SLOW-NEXT: addl %ecx, %eax
170 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
171 ; AVX-SLOW-NEXT: retq
173 ; AVX-FAST-LABEL: extract_extract01_v8i16_add_i16:
175 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
176 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
177 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
178 ; AVX-FAST-NEXT: retq
179 %x0 = extractelement <8 x i16> %x, i32 0
180 %x1 = extractelement <8 x i16> %x, i32 1
181 %x01 = add i16 %x0, %x1
185 define i16 @extract_extract45_v8i16_add_i16(<8 x i16> %x) {
186 ; SSE3-SLOW-LABEL: extract_extract45_v8i16_add_i16:
187 ; SSE3-SLOW: # %bb.0:
188 ; SSE3-SLOW-NEXT: pextrw $4, %xmm0, %ecx
189 ; SSE3-SLOW-NEXT: pextrw $5, %xmm0, %eax
190 ; SSE3-SLOW-NEXT: addl %ecx, %eax
191 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
192 ; SSE3-SLOW-NEXT: retq
194 ; SSE3-FAST-LABEL: extract_extract45_v8i16_add_i16:
195 ; SSE3-FAST: # %bb.0:
196 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
197 ; SSE3-FAST-NEXT: pextrw $2, %xmm0, %eax
198 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
199 ; SSE3-FAST-NEXT: retq
201 ; AVX-SLOW-LABEL: extract_extract45_v8i16_add_i16:
203 ; AVX-SLOW-NEXT: vpextrw $4, %xmm0, %ecx
204 ; AVX-SLOW-NEXT: vpextrw $5, %xmm0, %eax
205 ; AVX-SLOW-NEXT: addl %ecx, %eax
206 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
207 ; AVX-SLOW-NEXT: retq
209 ; AVX-FAST-LABEL: extract_extract45_v8i16_add_i16:
211 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
212 ; AVX-FAST-NEXT: vpextrw $2, %xmm0, %eax
213 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
214 ; AVX-FAST-NEXT: retq
215 %x0 = extractelement <8 x i16> %x, i32 4
216 %x1 = extractelement <8 x i16> %x, i32 5
217 %x01 = add i16 %x0, %x1
221 define i16 @extract_extract01_v8i16_add_i16_commute(<8 x i16> %x) {
222 ; SSE3-SLOW-LABEL: extract_extract01_v8i16_add_i16_commute:
223 ; SSE3-SLOW: # %bb.0:
224 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
225 ; SSE3-SLOW-NEXT: pextrw $1, %xmm0, %eax
226 ; SSE3-SLOW-NEXT: addl %ecx, %eax
227 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
228 ; SSE3-SLOW-NEXT: retq
230 ; SSE3-FAST-LABEL: extract_extract01_v8i16_add_i16_commute:
231 ; SSE3-FAST: # %bb.0:
232 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
233 ; SSE3-FAST-NEXT: movd %xmm0, %eax
234 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
235 ; SSE3-FAST-NEXT: retq
237 ; AVX-SLOW-LABEL: extract_extract01_v8i16_add_i16_commute:
239 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
240 ; AVX-SLOW-NEXT: vpextrw $1, %xmm0, %eax
241 ; AVX-SLOW-NEXT: addl %ecx, %eax
242 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
243 ; AVX-SLOW-NEXT: retq
245 ; AVX-FAST-LABEL: extract_extract01_v8i16_add_i16_commute:
247 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
248 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
249 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
250 ; AVX-FAST-NEXT: retq
251 %x0 = extractelement <8 x i16> %x, i32 0
252 %x1 = extractelement <8 x i16> %x, i32 1
253 %x01 = add i16 %x1, %x0
257 define i16 @extract_extract45_v8i16_add_i16_commute(<8 x i16> %x) {
258 ; SSE3-SLOW-LABEL: extract_extract45_v8i16_add_i16_commute:
259 ; SSE3-SLOW: # %bb.0:
260 ; SSE3-SLOW-NEXT: pextrw $4, %xmm0, %ecx
261 ; SSE3-SLOW-NEXT: pextrw $5, %xmm0, %eax
262 ; SSE3-SLOW-NEXT: addl %ecx, %eax
263 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
264 ; SSE3-SLOW-NEXT: retq
266 ; SSE3-FAST-LABEL: extract_extract45_v8i16_add_i16_commute:
267 ; SSE3-FAST: # %bb.0:
268 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
269 ; SSE3-FAST-NEXT: pextrw $2, %xmm0, %eax
270 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
271 ; SSE3-FAST-NEXT: retq
273 ; AVX-SLOW-LABEL: extract_extract45_v8i16_add_i16_commute:
275 ; AVX-SLOW-NEXT: vpextrw $4, %xmm0, %ecx
276 ; AVX-SLOW-NEXT: vpextrw $5, %xmm0, %eax
277 ; AVX-SLOW-NEXT: addl %ecx, %eax
278 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
279 ; AVX-SLOW-NEXT: retq
281 ; AVX-FAST-LABEL: extract_extract45_v8i16_add_i16_commute:
283 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
284 ; AVX-FAST-NEXT: vpextrw $2, %xmm0, %eax
285 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
286 ; AVX-FAST-NEXT: retq
287 %x0 = extractelement <8 x i16> %x, i32 4
288 %x1 = extractelement <8 x i16> %x, i32 5
289 %x01 = add i16 %x1, %x0
293 define i32 @extract_extract01_v4i32_sub_i32(<4 x i32> %x) {
294 ; SSE3-SLOW-LABEL: extract_extract01_v4i32_sub_i32:
295 ; SSE3-SLOW: # %bb.0:
296 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
297 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
298 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
299 ; SSE3-SLOW-NEXT: subl %ecx, %eax
300 ; SSE3-SLOW-NEXT: retq
302 ; SSE3-FAST-LABEL: extract_extract01_v4i32_sub_i32:
303 ; SSE3-FAST: # %bb.0:
304 ; SSE3-FAST-NEXT: phsubd %xmm0, %xmm0
305 ; SSE3-FAST-NEXT: movd %xmm0, %eax
306 ; SSE3-FAST-NEXT: retq
308 ; AVX-SLOW-LABEL: extract_extract01_v4i32_sub_i32:
310 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
311 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %ecx
312 ; AVX-SLOW-NEXT: subl %ecx, %eax
313 ; AVX-SLOW-NEXT: retq
315 ; AVX-FAST-LABEL: extract_extract01_v4i32_sub_i32:
317 ; AVX-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
318 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
319 ; AVX-FAST-NEXT: retq
320 %x0 = extractelement <4 x i32> %x, i32 0
321 %x1 = extractelement <4 x i32> %x, i32 1
322 %x01 = sub i32 %x0, %x1
326 define i32 @extract_extract23_v4i32_sub_i32(<4 x i32> %x) {
327 ; SSE3-SLOW-LABEL: extract_extract23_v4i32_sub_i32:
328 ; SSE3-SLOW: # %bb.0:
329 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
330 ; SSE3-SLOW-NEXT: movd %xmm1, %eax
331 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
332 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
333 ; SSE3-SLOW-NEXT: subl %ecx, %eax
334 ; SSE3-SLOW-NEXT: retq
336 ; SSE3-FAST-LABEL: extract_extract23_v4i32_sub_i32:
337 ; SSE3-FAST: # %bb.0:
338 ; SSE3-FAST-NEXT: phsubd %xmm0, %xmm0
339 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
340 ; SSE3-FAST-NEXT: movd %xmm0, %eax
341 ; SSE3-FAST-NEXT: retq
343 ; AVX-SLOW-LABEL: extract_extract23_v4i32_sub_i32:
345 ; AVX-SLOW-NEXT: vextractps $2, %xmm0, %eax
346 ; AVX-SLOW-NEXT: vextractps $3, %xmm0, %ecx
347 ; AVX-SLOW-NEXT: subl %ecx, %eax
348 ; AVX-SLOW-NEXT: retq
350 ; AVX-FAST-LABEL: extract_extract23_v4i32_sub_i32:
352 ; AVX-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
353 ; AVX-FAST-NEXT: vpextrd $1, %xmm0, %eax
354 ; AVX-FAST-NEXT: retq
355 %x0 = extractelement <4 x i32> %x, i32 2
356 %x1 = extractelement <4 x i32> %x, i32 3
357 %x01 = sub i32 %x0, %x1
361 define i32 @extract_extract01_v4i32_sub_i32_commute(<4 x i32> %x) {
362 ; SSE3-LABEL: extract_extract01_v4i32_sub_i32_commute:
364 ; SSE3-NEXT: movd %xmm0, %ecx
365 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
366 ; SSE3-NEXT: movd %xmm0, %eax
367 ; SSE3-NEXT: subl %ecx, %eax
370 ; AVX-LABEL: extract_extract01_v4i32_sub_i32_commute:
372 ; AVX-NEXT: vmovd %xmm0, %ecx
373 ; AVX-NEXT: vpextrd $1, %xmm0, %eax
374 ; AVX-NEXT: subl %ecx, %eax
376 %x0 = extractelement <4 x i32> %x, i32 0
377 %x1 = extractelement <4 x i32> %x, i32 1
378 %x01 = sub i32 %x1, %x0
382 define i32 @extract_extract23_v4i32_sub_i32_commute(<4 x i32> %x) {
383 ; SSE3-LABEL: extract_extract23_v4i32_sub_i32_commute:
385 ; SSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
386 ; SSE3-NEXT: movd %xmm1, %ecx
387 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
388 ; SSE3-NEXT: movd %xmm0, %eax
389 ; SSE3-NEXT: subl %ecx, %eax
392 ; AVX-LABEL: extract_extract23_v4i32_sub_i32_commute:
394 ; AVX-NEXT: vextractps $2, %xmm0, %ecx
395 ; AVX-NEXT: vextractps $3, %xmm0, %eax
396 ; AVX-NEXT: subl %ecx, %eax
398 %x0 = extractelement <4 x i32> %x, i32 2
399 %x1 = extractelement <4 x i32> %x, i32 3
400 %x01 = sub i32 %x1, %x0
404 define i16 @extract_extract01_v8i16_sub_i16(<8 x i16> %x) {
405 ; SSE3-SLOW-LABEL: extract_extract01_v8i16_sub_i16:
406 ; SSE3-SLOW: # %bb.0:
407 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
408 ; SSE3-SLOW-NEXT: pextrw $1, %xmm0, %ecx
409 ; SSE3-SLOW-NEXT: subl %ecx, %eax
410 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
411 ; SSE3-SLOW-NEXT: retq
413 ; SSE3-FAST-LABEL: extract_extract01_v8i16_sub_i16:
414 ; SSE3-FAST: # %bb.0:
415 ; SSE3-FAST-NEXT: phsubw %xmm0, %xmm0
416 ; SSE3-FAST-NEXT: movd %xmm0, %eax
417 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
418 ; SSE3-FAST-NEXT: retq
420 ; AVX-SLOW-LABEL: extract_extract01_v8i16_sub_i16:
422 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
423 ; AVX-SLOW-NEXT: vpextrw $1, %xmm0, %ecx
424 ; AVX-SLOW-NEXT: subl %ecx, %eax
425 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
426 ; AVX-SLOW-NEXT: retq
428 ; AVX-FAST-LABEL: extract_extract01_v8i16_sub_i16:
430 ; AVX-FAST-NEXT: vphsubw %xmm0, %xmm0, %xmm0
431 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
432 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
433 ; AVX-FAST-NEXT: retq
434 %x0 = extractelement <8 x i16> %x, i32 0
435 %x1 = extractelement <8 x i16> %x, i32 1
436 %x01 = sub i16 %x0, %x1
440 define i16 @extract_extract23_v8i16_sub_i16(<8 x i16> %x) {
441 ; SSE3-SLOW-LABEL: extract_extract23_v8i16_sub_i16:
442 ; SSE3-SLOW: # %bb.0:
443 ; SSE3-SLOW-NEXT: pextrw $2, %xmm0, %eax
444 ; SSE3-SLOW-NEXT: pextrw $3, %xmm0, %ecx
445 ; SSE3-SLOW-NEXT: subl %ecx, %eax
446 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
447 ; SSE3-SLOW-NEXT: retq
449 ; SSE3-FAST-LABEL: extract_extract23_v8i16_sub_i16:
450 ; SSE3-FAST: # %bb.0:
451 ; SSE3-FAST-NEXT: phsubw %xmm0, %xmm0
452 ; SSE3-FAST-NEXT: pextrw $1, %xmm0, %eax
453 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
454 ; SSE3-FAST-NEXT: retq
456 ; AVX-SLOW-LABEL: extract_extract23_v8i16_sub_i16:
458 ; AVX-SLOW-NEXT: vpextrw $2, %xmm0, %eax
459 ; AVX-SLOW-NEXT: vpextrw $3, %xmm0, %ecx
460 ; AVX-SLOW-NEXT: subl %ecx, %eax
461 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
462 ; AVX-SLOW-NEXT: retq
464 ; AVX-FAST-LABEL: extract_extract23_v8i16_sub_i16:
466 ; AVX-FAST-NEXT: vphsubw %xmm0, %xmm0, %xmm0
467 ; AVX-FAST-NEXT: vpextrw $1, %xmm0, %eax
468 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
469 ; AVX-FAST-NEXT: retq
470 %x0 = extractelement <8 x i16> %x, i32 2
471 %x1 = extractelement <8 x i16> %x, i32 3
472 %x01 = sub i16 %x0, %x1
476 define i16 @extract_extract01_v8i16_sub_i16_commute(<8 x i16> %x) {
477 ; SSE3-LABEL: extract_extract01_v8i16_sub_i16_commute:
479 ; SSE3-NEXT: movd %xmm0, %ecx
480 ; SSE3-NEXT: pextrw $1, %xmm0, %eax
481 ; SSE3-NEXT: subl %ecx, %eax
482 ; SSE3-NEXT: # kill: def $ax killed $ax killed $eax
485 ; AVX-LABEL: extract_extract01_v8i16_sub_i16_commute:
487 ; AVX-NEXT: vmovd %xmm0, %ecx
488 ; AVX-NEXT: vpextrw $1, %xmm0, %eax
489 ; AVX-NEXT: subl %ecx, %eax
490 ; AVX-NEXT: # kill: def $ax killed $ax killed $eax
492 %x0 = extractelement <8 x i16> %x, i32 0
493 %x1 = extractelement <8 x i16> %x, i32 1
494 %x01 = sub i16 %x1, %x0
498 define i16 @extract_extract23_v8i16_sub_i16_commute(<8 x i16> %x) {
499 ; SSE3-LABEL: extract_extract23_v8i16_sub_i16_commute:
501 ; SSE3-NEXT: pextrw $2, %xmm0, %ecx
502 ; SSE3-NEXT: pextrw $3, %xmm0, %eax
503 ; SSE3-NEXT: subl %ecx, %eax
504 ; SSE3-NEXT: # kill: def $ax killed $ax killed $eax
507 ; AVX-LABEL: extract_extract23_v8i16_sub_i16_commute:
509 ; AVX-NEXT: vpextrw $2, %xmm0, %ecx
510 ; AVX-NEXT: vpextrw $3, %xmm0, %eax
511 ; AVX-NEXT: subl %ecx, %eax
512 ; AVX-NEXT: # kill: def $ax killed $ax killed $eax
514 %x0 = extractelement <8 x i16> %x, i32 2
515 %x1 = extractelement <8 x i16> %x, i32 3
516 %x01 = sub i16 %x1, %x0
520 ; 256-bit vectors, i32/i16, add/sub
522 define i32 @extract_extract01_v8i32_add_i32(<8 x i32> %x) {
523 ; SSE3-SLOW-LABEL: extract_extract01_v8i32_add_i32:
524 ; SSE3-SLOW: # %bb.0:
525 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
526 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
527 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
528 ; SSE3-SLOW-NEXT: addl %ecx, %eax
529 ; SSE3-SLOW-NEXT: retq
531 ; SSE3-FAST-LABEL: extract_extract01_v8i32_add_i32:
532 ; SSE3-FAST: # %bb.0:
533 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
534 ; SSE3-FAST-NEXT: movd %xmm0, %eax
535 ; SSE3-FAST-NEXT: retq
537 ; AVX-SLOW-LABEL: extract_extract01_v8i32_add_i32:
539 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
540 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %eax
541 ; AVX-SLOW-NEXT: addl %ecx, %eax
542 ; AVX-SLOW-NEXT: vzeroupper
543 ; AVX-SLOW-NEXT: retq
545 ; AVX-FAST-LABEL: extract_extract01_v8i32_add_i32:
547 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
548 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
549 ; AVX-FAST-NEXT: vzeroupper
550 ; AVX-FAST-NEXT: retq
551 %x0 = extractelement <8 x i32> %x, i32 0
552 %x1 = extractelement <8 x i32> %x, i32 1
553 %x01 = add i32 %x0, %x1
557 define i32 @extract_extract23_v8i32_add_i32(<8 x i32> %x) {
558 ; SSE3-SLOW-LABEL: extract_extract23_v8i32_add_i32:
559 ; SSE3-SLOW: # %bb.0:
560 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
561 ; SSE3-SLOW-NEXT: movd %xmm1, %ecx
562 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
563 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
564 ; SSE3-SLOW-NEXT: addl %ecx, %eax
565 ; SSE3-SLOW-NEXT: retq
567 ; SSE3-FAST-LABEL: extract_extract23_v8i32_add_i32:
568 ; SSE3-FAST: # %bb.0:
569 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
570 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
571 ; SSE3-FAST-NEXT: movd %xmm0, %eax
572 ; SSE3-FAST-NEXT: retq
574 ; AVX-SLOW-LABEL: extract_extract23_v8i32_add_i32:
576 ; AVX-SLOW-NEXT: vextractps $2, %xmm0, %ecx
577 ; AVX-SLOW-NEXT: vextractps $3, %xmm0, %eax
578 ; AVX-SLOW-NEXT: addl %ecx, %eax
579 ; AVX-SLOW-NEXT: vzeroupper
580 ; AVX-SLOW-NEXT: retq
582 ; AVX-FAST-LABEL: extract_extract23_v8i32_add_i32:
584 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
585 ; AVX-FAST-NEXT: vpextrd $1, %xmm0, %eax
586 ; AVX-FAST-NEXT: vzeroupper
587 ; AVX-FAST-NEXT: retq
588 %x0 = extractelement <8 x i32> %x, i32 2
589 %x1 = extractelement <8 x i32> %x, i32 3
590 %x01 = add i32 %x0, %x1
594 define i32 @extract_extract67_v8i32_add_i32(<8 x i32> %x) {
595 ; SSE3-SLOW-LABEL: extract_extract67_v8i32_add_i32:
596 ; SSE3-SLOW: # %bb.0:
597 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1]
598 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
599 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[3,1,2,3]
600 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
601 ; SSE3-SLOW-NEXT: addl %ecx, %eax
602 ; SSE3-SLOW-NEXT: retq
604 ; SSE3-FAST-LABEL: extract_extract67_v8i32_add_i32:
605 ; SSE3-FAST: # %bb.0:
606 ; SSE3-FAST-NEXT: phaddd %xmm1, %xmm1
607 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
608 ; SSE3-FAST-NEXT: movd %xmm0, %eax
609 ; SSE3-FAST-NEXT: retq
611 ; AVX-SLOW-LABEL: extract_extract67_v8i32_add_i32:
613 ; AVX-SLOW-NEXT: vextractf128 $1, %ymm0, %xmm0
614 ; AVX-SLOW-NEXT: vextractps $2, %xmm0, %ecx
615 ; AVX-SLOW-NEXT: vextractps $3, %xmm0, %eax
616 ; AVX-SLOW-NEXT: addl %ecx, %eax
617 ; AVX-SLOW-NEXT: vzeroupper
618 ; AVX-SLOW-NEXT: retq
620 ; AVX1-FAST-LABEL: extract_extract67_v8i32_add_i32:
621 ; AVX1-FAST: # %bb.0:
622 ; AVX1-FAST-NEXT: vextractf128 $1, %ymm0, %xmm0
623 ; AVX1-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
624 ; AVX1-FAST-NEXT: vpextrd $1, %xmm0, %eax
625 ; AVX1-FAST-NEXT: vzeroupper
626 ; AVX1-FAST-NEXT: retq
628 ; AVX2-FAST-LABEL: extract_extract67_v8i32_add_i32:
629 ; AVX2-FAST: # %bb.0:
630 ; AVX2-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
631 ; AVX2-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
632 ; AVX2-FAST-NEXT: vpextrd $1, %xmm0, %eax
633 ; AVX2-FAST-NEXT: vzeroupper
634 ; AVX2-FAST-NEXT: retq
636 ; AVX512-FAST-LABEL: extract_extract67_v8i32_add_i32:
637 ; AVX512-FAST: # %bb.0:
638 ; AVX512-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
639 ; AVX512-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
640 ; AVX512-FAST-NEXT: vpextrd $1, %xmm0, %eax
641 ; AVX512-FAST-NEXT: vzeroupper
642 ; AVX512-FAST-NEXT: retq
643 %x0 = extractelement <8 x i32> %x, i32 6
644 %x1 = extractelement <8 x i32> %x, i32 7
645 %x01 = add i32 %x0, %x1
649 define i32 @extract_extract01_v8i32_add_i32_commute(<8 x i32> %x) {
650 ; SSE3-SLOW-LABEL: extract_extract01_v8i32_add_i32_commute:
651 ; SSE3-SLOW: # %bb.0:
652 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
653 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
654 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
655 ; SSE3-SLOW-NEXT: addl %ecx, %eax
656 ; SSE3-SLOW-NEXT: retq
658 ; SSE3-FAST-LABEL: extract_extract01_v8i32_add_i32_commute:
659 ; SSE3-FAST: # %bb.0:
660 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
661 ; SSE3-FAST-NEXT: movd %xmm0, %eax
662 ; SSE3-FAST-NEXT: retq
664 ; AVX-SLOW-LABEL: extract_extract01_v8i32_add_i32_commute:
666 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
667 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %eax
668 ; AVX-SLOW-NEXT: addl %ecx, %eax
669 ; AVX-SLOW-NEXT: vzeroupper
670 ; AVX-SLOW-NEXT: retq
672 ; AVX-FAST-LABEL: extract_extract01_v8i32_add_i32_commute:
674 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
675 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
676 ; AVX-FAST-NEXT: vzeroupper
677 ; AVX-FAST-NEXT: retq
678 %x0 = extractelement <8 x i32> %x, i32 0
679 %x1 = extractelement <8 x i32> %x, i32 1
680 %x01 = add i32 %x1, %x0
684 define i32 @extract_extract23_v8i32_add_i32_commute(<8 x i32> %x) {
685 ; SSE3-SLOW-LABEL: extract_extract23_v8i32_add_i32_commute:
686 ; SSE3-SLOW: # %bb.0:
687 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
688 ; SSE3-SLOW-NEXT: movd %xmm1, %ecx
689 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
690 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
691 ; SSE3-SLOW-NEXT: addl %ecx, %eax
692 ; SSE3-SLOW-NEXT: retq
694 ; SSE3-FAST-LABEL: extract_extract23_v8i32_add_i32_commute:
695 ; SSE3-FAST: # %bb.0:
696 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
697 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
698 ; SSE3-FAST-NEXT: movd %xmm0, %eax
699 ; SSE3-FAST-NEXT: retq
701 ; AVX-SLOW-LABEL: extract_extract23_v8i32_add_i32_commute:
703 ; AVX-SLOW-NEXT: vextractps $2, %xmm0, %ecx
704 ; AVX-SLOW-NEXT: vextractps $3, %xmm0, %eax
705 ; AVX-SLOW-NEXT: addl %ecx, %eax
706 ; AVX-SLOW-NEXT: vzeroupper
707 ; AVX-SLOW-NEXT: retq
709 ; AVX-FAST-LABEL: extract_extract23_v8i32_add_i32_commute:
711 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
712 ; AVX-FAST-NEXT: vpextrd $1, %xmm0, %eax
713 ; AVX-FAST-NEXT: vzeroupper
714 ; AVX-FAST-NEXT: retq
715 %x0 = extractelement <8 x i32> %x, i32 2
716 %x1 = extractelement <8 x i32> %x, i32 3
717 %x01 = add i32 %x1, %x0
721 define i32 @extract_extract67_v8i32_add_i32_commute(<8 x i32> %x) {
722 ; SSE3-SLOW-LABEL: extract_extract67_v8i32_add_i32_commute:
723 ; SSE3-SLOW: # %bb.0:
724 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1]
725 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
726 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[3,1,2,3]
727 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
728 ; SSE3-SLOW-NEXT: addl %ecx, %eax
729 ; SSE3-SLOW-NEXT: retq
731 ; SSE3-FAST-LABEL: extract_extract67_v8i32_add_i32_commute:
732 ; SSE3-FAST: # %bb.0:
733 ; SSE3-FAST-NEXT: phaddd %xmm1, %xmm1
734 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
735 ; SSE3-FAST-NEXT: movd %xmm0, %eax
736 ; SSE3-FAST-NEXT: retq
738 ; AVX-SLOW-LABEL: extract_extract67_v8i32_add_i32_commute:
740 ; AVX-SLOW-NEXT: vextractf128 $1, %ymm0, %xmm0
741 ; AVX-SLOW-NEXT: vextractps $2, %xmm0, %ecx
742 ; AVX-SLOW-NEXT: vextractps $3, %xmm0, %eax
743 ; AVX-SLOW-NEXT: addl %ecx, %eax
744 ; AVX-SLOW-NEXT: vzeroupper
745 ; AVX-SLOW-NEXT: retq
747 ; AVX1-FAST-LABEL: extract_extract67_v8i32_add_i32_commute:
748 ; AVX1-FAST: # %bb.0:
749 ; AVX1-FAST-NEXT: vextractf128 $1, %ymm0, %xmm0
750 ; AVX1-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
751 ; AVX1-FAST-NEXT: vpextrd $1, %xmm0, %eax
752 ; AVX1-FAST-NEXT: vzeroupper
753 ; AVX1-FAST-NEXT: retq
755 ; AVX2-FAST-LABEL: extract_extract67_v8i32_add_i32_commute:
756 ; AVX2-FAST: # %bb.0:
757 ; AVX2-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
758 ; AVX2-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
759 ; AVX2-FAST-NEXT: vpextrd $1, %xmm0, %eax
760 ; AVX2-FAST-NEXT: vzeroupper
761 ; AVX2-FAST-NEXT: retq
763 ; AVX512-FAST-LABEL: extract_extract67_v8i32_add_i32_commute:
764 ; AVX512-FAST: # %bb.0:
765 ; AVX512-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
766 ; AVX512-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
767 ; AVX512-FAST-NEXT: vpextrd $1, %xmm0, %eax
768 ; AVX512-FAST-NEXT: vzeroupper
769 ; AVX512-FAST-NEXT: retq
770 %x0 = extractelement <8 x i32> %x, i32 6
771 %x1 = extractelement <8 x i32> %x, i32 7
772 %x01 = add i32 %x1, %x0
776 define i16 @extract_extract01_v16i16_add_i16(<16 x i16> %x) {
777 ; SSE3-SLOW-LABEL: extract_extract01_v16i16_add_i16:
778 ; SSE3-SLOW: # %bb.0:
779 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
780 ; SSE3-SLOW-NEXT: pextrw $1, %xmm0, %eax
781 ; SSE3-SLOW-NEXT: addl %ecx, %eax
782 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
783 ; SSE3-SLOW-NEXT: retq
785 ; SSE3-FAST-LABEL: extract_extract01_v16i16_add_i16:
786 ; SSE3-FAST: # %bb.0:
787 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
788 ; SSE3-FAST-NEXT: movd %xmm0, %eax
789 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
790 ; SSE3-FAST-NEXT: retq
792 ; AVX-SLOW-LABEL: extract_extract01_v16i16_add_i16:
794 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
795 ; AVX-SLOW-NEXT: vpextrw $1, %xmm0, %eax
796 ; AVX-SLOW-NEXT: addl %ecx, %eax
797 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
798 ; AVX-SLOW-NEXT: vzeroupper
799 ; AVX-SLOW-NEXT: retq
801 ; AVX-FAST-LABEL: extract_extract01_v16i16_add_i16:
803 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
804 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
805 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
806 ; AVX-FAST-NEXT: vzeroupper
807 ; AVX-FAST-NEXT: retq
808 %x0 = extractelement <16 x i16> %x, i32 0
809 %x1 = extractelement <16 x i16> %x, i32 1
810 %x01 = add i16 %x0, %x1
814 define i16 @extract_extract23_v16i16_add_i16(<16 x i16> %x) {
815 ; SSE3-SLOW-LABEL: extract_extract23_v16i16_add_i16:
816 ; SSE3-SLOW: # %bb.0:
817 ; SSE3-SLOW-NEXT: pextrw $2, %xmm0, %ecx
818 ; SSE3-SLOW-NEXT: pextrw $3, %xmm0, %eax
819 ; SSE3-SLOW-NEXT: addl %ecx, %eax
820 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
821 ; SSE3-SLOW-NEXT: retq
823 ; SSE3-FAST-LABEL: extract_extract23_v16i16_add_i16:
824 ; SSE3-FAST: # %bb.0:
825 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
826 ; SSE3-FAST-NEXT: pextrw $1, %xmm0, %eax
827 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
828 ; SSE3-FAST-NEXT: retq
830 ; AVX-SLOW-LABEL: extract_extract23_v16i16_add_i16:
832 ; AVX-SLOW-NEXT: vpextrw $2, %xmm0, %ecx
833 ; AVX-SLOW-NEXT: vpextrw $3, %xmm0, %eax
834 ; AVX-SLOW-NEXT: addl %ecx, %eax
835 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
836 ; AVX-SLOW-NEXT: vzeroupper
837 ; AVX-SLOW-NEXT: retq
839 ; AVX-FAST-LABEL: extract_extract23_v16i16_add_i16:
841 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
842 ; AVX-FAST-NEXT: vpextrw $1, %xmm0, %eax
843 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
844 ; AVX-FAST-NEXT: vzeroupper
845 ; AVX-FAST-NEXT: retq
846 %x0 = extractelement <16 x i16> %x, i32 2
847 %x1 = extractelement <16 x i16> %x, i32 3
848 %x01 = add i16 %x0, %x1
852 define i16 @extract_extract89_v16i16_add_i16(<16 x i16> %x) {
853 ; SSE3-SLOW-LABEL: extract_extract89_v16i16_add_i16:
854 ; SSE3-SLOW: # %bb.0:
855 ; SSE3-SLOW-NEXT: movd %xmm1, %ecx
856 ; SSE3-SLOW-NEXT: pextrw $1, %xmm1, %eax
857 ; SSE3-SLOW-NEXT: addl %ecx, %eax
858 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
859 ; SSE3-SLOW-NEXT: retq
861 ; SSE3-FAST-LABEL: extract_extract89_v16i16_add_i16:
862 ; SSE3-FAST: # %bb.0:
863 ; SSE3-FAST-NEXT: phaddw %xmm1, %xmm1
864 ; SSE3-FAST-NEXT: movd %xmm1, %eax
865 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
866 ; SSE3-FAST-NEXT: retq
868 ; AVX1-SLOW-LABEL: extract_extract89_v16i16_add_i16:
869 ; AVX1-SLOW: # %bb.0:
870 ; AVX1-SLOW-NEXT: vextractf128 $1, %ymm0, %xmm0
871 ; AVX1-SLOW-NEXT: vmovd %xmm0, %ecx
872 ; AVX1-SLOW-NEXT: vpextrw $1, %xmm0, %eax
873 ; AVX1-SLOW-NEXT: addl %ecx, %eax
874 ; AVX1-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
875 ; AVX1-SLOW-NEXT: vzeroupper
876 ; AVX1-SLOW-NEXT: retq
878 ; AVX1-FAST-LABEL: extract_extract89_v16i16_add_i16:
879 ; AVX1-FAST: # %bb.0:
880 ; AVX1-FAST-NEXT: vextractf128 $1, %ymm0, %xmm0
881 ; AVX1-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
882 ; AVX1-FAST-NEXT: vmovd %xmm0, %eax
883 ; AVX1-FAST-NEXT: # kill: def $ax killed $ax killed $eax
884 ; AVX1-FAST-NEXT: vzeroupper
885 ; AVX1-FAST-NEXT: retq
887 ; AVX2-SLOW-LABEL: extract_extract89_v16i16_add_i16:
888 ; AVX2-SLOW: # %bb.0:
889 ; AVX2-SLOW-NEXT: vextracti128 $1, %ymm0, %xmm0
890 ; AVX2-SLOW-NEXT: vmovd %xmm0, %ecx
891 ; AVX2-SLOW-NEXT: vpextrw $1, %xmm0, %eax
892 ; AVX2-SLOW-NEXT: addl %ecx, %eax
893 ; AVX2-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
894 ; AVX2-SLOW-NEXT: vzeroupper
895 ; AVX2-SLOW-NEXT: retq
897 ; AVX2-FAST-LABEL: extract_extract89_v16i16_add_i16:
898 ; AVX2-FAST: # %bb.0:
899 ; AVX2-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
900 ; AVX2-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
901 ; AVX2-FAST-NEXT: vmovd %xmm0, %eax
902 ; AVX2-FAST-NEXT: # kill: def $ax killed $ax killed $eax
903 ; AVX2-FAST-NEXT: vzeroupper
904 ; AVX2-FAST-NEXT: retq
906 ; AVX512-SLOW-LABEL: extract_extract89_v16i16_add_i16:
907 ; AVX512-SLOW: # %bb.0:
908 ; AVX512-SLOW-NEXT: vextracti128 $1, %ymm0, %xmm0
909 ; AVX512-SLOW-NEXT: vmovd %xmm0, %ecx
910 ; AVX512-SLOW-NEXT: vpextrw $1, %xmm0, %eax
911 ; AVX512-SLOW-NEXT: addl %ecx, %eax
912 ; AVX512-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
913 ; AVX512-SLOW-NEXT: vzeroupper
914 ; AVX512-SLOW-NEXT: retq
916 ; AVX512-FAST-LABEL: extract_extract89_v16i16_add_i16:
917 ; AVX512-FAST: # %bb.0:
918 ; AVX512-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
919 ; AVX512-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
920 ; AVX512-FAST-NEXT: vmovd %xmm0, %eax
921 ; AVX512-FAST-NEXT: # kill: def $ax killed $ax killed $eax
922 ; AVX512-FAST-NEXT: vzeroupper
923 ; AVX512-FAST-NEXT: retq
924 %x0 = extractelement <16 x i16> %x, i32 8
925 %x1 = extractelement <16 x i16> %x, i32 9
926 %x01 = add i16 %x0, %x1
930 define i16 @extract_extract01_v16i16_add_i16_commute(<16 x i16> %x) {
931 ; SSE3-SLOW-LABEL: extract_extract01_v16i16_add_i16_commute:
932 ; SSE3-SLOW: # %bb.0:
933 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
934 ; SSE3-SLOW-NEXT: pextrw $1, %xmm0, %eax
935 ; SSE3-SLOW-NEXT: addl %ecx, %eax
936 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
937 ; SSE3-SLOW-NEXT: retq
939 ; SSE3-FAST-LABEL: extract_extract01_v16i16_add_i16_commute:
940 ; SSE3-FAST: # %bb.0:
941 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
942 ; SSE3-FAST-NEXT: movd %xmm0, %eax
943 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
944 ; SSE3-FAST-NEXT: retq
946 ; AVX-SLOW-LABEL: extract_extract01_v16i16_add_i16_commute:
948 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
949 ; AVX-SLOW-NEXT: vpextrw $1, %xmm0, %eax
950 ; AVX-SLOW-NEXT: addl %ecx, %eax
951 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
952 ; AVX-SLOW-NEXT: vzeroupper
953 ; AVX-SLOW-NEXT: retq
955 ; AVX-FAST-LABEL: extract_extract01_v16i16_add_i16_commute:
957 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
958 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
959 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
960 ; AVX-FAST-NEXT: vzeroupper
961 ; AVX-FAST-NEXT: retq
962 %x0 = extractelement <16 x i16> %x, i32 0
963 %x1 = extractelement <16 x i16> %x, i32 1
964 %x01 = add i16 %x1, %x0
968 define i16 @extract_extract45_v16i16_add_i16_commute(<16 x i16> %x) {
969 ; SSE3-SLOW-LABEL: extract_extract45_v16i16_add_i16_commute:
970 ; SSE3-SLOW: # %bb.0:
971 ; SSE3-SLOW-NEXT: pextrw $4, %xmm0, %ecx
972 ; SSE3-SLOW-NEXT: pextrw $5, %xmm0, %eax
973 ; SSE3-SLOW-NEXT: addl %ecx, %eax
974 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
975 ; SSE3-SLOW-NEXT: retq
977 ; SSE3-FAST-LABEL: extract_extract45_v16i16_add_i16_commute:
978 ; SSE3-FAST: # %bb.0:
979 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
980 ; SSE3-FAST-NEXT: pextrw $2, %xmm0, %eax
981 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
982 ; SSE3-FAST-NEXT: retq
984 ; AVX-SLOW-LABEL: extract_extract45_v16i16_add_i16_commute:
986 ; AVX-SLOW-NEXT: vpextrw $4, %xmm0, %ecx
987 ; AVX-SLOW-NEXT: vpextrw $5, %xmm0, %eax
988 ; AVX-SLOW-NEXT: addl %ecx, %eax
989 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
990 ; AVX-SLOW-NEXT: vzeroupper
991 ; AVX-SLOW-NEXT: retq
993 ; AVX-FAST-LABEL: extract_extract45_v16i16_add_i16_commute:
995 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
996 ; AVX-FAST-NEXT: vpextrw $2, %xmm0, %eax
997 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
998 ; AVX-FAST-NEXT: vzeroupper
999 ; AVX-FAST-NEXT: retq
1000 %x0 = extractelement <16 x i16> %x, i32 4
1001 %x1 = extractelement <16 x i16> %x, i32 5
1002 %x01 = add i16 %x1, %x0
1006 define i16 @extract_extract89_v16i16_add_i16_commute(<16 x i16> %x) {
1007 ; SSE3-SLOW-LABEL: extract_extract89_v16i16_add_i16_commute:
1008 ; SSE3-SLOW: # %bb.0:
1009 ; SSE3-SLOW-NEXT: movd %xmm1, %ecx
1010 ; SSE3-SLOW-NEXT: pextrw $1, %xmm1, %eax
1011 ; SSE3-SLOW-NEXT: addl %ecx, %eax
1012 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1013 ; SSE3-SLOW-NEXT: retq
1015 ; SSE3-FAST-LABEL: extract_extract89_v16i16_add_i16_commute:
1016 ; SSE3-FAST: # %bb.0:
1017 ; SSE3-FAST-NEXT: phaddw %xmm1, %xmm1
1018 ; SSE3-FAST-NEXT: movd %xmm1, %eax
1019 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1020 ; SSE3-FAST-NEXT: retq
1022 ; AVX1-SLOW-LABEL: extract_extract89_v16i16_add_i16_commute:
1023 ; AVX1-SLOW: # %bb.0:
1024 ; AVX1-SLOW-NEXT: vextractf128 $1, %ymm0, %xmm0
1025 ; AVX1-SLOW-NEXT: vmovd %xmm0, %ecx
1026 ; AVX1-SLOW-NEXT: vpextrw $1, %xmm0, %eax
1027 ; AVX1-SLOW-NEXT: addl %ecx, %eax
1028 ; AVX1-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1029 ; AVX1-SLOW-NEXT: vzeroupper
1030 ; AVX1-SLOW-NEXT: retq
1032 ; AVX1-FAST-LABEL: extract_extract89_v16i16_add_i16_commute:
1033 ; AVX1-FAST: # %bb.0:
1034 ; AVX1-FAST-NEXT: vextractf128 $1, %ymm0, %xmm0
1035 ; AVX1-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
1036 ; AVX1-FAST-NEXT: vmovd %xmm0, %eax
1037 ; AVX1-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1038 ; AVX1-FAST-NEXT: vzeroupper
1039 ; AVX1-FAST-NEXT: retq
1041 ; AVX2-SLOW-LABEL: extract_extract89_v16i16_add_i16_commute:
1042 ; AVX2-SLOW: # %bb.0:
1043 ; AVX2-SLOW-NEXT: vextracti128 $1, %ymm0, %xmm0
1044 ; AVX2-SLOW-NEXT: vmovd %xmm0, %ecx
1045 ; AVX2-SLOW-NEXT: vpextrw $1, %xmm0, %eax
1046 ; AVX2-SLOW-NEXT: addl %ecx, %eax
1047 ; AVX2-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1048 ; AVX2-SLOW-NEXT: vzeroupper
1049 ; AVX2-SLOW-NEXT: retq
1051 ; AVX2-FAST-LABEL: extract_extract89_v16i16_add_i16_commute:
1052 ; AVX2-FAST: # %bb.0:
1053 ; AVX2-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
1054 ; AVX2-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
1055 ; AVX2-FAST-NEXT: vmovd %xmm0, %eax
1056 ; AVX2-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1057 ; AVX2-FAST-NEXT: vzeroupper
1058 ; AVX2-FAST-NEXT: retq
1060 ; AVX512-SLOW-LABEL: extract_extract89_v16i16_add_i16_commute:
1061 ; AVX512-SLOW: # %bb.0:
1062 ; AVX512-SLOW-NEXT: vextracti128 $1, %ymm0, %xmm0
1063 ; AVX512-SLOW-NEXT: vmovd %xmm0, %ecx
1064 ; AVX512-SLOW-NEXT: vpextrw $1, %xmm0, %eax
1065 ; AVX512-SLOW-NEXT: addl %ecx, %eax
1066 ; AVX512-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1067 ; AVX512-SLOW-NEXT: vzeroupper
1068 ; AVX512-SLOW-NEXT: retq
1070 ; AVX512-FAST-LABEL: extract_extract89_v16i16_add_i16_commute:
1071 ; AVX512-FAST: # %bb.0:
1072 ; AVX512-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
1073 ; AVX512-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
1074 ; AVX512-FAST-NEXT: vmovd %xmm0, %eax
1075 ; AVX512-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1076 ; AVX512-FAST-NEXT: vzeroupper
1077 ; AVX512-FAST-NEXT: retq
1078 %x0 = extractelement <16 x i16> %x, i32 8
1079 %x1 = extractelement <16 x i16> %x, i32 9
1080 %x01 = add i16 %x1, %x0
1084 define i32 @extract_extract01_v8i32_sub_i32(<8 x i32> %x) {
1085 ; SSE3-SLOW-LABEL: extract_extract01_v8i32_sub_i32:
1086 ; SSE3-SLOW: # %bb.0:
1087 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1088 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1089 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1090 ; SSE3-SLOW-NEXT: subl %ecx, %eax
1091 ; SSE3-SLOW-NEXT: retq
1093 ; SSE3-FAST-LABEL: extract_extract01_v8i32_sub_i32:
1094 ; SSE3-FAST: # %bb.0:
1095 ; SSE3-FAST-NEXT: phsubd %xmm0, %xmm0
1096 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1097 ; SSE3-FAST-NEXT: retq
1099 ; AVX-SLOW-LABEL: extract_extract01_v8i32_sub_i32:
1100 ; AVX-SLOW: # %bb.0:
1101 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1102 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %ecx
1103 ; AVX-SLOW-NEXT: subl %ecx, %eax
1104 ; AVX-SLOW-NEXT: vzeroupper
1105 ; AVX-SLOW-NEXT: retq
1107 ; AVX-FAST-LABEL: extract_extract01_v8i32_sub_i32:
1108 ; AVX-FAST: # %bb.0:
1109 ; AVX-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
1110 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1111 ; AVX-FAST-NEXT: vzeroupper
1112 ; AVX-FAST-NEXT: retq
1113 %x0 = extractelement <8 x i32> %x, i32 0
1114 %x1 = extractelement <8 x i32> %x, i32 1
1115 %x01 = sub i32 %x0, %x1
1119 define i32 @extract_extract23_v8i32_sub_i32(<8 x i32> %x) {
1120 ; SSE3-SLOW-LABEL: extract_extract23_v8i32_sub_i32:
1121 ; SSE3-SLOW: # %bb.0:
1122 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1123 ; SSE3-SLOW-NEXT: movd %xmm1, %eax
1124 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
1125 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1126 ; SSE3-SLOW-NEXT: subl %ecx, %eax
1127 ; SSE3-SLOW-NEXT: retq
1129 ; SSE3-FAST-LABEL: extract_extract23_v8i32_sub_i32:
1130 ; SSE3-FAST: # %bb.0:
1131 ; SSE3-FAST-NEXT: phsubd %xmm0, %xmm0
1132 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1133 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1134 ; SSE3-FAST-NEXT: retq
1136 ; AVX-SLOW-LABEL: extract_extract23_v8i32_sub_i32:
1137 ; AVX-SLOW: # %bb.0:
1138 ; AVX-SLOW-NEXT: vextractps $2, %xmm0, %eax
1139 ; AVX-SLOW-NEXT: vextractps $3, %xmm0, %ecx
1140 ; AVX-SLOW-NEXT: subl %ecx, %eax
1141 ; AVX-SLOW-NEXT: vzeroupper
1142 ; AVX-SLOW-NEXT: retq
1144 ; AVX-FAST-LABEL: extract_extract23_v8i32_sub_i32:
1145 ; AVX-FAST: # %bb.0:
1146 ; AVX-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
1147 ; AVX-FAST-NEXT: vpextrd $1, %xmm0, %eax
1148 ; AVX-FAST-NEXT: vzeroupper
1149 ; AVX-FAST-NEXT: retq
1150 %x0 = extractelement <8 x i32> %x, i32 2
1151 %x1 = extractelement <8 x i32> %x, i32 3
1152 %x01 = sub i32 %x0, %x1
1156 define i32 @extract_extract67_v8i32_sub_i32(<8 x i32> %x) {
1157 ; SSE3-SLOW-LABEL: extract_extract67_v8i32_sub_i32:
1158 ; SSE3-SLOW: # %bb.0:
1159 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1]
1160 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1161 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[3,1,2,3]
1162 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1163 ; SSE3-SLOW-NEXT: subl %ecx, %eax
1164 ; SSE3-SLOW-NEXT: retq
1166 ; SSE3-FAST-LABEL: extract_extract67_v8i32_sub_i32:
1167 ; SSE3-FAST: # %bb.0:
1168 ; SSE3-FAST-NEXT: phsubd %xmm1, %xmm1
1169 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
1170 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1171 ; SSE3-FAST-NEXT: retq
1173 ; AVX-SLOW-LABEL: extract_extract67_v8i32_sub_i32:
1174 ; AVX-SLOW: # %bb.0:
1175 ; AVX-SLOW-NEXT: vextractf128 $1, %ymm0, %xmm0
1176 ; AVX-SLOW-NEXT: vextractps $2, %xmm0, %eax
1177 ; AVX-SLOW-NEXT: vextractps $3, %xmm0, %ecx
1178 ; AVX-SLOW-NEXT: subl %ecx, %eax
1179 ; AVX-SLOW-NEXT: vzeroupper
1180 ; AVX-SLOW-NEXT: retq
1182 ; AVX1-FAST-LABEL: extract_extract67_v8i32_sub_i32:
1183 ; AVX1-FAST: # %bb.0:
1184 ; AVX1-FAST-NEXT: vextractf128 $1, %ymm0, %xmm0
1185 ; AVX1-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
1186 ; AVX1-FAST-NEXT: vpextrd $1, %xmm0, %eax
1187 ; AVX1-FAST-NEXT: vzeroupper
1188 ; AVX1-FAST-NEXT: retq
1190 ; AVX2-FAST-LABEL: extract_extract67_v8i32_sub_i32:
1191 ; AVX2-FAST: # %bb.0:
1192 ; AVX2-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
1193 ; AVX2-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
1194 ; AVX2-FAST-NEXT: vpextrd $1, %xmm0, %eax
1195 ; AVX2-FAST-NEXT: vzeroupper
1196 ; AVX2-FAST-NEXT: retq
1198 ; AVX512-FAST-LABEL: extract_extract67_v8i32_sub_i32:
1199 ; AVX512-FAST: # %bb.0:
1200 ; AVX512-FAST-NEXT: vextracti128 $1, %ymm0, %xmm0
1201 ; AVX512-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
1202 ; AVX512-FAST-NEXT: vpextrd $1, %xmm0, %eax
1203 ; AVX512-FAST-NEXT: vzeroupper
1204 ; AVX512-FAST-NEXT: retq
1205 %x0 = extractelement <8 x i32> %x, i32 6
1206 %x1 = extractelement <8 x i32> %x, i32 7
1207 %x01 = sub i32 %x0, %x1
1211 ; Negative test...or get hoppy and negate?
1213 define i32 @extract_extract01_v8i32_sub_i32_commute(<8 x i32> %x) {
1214 ; SSE3-LABEL: extract_extract01_v8i32_sub_i32_commute:
1216 ; SSE3-NEXT: movd %xmm0, %ecx
1217 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1218 ; SSE3-NEXT: movd %xmm0, %eax
1219 ; SSE3-NEXT: subl %ecx, %eax
1222 ; AVX-LABEL: extract_extract01_v8i32_sub_i32_commute:
1224 ; AVX-NEXT: vmovd %xmm0, %ecx
1225 ; AVX-NEXT: vpextrd $1, %xmm0, %eax
1226 ; AVX-NEXT: subl %ecx, %eax
1227 ; AVX-NEXT: vzeroupper
1229 %x0 = extractelement <8 x i32> %x, i32 0
1230 %x1 = extractelement <8 x i32> %x, i32 1
1231 %x01 = sub i32 %x1, %x0
1235 define i16 @extract_extract01_v16i16_sub_i16(<16 x i16> %x) {
1236 ; SSE3-SLOW-LABEL: extract_extract01_v16i16_sub_i16:
1237 ; SSE3-SLOW: # %bb.0:
1238 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1239 ; SSE3-SLOW-NEXT: pextrw $1, %xmm0, %ecx
1240 ; SSE3-SLOW-NEXT: subl %ecx, %eax
1241 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1242 ; SSE3-SLOW-NEXT: retq
1244 ; SSE3-FAST-LABEL: extract_extract01_v16i16_sub_i16:
1245 ; SSE3-FAST: # %bb.0:
1246 ; SSE3-FAST-NEXT: phsubw %xmm0, %xmm0
1247 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1248 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1249 ; SSE3-FAST-NEXT: retq
1251 ; AVX-SLOW-LABEL: extract_extract01_v16i16_sub_i16:
1252 ; AVX-SLOW: # %bb.0:
1253 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1254 ; AVX-SLOW-NEXT: vpextrw $1, %xmm0, %ecx
1255 ; AVX-SLOW-NEXT: subl %ecx, %eax
1256 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1257 ; AVX-SLOW-NEXT: vzeroupper
1258 ; AVX-SLOW-NEXT: retq
1260 ; AVX-FAST-LABEL: extract_extract01_v16i16_sub_i16:
1261 ; AVX-FAST: # %bb.0:
1262 ; AVX-FAST-NEXT: vphsubw %xmm0, %xmm0, %xmm0
1263 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1264 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1265 ; AVX-FAST-NEXT: vzeroupper
1266 ; AVX-FAST-NEXT: retq
1267 %x0 = extractelement <16 x i16> %x, i32 0
1268 %x1 = extractelement <16 x i16> %x, i32 1
1269 %x01 = sub i16 %x0, %x1
1273 ; Negative test...or get hoppy and negate?
1275 define i16 @extract_extract01_v16i16_sub_i16_commute(<16 x i16> %x) {
1276 ; SSE3-LABEL: extract_extract01_v16i16_sub_i16_commute:
1278 ; SSE3-NEXT: movd %xmm0, %ecx
1279 ; SSE3-NEXT: pextrw $1, %xmm0, %eax
1280 ; SSE3-NEXT: subl %ecx, %eax
1281 ; SSE3-NEXT: # kill: def $ax killed $ax killed $eax
1284 ; AVX-LABEL: extract_extract01_v16i16_sub_i16_commute:
1286 ; AVX-NEXT: vmovd %xmm0, %ecx
1287 ; AVX-NEXT: vpextrw $1, %xmm0, %eax
1288 ; AVX-NEXT: subl %ecx, %eax
1289 ; AVX-NEXT: # kill: def $ax killed $ax killed $eax
1290 ; AVX-NEXT: vzeroupper
1292 %x0 = extractelement <16 x i16> %x, i32 0
1293 %x1 = extractelement <16 x i16> %x, i32 1
1294 %x01 = sub i16 %x1, %x0
1298 ; 512-bit vectors, i32/i16, add/sub
1300 define i32 @extract_extract01_v16i32_add_i32(<16 x i32> %x) {
1301 ; SSE3-SLOW-LABEL: extract_extract01_v16i32_add_i32:
1302 ; SSE3-SLOW: # %bb.0:
1303 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1304 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1305 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1306 ; SSE3-SLOW-NEXT: addl %ecx, %eax
1307 ; SSE3-SLOW-NEXT: retq
1309 ; SSE3-FAST-LABEL: extract_extract01_v16i32_add_i32:
1310 ; SSE3-FAST: # %bb.0:
1311 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
1312 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1313 ; SSE3-FAST-NEXT: retq
1315 ; AVX-SLOW-LABEL: extract_extract01_v16i32_add_i32:
1316 ; AVX-SLOW: # %bb.0:
1317 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
1318 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %eax
1319 ; AVX-SLOW-NEXT: addl %ecx, %eax
1320 ; AVX-SLOW-NEXT: vzeroupper
1321 ; AVX-SLOW-NEXT: retq
1323 ; AVX-FAST-LABEL: extract_extract01_v16i32_add_i32:
1324 ; AVX-FAST: # %bb.0:
1325 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1326 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1327 ; AVX-FAST-NEXT: vzeroupper
1328 ; AVX-FAST-NEXT: retq
1329 %x0 = extractelement <16 x i32> %x, i32 0
1330 %x1 = extractelement <16 x i32> %x, i32 1
1331 %x01 = add i32 %x0, %x1
1335 define i32 @extract_extract01_v16i32_add_i32_commute(<16 x i32> %x) {
1336 ; SSE3-SLOW-LABEL: extract_extract01_v16i32_add_i32_commute:
1337 ; SSE3-SLOW: # %bb.0:
1338 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1339 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1340 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1341 ; SSE3-SLOW-NEXT: addl %ecx, %eax
1342 ; SSE3-SLOW-NEXT: retq
1344 ; SSE3-FAST-LABEL: extract_extract01_v16i32_add_i32_commute:
1345 ; SSE3-FAST: # %bb.0:
1346 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
1347 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1348 ; SSE3-FAST-NEXT: retq
1350 ; AVX-SLOW-LABEL: extract_extract01_v16i32_add_i32_commute:
1351 ; AVX-SLOW: # %bb.0:
1352 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
1353 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %eax
1354 ; AVX-SLOW-NEXT: addl %ecx, %eax
1355 ; AVX-SLOW-NEXT: vzeroupper
1356 ; AVX-SLOW-NEXT: retq
1358 ; AVX-FAST-LABEL: extract_extract01_v16i32_add_i32_commute:
1359 ; AVX-FAST: # %bb.0:
1360 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1361 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1362 ; AVX-FAST-NEXT: vzeroupper
1363 ; AVX-FAST-NEXT: retq
1364 %x0 = extractelement <16 x i32> %x, i32 0
1365 %x1 = extractelement <16 x i32> %x, i32 1
1366 %x01 = add i32 %x1, %x0
1370 define i16 @extract_extract01_v32i16_add_i16(<32 x i16> %x) {
1371 ; SSE3-SLOW-LABEL: extract_extract01_v32i16_add_i16:
1372 ; SSE3-SLOW: # %bb.0:
1373 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1374 ; SSE3-SLOW-NEXT: pextrw $1, %xmm0, %eax
1375 ; SSE3-SLOW-NEXT: addl %ecx, %eax
1376 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1377 ; SSE3-SLOW-NEXT: retq
1379 ; SSE3-FAST-LABEL: extract_extract01_v32i16_add_i16:
1380 ; SSE3-FAST: # %bb.0:
1381 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
1382 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1383 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1384 ; SSE3-FAST-NEXT: retq
1386 ; AVX-SLOW-LABEL: extract_extract01_v32i16_add_i16:
1387 ; AVX-SLOW: # %bb.0:
1388 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
1389 ; AVX-SLOW-NEXT: vpextrw $1, %xmm0, %eax
1390 ; AVX-SLOW-NEXT: addl %ecx, %eax
1391 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1392 ; AVX-SLOW-NEXT: vzeroupper
1393 ; AVX-SLOW-NEXT: retq
1395 ; AVX-FAST-LABEL: extract_extract01_v32i16_add_i16:
1396 ; AVX-FAST: # %bb.0:
1397 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
1398 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1399 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1400 ; AVX-FAST-NEXT: vzeroupper
1401 ; AVX-FAST-NEXT: retq
1402 %x0 = extractelement <32 x i16> %x, i32 0
1403 %x1 = extractelement <32 x i16> %x, i32 1
1404 %x01 = add i16 %x0, %x1
1408 define i16 @extract_extract01_v32i16_add_i16_commute(<32 x i16> %x) {
1409 ; SSE3-SLOW-LABEL: extract_extract01_v32i16_add_i16_commute:
1410 ; SSE3-SLOW: # %bb.0:
1411 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1412 ; SSE3-SLOW-NEXT: pextrw $1, %xmm0, %eax
1413 ; SSE3-SLOW-NEXT: addl %ecx, %eax
1414 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1415 ; SSE3-SLOW-NEXT: retq
1417 ; SSE3-FAST-LABEL: extract_extract01_v32i16_add_i16_commute:
1418 ; SSE3-FAST: # %bb.0:
1419 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
1420 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1421 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1422 ; SSE3-FAST-NEXT: retq
1424 ; AVX-SLOW-LABEL: extract_extract01_v32i16_add_i16_commute:
1425 ; AVX-SLOW: # %bb.0:
1426 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
1427 ; AVX-SLOW-NEXT: vpextrw $1, %xmm0, %eax
1428 ; AVX-SLOW-NEXT: addl %ecx, %eax
1429 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1430 ; AVX-SLOW-NEXT: vzeroupper
1431 ; AVX-SLOW-NEXT: retq
1433 ; AVX-FAST-LABEL: extract_extract01_v32i16_add_i16_commute:
1434 ; AVX-FAST: # %bb.0:
1435 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
1436 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1437 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1438 ; AVX-FAST-NEXT: vzeroupper
1439 ; AVX-FAST-NEXT: retq
1440 %x0 = extractelement <32 x i16> %x, i32 0
1441 %x1 = extractelement <32 x i16> %x, i32 1
1442 %x01 = add i16 %x1, %x0
1446 define i32 @extract_extract01_v16i32_sub_i32(<16 x i32> %x) {
1447 ; SSE3-SLOW-LABEL: extract_extract01_v16i32_sub_i32:
1448 ; SSE3-SLOW: # %bb.0:
1449 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1450 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1451 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1452 ; SSE3-SLOW-NEXT: subl %ecx, %eax
1453 ; SSE3-SLOW-NEXT: retq
1455 ; SSE3-FAST-LABEL: extract_extract01_v16i32_sub_i32:
1456 ; SSE3-FAST: # %bb.0:
1457 ; SSE3-FAST-NEXT: phsubd %xmm0, %xmm0
1458 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1459 ; SSE3-FAST-NEXT: retq
1461 ; AVX-SLOW-LABEL: extract_extract01_v16i32_sub_i32:
1462 ; AVX-SLOW: # %bb.0:
1463 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1464 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %ecx
1465 ; AVX-SLOW-NEXT: subl %ecx, %eax
1466 ; AVX-SLOW-NEXT: vzeroupper
1467 ; AVX-SLOW-NEXT: retq
1469 ; AVX-FAST-LABEL: extract_extract01_v16i32_sub_i32:
1470 ; AVX-FAST: # %bb.0:
1471 ; AVX-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
1472 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1473 ; AVX-FAST-NEXT: vzeroupper
1474 ; AVX-FAST-NEXT: retq
1475 %x0 = extractelement <16 x i32> %x, i32 0
1476 %x1 = extractelement <16 x i32> %x, i32 1
1477 %x01 = sub i32 %x0, %x1
1481 define i32 @extract_extract01_v16i32_sub_i32_commute(<16 x i32> %x) {
1482 ; SSE3-LABEL: extract_extract01_v16i32_sub_i32_commute:
1484 ; SSE3-NEXT: movd %xmm0, %ecx
1485 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1486 ; SSE3-NEXT: movd %xmm0, %eax
1487 ; SSE3-NEXT: subl %ecx, %eax
1490 ; AVX-LABEL: extract_extract01_v16i32_sub_i32_commute:
1492 ; AVX-NEXT: vmovd %xmm0, %ecx
1493 ; AVX-NEXT: vpextrd $1, %xmm0, %eax
1494 ; AVX-NEXT: subl %ecx, %eax
1495 ; AVX-NEXT: vzeroupper
1497 %x0 = extractelement <16 x i32> %x, i32 0
1498 %x1 = extractelement <16 x i32> %x, i32 1
1499 %x01 = sub i32 %x1, %x0
1503 define i16 @extract_extract01_v32i16_sub_i16(<32 x i16> %x) {
1504 ; SSE3-SLOW-LABEL: extract_extract01_v32i16_sub_i16:
1505 ; SSE3-SLOW: # %bb.0:
1506 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1507 ; SSE3-SLOW-NEXT: pextrw $1, %xmm0, %ecx
1508 ; SSE3-SLOW-NEXT: subl %ecx, %eax
1509 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1510 ; SSE3-SLOW-NEXT: retq
1512 ; SSE3-FAST-LABEL: extract_extract01_v32i16_sub_i16:
1513 ; SSE3-FAST: # %bb.0:
1514 ; SSE3-FAST-NEXT: phsubw %xmm0, %xmm0
1515 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1516 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1517 ; SSE3-FAST-NEXT: retq
1519 ; AVX-SLOW-LABEL: extract_extract01_v32i16_sub_i16:
1520 ; AVX-SLOW: # %bb.0:
1521 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1522 ; AVX-SLOW-NEXT: vpextrw $1, %xmm0, %ecx
1523 ; AVX-SLOW-NEXT: subl %ecx, %eax
1524 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1525 ; AVX-SLOW-NEXT: vzeroupper
1526 ; AVX-SLOW-NEXT: retq
1528 ; AVX-FAST-LABEL: extract_extract01_v32i16_sub_i16:
1529 ; AVX-FAST: # %bb.0:
1530 ; AVX-FAST-NEXT: vphsubw %xmm0, %xmm0, %xmm0
1531 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1532 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1533 ; AVX-FAST-NEXT: vzeroupper
1534 ; AVX-FAST-NEXT: retq
1535 %x0 = extractelement <32 x i16> %x, i32 0
1536 %x1 = extractelement <32 x i16> %x, i32 1
1537 %x01 = sub i16 %x0, %x1
1541 define i16 @extract_extract01_v32i16_sub_i16_commute(<32 x i16> %x) {
1542 ; SSE3-LABEL: extract_extract01_v32i16_sub_i16_commute:
1544 ; SSE3-NEXT: movd %xmm0, %ecx
1545 ; SSE3-NEXT: pextrw $1, %xmm0, %eax
1546 ; SSE3-NEXT: subl %ecx, %eax
1547 ; SSE3-NEXT: # kill: def $ax killed $ax killed $eax
1550 ; AVX-LABEL: extract_extract01_v32i16_sub_i16_commute:
1552 ; AVX-NEXT: vmovd %xmm0, %ecx
1553 ; AVX-NEXT: vpextrw $1, %xmm0, %eax
1554 ; AVX-NEXT: subl %ecx, %eax
1555 ; AVX-NEXT: # kill: def $ax killed $ax killed $eax
1556 ; AVX-NEXT: vzeroupper
1558 %x0 = extractelement <32 x i16> %x, i32 0
1559 %x1 = extractelement <32 x i16> %x, i32 1
1560 %x01 = sub i16 %x1, %x0
1564 ; Check output when 1 or both extracts have extra uses.
1566 define i32 @extract_extract01_v4i32_add_i32_uses1(<4 x i32> %x, i32* %p) {
1567 ; SSE3-SLOW-LABEL: extract_extract01_v4i32_add_i32_uses1:
1568 ; SSE3-SLOW: # %bb.0:
1569 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1570 ; SSE3-SLOW-NEXT: movd %xmm0, (%rdi)
1571 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1572 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1573 ; SSE3-SLOW-NEXT: addl %ecx, %eax
1574 ; SSE3-SLOW-NEXT: retq
1576 ; SSE3-FAST-LABEL: extract_extract01_v4i32_add_i32_uses1:
1577 ; SSE3-FAST: # %bb.0:
1578 ; SSE3-FAST-NEXT: movd %xmm0, (%rdi)
1579 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
1580 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1581 ; SSE3-FAST-NEXT: retq
1583 ; AVX-SLOW-LABEL: extract_extract01_v4i32_add_i32_uses1:
1584 ; AVX-SLOW: # %bb.0:
1585 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
1586 ; AVX-SLOW-NEXT: vmovd %xmm0, (%rdi)
1587 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %eax
1588 ; AVX-SLOW-NEXT: addl %ecx, %eax
1589 ; AVX-SLOW-NEXT: retq
1591 ; AVX-FAST-LABEL: extract_extract01_v4i32_add_i32_uses1:
1592 ; AVX-FAST: # %bb.0:
1593 ; AVX-FAST-NEXT: vmovd %xmm0, (%rdi)
1594 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1595 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1596 ; AVX-FAST-NEXT: retq
1597 %x0 = extractelement <4 x i32> %x, i32 0
1598 store i32 %x0, i32* %p
1599 %x1 = extractelement <4 x i32> %x, i32 1
1600 %x01 = add i32 %x0, %x1
1604 define i32 @extract_extract01_v4i32_add_i32_uses2(<4 x i32> %x, i32* %p) {
1605 ; SSE3-SLOW-LABEL: extract_extract01_v4i32_add_i32_uses2:
1606 ; SSE3-SLOW: # %bb.0:
1607 ; SSE3-SLOW-NEXT: movd %xmm0, %ecx
1608 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1609 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1610 ; SSE3-SLOW-NEXT: addl %ecx, %eax
1611 ; SSE3-SLOW-NEXT: movd %xmm0, (%rdi)
1612 ; SSE3-SLOW-NEXT: retq
1614 ; SSE3-FAST-LABEL: extract_extract01_v4i32_add_i32_uses2:
1615 ; SSE3-FAST: # %bb.0:
1616 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1617 ; SSE3-FAST-NEXT: movd %xmm1, (%rdi)
1618 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
1619 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1620 ; SSE3-FAST-NEXT: retq
1622 ; AVX-SLOW-LABEL: extract_extract01_v4i32_add_i32_uses2:
1623 ; AVX-SLOW: # %bb.0:
1624 ; AVX-SLOW-NEXT: vmovd %xmm0, %ecx
1625 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, %eax
1626 ; AVX-SLOW-NEXT: addl %ecx, %eax
1627 ; AVX-SLOW-NEXT: vpextrd $1, %xmm0, (%rdi)
1628 ; AVX-SLOW-NEXT: retq
1630 ; AVX-FAST-LABEL: extract_extract01_v4i32_add_i32_uses2:
1631 ; AVX-FAST: # %bb.0:
1632 ; AVX-FAST-NEXT: vpextrd $1, %xmm0, (%rdi)
1633 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1634 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1635 ; AVX-FAST-NEXT: retq
1636 %x0 = extractelement <4 x i32> %x, i32 0
1637 %x1 = extractelement <4 x i32> %x, i32 1
1638 store i32 %x1, i32* %p
1639 %x01 = add i32 %x0, %x1
1643 define i32 @extract_extract01_v4i32_add_i32_uses3(<4 x i32> %x, i32* %p1, i32* %p2) {
1644 ; SSE3-LABEL: extract_extract01_v4i32_add_i32_uses3:
1646 ; SSE3-NEXT: movd %xmm0, %ecx
1647 ; SSE3-NEXT: movd %xmm0, (%rdi)
1648 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1649 ; SSE3-NEXT: movd %xmm0, %eax
1650 ; SSE3-NEXT: addl %ecx, %eax
1651 ; SSE3-NEXT: movd %xmm0, (%rsi)
1654 ; AVX-LABEL: extract_extract01_v4i32_add_i32_uses3:
1656 ; AVX-NEXT: vmovd %xmm0, %ecx
1657 ; AVX-NEXT: vmovd %xmm0, (%rdi)
1658 ; AVX-NEXT: vpextrd $1, %xmm0, %eax
1659 ; AVX-NEXT: addl %ecx, %eax
1660 ; AVX-NEXT: vpextrd $1, %xmm0, (%rsi)
1662 %x0 = extractelement <4 x i32> %x, i32 0
1663 store i32 %x0, i32* %p1
1664 %x1 = extractelement <4 x i32> %x, i32 1
1665 store i32 %x1, i32* %p2
1666 %x01 = add i32 %x0, %x1
1670 ; PR33758: https://bugs.llvm.org/show_bug.cgi?id=33758
1672 define i32 @partial_reduction_add_v8i32(<8 x i32> %x) {
1673 ; SSE3-SLOW-LABEL: partial_reduction_add_v8i32:
1674 ; SSE3-SLOW: # %bb.0:
1675 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1676 ; SSE3-SLOW-NEXT: paddd %xmm0, %xmm1
1677 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
1678 ; SSE3-SLOW-NEXT: paddd %xmm1, %xmm0
1679 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1680 ; SSE3-SLOW-NEXT: retq
1682 ; SSE3-FAST-LABEL: partial_reduction_add_v8i32:
1683 ; SSE3-FAST: # %bb.0:
1684 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1685 ; SSE3-FAST-NEXT: paddd %xmm0, %xmm1
1686 ; SSE3-FAST-NEXT: phaddd %xmm1, %xmm1
1687 ; SSE3-FAST-NEXT: movd %xmm1, %eax
1688 ; SSE3-FAST-NEXT: retq
1690 ; AVX-SLOW-LABEL: partial_reduction_add_v8i32:
1691 ; AVX-SLOW: # %bb.0:
1692 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1693 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
1694 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1695 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
1696 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1697 ; AVX-SLOW-NEXT: vzeroupper
1698 ; AVX-SLOW-NEXT: retq
1700 ; AVX-FAST-LABEL: partial_reduction_add_v8i32:
1701 ; AVX-FAST: # %bb.0:
1702 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1703 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1704 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1705 ; AVX-FAST-NEXT: vzeroupper
1706 ; AVX-FAST-NEXT: retq
1707 %x23 = shufflevector <8 x i32> %x, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1708 %x0213 = add <8 x i32> %x, %x23
1709 %x13 = shufflevector <8 x i32> %x0213, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1710 %x0123 = add <8 x i32> %x0213, %x13
1711 %r = extractelement <8 x i32> %x0123, i32 0
1715 define i32 @partial_reduction_add_v16i32(<16 x i32> %x) {
1716 ; SSE3-SLOW-LABEL: partial_reduction_add_v16i32:
1717 ; SSE3-SLOW: # %bb.0:
1718 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1719 ; SSE3-SLOW-NEXT: paddd %xmm0, %xmm1
1720 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
1721 ; SSE3-SLOW-NEXT: paddd %xmm1, %xmm0
1722 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1723 ; SSE3-SLOW-NEXT: retq
1725 ; SSE3-FAST-LABEL: partial_reduction_add_v16i32:
1726 ; SSE3-FAST: # %bb.0:
1727 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1728 ; SSE3-FAST-NEXT: paddd %xmm0, %xmm1
1729 ; SSE3-FAST-NEXT: phaddd %xmm1, %xmm1
1730 ; SSE3-FAST-NEXT: movd %xmm1, %eax
1731 ; SSE3-FAST-NEXT: retq
1733 ; AVX-SLOW-LABEL: partial_reduction_add_v16i32:
1734 ; AVX-SLOW: # %bb.0:
1735 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1736 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
1737 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1738 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
1739 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1740 ; AVX-SLOW-NEXT: vzeroupper
1741 ; AVX-SLOW-NEXT: retq
1743 ; AVX-FAST-LABEL: partial_reduction_add_v16i32:
1744 ; AVX-FAST: # %bb.0:
1745 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1746 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1747 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1748 ; AVX-FAST-NEXT: vzeroupper
1749 ; AVX-FAST-NEXT: retq
1750 %x23 = shufflevector <16 x i32> %x, <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1751 %x0213 = add <16 x i32> %x, %x23
1752 %x13 = shufflevector <16 x i32> %x0213, <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1753 %x0123 = add <16 x i32> %x0213, %x13
1754 %r = extractelement <16 x i32> %x0123, i32 0
1758 define i32 @partial_reduction_sub_v8i32(<8 x i32> %x) {
1759 ; SSE3-SLOW-LABEL: partial_reduction_sub_v8i32:
1760 ; SSE3-SLOW: # %bb.0:
1761 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1762 ; SSE3-SLOW-NEXT: psubd %xmm1, %xmm0
1763 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1764 ; SSE3-SLOW-NEXT: psubd %xmm1, %xmm0
1765 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1766 ; SSE3-SLOW-NEXT: retq
1768 ; SSE3-FAST-LABEL: partial_reduction_sub_v8i32:
1769 ; SSE3-FAST: # %bb.0:
1770 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1771 ; SSE3-FAST-NEXT: psubd %xmm1, %xmm0
1772 ; SSE3-FAST-NEXT: phsubd %xmm0, %xmm0
1773 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1774 ; SSE3-FAST-NEXT: retq
1776 ; AVX-SLOW-LABEL: partial_reduction_sub_v8i32:
1777 ; AVX-SLOW: # %bb.0:
1778 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1779 ; AVX-SLOW-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1780 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1781 ; AVX-SLOW-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1782 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1783 ; AVX-SLOW-NEXT: vzeroupper
1784 ; AVX-SLOW-NEXT: retq
1786 ; AVX-FAST-LABEL: partial_reduction_sub_v8i32:
1787 ; AVX-FAST: # %bb.0:
1788 ; AVX-FAST-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1789 ; AVX-FAST-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1790 ; AVX-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
1791 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1792 ; AVX-FAST-NEXT: vzeroupper
1793 ; AVX-FAST-NEXT: retq
1794 %x23 = shufflevector <8 x i32> %x, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1795 %x0213 = sub <8 x i32> %x, %x23
1796 %x13 = shufflevector <8 x i32> %x0213, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1797 %x0123 = sub <8 x i32> %x0213, %x13
1798 %r = extractelement <8 x i32> %x0123, i32 0
1802 define i32 @partial_reduction_sub_v16i32(<16 x i32> %x) {
1803 ; SSE3-SLOW-LABEL: partial_reduction_sub_v16i32:
1804 ; SSE3-SLOW: # %bb.0:
1805 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1806 ; SSE3-SLOW-NEXT: psubd %xmm1, %xmm0
1807 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1808 ; SSE3-SLOW-NEXT: psubd %xmm1, %xmm0
1809 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1810 ; SSE3-SLOW-NEXT: retq
1812 ; SSE3-FAST-LABEL: partial_reduction_sub_v16i32:
1813 ; SSE3-FAST: # %bb.0:
1814 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1815 ; SSE3-FAST-NEXT: psubd %xmm1, %xmm0
1816 ; SSE3-FAST-NEXT: phsubd %xmm0, %xmm0
1817 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1818 ; SSE3-FAST-NEXT: retq
1820 ; AVX-SLOW-LABEL: partial_reduction_sub_v16i32:
1821 ; AVX-SLOW: # %bb.0:
1822 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1823 ; AVX-SLOW-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1824 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1825 ; AVX-SLOW-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1826 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1827 ; AVX-SLOW-NEXT: vzeroupper
1828 ; AVX-SLOW-NEXT: retq
1830 ; AVX1-FAST-LABEL: partial_reduction_sub_v16i32:
1831 ; AVX1-FAST: # %bb.0:
1832 ; AVX1-FAST-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1833 ; AVX1-FAST-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1834 ; AVX1-FAST-NEXT: vphsubd %xmm0, %xmm0, %xmm0
1835 ; AVX1-FAST-NEXT: vmovd %xmm0, %eax
1836 ; AVX1-FAST-NEXT: vzeroupper
1837 ; AVX1-FAST-NEXT: retq
1839 ; AVX2-FAST-LABEL: partial_reduction_sub_v16i32:
1840 ; AVX2-FAST: # %bb.0:
1841 ; AVX2-FAST-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1842 ; AVX2-FAST-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1843 ; AVX2-FAST-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1844 ; AVX2-FAST-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1845 ; AVX2-FAST-NEXT: vmovd %xmm0, %eax
1846 ; AVX2-FAST-NEXT: vzeroupper
1847 ; AVX2-FAST-NEXT: retq
1849 ; AVX512-FAST-LABEL: partial_reduction_sub_v16i32:
1850 ; AVX512-FAST: # %bb.0:
1851 ; AVX512-FAST-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1852 ; AVX512-FAST-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1853 ; AVX512-FAST-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1854 ; AVX512-FAST-NEXT: vpsubd %xmm1, %xmm0, %xmm0
1855 ; AVX512-FAST-NEXT: vmovd %xmm0, %eax
1856 ; AVX512-FAST-NEXT: vzeroupper
1857 ; AVX512-FAST-NEXT: retq
1858 %x23 = shufflevector <16 x i32> %x, <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1859 %x0213 = sub <16 x i32> %x, %x23
1860 %x13 = shufflevector <16 x i32> %x0213, <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1861 %x0123 = sub <16 x i32> %x0213, %x13
1862 %r = extractelement <16 x i32> %x0123, i32 0
1866 ; PR42023 - https://bugs.llvm.org/show_bug.cgi?id=42023
1868 define i16 @hadd16_8(<8 x i16> %x223) {
1869 ; SSE3-SLOW-LABEL: hadd16_8:
1870 ; SSE3-SLOW: # %bb.0:
1871 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1872 ; SSE3-SLOW-NEXT: paddw %xmm0, %xmm1
1873 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
1874 ; SSE3-SLOW-NEXT: paddw %xmm1, %xmm0
1875 ; SSE3-SLOW-NEXT: movdqa %xmm0, %xmm1
1876 ; SSE3-SLOW-NEXT: psrld $16, %xmm1
1877 ; SSE3-SLOW-NEXT: paddw %xmm0, %xmm1
1878 ; SSE3-SLOW-NEXT: movd %xmm1, %eax
1879 ; SSE3-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1880 ; SSE3-SLOW-NEXT: retq
1882 ; SSE3-FAST-LABEL: hadd16_8:
1883 ; SSE3-FAST: # %bb.0:
1884 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
1885 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
1886 ; SSE3-FAST-NEXT: phaddw %xmm0, %xmm0
1887 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1888 ; SSE3-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1889 ; SSE3-FAST-NEXT: retq
1891 ; AVX-SLOW-LABEL: hadd16_8:
1892 ; AVX-SLOW: # %bb.0:
1893 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1894 ; AVX-SLOW-NEXT: vpaddw %xmm1, %xmm0, %xmm0
1895 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1896 ; AVX-SLOW-NEXT: vpaddw %xmm1, %xmm0, %xmm0
1897 ; AVX-SLOW-NEXT: vpsrld $16, %xmm0, %xmm1
1898 ; AVX-SLOW-NEXT: vpaddw %xmm1, %xmm0, %xmm0
1899 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1900 ; AVX-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
1901 ; AVX-SLOW-NEXT: retq
1903 ; AVX-FAST-LABEL: hadd16_8:
1904 ; AVX-FAST: # %bb.0:
1905 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
1906 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
1907 ; AVX-FAST-NEXT: vphaddw %xmm0, %xmm0, %xmm0
1908 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1909 ; AVX-FAST-NEXT: # kill: def $ax killed $ax killed $eax
1910 ; AVX-FAST-NEXT: retq
1911 %x224 = shufflevector <8 x i16> %x223, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
1912 %x225 = add <8 x i16> %x223, %x224
1913 %x226 = shufflevector <8 x i16> %x225, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1914 %x227 = add <8 x i16> %x225, %x226
1915 %x228 = shufflevector <8 x i16> %x227, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1916 %x229 = add <8 x i16> %x227, %x228
1917 %x230 = extractelement <8 x i16> %x229, i32 0
1921 define i32 @hadd32_4(<4 x i32> %x225) {
1922 ; SSE3-SLOW-LABEL: hadd32_4:
1923 ; SSE3-SLOW: # %bb.0:
1924 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1925 ; SSE3-SLOW-NEXT: paddd %xmm0, %xmm1
1926 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
1927 ; SSE3-SLOW-NEXT: paddd %xmm1, %xmm0
1928 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1929 ; SSE3-SLOW-NEXT: retq
1931 ; SSE3-FAST-LABEL: hadd32_4:
1932 ; SSE3-FAST: # %bb.0:
1933 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
1934 ; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
1935 ; SSE3-FAST-NEXT: movd %xmm0, %eax
1936 ; SSE3-FAST-NEXT: retq
1938 ; AVX-SLOW-LABEL: hadd32_4:
1939 ; AVX-SLOW: # %bb.0:
1940 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1941 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
1942 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1943 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
1944 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1945 ; AVX-SLOW-NEXT: retq
1947 ; AVX-FAST-LABEL: hadd32_4:
1948 ; AVX-FAST: # %bb.0:
1949 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1950 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1951 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1952 ; AVX-FAST-NEXT: retq
1953 %x226 = shufflevector <4 x i32> %x225, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
1954 %x227 = add <4 x i32> %x225, %x226
1955 %x228 = shufflevector <4 x i32> %x227, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
1956 %x229 = add <4 x i32> %x227, %x228
1957 %x230 = extractelement <4 x i32> %x229, i32 0
1961 define i32 @hadd32_8(<8 x i32> %x225) {
1962 ; SSE3-SLOW-LABEL: hadd32_8:
1963 ; SSE3-SLOW: # %bb.0:
1964 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1965 ; SSE3-SLOW-NEXT: paddd %xmm0, %xmm1
1966 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
1967 ; SSE3-SLOW-NEXT: paddd %xmm1, %xmm0
1968 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
1969 ; SSE3-SLOW-NEXT: retq
1971 ; SSE3-FAST-LABEL: hadd32_8:
1972 ; SSE3-FAST: # %bb.0:
1973 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1974 ; SSE3-FAST-NEXT: paddd %xmm0, %xmm1
1975 ; SSE3-FAST-NEXT: phaddd %xmm1, %xmm1
1976 ; SSE3-FAST-NEXT: movd %xmm1, %eax
1977 ; SSE3-FAST-NEXT: retq
1979 ; AVX-SLOW-LABEL: hadd32_8:
1980 ; AVX-SLOW: # %bb.0:
1981 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
1982 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
1983 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
1984 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
1985 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
1986 ; AVX-SLOW-NEXT: vzeroupper
1987 ; AVX-SLOW-NEXT: retq
1989 ; AVX-FAST-LABEL: hadd32_8:
1990 ; AVX-FAST: # %bb.0:
1991 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1992 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
1993 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
1994 ; AVX-FAST-NEXT: vzeroupper
1995 ; AVX-FAST-NEXT: retq
1996 %x226 = shufflevector <8 x i32> %x225, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1997 %x227 = add <8 x i32> %x225, %x226
1998 %x228 = shufflevector <8 x i32> %x227, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1999 %x229 = add <8 x i32> %x227, %x228
2000 %x230 = extractelement <8 x i32> %x229, i32 0
2004 define i32 @hadd32_16(<16 x i32> %x225) {
2005 ; SSE3-SLOW-LABEL: hadd32_16:
2006 ; SSE3-SLOW: # %bb.0:
2007 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
2008 ; SSE3-SLOW-NEXT: paddd %xmm0, %xmm1
2009 ; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
2010 ; SSE3-SLOW-NEXT: paddd %xmm1, %xmm0
2011 ; SSE3-SLOW-NEXT: movd %xmm0, %eax
2012 ; SSE3-SLOW-NEXT: retq
2014 ; SSE3-FAST-LABEL: hadd32_16:
2015 ; SSE3-FAST: # %bb.0:
2016 ; SSE3-FAST-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
2017 ; SSE3-FAST-NEXT: paddd %xmm0, %xmm1
2018 ; SSE3-FAST-NEXT: phaddd %xmm1, %xmm1
2019 ; SSE3-FAST-NEXT: movd %xmm1, %eax
2020 ; SSE3-FAST-NEXT: retq
2022 ; AVX-SLOW-LABEL: hadd32_16:
2023 ; AVX-SLOW: # %bb.0:
2024 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
2025 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
2026 ; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
2027 ; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
2028 ; AVX-SLOW-NEXT: vmovd %xmm0, %eax
2029 ; AVX-SLOW-NEXT: vzeroupper
2030 ; AVX-SLOW-NEXT: retq
2032 ; AVX-FAST-LABEL: hadd32_16:
2033 ; AVX-FAST: # %bb.0:
2034 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
2035 ; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
2036 ; AVX-FAST-NEXT: vmovd %xmm0, %eax
2037 ; AVX-FAST-NEXT: vzeroupper
2038 ; AVX-FAST-NEXT: retq
2039 %x226 = shufflevector <16 x i32> %x225, <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
2040 %x227 = add <16 x i32> %x225, %x226
2041 %x228 = shufflevector <16 x i32> %x227, <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
2042 %x229 = add <16 x i32> %x227, %x228
2043 %x230 = extractelement <16 x i32> %x229, i32 0
2047 define i16 @hadd16_8_optsize(<8 x i16> %x223) optsize {
2048 ; SSE3-LABEL: hadd16_8_optsize:
2050 ; SSE3-NEXT: phaddw %xmm0, %xmm0
2051 ; SSE3-NEXT: phaddw %xmm0, %xmm0
2052 ; SSE3-NEXT: phaddw %xmm0, %xmm0
2053 ; SSE3-NEXT: movd %xmm0, %eax
2054 ; SSE3-NEXT: # kill: def $ax killed $ax killed $eax
2057 ; AVX-LABEL: hadd16_8_optsize:
2059 ; AVX-NEXT: vphaddw %xmm0, %xmm0, %xmm0
2060 ; AVX-NEXT: vphaddw %xmm0, %xmm0, %xmm0
2061 ; AVX-NEXT: vphaddw %xmm0, %xmm0, %xmm0
2062 ; AVX-NEXT: vmovd %xmm0, %eax
2063 ; AVX-NEXT: # kill: def $ax killed $ax killed $eax
2065 %x224 = shufflevector <8 x i16> %x223, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
2066 %x225 = add <8 x i16> %x223, %x224
2067 %x226 = shufflevector <8 x i16> %x225, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
2068 %x227 = add <8 x i16> %x225, %x226
2069 %x228 = shufflevector <8 x i16> %x227, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
2070 %x229 = add <8 x i16> %x227, %x228
2071 %x230 = extractelement <8 x i16> %x229, i32 0
2075 define i32 @hadd32_4_optsize(<4 x i32> %x225) optsize {
2076 ; SSE3-LABEL: hadd32_4_optsize:
2078 ; SSE3-NEXT: phaddd %xmm0, %xmm0
2079 ; SSE3-NEXT: phaddd %xmm0, %xmm0
2080 ; SSE3-NEXT: movd %xmm0, %eax
2083 ; AVX-LABEL: hadd32_4_optsize:
2085 ; AVX-NEXT: vphaddd %xmm0, %xmm0, %xmm0
2086 ; AVX-NEXT: vphaddd %xmm0, %xmm0, %xmm0
2087 ; AVX-NEXT: vmovd %xmm0, %eax
2089 %x226 = shufflevector <4 x i32> %x225, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
2090 %x227 = add <4 x i32> %x225, %x226
2091 %x228 = shufflevector <4 x i32> %x227, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
2092 %x229 = add <4 x i32> %x227, %x228
2093 %x230 = extractelement <4 x i32> %x229, i32 0
2097 define i32 @hadd32_8_optsize(<8 x i32> %x225) optsize {
2098 ; SSE3-LABEL: hadd32_8_optsize:
2100 ; SSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
2101 ; SSE3-NEXT: paddd %xmm0, %xmm1
2102 ; SSE3-NEXT: phaddd %xmm1, %xmm1
2103 ; SSE3-NEXT: movd %xmm1, %eax
2106 ; AVX-LABEL: hadd32_8_optsize:
2108 ; AVX-NEXT: vphaddd %xmm0, %xmm0, %xmm0
2109 ; AVX-NEXT: vphaddd %xmm0, %xmm0, %xmm0
2110 ; AVX-NEXT: vmovd %xmm0, %eax
2111 ; AVX-NEXT: vzeroupper
2113 %x226 = shufflevector <8 x i32> %x225, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
2114 %x227 = add <8 x i32> %x225, %x226
2115 %x228 = shufflevector <8 x i32> %x227, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
2116 %x229 = add <8 x i32> %x227, %x228
2117 %x230 = extractelement <8 x i32> %x229, i32 0
2121 define i32 @hadd32_16_optsize(<16 x i32> %x225) optsize {
2122 ; SSE3-LABEL: hadd32_16_optsize:
2124 ; SSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
2125 ; SSE3-NEXT: paddd %xmm0, %xmm1
2126 ; SSE3-NEXT: phaddd %xmm1, %xmm1
2127 ; SSE3-NEXT: movd %xmm1, %eax
2130 ; AVX-LABEL: hadd32_16_optsize:
2132 ; AVX-NEXT: vphaddd %xmm0, %xmm0, %xmm0
2133 ; AVX-NEXT: vphaddd %xmm0, %xmm0, %xmm0
2134 ; AVX-NEXT: vmovd %xmm0, %eax
2135 ; AVX-NEXT: vzeroupper
2137 %x226 = shufflevector <16 x i32> %x225, <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
2138 %x227 = add <16 x i32> %x225, %x226
2139 %x228 = shufflevector <16 x i32> %x227, <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
2140 %x229 = add <16 x i32> %x227, %x228
2141 %x230 = extractelement <16 x i32> %x229, i32 0