1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=ALL --check-prefix=AVX
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=ALL --check-prefix=AVX2
5 ; 0'th element insertion into an AVX register.
7 define <8 x float> @insert_f32_firstelt_of_low_subvector(<8 x float> %x, float %s) {
8 ; ALL-LABEL: insert_f32_firstelt_of_low_subvector:
10 ; ALL-NEXT: # kill: def $xmm1 killed $xmm1 def $ymm1
11 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3,4,5,6,7]
13 %i0 = insertelement <8 x float> %x, float %s, i32 0
17 define <4 x double> @insert_f64_firstelt_of_low_subvector(<4 x double> %x, double %s) {
18 ; ALL-LABEL: insert_f64_firstelt_of_low_subvector:
20 ; ALL-NEXT: # kill: def $xmm1 killed $xmm1 def $ymm1
21 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
23 %i0 = insertelement <4 x double> %x, double %s, i32 0
27 define <32 x i8> @insert_i8_firstelt_of_low_subvector(<32 x i8> %x, i8 %s) {
28 ; AVX-LABEL: insert_i8_firstelt_of_low_subvector:
30 ; AVX-NEXT: vpinsrb $0, %edi, %xmm0, %xmm1
31 ; AVX-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
34 ; AVX2-LABEL: insert_i8_firstelt_of_low_subvector:
36 ; AVX2-NEXT: vpinsrb $0, %edi, %xmm0, %xmm1
37 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
39 %i0 = insertelement <32 x i8> %x, i8 %s, i32 0
43 define <16 x i16> @insert_i16_firstelt_of_low_subvector(<16 x i16> %x, i16 %s) {
44 ; AVX-LABEL: insert_i16_firstelt_of_low_subvector:
46 ; AVX-NEXT: vpinsrw $0, %edi, %xmm0, %xmm1
47 ; AVX-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
50 ; AVX2-LABEL: insert_i16_firstelt_of_low_subvector:
52 ; AVX2-NEXT: vpinsrw $0, %edi, %xmm0, %xmm1
53 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
55 %i0 = insertelement <16 x i16> %x, i16 %s, i32 0
59 define <8 x i32> @insert_i32_firstelt_of_low_subvector(<8 x i32> %x, i32 %s) {
60 ; AVX-LABEL: insert_i32_firstelt_of_low_subvector:
62 ; AVX-NEXT: vpinsrd $0, %edi, %xmm0, %xmm1
63 ; AVX-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
66 ; AVX2-LABEL: insert_i32_firstelt_of_low_subvector:
68 ; AVX2-NEXT: vmovd %edi, %xmm1
69 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3,4,5,6,7]
71 %i0 = insertelement <8 x i32> %x, i32 %s, i32 0
75 define <4 x i64> @insert_i64_firstelt_of_low_subvector(<4 x i64> %x, i64 %s) {
76 ; AVX-LABEL: insert_i64_firstelt_of_low_subvector:
78 ; AVX-NEXT: vpinsrq $0, %rdi, %xmm0, %xmm1
79 ; AVX-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
82 ; AVX2-LABEL: insert_i64_firstelt_of_low_subvector:
84 ; AVX2-NEXT: vmovq %rdi, %xmm1
85 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
87 %i0 = insertelement <4 x i64> %x, i64 %s, i32 0
91 ; 0'th element of high subvector insertion into an AVX register.
93 define <8 x float> @insert_f32_firstelt_of_high_subvector(<8 x float> %x, float %s) {
94 ; AVX-LABEL: insert_f32_firstelt_of_high_subvector:
96 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm2
97 ; AVX-NEXT: vblendps {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3]
98 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
101 ; AVX2-LABEL: insert_f32_firstelt_of_high_subvector:
103 ; AVX2-NEXT: vbroadcastss %xmm1, %ymm1
104 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4],ymm0[5,6,7]
106 %i0 = insertelement <8 x float> %x, float %s, i32 4
110 define <4 x double> @insert_f64_firstelt_of_high_subvector(<4 x double> %x, double %s) {
111 ; AVX-LABEL: insert_f64_firstelt_of_high_subvector:
113 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm2
114 ; AVX-NEXT: vblendps {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3]
115 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
118 ; AVX2-LABEL: insert_f64_firstelt_of_high_subvector:
120 ; AVX2-NEXT: vbroadcastsd %xmm1, %ymm1
121 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
123 %i0 = insertelement <4 x double> %x, double %s, i32 2
127 define <32 x i8> @insert_i8_firstelt_of_high_subvector(<32 x i8> %x, i8 %s) {
128 ; AVX-LABEL: insert_i8_firstelt_of_high_subvector:
130 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm1
131 ; AVX-NEXT: vpinsrb $0, %edi, %xmm1, %xmm1
132 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
135 ; AVX2-LABEL: insert_i8_firstelt_of_high_subvector:
137 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
138 ; AVX2-NEXT: vpinsrb $0, %edi, %xmm1, %xmm1
139 ; AVX2-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
141 %i0 = insertelement <32 x i8> %x, i8 %s, i32 16
145 define <16 x i16> @insert_i16_firstelt_of_high_subvector(<16 x i16> %x, i16 %s) {
146 ; AVX-LABEL: insert_i16_firstelt_of_high_subvector:
148 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm1
149 ; AVX-NEXT: vpinsrw $0, %edi, %xmm1, %xmm1
150 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
153 ; AVX2-LABEL: insert_i16_firstelt_of_high_subvector:
155 ; AVX2-NEXT: vmovd %edi, %xmm1
156 ; AVX2-NEXT: vpbroadcastw %xmm1, %ymm1
157 ; AVX2-NEXT: vpblendw {{.*#+}} ymm1 = ymm1[0],ymm0[1,2,3,4,5,6,7],ymm1[8],ymm0[9,10,11,12,13,14,15]
158 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
160 %i0 = insertelement <16 x i16> %x, i16 %s, i32 8
164 define <8 x i32> @insert_i32_firstelt_of_high_subvector(<8 x i32> %x, i32 %s) {
165 ; AVX-LABEL: insert_i32_firstelt_of_high_subvector:
167 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm1
168 ; AVX-NEXT: vpinsrd $0, %edi, %xmm1, %xmm1
169 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
172 ; AVX2-LABEL: insert_i32_firstelt_of_high_subvector:
174 ; AVX2-NEXT: vmovd %edi, %xmm1
175 ; AVX2-NEXT: vpbroadcastd %xmm1, %ymm1
176 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4],ymm0[5,6,7]
178 %i0 = insertelement <8 x i32> %x, i32 %s, i32 4
182 define <4 x i64> @insert_i64_firstelt_of_high_subvector(<4 x i64> %x, i64 %s) {
183 ; AVX-LABEL: insert_i64_firstelt_of_high_subvector:
185 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm1
186 ; AVX-NEXT: vpinsrq $0, %rdi, %xmm1, %xmm1
187 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
190 ; AVX2-LABEL: insert_i64_firstelt_of_high_subvector:
192 ; AVX2-NEXT: vmovq %rdi, %xmm1
193 ; AVX2-NEXT: vpbroadcastq %xmm1, %ymm1
194 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
196 %i0 = insertelement <4 x i64> %x, i64 %s, i32 2
200 ; element insertion into 0'th element of both subvectors
202 define <8 x float> @insert_f32_firstelts(<8 x float> %x, float %s) {
203 ; AVX-LABEL: insert_f32_firstelts:
205 ; AVX-NEXT: vblendps {{.*#+}} xmm2 = xmm1[0],xmm0[1,2,3]
206 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
207 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1,2,3]
208 ; AVX-NEXT: vinsertf128 $1, %xmm0, %ymm2, %ymm0
211 ; AVX2-LABEL: insert_f32_firstelts:
213 ; AVX2-NEXT: vbroadcastss %xmm1, %ymm1
214 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3],ymm1[4],ymm0[5,6,7]
216 %i0 = insertelement <8 x float> %x, float %s, i32 0
217 %i1 = insertelement <8 x float> %i0, float %s, i32 4
221 define <4 x double> @insert_f64_firstelts(<4 x double> %x, double %s) {
222 ; AVX-LABEL: insert_f64_firstelts:
224 ; AVX-NEXT: vblendps {{.*#+}} xmm2 = xmm1[0,1],xmm0[2,3]
225 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
226 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
227 ; AVX-NEXT: vinsertf128 $1, %xmm0, %ymm2, %ymm0
230 ; AVX2-LABEL: insert_f64_firstelts:
232 ; AVX2-NEXT: vbroadcastsd %xmm1, %ymm1
233 ; AVX2-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
235 %i0 = insertelement <4 x double> %x, double %s, i32 0
236 %i1 = insertelement <4 x double> %i0, double %s, i32 2
240 define <32 x i8> @insert_i8_firstelts(<32 x i8> %x, i8 %s) {
241 ; AVX-LABEL: insert_i8_firstelts:
243 ; AVX-NEXT: vpinsrb $0, %edi, %xmm0, %xmm1
244 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
245 ; AVX-NEXT: vpinsrb $0, %edi, %xmm0, %xmm0
246 ; AVX-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
249 ; AVX2-LABEL: insert_i8_firstelts:
251 ; AVX2-NEXT: vpinsrb $0, %edi, %xmm0, %xmm1
252 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm0
253 ; AVX2-NEXT: vpinsrb $0, %edi, %xmm0, %xmm0
254 ; AVX2-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
256 %i0 = insertelement <32 x i8> %x, i8 %s, i32 0
257 %i1 = insertelement <32 x i8> %i0, i8 %s, i32 16
261 define <16 x i16> @insert_i16_firstelts(<16 x i16> %x, i16 %s) {
262 ; AVX-LABEL: insert_i16_firstelts:
264 ; AVX-NEXT: vpinsrw $0, %edi, %xmm0, %xmm1
265 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
266 ; AVX-NEXT: vpinsrw $0, %edi, %xmm0, %xmm0
267 ; AVX-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
270 ; AVX2-LABEL: insert_i16_firstelts:
272 ; AVX2-NEXT: vpinsrw $0, %edi, %xmm0, %xmm1
273 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
274 ; AVX2-NEXT: vmovd %edi, %xmm1
275 ; AVX2-NEXT: vpbroadcastw %xmm1, %ymm1
276 ; AVX2-NEXT: vpblendw {{.*#+}} ymm1 = ymm1[0],ymm0[1,2,3,4,5,6,7],ymm1[8],ymm0[9,10,11,12,13,14,15]
277 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
279 %i0 = insertelement <16 x i16> %x, i16 %s, i32 0
280 %i1 = insertelement <16 x i16> %i0, i16 %s, i32 8
284 define <8 x i32> @insert_i32_firstelts(<8 x i32> %x, i32 %s) {
285 ; AVX-LABEL: insert_i32_firstelts:
287 ; AVX-NEXT: vpinsrd $0, %edi, %xmm0, %xmm1
288 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
289 ; AVX-NEXT: vpinsrd $0, %edi, %xmm0, %xmm0
290 ; AVX-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
293 ; AVX2-LABEL: insert_i32_firstelts:
295 ; AVX2-NEXT: vmovd %edi, %xmm1
296 ; AVX2-NEXT: vpbroadcastd %xmm1, %ymm1
297 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3],ymm1[4],ymm0[5,6,7]
299 %i0 = insertelement <8 x i32> %x, i32 %s, i32 0
300 %i1 = insertelement <8 x i32> %i0, i32 %s, i32 4
304 define <4 x i64> @insert_i64_firstelts(<4 x i64> %x, i64 %s) {
305 ; AVX-LABEL: insert_i64_firstelts:
307 ; AVX-NEXT: vpinsrq $0, %rdi, %xmm0, %xmm1
308 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
309 ; AVX-NEXT: vpinsrq $0, %rdi, %xmm0, %xmm0
310 ; AVX-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
313 ; AVX2-LABEL: insert_i64_firstelts:
315 ; AVX2-NEXT: vmovq %rdi, %xmm1
316 ; AVX2-NEXT: vpbroadcastq %xmm1, %ymm1
317 ; AVX2-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
319 %i0 = insertelement <4 x i64> %x, i64 %s, i32 0
320 %i1 = insertelement <4 x i64> %i0, i64 %s, i32 2
324 ; element insertion into two elements of high subvector
326 define <8 x float> @insert_f32_two_elts_of_high_subvector(<8 x float> %x, float %s) {
327 ; AVX-LABEL: insert_f32_two_elts_of_high_subvector:
329 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm2
330 ; AVX-NEXT: vshufps {{.*#+}} xmm1 = xmm1[0,0],xmm2[2,3]
331 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
334 ; AVX2-LABEL: insert_f32_two_elts_of_high_subvector:
336 ; AVX2-NEXT: vbroadcastss %xmm1, %ymm1
337 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
339 %i0 = insertelement <8 x float> %x, float %s, i32 4
340 %i1 = insertelement <8 x float> %i0, float %s, i32 5
344 define <4 x double> @insert_f64_two_elts_of_high_subvector(<4 x double> %x, double %s) {
345 ; AVX-LABEL: insert_f64_two_elts_of_high_subvector:
347 ; AVX-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
348 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
351 ; AVX2-LABEL: insert_f64_two_elts_of_high_subvector:
353 ; AVX2-NEXT: vbroadcastsd %xmm1, %ymm1
354 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
356 %i0 = insertelement <4 x double> %x, double %s, i32 2
357 %i1 = insertelement <4 x double> %i0, double %s, i32 3
361 define <32 x i8> @insert_i8_two_elts_of_high_subvector(<32 x i8> %x, i8 %s) {
362 ; AVX-LABEL: insert_i8_two_elts_of_high_subvector:
364 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm1
365 ; AVX-NEXT: vpinsrb $0, %edi, %xmm1, %xmm1
366 ; AVX-NEXT: vpinsrb $1, %edi, %xmm1, %xmm1
367 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
370 ; AVX2-LABEL: insert_i8_two_elts_of_high_subvector:
372 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
373 ; AVX2-NEXT: vpinsrb $0, %edi, %xmm1, %xmm1
374 ; AVX2-NEXT: vpinsrb $1, %edi, %xmm1, %xmm1
375 ; AVX2-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
377 %i0 = insertelement <32 x i8> %x, i8 %s, i32 16
378 %i1 = insertelement <32 x i8> %i0, i8 %s, i32 17
382 define <16 x i16> @insert_i16_two_elts_of_high_subvector(<16 x i16> %x, i16 %s) {
383 ; AVX-LABEL: insert_i16_two_elts_of_high_subvector:
385 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm1
386 ; AVX-NEXT: vpinsrw $0, %edi, %xmm1, %xmm1
387 ; AVX-NEXT: vpinsrw $1, %edi, %xmm1, %xmm1
388 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
391 ; AVX2-LABEL: insert_i16_two_elts_of_high_subvector:
393 ; AVX2-NEXT: vmovd %edi, %xmm1
394 ; AVX2-NEXT: vpbroadcastw %xmm1, %ymm1
395 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4],ymm0[5,6,7]
397 %i0 = insertelement <16 x i16> %x, i16 %s, i32 8
398 %i1 = insertelement <16 x i16> %i0, i16 %s, i32 9
402 define <8 x i32> @insert_i32_two_elts_of_high_subvector(<8 x i32> %x, i32 %s) {
403 ; AVX-LABEL: insert_i32_two_elts_of_high_subvector:
405 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm1
406 ; AVX-NEXT: vpinsrd $0, %edi, %xmm1, %xmm1
407 ; AVX-NEXT: vpinsrd $1, %edi, %xmm1, %xmm1
408 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
411 ; AVX2-LABEL: insert_i32_two_elts_of_high_subvector:
413 ; AVX2-NEXT: vmovd %edi, %xmm1
414 ; AVX2-NEXT: vpbroadcastd %xmm1, %ymm1
415 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
417 %i0 = insertelement <8 x i32> %x, i32 %s, i32 4
418 %i1 = insertelement <8 x i32> %i0, i32 %s, i32 5
422 define <4 x i64> @insert_i64_two_elts_of_high_subvector(<4 x i64> %x, i64 %s) {
423 ; AVX-LABEL: insert_i64_two_elts_of_high_subvector:
425 ; AVX-NEXT: vmovq %rdi, %xmm1
426 ; AVX-NEXT: vpinsrq $1, %rdi, %xmm1, %xmm1
427 ; AVX-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
430 ; AVX2-LABEL: insert_i64_two_elts_of_high_subvector:
432 ; AVX2-NEXT: vmovq %rdi, %xmm1
433 ; AVX2-NEXT: vpbroadcastq %xmm1, %ymm1
434 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
436 %i0 = insertelement <4 x i64> %x, i64 %s, i32 2
437 %i1 = insertelement <4 x i64> %i0, i64 %s, i32 3
441 ; element insertion into two elements of low subvector
443 define <8 x float> @insert_f32_two_elts_of_low_subvector(<8 x float> %x, float %s) {
444 ; ALL-LABEL: insert_f32_two_elts_of_low_subvector:
446 ; ALL-NEXT: vshufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,3]
447 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
449 %i0 = insertelement <8 x float> %x, float %s, i32 0
450 %i1 = insertelement <8 x float> %i0, float %s, i32 1
454 define <4 x double> @insert_f64_two_elts_of_low_subvector(<4 x double> %x, double %s) {
455 ; ALL-LABEL: insert_f64_two_elts_of_low_subvector:
457 ; ALL-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
458 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
460 %i0 = insertelement <4 x double> %x, double %s, i32 0
461 %i1 = insertelement <4 x double> %i0, double %s, i32 1
465 define <32 x i8> @insert_i8_two_elts_of_low_subvector(<32 x i8> %x, i8 %s) {
466 ; AVX-LABEL: insert_i8_two_elts_of_low_subvector:
468 ; AVX-NEXT: vpinsrb $0, %edi, %xmm0, %xmm1
469 ; AVX-NEXT: vpinsrb $1, %edi, %xmm1, %xmm1
470 ; AVX-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
473 ; AVX2-LABEL: insert_i8_two_elts_of_low_subvector:
475 ; AVX2-NEXT: vpinsrb $0, %edi, %xmm0, %xmm1
476 ; AVX2-NEXT: vpinsrb $1, %edi, %xmm1, %xmm1
477 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
479 %i0 = insertelement <32 x i8> %x, i8 %s, i32 0
480 %i1 = insertelement <32 x i8> %i0, i8 %s, i32 1
484 define <16 x i16> @insert_i16_two_elts_of_low_subvector(<16 x i16> %x, i16 %s) {
485 ; AVX-LABEL: insert_i16_two_elts_of_low_subvector:
487 ; AVX-NEXT: vpinsrw $0, %edi, %xmm0, %xmm1
488 ; AVX-NEXT: vpinsrw $1, %edi, %xmm1, %xmm1
489 ; AVX-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
492 ; AVX2-LABEL: insert_i16_two_elts_of_low_subvector:
494 ; AVX2-NEXT: vpinsrw $0, %edi, %xmm0, %xmm1
495 ; AVX2-NEXT: vpinsrw $1, %edi, %xmm1, %xmm1
496 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
498 %i0 = insertelement <16 x i16> %x, i16 %s, i32 0
499 %i1 = insertelement <16 x i16> %i0, i16 %s, i32 1
503 define <8 x i32> @insert_i32_two_elts_of_low_subvector(<8 x i32> %x, i32 %s) {
504 ; AVX-LABEL: insert_i32_two_elts_of_low_subvector:
506 ; AVX-NEXT: vpinsrd $0, %edi, %xmm0, %xmm1
507 ; AVX-NEXT: vpinsrd $1, %edi, %xmm1, %xmm1
508 ; AVX-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
511 ; AVX2-LABEL: insert_i32_two_elts_of_low_subvector:
513 ; AVX2-NEXT: vmovd %edi, %xmm1
514 ; AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm0[1,2,3]
515 ; AVX2-NEXT: vpinsrd $1, %edi, %xmm1, %xmm1
516 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
518 %i0 = insertelement <8 x i32> %x, i32 %s, i32 0
519 %i1 = insertelement <8 x i32> %i0, i32 %s, i32 1
523 define <4 x i64> @insert_i64_two_elts_of_low_subvector(<4 x i64> %x, i64 %s) {
524 ; AVX-LABEL: insert_i64_two_elts_of_low_subvector:
526 ; AVX-NEXT: vmovq %rdi, %xmm1
527 ; AVX-NEXT: vpinsrq $1, %rdi, %xmm1, %xmm1
528 ; AVX-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
531 ; AVX2-LABEL: insert_i64_two_elts_of_low_subvector:
533 ; AVX2-NEXT: vmovq %rdi, %xmm1
534 ; AVX2-NEXT: vpinsrq $1, %rdi, %xmm1, %xmm1
535 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
537 %i0 = insertelement <4 x i64> %x, i64 %s, i32 0
538 %i1 = insertelement <4 x i64> %i0, i64 %s, i32 1