1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f | FileCheck --check-prefix=CHECK --check-prefix=KNL %s
3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq | FileCheck --check-prefix=CHECK --check-prefix=SKX --check-prefix=SKX_ONLY %s
4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq,+avx512vbmi | FileCheck --check-prefix=CHECK --check-prefix=SKX --check-prefix=SKX_VBMI %s
6 define <16 x float> @test1(<16 x float> %x, float* %br, float %y) nounwind {
9 ; CHECK-NEXT: vinsertps {{.*#+}} xmm2 = xmm0[0],mem[0],xmm0[2,3]
10 ; CHECK-NEXT: vinsertf32x4 $0, %xmm2, %zmm0, %zmm2
11 ; CHECK-NEXT: vextractf32x4 $3, %zmm0, %xmm0
12 ; CHECK-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0,1],xmm1[0],xmm0[3]
13 ; CHECK-NEXT: vinsertf32x4 $3, %xmm0, %zmm2, %zmm0
15 %rrr = load float, float* %br
16 %rrr2 = insertelement <16 x float> %x, float %rrr, i32 1
17 %rrr3 = insertelement <16 x float> %rrr2, float %y, i32 14
18 ret <16 x float> %rrr3
21 define <8 x double> @test2(<8 x double> %x, double* %br, double %y) nounwind {
24 ; CHECK-NEXT: vmovhps {{.*#+}} xmm2 = xmm0[0,1],mem[0,1]
25 ; CHECK-NEXT: vinsertf32x4 $0, %xmm2, %zmm0, %zmm2
26 ; CHECK-NEXT: vextractf32x4 $3, %zmm0, %xmm0
27 ; CHECK-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
28 ; CHECK-NEXT: vinsertf32x4 $3, %xmm0, %zmm2, %zmm0
30 %rrr = load double, double* %br
31 %rrr2 = insertelement <8 x double> %x, double %rrr, i32 1
32 %rrr3 = insertelement <8 x double> %rrr2, double %y, i32 6
33 ret <8 x double> %rrr3
36 define <16 x float> @test3(<16 x float> %x) nounwind {
39 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
40 ; CHECK-NEXT: vinsertps {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[2,3]
41 ; CHECK-NEXT: vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
43 %eee = extractelement <16 x float> %x, i32 4
44 %rrr2 = insertelement <16 x float> %x, float %eee, i32 1
45 ret <16 x float> %rrr2
48 define <8 x i64> @test4(<8 x i64> %x) nounwind {
51 ; CHECK-NEXT: vextracti32x4 $2, %zmm0, %xmm1
52 ; CHECK-NEXT: vmovq %xmm1, %rax
53 ; CHECK-NEXT: vpinsrq $1, %rax, %xmm0, %xmm1
54 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
56 %eee = extractelement <8 x i64> %x, i32 4
57 %rrr2 = insertelement <8 x i64> %x, i64 %eee, i32 1
61 define i32 @test5(<4 x float> %x) nounwind {
64 ; CHECK-NEXT: vextractps $3, %xmm0, %eax
66 %ef = extractelement <4 x float> %x, i32 3
67 %ei = bitcast float %ef to i32
71 define void @test6(<4 x float> %x, float* %out) nounwind {
74 ; CHECK-NEXT: vextractps $3, %xmm0, (%rdi)
76 %ef = extractelement <4 x float> %x, i32 3
77 store float %ef, float* %out, align 4
81 define float @test7(<16 x float> %x, i32 %ind) nounwind {
84 ; CHECK-NEXT: pushq %rbp
85 ; CHECK-NEXT: movq %rsp, %rbp
86 ; CHECK-NEXT: andq $-64, %rsp
87 ; CHECK-NEXT: subq $128, %rsp
88 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
89 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
90 ; CHECK-NEXT: andl $15, %edi
91 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
92 ; CHECK-NEXT: movq %rbp, %rsp
93 ; CHECK-NEXT: popq %rbp
94 ; CHECK-NEXT: vzeroupper
96 %e = extractelement <16 x float> %x, i32 %ind
100 define double @test8(<8 x double> %x, i32 %ind) nounwind {
101 ; CHECK-LABEL: test8:
103 ; CHECK-NEXT: pushq %rbp
104 ; CHECK-NEXT: movq %rsp, %rbp
105 ; CHECK-NEXT: andq $-64, %rsp
106 ; CHECK-NEXT: subq $128, %rsp
107 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
108 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
109 ; CHECK-NEXT: andl $7, %edi
110 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
111 ; CHECK-NEXT: movq %rbp, %rsp
112 ; CHECK-NEXT: popq %rbp
113 ; CHECK-NEXT: vzeroupper
115 %e = extractelement <8 x double> %x, i32 %ind
119 define float @test9(<8 x float> %x, i32 %ind) nounwind {
120 ; CHECK-LABEL: test9:
122 ; CHECK-NEXT: pushq %rbp
123 ; CHECK-NEXT: movq %rsp, %rbp
124 ; CHECK-NEXT: andq $-32, %rsp
125 ; CHECK-NEXT: subq $64, %rsp
126 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
127 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
128 ; CHECK-NEXT: andl $7, %edi
129 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
130 ; CHECK-NEXT: movq %rbp, %rsp
131 ; CHECK-NEXT: popq %rbp
132 ; CHECK-NEXT: vzeroupper
134 %e = extractelement <8 x float> %x, i32 %ind
138 define i32 @test10(<16 x i32> %x, i32 %ind) nounwind {
139 ; CHECK-LABEL: test10:
141 ; CHECK-NEXT: pushq %rbp
142 ; CHECK-NEXT: movq %rsp, %rbp
143 ; CHECK-NEXT: andq $-64, %rsp
144 ; CHECK-NEXT: subq $128, %rsp
145 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
146 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
147 ; CHECK-NEXT: andl $15, %edi
148 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
149 ; CHECK-NEXT: movq %rbp, %rsp
150 ; CHECK-NEXT: popq %rbp
151 ; CHECK-NEXT: vzeroupper
153 %e = extractelement <16 x i32> %x, i32 %ind
157 define <16 x i32> @test11(<16 x i32>%a, <16 x i32>%b) {
160 ; KNL-NEXT: vpcmpltud %zmm1, %zmm0, %k0
161 ; KNL-NEXT: kshiftrw $4, %k0, %k0
162 ; KNL-NEXT: kmovw %k0, %eax
163 ; KNL-NEXT: testb $1, %al
164 ; KNL-NEXT: je LBB10_2
165 ; KNL-NEXT: ## %bb.1: ## %A
166 ; KNL-NEXT: vmovdqa64 %zmm1, %zmm0
168 ; KNL-NEXT: LBB10_2: ## %B
169 ; KNL-NEXT: vpaddd %zmm0, %zmm1, %zmm0
174 ; SKX-NEXT: vpcmpltud %zmm1, %zmm0, %k0
175 ; SKX-NEXT: kshiftrw $4, %k0, %k0
176 ; SKX-NEXT: kmovd %k0, %eax
177 ; SKX-NEXT: testb $1, %al
178 ; SKX-NEXT: je LBB10_2
179 ; SKX-NEXT: ## %bb.1: ## %A
180 ; SKX-NEXT: vmovdqa64 %zmm1, %zmm0
182 ; SKX-NEXT: LBB10_2: ## %B
183 ; SKX-NEXT: vpaddd %zmm0, %zmm1, %zmm0
185 %cmp_res = icmp ult <16 x i32> %a, %b
186 %ia = extractelement <16 x i1> %cmp_res, i32 4
187 br i1 %ia, label %A, label %B
191 %c = add <16 x i32>%b, %a
195 define i64 @test12(<16 x i64>%a, <16 x i64>%b, i64 %a1, i64 %b1) {
198 ; KNL-NEXT: movq %rdi, %rax
199 ; KNL-NEXT: vpcmpgtq %zmm0, %zmm2, %k0
200 ; KNL-NEXT: kmovw %k0, %ecx
201 ; KNL-NEXT: testb $1, %cl
202 ; KNL-NEXT: cmoveq %rsi, %rax
203 ; KNL-NEXT: vzeroupper
208 ; SKX-NEXT: movq %rdi, %rax
209 ; SKX-NEXT: vpcmpgtq %zmm0, %zmm2, %k0
210 ; SKX-NEXT: kmovd %k0, %ecx
211 ; SKX-NEXT: testb $1, %cl
212 ; SKX-NEXT: cmoveq %rsi, %rax
213 ; SKX-NEXT: vzeroupper
215 %cmpvector_func.i = icmp slt <16 x i64> %a, %b
216 %extract24vector_func.i = extractelement <16 x i1> %cmpvector_func.i, i32 0
217 %res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
221 define i16 @test13(i32 %a, i32 %b) {
224 ; KNL-NEXT: cmpl %esi, %edi
226 ; KNL-NEXT: movw $-4, %cx
227 ; KNL-NEXT: kmovw %ecx, %k0
228 ; KNL-NEXT: kshiftrw $1, %k0, %k0
229 ; KNL-NEXT: kshiftlw $1, %k0, %k0
230 ; KNL-NEXT: andl $1, %eax
231 ; KNL-NEXT: kmovw %eax, %k1
232 ; KNL-NEXT: korw %k1, %k0, %k0
233 ; KNL-NEXT: kmovw %k0, %eax
234 ; KNL-NEXT: ## kill: def $ax killed $ax killed $eax
239 ; SKX-NEXT: cmpl %esi, %edi
241 ; SKX-NEXT: movw $-4, %cx
242 ; SKX-NEXT: kmovd %ecx, %k0
243 ; SKX-NEXT: kshiftrw $1, %k0, %k0
244 ; SKX-NEXT: kshiftlw $1, %k0, %k0
245 ; SKX-NEXT: andl $1, %eax
246 ; SKX-NEXT: kmovw %eax, %k1
247 ; SKX-NEXT: korw %k1, %k0, %k0
248 ; SKX-NEXT: kmovd %k0, %eax
249 ; SKX-NEXT: ## kill: def $ax killed $ax killed $eax
251 %cmp_res = icmp ult i32 %a, %b
252 %maskv = insertelement <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>, i1 %cmp_res, i32 0
253 %res = bitcast <16 x i1> %maskv to i16
257 define i64 @test14(<8 x i64>%a, <8 x i64>%b, i64 %a1, i64 %b1) {
260 ; KNL-NEXT: movq %rdi, %rax
261 ; KNL-NEXT: vpcmpgtq %zmm0, %zmm1, %k0
262 ; KNL-NEXT: kshiftrw $4, %k0, %k0
263 ; KNL-NEXT: kmovw %k0, %ecx
264 ; KNL-NEXT: testb $1, %cl
265 ; KNL-NEXT: cmoveq %rsi, %rax
266 ; KNL-NEXT: vzeroupper
271 ; SKX-NEXT: movq %rdi, %rax
272 ; SKX-NEXT: vpcmpgtq %zmm0, %zmm1, %k0
273 ; SKX-NEXT: kshiftrb $4, %k0, %k0
274 ; SKX-NEXT: kmovd %k0, %ecx
275 ; SKX-NEXT: testb $1, %cl
276 ; SKX-NEXT: cmoveq %rsi, %rax
277 ; SKX-NEXT: vzeroupper
279 %cmpvector_func.i = icmp slt <8 x i64> %a, %b
280 %extract24vector_func.i = extractelement <8 x i1> %cmpvector_func.i, i32 4
281 %res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
285 define i16 @test15(i1 *%addr) {
286 ; CHECK-LABEL: test15:
288 ; CHECK-NEXT: xorl %ecx, %ecx
289 ; CHECK-NEXT: cmpb $0, (%rdi)
290 ; CHECK-NEXT: movl $65535, %eax ## imm = 0xFFFF
291 ; CHECK-NEXT: cmovel %ecx, %eax
292 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
294 %x = load i1 , i1 * %addr, align 1
295 %x1 = insertelement <16 x i1> undef, i1 %x, i32 10
296 %x2 = bitcast <16 x i1>%x1 to i16
300 define i16 @test16(i1 *%addr, i16 %a) {
303 ; KNL-NEXT: movb (%rdi), %al
304 ; KNL-NEXT: kmovw %esi, %k0
305 ; KNL-NEXT: kmovw %eax, %k1
306 ; KNL-NEXT: kshiftrw $10, %k0, %k2
307 ; KNL-NEXT: kxorw %k1, %k2, %k1
308 ; KNL-NEXT: kshiftlw $15, %k1, %k1
309 ; KNL-NEXT: kshiftrw $5, %k1, %k1
310 ; KNL-NEXT: kxorw %k1, %k0, %k0
311 ; KNL-NEXT: kmovw %k0, %eax
312 ; KNL-NEXT: ## kill: def $ax killed $ax killed $eax
317 ; SKX-NEXT: kmovb (%rdi), %k0
318 ; SKX-NEXT: kmovd %esi, %k1
319 ; SKX-NEXT: kshiftrw $10, %k1, %k2
320 ; SKX-NEXT: kxorw %k0, %k2, %k0
321 ; SKX-NEXT: kshiftlw $15, %k0, %k0
322 ; SKX-NEXT: kshiftrw $5, %k0, %k0
323 ; SKX-NEXT: kxorw %k0, %k1, %k0
324 ; SKX-NEXT: kmovd %k0, %eax
325 ; SKX-NEXT: ## kill: def $ax killed $ax killed $eax
327 %x = load i1 , i1 * %addr, align 128
328 %a1 = bitcast i16 %a to <16 x i1>
329 %x1 = insertelement <16 x i1> %a1, i1 %x, i32 10
330 %x2 = bitcast <16 x i1>%x1 to i16
334 define i8 @test17(i1 *%addr, i8 %a) {
337 ; KNL-NEXT: movb (%rdi), %al
338 ; KNL-NEXT: kmovw %esi, %k0
339 ; KNL-NEXT: kmovw %eax, %k1
340 ; KNL-NEXT: kshiftrw $4, %k0, %k2
341 ; KNL-NEXT: kxorw %k1, %k2, %k1
342 ; KNL-NEXT: kshiftlw $15, %k1, %k1
343 ; KNL-NEXT: kshiftrw $11, %k1, %k1
344 ; KNL-NEXT: kxorw %k1, %k0, %k0
345 ; KNL-NEXT: kmovw %k0, %eax
346 ; KNL-NEXT: ## kill: def $al killed $al killed $eax
351 ; SKX-NEXT: kmovb (%rdi), %k0
352 ; SKX-NEXT: kmovd %esi, %k1
353 ; SKX-NEXT: kshiftrb $4, %k1, %k2
354 ; SKX-NEXT: kxorb %k0, %k2, %k0
355 ; SKX-NEXT: kshiftlb $7, %k0, %k0
356 ; SKX-NEXT: kshiftrb $3, %k0, %k0
357 ; SKX-NEXT: kxorb %k0, %k1, %k0
358 ; SKX-NEXT: kmovd %k0, %eax
359 ; SKX-NEXT: ## kill: def $al killed $al killed $eax
361 %x = load i1 , i1 * %addr, align 128
362 %a1 = bitcast i8 %a to <8 x i1>
363 %x1 = insertelement <8 x i1> %a1, i1 %x, i32 4
364 %x2 = bitcast <8 x i1>%x1 to i8
368 define i64 @extract_v8i64(<8 x i64> %x, i64* %dst) {
369 ; CHECK-LABEL: extract_v8i64:
371 ; CHECK-NEXT: vpextrq $1, %xmm0, %rax
372 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
373 ; CHECK-NEXT: vpextrq $1, %xmm0, (%rdi)
374 ; CHECK-NEXT: vzeroupper
376 %r1 = extractelement <8 x i64> %x, i32 1
377 %r2 = extractelement <8 x i64> %x, i32 3
378 store i64 %r2, i64* %dst, align 1
382 define i64 @extract_v4i64(<4 x i64> %x, i64* %dst) {
383 ; CHECK-LABEL: extract_v4i64:
385 ; CHECK-NEXT: vpextrq $1, %xmm0, %rax
386 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
387 ; CHECK-NEXT: vpextrq $1, %xmm0, (%rdi)
388 ; CHECK-NEXT: vzeroupper
390 %r1 = extractelement <4 x i64> %x, i32 1
391 %r2 = extractelement <4 x i64> %x, i32 3
392 store i64 %r2, i64* %dst, align 1
396 define i64 @extract_v2i64(<2 x i64> %x, i64* %dst) {
397 ; CHECK-LABEL: extract_v2i64:
399 ; CHECK-NEXT: vmovq %xmm0, %rax
400 ; CHECK-NEXT: vpextrq $1, %xmm0, (%rdi)
402 %r1 = extractelement <2 x i64> %x, i32 0
403 %r2 = extractelement <2 x i64> %x, i32 1
404 store i64 %r2, i64* %dst, align 1
408 define i32 @extract_v16i32(<16 x i32> %x, i32* %dst) {
409 ; CHECK-LABEL: extract_v16i32:
411 ; CHECK-NEXT: vextractps $1, %xmm0, %eax
412 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
413 ; CHECK-NEXT: vextractps $1, %xmm0, (%rdi)
414 ; CHECK-NEXT: vzeroupper
416 %r1 = extractelement <16 x i32> %x, i32 1
417 %r2 = extractelement <16 x i32> %x, i32 5
418 store i32 %r2, i32* %dst, align 1
422 define i32 @extract_v8i32(<8 x i32> %x, i32* %dst) {
423 ; CHECK-LABEL: extract_v8i32:
425 ; CHECK-NEXT: vextractps $1, %xmm0, %eax
426 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
427 ; CHECK-NEXT: vextractps $1, %xmm0, (%rdi)
428 ; CHECK-NEXT: vzeroupper
430 %r1 = extractelement <8 x i32> %x, i32 1
431 %r2 = extractelement <8 x i32> %x, i32 5
432 store i32 %r2, i32* %dst, align 1
436 define i32 @extract_v4i32(<4 x i32> %x, i32* %dst) {
437 ; CHECK-LABEL: extract_v4i32:
439 ; CHECK-NEXT: vextractps $1, %xmm0, %eax
440 ; CHECK-NEXT: vextractps $3, %xmm0, (%rdi)
442 %r1 = extractelement <4 x i32> %x, i32 1
443 %r2 = extractelement <4 x i32> %x, i32 3
444 store i32 %r2, i32* %dst, align 1
448 define i16 @extract_v32i16(<32 x i16> %x, i16* %dst) {
449 ; CHECK-LABEL: extract_v32i16:
451 ; CHECK-NEXT: vpextrw $1, %xmm0, %eax
452 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
453 ; CHECK-NEXT: vpextrw $1, %xmm0, (%rdi)
454 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
455 ; CHECK-NEXT: vzeroupper
457 %r1 = extractelement <32 x i16> %x, i32 1
458 %r2 = extractelement <32 x i16> %x, i32 9
459 store i16 %r2, i16* %dst, align 1
463 define i16 @extract_v16i16(<16 x i16> %x, i16* %dst) {
464 ; CHECK-LABEL: extract_v16i16:
466 ; CHECK-NEXT: vpextrw $1, %xmm0, %eax
467 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
468 ; CHECK-NEXT: vpextrw $1, %xmm0, (%rdi)
469 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
470 ; CHECK-NEXT: vzeroupper
472 %r1 = extractelement <16 x i16> %x, i32 1
473 %r2 = extractelement <16 x i16> %x, i32 9
474 store i16 %r2, i16* %dst, align 1
478 define i16 @extract_v8i16(<8 x i16> %x, i16* %dst) {
479 ; CHECK-LABEL: extract_v8i16:
481 ; CHECK-NEXT: vpextrw $1, %xmm0, %eax
482 ; CHECK-NEXT: vpextrw $3, %xmm0, (%rdi)
483 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
485 %r1 = extractelement <8 x i16> %x, i32 1
486 %r2 = extractelement <8 x i16> %x, i32 3
487 store i16 %r2, i16* %dst, align 1
491 define i8 @extract_v64i8(<64 x i8> %x, i8* %dst) {
492 ; CHECK-LABEL: extract_v64i8:
494 ; CHECK-NEXT: vpextrb $1, %xmm0, %eax
495 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
496 ; CHECK-NEXT: vpextrb $1, %xmm0, (%rdi)
497 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
498 ; CHECK-NEXT: vzeroupper
500 %r1 = extractelement <64 x i8> %x, i32 1
501 %r2 = extractelement <64 x i8> %x, i32 17
502 store i8 %r2, i8* %dst, align 1
506 define i8 @extract_v32i8(<32 x i8> %x, i8* %dst) {
507 ; CHECK-LABEL: extract_v32i8:
509 ; CHECK-NEXT: vpextrb $1, %xmm0, %eax
510 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
511 ; CHECK-NEXT: vpextrb $1, %xmm0, (%rdi)
512 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
513 ; CHECK-NEXT: vzeroupper
515 %r1 = extractelement <32 x i8> %x, i32 1
516 %r2 = extractelement <32 x i8> %x, i32 17
517 store i8 %r2, i8* %dst, align 1
521 define i8 @extract_v16i8(<16 x i8> %x, i8* %dst) {
522 ; CHECK-LABEL: extract_v16i8:
524 ; CHECK-NEXT: vpextrb $1, %xmm0, %eax
525 ; CHECK-NEXT: vpextrb $3, %xmm0, (%rdi)
526 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
528 %r1 = extractelement <16 x i8> %x, i32 1
529 %r2 = extractelement <16 x i8> %x, i32 3
530 store i8 %r2, i8* %dst, align 1
534 define <8 x i64> @insert_v8i64(<8 x i64> %x, i64 %y , i64* %ptr) {
535 ; CHECK-LABEL: insert_v8i64:
537 ; CHECK-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm1
538 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
539 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
540 ; CHECK-NEXT: vpinsrq $1, %rdi, %xmm0, %xmm0
541 ; CHECK-NEXT: vinserti32x4 $1, %xmm0, %zmm1, %zmm0
543 %val = load i64, i64* %ptr
544 %r1 = insertelement <8 x i64> %x, i64 %val, i32 1
545 %r2 = insertelement <8 x i64> %r1, i64 %y, i32 3
549 define <4 x i64> @insert_v4i64(<4 x i64> %x, i64 %y , i64* %ptr) {
550 ; CHECK-LABEL: insert_v4i64:
552 ; CHECK-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm1
553 ; CHECK-NEXT: vpblendd {{.*#+}} ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
554 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
555 ; CHECK-NEXT: vpinsrq $1, %rdi, %xmm0, %xmm0
556 ; CHECK-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
558 %val = load i64, i64* %ptr
559 %r1 = insertelement <4 x i64> %x, i64 %val, i32 1
560 %r2 = insertelement <4 x i64> %r1, i64 %y, i32 3
564 define <2 x i64> @insert_v2i64(<2 x i64> %x, i64 %y , i64* %ptr) {
565 ; CHECK-LABEL: insert_v2i64:
567 ; CHECK-NEXT: vpinsrq $0, %rdi, %xmm0, %xmm0
568 ; CHECK-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm0
570 %val = load i64, i64* %ptr
571 %r1 = insertelement <2 x i64> %x, i64 %val, i32 1
572 %r2 = insertelement <2 x i64> %r1, i64 %y, i32 0
576 define <16 x i32> @insert_v16i32(<16 x i32> %x, i32 %y, i32* %ptr) {
577 ; CHECK-LABEL: insert_v16i32:
579 ; CHECK-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm1
580 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
581 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
582 ; CHECK-NEXT: vpinsrd $1, %edi, %xmm0, %xmm0
583 ; CHECK-NEXT: vinserti32x4 $1, %xmm0, %zmm1, %zmm0
585 %val = load i32, i32* %ptr
586 %r1 = insertelement <16 x i32> %x, i32 %val, i32 1
587 %r2 = insertelement <16 x i32> %r1, i32 %y, i32 5
591 define <8 x i32> @insert_v8i32(<8 x i32> %x, i32 %y, i32* %ptr) {
592 ; CHECK-LABEL: insert_v8i32:
594 ; CHECK-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm1
595 ; CHECK-NEXT: vpblendd {{.*#+}} ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
596 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
597 ; CHECK-NEXT: vpinsrd $1, %edi, %xmm0, %xmm0
598 ; CHECK-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
600 %val = load i32, i32* %ptr
601 %r1 = insertelement <8 x i32> %x, i32 %val, i32 1
602 %r2 = insertelement <8 x i32> %r1, i32 %y, i32 5
606 define <4 x i32> @insert_v4i32(<4 x i32> %x, i32 %y, i32* %ptr) {
607 ; CHECK-LABEL: insert_v4i32:
609 ; CHECK-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm0
610 ; CHECK-NEXT: vpinsrd $3, %edi, %xmm0, %xmm0
612 %val = load i32, i32* %ptr
613 %r1 = insertelement <4 x i32> %x, i32 %val, i32 1
614 %r2 = insertelement <4 x i32> %r1, i32 %y, i32 3
618 define <32 x i16> @insert_v32i16(<32 x i16> %x, i16 %y, i16* %ptr) {
619 ; KNL-LABEL: insert_v32i16:
621 ; KNL-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
622 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm2
623 ; KNL-NEXT: vpinsrw $1, %edi, %xmm2, %xmm2
624 ; KNL-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
625 ; KNL-NEXT: vshufi64x2 {{.*#+}} zmm0 = zmm1[0,1,2,3],zmm0[4,5,6,7]
628 ; SKX-LABEL: insert_v32i16:
630 ; SKX-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
631 ; SKX-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
632 ; SKX-NEXT: vextracti128 $1, %ymm0, %xmm0
633 ; SKX-NEXT: vpinsrw $1, %edi, %xmm0, %xmm0
634 ; SKX-NEXT: vinserti32x4 $1, %xmm0, %zmm1, %zmm0
636 %val = load i16, i16* %ptr
637 %r1 = insertelement <32 x i16> %x, i16 %val, i32 1
638 %r2 = insertelement <32 x i16> %r1, i16 %y, i32 9
642 define <16 x i16> @insert_v16i16(<16 x i16> %x, i16 %y, i16* %ptr) {
643 ; CHECK-LABEL: insert_v16i16:
645 ; CHECK-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
646 ; CHECK-NEXT: vpblendd {{.*#+}} ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
647 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
648 ; CHECK-NEXT: vpinsrw $1, %edi, %xmm0, %xmm0
649 ; CHECK-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
651 %val = load i16, i16* %ptr
652 %r1 = insertelement <16 x i16> %x, i16 %val, i32 1
653 %r2 = insertelement <16 x i16> %r1, i16 %y, i32 9
657 define <8 x i16> @insert_v8i16(<8 x i16> %x, i16 %y, i16* %ptr) {
658 ; CHECK-LABEL: insert_v8i16:
660 ; CHECK-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm0
661 ; CHECK-NEXT: vpinsrw $5, %edi, %xmm0, %xmm0
663 %val = load i16, i16* %ptr
664 %r1 = insertelement <8 x i16> %x, i16 %val, i32 1
665 %r2 = insertelement <8 x i16> %r1, i16 %y, i32 5
669 define <64 x i8> @insert_v64i8(<64 x i8> %x, i8 %y, i8* %ptr) {
670 ; KNL-LABEL: insert_v64i8:
672 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm1
673 ; KNL-NEXT: vpinsrb $1, (%rsi), %xmm0, %xmm2
674 ; KNL-NEXT: vpblendd {{.*#+}} ymm0 = ymm2[0,1,2,3],ymm0[4,5,6,7]
675 ; KNL-NEXT: vextracti128 $1, %ymm1, %xmm2
676 ; KNL-NEXT: vpinsrb $2, %edi, %xmm2, %xmm2
677 ; KNL-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
678 ; KNL-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
681 ; SKX-LABEL: insert_v64i8:
683 ; SKX-NEXT: vpinsrb $1, (%rsi), %xmm0, %xmm1
684 ; SKX-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
685 ; SKX-NEXT: vextracti32x4 $3, %zmm0, %xmm0
686 ; SKX-NEXT: vpinsrb $2, %edi, %xmm0, %xmm0
687 ; SKX-NEXT: vinserti32x4 $3, %xmm0, %zmm1, %zmm0
689 %val = load i8, i8* %ptr
690 %r1 = insertelement <64 x i8> %x, i8 %val, i32 1
691 %r2 = insertelement <64 x i8> %r1, i8 %y, i32 50
695 define <32 x i8> @insert_v32i8(<32 x i8> %x, i8 %y, i8* %ptr) {
696 ; CHECK-LABEL: insert_v32i8:
698 ; CHECK-NEXT: vpinsrb $1, (%rsi), %xmm0, %xmm1
699 ; CHECK-NEXT: vpblendd {{.*#+}} ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
700 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
701 ; CHECK-NEXT: vpinsrb $1, %edi, %xmm0, %xmm0
702 ; CHECK-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
704 %val = load i8, i8* %ptr
705 %r1 = insertelement <32 x i8> %x, i8 %val, i32 1
706 %r2 = insertelement <32 x i8> %r1, i8 %y, i32 17
710 define <16 x i8> @insert_v16i8(<16 x i8> %x, i8 %y, i8* %ptr) {
711 ; CHECK-LABEL: insert_v16i8:
713 ; CHECK-NEXT: vpinsrb $3, (%rsi), %xmm0, %xmm0
714 ; CHECK-NEXT: vpinsrb $10, %edi, %xmm0, %xmm0
716 %val = load i8, i8* %ptr
717 %r1 = insertelement <16 x i8> %x, i8 %val, i32 3
718 %r2 = insertelement <16 x i8> %r1, i8 %y, i32 10
722 define <8 x i64> @test_insert_128_v8i64(<8 x i64> %x, i64 %y) {
723 ; CHECK-LABEL: test_insert_128_v8i64:
725 ; CHECK-NEXT: vpinsrq $1, %rdi, %xmm0, %xmm1
726 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
728 %r = insertelement <8 x i64> %x, i64 %y, i32 1
732 define <16 x i32> @test_insert_128_v16i32(<16 x i32> %x, i32 %y) {
733 ; CHECK-LABEL: test_insert_128_v16i32:
735 ; CHECK-NEXT: vpinsrd $1, %edi, %xmm0, %xmm1
736 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
738 %r = insertelement <16 x i32> %x, i32 %y, i32 1
742 define <8 x double> @test_insert_128_v8f64(<8 x double> %x, double %y) {
743 ; CHECK-LABEL: test_insert_128_v8f64:
745 ; CHECK-NEXT: vmovlhps {{.*#+}} xmm1 = xmm0[0],xmm1[0]
746 ; CHECK-NEXT: vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
748 %r = insertelement <8 x double> %x, double %y, i32 1
752 define <16 x float> @test_insert_128_v16f32(<16 x float> %x, float %y) {
753 ; CHECK-LABEL: test_insert_128_v16f32:
755 ; CHECK-NEXT: vinsertps {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[2,3]
756 ; CHECK-NEXT: vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
758 %r = insertelement <16 x float> %x, float %y, i32 1
762 define <16 x i16> @test_insert_128_v16i16(<16 x i16> %x, i16 %y) {
763 ; CHECK-LABEL: test_insert_128_v16i16:
765 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm1
766 ; CHECK-NEXT: vpinsrw $2, %edi, %xmm1, %xmm1
767 ; CHECK-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
769 %r = insertelement <16 x i16> %x, i16 %y, i32 10
773 define <32 x i8> @test_insert_128_v32i8(<32 x i8> %x, i8 %y) {
774 ; CHECK-LABEL: test_insert_128_v32i8:
776 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm1
777 ; CHECK-NEXT: vpinsrb $4, %edi, %xmm1, %xmm1
778 ; CHECK-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
780 %r = insertelement <32 x i8> %x, i8 %y, i32 20
784 define i32 @test_insertelement_v32i1(i32 %a, i32 %b, <32 x i32> %x , <32 x i32> %y) {
785 ; KNL-LABEL: test_insertelement_v32i1:
787 ; KNL-NEXT: cmpl %esi, %edi
789 ; KNL-NEXT: vpcmpltud %zmm3, %zmm1, %k0
790 ; KNL-NEXT: kmovw %k0, %ecx
791 ; KNL-NEXT: shll $16, %ecx
792 ; KNL-NEXT: vpcmpltud %zmm2, %zmm0, %k0
793 ; KNL-NEXT: kshiftrw $4, %k0, %k1
794 ; KNL-NEXT: kmovw %eax, %k2
795 ; KNL-NEXT: kxorw %k2, %k1, %k1
796 ; KNL-NEXT: kshiftlw $15, %k1, %k1
797 ; KNL-NEXT: kshiftrw $11, %k1, %k1
798 ; KNL-NEXT: kxorw %k1, %k0, %k0
799 ; KNL-NEXT: kmovw %k0, %eax
800 ; KNL-NEXT: orl %ecx, %eax
801 ; KNL-NEXT: vzeroupper
804 ; SKX-LABEL: test_insertelement_v32i1:
806 ; SKX-NEXT: cmpl %esi, %edi
808 ; SKX-NEXT: vpcmpltud %zmm2, %zmm0, %k0
809 ; SKX-NEXT: vpcmpltud %zmm3, %zmm1, %k1
810 ; SKX-NEXT: kunpckwd %k0, %k1, %k0
811 ; SKX-NEXT: kshiftrd $4, %k0, %k1
812 ; SKX-NEXT: kmovd %eax, %k2
813 ; SKX-NEXT: kxord %k2, %k1, %k1
814 ; SKX-NEXT: kshiftld $31, %k1, %k1
815 ; SKX-NEXT: kshiftrd $27, %k1, %k1
816 ; SKX-NEXT: kxord %k1, %k0, %k0
817 ; SKX-NEXT: kmovd %k0, %eax
818 ; SKX-NEXT: vzeroupper
820 %cmp_res_i1 = icmp ult i32 %a, %b
821 %cmp_cmp_vec = icmp ult <32 x i32> %x, %y
822 %maskv = insertelement <32 x i1> %cmp_cmp_vec, i1 %cmp_res_i1, i32 4
823 %res = bitcast <32 x i1> %maskv to i32
827 define i8 @test_iinsertelement_v4i1(i32 %a, i32 %b, <4 x i32> %x , <4 x i32> %y) {
828 ; KNL-LABEL: test_iinsertelement_v4i1:
830 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
831 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
832 ; KNL-NEXT: cmpl %esi, %edi
834 ; KNL-NEXT: vpcmpltud %zmm1, %zmm0, %k0
835 ; KNL-NEXT: kshiftrw $2, %k0, %k1
836 ; KNL-NEXT: kmovw %eax, %k2
837 ; KNL-NEXT: kxorw %k2, %k1, %k1
838 ; KNL-NEXT: kshiftlw $15, %k1, %k1
839 ; KNL-NEXT: kshiftrw $13, %k1, %k1
840 ; KNL-NEXT: kxorw %k1, %k0, %k0
841 ; KNL-NEXT: kmovw %k0, %eax
842 ; KNL-NEXT: ## kill: def $al killed $al killed $eax
843 ; KNL-NEXT: vzeroupper
846 ; SKX-LABEL: test_iinsertelement_v4i1:
848 ; SKX-NEXT: cmpl %esi, %edi
850 ; SKX-NEXT: vpcmpltud %xmm1, %xmm0, %k0
851 ; SKX-NEXT: kshiftrb $2, %k0, %k1
852 ; SKX-NEXT: kmovd %eax, %k2
853 ; SKX-NEXT: kxorb %k2, %k1, %k1
854 ; SKX-NEXT: kshiftlb $7, %k1, %k1
855 ; SKX-NEXT: kshiftrb $5, %k1, %k1
856 ; SKX-NEXT: kxorw %k1, %k0, %k0
857 ; SKX-NEXT: kmovd %k0, %eax
858 ; SKX-NEXT: ## kill: def $al killed $al killed $eax
860 %cmp_res_i1 = icmp ult i32 %a, %b
861 %cmp_cmp_vec = icmp ult <4 x i32> %x, %y
862 %maskv = insertelement <4 x i1> %cmp_cmp_vec, i1 %cmp_res_i1, i32 2
863 %res0 = shufflevector <4 x i1> %maskv, <4 x i1> undef , <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 4, i32 4, i32 4>
864 %res = bitcast <8 x i1> %res0 to i8
868 define i8 @test_iinsertelement_v2i1(i32 %a, i32 %b, <2 x i64> %x , <2 x i64> %y) {
869 ; KNL-LABEL: test_iinsertelement_v2i1:
871 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
872 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
873 ; KNL-NEXT: cmpl %esi, %edi
875 ; KNL-NEXT: vpcmpltuq %zmm1, %zmm0, %k0
876 ; KNL-NEXT: kshiftlw $15, %k0, %k0
877 ; KNL-NEXT: kshiftrw $15, %k0, %k0
878 ; KNL-NEXT: kmovw %eax, %k1
879 ; KNL-NEXT: kshiftlw $1, %k1, %k1
880 ; KNL-NEXT: korw %k1, %k0, %k0
881 ; KNL-NEXT: kmovw %k0, %eax
882 ; KNL-NEXT: ## kill: def $al killed $al killed $eax
883 ; KNL-NEXT: vzeroupper
886 ; SKX-LABEL: test_iinsertelement_v2i1:
888 ; SKX-NEXT: cmpl %esi, %edi
890 ; SKX-NEXT: vpcmpltuq %xmm1, %xmm0, %k0
891 ; SKX-NEXT: kshiftlb $7, %k0, %k0
892 ; SKX-NEXT: kshiftrb $7, %k0, %k0
893 ; SKX-NEXT: kmovd %eax, %k1
894 ; SKX-NEXT: kshiftlb $1, %k1, %k1
895 ; SKX-NEXT: korw %k1, %k0, %k0
896 ; SKX-NEXT: kmovd %k0, %eax
897 ; SKX-NEXT: ## kill: def $al killed $al killed $eax
899 %cmp_res_i1 = icmp ult i32 %a, %b
900 %cmp_cmp_vec = icmp ult <2 x i64> %x, %y
901 %maskv = insertelement <2 x i1> %cmp_cmp_vec, i1 %cmp_res_i1, i32 1
902 %res0 = shufflevector <2 x i1> %maskv, <2 x i1> undef , <8 x i32> <i32 0, i32 1, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
903 %res = bitcast <8 x i1> %res0 to i8
907 define zeroext i8 @test_extractelement_v2i1(<2 x i64> %a, <2 x i64> %b) {
908 ; KNL-LABEL: test_extractelement_v2i1:
910 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
911 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
912 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k0
913 ; KNL-NEXT: kmovw %k0, %ecx
914 ; KNL-NEXT: andl $1, %ecx
915 ; KNL-NEXT: movl $4, %eax
916 ; KNL-NEXT: subl %ecx, %eax
917 ; KNL-NEXT: vzeroupper
920 ; SKX-LABEL: test_extractelement_v2i1:
922 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
923 ; SKX-NEXT: kmovd %k0, %ecx
924 ; SKX-NEXT: andl $1, %ecx
925 ; SKX-NEXT: movl $4, %eax
926 ; SKX-NEXT: subl %ecx, %eax
928 %t1 = icmp ugt <2 x i64> %a, %b
929 %t2 = extractelement <2 x i1> %t1, i32 0
930 %res = select i1 %t2, i8 3, i8 4
934 define zeroext i8 @extractelement_v2i1_alt(<2 x i64> %a, <2 x i64> %b) {
935 ; KNL-LABEL: extractelement_v2i1_alt:
937 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
938 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
939 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k0
940 ; KNL-NEXT: kmovw %k0, %eax
941 ; KNL-NEXT: andb $1, %al
942 ; KNL-NEXT: movb $4, %cl
943 ; KNL-NEXT: subb %al, %cl
944 ; KNL-NEXT: movzbl %cl, %eax
945 ; KNL-NEXT: vzeroupper
948 ; SKX-LABEL: extractelement_v2i1_alt:
950 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
951 ; SKX-NEXT: kmovd %k0, %eax
952 ; SKX-NEXT: andb $1, %al
953 ; SKX-NEXT: movb $4, %cl
954 ; SKX-NEXT: subb %al, %cl
955 ; SKX-NEXT: movzbl %cl, %eax
957 %t1 = icmp ugt <2 x i64> %a, %b
958 %t2 = extractelement <2 x i1> %t1, i32 0
959 %sext = sext i1 %t2 to i8
960 %res = add i8 %sext, 4
964 define zeroext i8 @test_extractelement_v4i1(<4 x i32> %a, <4 x i32> %b) {
965 ; KNL-LABEL: test_extractelement_v4i1:
967 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
968 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
969 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k0
970 ; KNL-NEXT: kshiftrw $3, %k0, %k0
971 ; KNL-NEXT: kmovw %k0, %eax
972 ; KNL-NEXT: andl $1, %eax
973 ; KNL-NEXT: vzeroupper
976 ; SKX-LABEL: test_extractelement_v4i1:
978 ; SKX-NEXT: vpcmpnleud %xmm1, %xmm0, %k0
979 ; SKX-NEXT: kshiftrb $3, %k0, %k0
980 ; SKX-NEXT: kmovd %k0, %eax
981 ; SKX-NEXT: andl $1, %eax
983 %t1 = icmp ugt <4 x i32> %a, %b
984 %t2 = extractelement <4 x i1> %t1, i32 3
985 %res = zext i1 %t2 to i8
989 define zeroext i8 @test_extractelement_v32i1(<32 x i8> %a, <32 x i8> %b) {
990 ; KNL-LABEL: test_extractelement_v32i1:
992 ; KNL-NEXT: vpminub %xmm1, %xmm0, %xmm1
993 ; KNL-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
994 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
995 ; KNL-NEXT: vpmovsxbd %xmm0, %zmm0
996 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
997 ; KNL-NEXT: kshiftrw $2, %k0, %k0
998 ; KNL-NEXT: kmovw %k0, %eax
999 ; KNL-NEXT: andl $1, %eax
1000 ; KNL-NEXT: vzeroupper
1003 ; SKX-LABEL: test_extractelement_v32i1:
1005 ; SKX-NEXT: vpcmpnleub %ymm1, %ymm0, %k0
1006 ; SKX-NEXT: kshiftrd $2, %k0, %k0
1007 ; SKX-NEXT: kmovd %k0, %eax
1008 ; SKX-NEXT: andl $1, %eax
1009 ; SKX-NEXT: vzeroupper
1011 %t1 = icmp ugt <32 x i8> %a, %b
1012 %t2 = extractelement <32 x i1> %t1, i32 2
1013 %res = zext i1 %t2 to i8
1017 define zeroext i8 @test_extractelement_v64i1(<64 x i8> %a, <64 x i8> %b) {
1018 ; KNL-LABEL: test_extractelement_v64i1:
1020 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm0
1021 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm1
1022 ; KNL-NEXT: vextracti128 $1, %ymm1, %xmm1
1023 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm0
1024 ; KNL-NEXT: vpminub %xmm1, %xmm0, %xmm1
1025 ; KNL-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1026 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1027 ; KNL-NEXT: vpmovsxbd %xmm0, %zmm0
1028 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1029 ; KNL-NEXT: kshiftrw $15, %k0, %k0
1030 ; KNL-NEXT: kmovw %k0, %ecx
1031 ; KNL-NEXT: andl $1, %ecx
1032 ; KNL-NEXT: movl $4, %eax
1033 ; KNL-NEXT: subl %ecx, %eax
1034 ; KNL-NEXT: vzeroupper
1037 ; SKX-LABEL: test_extractelement_v64i1:
1039 ; SKX-NEXT: vpcmpnleub %zmm1, %zmm0, %k0
1040 ; SKX-NEXT: kshiftrq $63, %k0, %k0
1041 ; SKX-NEXT: kmovd %k0, %ecx
1042 ; SKX-NEXT: andl $1, %ecx
1043 ; SKX-NEXT: movl $4, %eax
1044 ; SKX-NEXT: subl %ecx, %eax
1045 ; SKX-NEXT: vzeroupper
1047 %t1 = icmp ugt <64 x i8> %a, %b
1048 %t2 = extractelement <64 x i1> %t1, i32 63
1049 %res = select i1 %t2, i8 3, i8 4
1053 define zeroext i8 @extractelement_v64i1_alt(<64 x i8> %a, <64 x i8> %b) {
1054 ; KNL-LABEL: extractelement_v64i1_alt:
1056 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm0
1057 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm1
1058 ; KNL-NEXT: vextracti128 $1, %ymm1, %xmm1
1059 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm0
1060 ; KNL-NEXT: vpminub %xmm1, %xmm0, %xmm1
1061 ; KNL-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1062 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1063 ; KNL-NEXT: vpmovsxbd %xmm0, %zmm0
1064 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1065 ; KNL-NEXT: kshiftrw $15, %k0, %k0
1066 ; KNL-NEXT: kmovw %k0, %eax
1067 ; KNL-NEXT: andb $1, %al
1068 ; KNL-NEXT: movb $4, %cl
1069 ; KNL-NEXT: subb %al, %cl
1070 ; KNL-NEXT: movzbl %cl, %eax
1071 ; KNL-NEXT: vzeroupper
1074 ; SKX-LABEL: extractelement_v64i1_alt:
1076 ; SKX-NEXT: vpcmpnleub %zmm1, %zmm0, %k0
1077 ; SKX-NEXT: kshiftrq $63, %k0, %k0
1078 ; SKX-NEXT: kmovd %k0, %eax
1079 ; SKX-NEXT: andb $1, %al
1080 ; SKX-NEXT: movb $4, %cl
1081 ; SKX-NEXT: subb %al, %cl
1082 ; SKX-NEXT: movzbl %cl, %eax
1083 ; SKX-NEXT: vzeroupper
1085 %t1 = icmp ugt <64 x i8> %a, %b
1086 %t2 = extractelement <64 x i1> %t1, i32 63
1087 %sext = sext i1 %t2 to i8
1088 %res = add i8 %sext, 4
1092 define i64 @test_extractelement_variable_v2i64(<2 x i64> %t1, i32 %index) {
1093 ; CHECK-LABEL: test_extractelement_variable_v2i64:
1095 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1096 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1097 ; CHECK-NEXT: andl $1, %edi
1098 ; CHECK-NEXT: movq -24(%rsp,%rdi,8), %rax
1100 %t2 = extractelement <2 x i64> %t1, i32 %index
1104 define i64 @test_extractelement_variable_v4i64(<4 x i64> %t1, i32 %index) {
1105 ; CHECK-LABEL: test_extractelement_variable_v4i64:
1107 ; CHECK-NEXT: pushq %rbp
1108 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1109 ; CHECK-NEXT: .cfi_offset %rbp, -16
1110 ; CHECK-NEXT: movq %rsp, %rbp
1111 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1112 ; CHECK-NEXT: andq $-32, %rsp
1113 ; CHECK-NEXT: subq $64, %rsp
1114 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1115 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1116 ; CHECK-NEXT: andl $3, %edi
1117 ; CHECK-NEXT: movq (%rsp,%rdi,8), %rax
1118 ; CHECK-NEXT: movq %rbp, %rsp
1119 ; CHECK-NEXT: popq %rbp
1120 ; CHECK-NEXT: vzeroupper
1122 %t2 = extractelement <4 x i64> %t1, i32 %index
1126 define i64 @test_extractelement_variable_v8i64(<8 x i64> %t1, i32 %index) {
1127 ; CHECK-LABEL: test_extractelement_variable_v8i64:
1129 ; CHECK-NEXT: pushq %rbp
1130 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1131 ; CHECK-NEXT: .cfi_offset %rbp, -16
1132 ; CHECK-NEXT: movq %rsp, %rbp
1133 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1134 ; CHECK-NEXT: andq $-64, %rsp
1135 ; CHECK-NEXT: subq $128, %rsp
1136 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1137 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1138 ; CHECK-NEXT: andl $7, %edi
1139 ; CHECK-NEXT: movq (%rsp,%rdi,8), %rax
1140 ; CHECK-NEXT: movq %rbp, %rsp
1141 ; CHECK-NEXT: popq %rbp
1142 ; CHECK-NEXT: vzeroupper
1144 %t2 = extractelement <8 x i64> %t1, i32 %index
1148 define double @test_extractelement_variable_v2f64(<2 x double> %t1, i32 %index) {
1149 ; CHECK-LABEL: test_extractelement_variable_v2f64:
1151 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1152 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1153 ; CHECK-NEXT: andl $1, %edi
1154 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1156 %t2 = extractelement <2 x double> %t1, i32 %index
1160 define double @test_extractelement_variable_v4f64(<4 x double> %t1, i32 %index) {
1161 ; CHECK-LABEL: test_extractelement_variable_v4f64:
1163 ; CHECK-NEXT: pushq %rbp
1164 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1165 ; CHECK-NEXT: .cfi_offset %rbp, -16
1166 ; CHECK-NEXT: movq %rsp, %rbp
1167 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1168 ; CHECK-NEXT: andq $-32, %rsp
1169 ; CHECK-NEXT: subq $64, %rsp
1170 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1171 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1172 ; CHECK-NEXT: andl $3, %edi
1173 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1174 ; CHECK-NEXT: movq %rbp, %rsp
1175 ; CHECK-NEXT: popq %rbp
1176 ; CHECK-NEXT: vzeroupper
1178 %t2 = extractelement <4 x double> %t1, i32 %index
1182 define double @test_extractelement_variable_v8f64(<8 x double> %t1, i32 %index) {
1183 ; CHECK-LABEL: test_extractelement_variable_v8f64:
1185 ; CHECK-NEXT: pushq %rbp
1186 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1187 ; CHECK-NEXT: .cfi_offset %rbp, -16
1188 ; CHECK-NEXT: movq %rsp, %rbp
1189 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1190 ; CHECK-NEXT: andq $-64, %rsp
1191 ; CHECK-NEXT: subq $128, %rsp
1192 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1193 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1194 ; CHECK-NEXT: andl $7, %edi
1195 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1196 ; CHECK-NEXT: movq %rbp, %rsp
1197 ; CHECK-NEXT: popq %rbp
1198 ; CHECK-NEXT: vzeroupper
1200 %t2 = extractelement <8 x double> %t1, i32 %index
1204 define i32 @test_extractelement_variable_v4i32(<4 x i32> %t1, i32 %index) {
1205 ; CHECK-LABEL: test_extractelement_variable_v4i32:
1207 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1208 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1209 ; CHECK-NEXT: andl $3, %edi
1210 ; CHECK-NEXT: movl -24(%rsp,%rdi,4), %eax
1212 %t2 = extractelement <4 x i32> %t1, i32 %index
1216 define i32 @test_extractelement_variable_v8i32(<8 x i32> %t1, i32 %index) {
1217 ; CHECK-LABEL: test_extractelement_variable_v8i32:
1219 ; CHECK-NEXT: pushq %rbp
1220 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1221 ; CHECK-NEXT: .cfi_offset %rbp, -16
1222 ; CHECK-NEXT: movq %rsp, %rbp
1223 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1224 ; CHECK-NEXT: andq $-32, %rsp
1225 ; CHECK-NEXT: subq $64, %rsp
1226 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1227 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1228 ; CHECK-NEXT: andl $7, %edi
1229 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
1230 ; CHECK-NEXT: movq %rbp, %rsp
1231 ; CHECK-NEXT: popq %rbp
1232 ; CHECK-NEXT: vzeroupper
1234 %t2 = extractelement <8 x i32> %t1, i32 %index
1238 define i32 @test_extractelement_variable_v16i32(<16 x i32> %t1, i32 %index) {
1239 ; CHECK-LABEL: test_extractelement_variable_v16i32:
1241 ; CHECK-NEXT: pushq %rbp
1242 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1243 ; CHECK-NEXT: .cfi_offset %rbp, -16
1244 ; CHECK-NEXT: movq %rsp, %rbp
1245 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1246 ; CHECK-NEXT: andq $-64, %rsp
1247 ; CHECK-NEXT: subq $128, %rsp
1248 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1249 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1250 ; CHECK-NEXT: andl $15, %edi
1251 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
1252 ; CHECK-NEXT: movq %rbp, %rsp
1253 ; CHECK-NEXT: popq %rbp
1254 ; CHECK-NEXT: vzeroupper
1256 %t2 = extractelement <16 x i32> %t1, i32 %index
1260 define float @test_extractelement_variable_v4f32(<4 x float> %t1, i32 %index) {
1261 ; CHECK-LABEL: test_extractelement_variable_v4f32:
1263 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1264 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1265 ; CHECK-NEXT: andl $3, %edi
1266 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1268 %t2 = extractelement <4 x float> %t1, i32 %index
1272 define float @test_extractelement_variable_v8f32(<8 x float> %t1, i32 %index) {
1273 ; CHECK-LABEL: test_extractelement_variable_v8f32:
1275 ; CHECK-NEXT: pushq %rbp
1276 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1277 ; CHECK-NEXT: .cfi_offset %rbp, -16
1278 ; CHECK-NEXT: movq %rsp, %rbp
1279 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1280 ; CHECK-NEXT: andq $-32, %rsp
1281 ; CHECK-NEXT: subq $64, %rsp
1282 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1283 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1284 ; CHECK-NEXT: andl $7, %edi
1285 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1286 ; CHECK-NEXT: movq %rbp, %rsp
1287 ; CHECK-NEXT: popq %rbp
1288 ; CHECK-NEXT: vzeroupper
1290 %t2 = extractelement <8 x float> %t1, i32 %index
1294 define float @test_extractelement_variable_v16f32(<16 x float> %t1, i32 %index) {
1295 ; CHECK-LABEL: test_extractelement_variable_v16f32:
1297 ; CHECK-NEXT: pushq %rbp
1298 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1299 ; CHECK-NEXT: .cfi_offset %rbp, -16
1300 ; CHECK-NEXT: movq %rsp, %rbp
1301 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1302 ; CHECK-NEXT: andq $-64, %rsp
1303 ; CHECK-NEXT: subq $128, %rsp
1304 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1305 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1306 ; CHECK-NEXT: andl $15, %edi
1307 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1308 ; CHECK-NEXT: movq %rbp, %rsp
1309 ; CHECK-NEXT: popq %rbp
1310 ; CHECK-NEXT: vzeroupper
1312 %t2 = extractelement <16 x float> %t1, i32 %index
1316 define i16 @test_extractelement_variable_v8i16(<8 x i16> %t1, i32 %index) {
1317 ; CHECK-LABEL: test_extractelement_variable_v8i16:
1319 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1320 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1321 ; CHECK-NEXT: andl $7, %edi
1322 ; CHECK-NEXT: movzwl -24(%rsp,%rdi,2), %eax
1324 %t2 = extractelement <8 x i16> %t1, i32 %index
1328 define i16 @test_extractelement_variable_v16i16(<16 x i16> %t1, i32 %index) {
1329 ; CHECK-LABEL: test_extractelement_variable_v16i16:
1331 ; CHECK-NEXT: pushq %rbp
1332 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1333 ; CHECK-NEXT: .cfi_offset %rbp, -16
1334 ; CHECK-NEXT: movq %rsp, %rbp
1335 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1336 ; CHECK-NEXT: andq $-32, %rsp
1337 ; CHECK-NEXT: subq $64, %rsp
1338 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1339 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1340 ; CHECK-NEXT: andl $15, %edi
1341 ; CHECK-NEXT: movzwl (%rsp,%rdi,2), %eax
1342 ; CHECK-NEXT: movq %rbp, %rsp
1343 ; CHECK-NEXT: popq %rbp
1344 ; CHECK-NEXT: vzeroupper
1346 %t2 = extractelement <16 x i16> %t1, i32 %index
1350 define i16 @test_extractelement_variable_v32i16(<32 x i16> %t1, i32 %index) {
1351 ; KNL-LABEL: test_extractelement_variable_v32i16:
1353 ; KNL-NEXT: pushq %rbp
1354 ; KNL-NEXT: .cfi_def_cfa_offset 16
1355 ; KNL-NEXT: .cfi_offset %rbp, -16
1356 ; KNL-NEXT: movq %rsp, %rbp
1357 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1358 ; KNL-NEXT: andq $-64, %rsp
1359 ; KNL-NEXT: subq $128, %rsp
1360 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1361 ; KNL-NEXT: vextractf64x4 $1, %zmm0, {{[0-9]+}}(%rsp)
1362 ; KNL-NEXT: vmovaps %ymm0, (%rsp)
1363 ; KNL-NEXT: andl $31, %edi
1364 ; KNL-NEXT: movzwl (%rsp,%rdi,2), %eax
1365 ; KNL-NEXT: movq %rbp, %rsp
1366 ; KNL-NEXT: popq %rbp
1367 ; KNL-NEXT: vzeroupper
1370 ; SKX-LABEL: test_extractelement_variable_v32i16:
1372 ; SKX-NEXT: pushq %rbp
1373 ; SKX-NEXT: .cfi_def_cfa_offset 16
1374 ; SKX-NEXT: .cfi_offset %rbp, -16
1375 ; SKX-NEXT: movq %rsp, %rbp
1376 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1377 ; SKX-NEXT: andq $-64, %rsp
1378 ; SKX-NEXT: subq $128, %rsp
1379 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1380 ; SKX-NEXT: vmovaps %zmm0, (%rsp)
1381 ; SKX-NEXT: andl $31, %edi
1382 ; SKX-NEXT: movzwl (%rsp,%rdi,2), %eax
1383 ; SKX-NEXT: movq %rbp, %rsp
1384 ; SKX-NEXT: popq %rbp
1385 ; SKX-NEXT: vzeroupper
1387 %t2 = extractelement <32 x i16> %t1, i32 %index
1391 define i8 @test_extractelement_variable_v16i8(<16 x i8> %t1, i32 %index) {
1392 ; CHECK-LABEL: test_extractelement_variable_v16i8:
1394 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1395 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1396 ; CHECK-NEXT: andl $15, %edi
1397 ; CHECK-NEXT: movb -24(%rsp,%rdi), %al
1399 %t2 = extractelement <16 x i8> %t1, i32 %index
1403 define i8 @test_extractelement_variable_v32i8(<32 x i8> %t1, i32 %index) {
1404 ; CHECK-LABEL: test_extractelement_variable_v32i8:
1406 ; CHECK-NEXT: pushq %rbp
1407 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1408 ; CHECK-NEXT: .cfi_offset %rbp, -16
1409 ; CHECK-NEXT: movq %rsp, %rbp
1410 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1411 ; CHECK-NEXT: andq $-32, %rsp
1412 ; CHECK-NEXT: subq $64, %rsp
1413 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1414 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1415 ; CHECK-NEXT: andl $31, %edi
1416 ; CHECK-NEXT: movb (%rsp,%rdi), %al
1417 ; CHECK-NEXT: movq %rbp, %rsp
1418 ; CHECK-NEXT: popq %rbp
1419 ; CHECK-NEXT: vzeroupper
1422 %t2 = extractelement <32 x i8> %t1, i32 %index
1426 define i8 @test_extractelement_variable_v64i8(<64 x i8> %t1, i32 %index) {
1427 ; KNL-LABEL: test_extractelement_variable_v64i8:
1429 ; KNL-NEXT: pushq %rbp
1430 ; KNL-NEXT: .cfi_def_cfa_offset 16
1431 ; KNL-NEXT: .cfi_offset %rbp, -16
1432 ; KNL-NEXT: movq %rsp, %rbp
1433 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1434 ; KNL-NEXT: andq $-64, %rsp
1435 ; KNL-NEXT: subq $128, %rsp
1436 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1437 ; KNL-NEXT: vextractf64x4 $1, %zmm0, {{[0-9]+}}(%rsp)
1438 ; KNL-NEXT: vmovaps %ymm0, (%rsp)
1439 ; KNL-NEXT: andl $63, %edi
1440 ; KNL-NEXT: movb (%rsp,%rdi), %al
1441 ; KNL-NEXT: movq %rbp, %rsp
1442 ; KNL-NEXT: popq %rbp
1443 ; KNL-NEXT: vzeroupper
1446 ; SKX-LABEL: test_extractelement_variable_v64i8:
1448 ; SKX-NEXT: pushq %rbp
1449 ; SKX-NEXT: .cfi_def_cfa_offset 16
1450 ; SKX-NEXT: .cfi_offset %rbp, -16
1451 ; SKX-NEXT: movq %rsp, %rbp
1452 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1453 ; SKX-NEXT: andq $-64, %rsp
1454 ; SKX-NEXT: subq $128, %rsp
1455 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1456 ; SKX-NEXT: vmovaps %zmm0, (%rsp)
1457 ; SKX-NEXT: andl $63, %edi
1458 ; SKX-NEXT: movb (%rsp,%rdi), %al
1459 ; SKX-NEXT: movq %rbp, %rsp
1460 ; SKX-NEXT: popq %rbp
1461 ; SKX-NEXT: vzeroupper
1464 %t2 = extractelement <64 x i8> %t1, i32 %index
1468 define i8 @test_extractelement_variable_v64i8_indexi8(<64 x i8> %t1, i8 %index) {
1469 ; KNL-LABEL: test_extractelement_variable_v64i8_indexi8:
1471 ; KNL-NEXT: pushq %rbp
1472 ; KNL-NEXT: .cfi_def_cfa_offset 16
1473 ; KNL-NEXT: .cfi_offset %rbp, -16
1474 ; KNL-NEXT: movq %rsp, %rbp
1475 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1476 ; KNL-NEXT: andq $-64, %rsp
1477 ; KNL-NEXT: subq $128, %rsp
1478 ; KNL-NEXT: addb %dil, %dil
1479 ; KNL-NEXT: vextractf64x4 $1, %zmm0, {{[0-9]+}}(%rsp)
1480 ; KNL-NEXT: vmovaps %ymm0, (%rsp)
1481 ; KNL-NEXT: movzbl %dil, %eax
1482 ; KNL-NEXT: andl $63, %eax
1483 ; KNL-NEXT: movb (%rsp,%rax), %al
1484 ; KNL-NEXT: movq %rbp, %rsp
1485 ; KNL-NEXT: popq %rbp
1486 ; KNL-NEXT: vzeroupper
1489 ; SKX-LABEL: test_extractelement_variable_v64i8_indexi8:
1491 ; SKX-NEXT: pushq %rbp
1492 ; SKX-NEXT: .cfi_def_cfa_offset 16
1493 ; SKX-NEXT: .cfi_offset %rbp, -16
1494 ; SKX-NEXT: movq %rsp, %rbp
1495 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1496 ; SKX-NEXT: andq $-64, %rsp
1497 ; SKX-NEXT: subq $128, %rsp
1498 ; SKX-NEXT: addb %dil, %dil
1499 ; SKX-NEXT: vmovaps %zmm0, (%rsp)
1500 ; SKX-NEXT: movzbl %dil, %eax
1501 ; SKX-NEXT: andl $63, %eax
1502 ; SKX-NEXT: movb (%rsp,%rax), %al
1503 ; SKX-NEXT: movq %rbp, %rsp
1504 ; SKX-NEXT: popq %rbp
1505 ; SKX-NEXT: vzeroupper
1508 %i = add i8 %index, %index
1509 %t2 = extractelement <64 x i8> %t1, i8 %i
1513 define zeroext i8 @test_extractelement_varible_v2i1(<2 x i64> %a, <2 x i64> %b, i32 %index) {
1514 ; KNL-LABEL: test_extractelement_varible_v2i1:
1516 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1517 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1518 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
1519 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k1
1520 ; KNL-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1521 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1522 ; KNL-NEXT: andl $1, %edi
1523 ; KNL-NEXT: movzbl -24(%rsp,%rdi,8), %eax
1524 ; KNL-NEXT: andl $1, %eax
1525 ; KNL-NEXT: vzeroupper
1528 ; SKX-LABEL: test_extractelement_varible_v2i1:
1530 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1531 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
1532 ; SKX-NEXT: vpmovm2q %k0, %xmm0
1533 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1534 ; SKX-NEXT: andl $1, %edi
1535 ; SKX-NEXT: movzbl -24(%rsp,%rdi,8), %eax
1536 ; SKX-NEXT: andl $1, %eax
1538 %t1 = icmp ugt <2 x i64> %a, %b
1539 %t2 = extractelement <2 x i1> %t1, i32 %index
1540 %res = zext i1 %t2 to i8
1544 define zeroext i8 @test_extractelement_varible_v4i1(<4 x i32> %a, <4 x i32> %b, i32 %index) {
1545 ; KNL-LABEL: test_extractelement_varible_v4i1:
1547 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1548 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1549 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
1550 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1551 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1552 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1553 ; KNL-NEXT: andl $3, %edi
1554 ; KNL-NEXT: movzbl -24(%rsp,%rdi,4), %eax
1555 ; KNL-NEXT: andl $1, %eax
1556 ; KNL-NEXT: vzeroupper
1559 ; SKX-LABEL: test_extractelement_varible_v4i1:
1561 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1562 ; SKX-NEXT: vpcmpnleud %xmm1, %xmm0, %k0
1563 ; SKX-NEXT: vpmovm2d %k0, %xmm0
1564 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1565 ; SKX-NEXT: andl $3, %edi
1566 ; SKX-NEXT: movzbl -24(%rsp,%rdi,4), %eax
1567 ; SKX-NEXT: andl $1, %eax
1569 %t1 = icmp ugt <4 x i32> %a, %b
1570 %t2 = extractelement <4 x i1> %t1, i32 %index
1571 %res = zext i1 %t2 to i8
1575 define zeroext i8 @test_extractelement_varible_v8i1(<8 x i32> %a, <8 x i32> %b, i32 %index) {
1576 ; KNL-LABEL: test_extractelement_varible_v8i1:
1578 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1579 ; KNL-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
1580 ; KNL-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
1581 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1582 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1583 ; KNL-NEXT: vpmovdw %zmm0, %ymm0
1584 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1585 ; KNL-NEXT: andl $7, %edi
1586 ; KNL-NEXT: movzbl -24(%rsp,%rdi,2), %eax
1587 ; KNL-NEXT: andl $1, %eax
1588 ; KNL-NEXT: vzeroupper
1591 ; SKX-LABEL: test_extractelement_varible_v8i1:
1593 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1594 ; SKX-NEXT: vpcmpnleud %ymm1, %ymm0, %k0
1595 ; SKX-NEXT: vpmovm2w %k0, %xmm0
1596 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1597 ; SKX-NEXT: andl $7, %edi
1598 ; SKX-NEXT: movzbl -24(%rsp,%rdi,2), %eax
1599 ; SKX-NEXT: andl $1, %eax
1600 ; SKX-NEXT: vzeroupper
1602 %t1 = icmp ugt <8 x i32> %a, %b
1603 %t2 = extractelement <8 x i1> %t1, i32 %index
1604 %res = zext i1 %t2 to i8
1608 define zeroext i8 @test_extractelement_varible_v16i1(<16 x i32> %a, <16 x i32> %b, i32 %index) {
1609 ; KNL-LABEL: test_extractelement_varible_v16i1:
1611 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1612 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1613 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1614 ; KNL-NEXT: vpmovdb %zmm0, -{{[0-9]+}}(%rsp)
1615 ; KNL-NEXT: andl $15, %edi
1616 ; KNL-NEXT: movzbl -24(%rsp,%rdi), %eax
1617 ; KNL-NEXT: andl $1, %eax
1618 ; KNL-NEXT: vzeroupper
1621 ; SKX-LABEL: test_extractelement_varible_v16i1:
1623 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1624 ; SKX-NEXT: vpcmpnleud %zmm1, %zmm0, %k0
1625 ; SKX-NEXT: vpmovm2b %k0, %xmm0
1626 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1627 ; SKX-NEXT: andl $15, %edi
1628 ; SKX-NEXT: movzbl -24(%rsp,%rdi), %eax
1629 ; SKX-NEXT: andl $1, %eax
1630 ; SKX-NEXT: vzeroupper
1632 %t1 = icmp ugt <16 x i32> %a, %b
1633 %t2 = extractelement <16 x i1> %t1, i32 %index
1634 %res = zext i1 %t2 to i8
1638 define zeroext i8 @test_extractelement_varible_v32i1(<32 x i8> %a, <32 x i8> %b, i32 %index) {
1639 ; KNL-LABEL: test_extractelement_varible_v32i1:
1641 ; KNL-NEXT: pushq %rbp
1642 ; KNL-NEXT: .cfi_def_cfa_offset 16
1643 ; KNL-NEXT: .cfi_offset %rbp, -16
1644 ; KNL-NEXT: movq %rsp, %rbp
1645 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1646 ; KNL-NEXT: andq $-32, %rsp
1647 ; KNL-NEXT: subq $64, %rsp
1648 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1649 ; KNL-NEXT: vpminub %ymm1, %ymm0, %ymm1
1650 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1651 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1652 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
1653 ; KNL-NEXT: andl $31, %edi
1654 ; KNL-NEXT: movzbl (%rsp,%rdi), %eax
1655 ; KNL-NEXT: andl $1, %eax
1656 ; KNL-NEXT: movq %rbp, %rsp
1657 ; KNL-NEXT: popq %rbp
1658 ; KNL-NEXT: vzeroupper
1661 ; SKX-LABEL: test_extractelement_varible_v32i1:
1663 ; SKX-NEXT: pushq %rbp
1664 ; SKX-NEXT: .cfi_def_cfa_offset 16
1665 ; SKX-NEXT: .cfi_offset %rbp, -16
1666 ; SKX-NEXT: movq %rsp, %rbp
1667 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1668 ; SKX-NEXT: andq $-32, %rsp
1669 ; SKX-NEXT: subq $64, %rsp
1670 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1671 ; SKX-NEXT: vpcmpnleub %ymm1, %ymm0, %k0
1672 ; SKX-NEXT: vpmovm2b %k0, %ymm0
1673 ; SKX-NEXT: vmovdqa %ymm0, (%rsp)
1674 ; SKX-NEXT: andl $31, %edi
1675 ; SKX-NEXT: movzbl (%rsp,%rdi), %eax
1676 ; SKX-NEXT: andl $1, %eax
1677 ; SKX-NEXT: movq %rbp, %rsp
1678 ; SKX-NEXT: popq %rbp
1679 ; SKX-NEXT: vzeroupper
1681 %t1 = icmp ugt <32 x i8> %a, %b
1682 %t2 = extractelement <32 x i1> %t1, i32 %index
1683 %res = zext i1 %t2 to i8
1687 define <8 x i64> @insert_double_zero(<2 x i64> %a) nounwind {
1688 ; CHECK-LABEL: insert_double_zero:
1690 ; CHECK-NEXT: vxorps %xmm1, %xmm1, %xmm1
1691 ; CHECK-NEXT: vinsertf32x4 $2, %xmm0, %zmm1, %zmm0
1693 %b = shufflevector <2 x i64> %a, <2 x i64> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1694 %d = shufflevector <4 x i64> %b, <4 x i64> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
1695 %e = shufflevector <8 x i64> %d, <8 x i64> zeroinitializer, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 0, i32 1, i32 2, i32 3>
1699 define i32 @test_insertelement_variable_v32i1(<32 x i8> %a, i8 %b, i32 %index) {
1700 ; KNL-LABEL: test_insertelement_variable_v32i1:
1702 ; KNL-NEXT: pushq %rbp
1703 ; KNL-NEXT: .cfi_def_cfa_offset 16
1704 ; KNL-NEXT: .cfi_offset %rbp, -16
1705 ; KNL-NEXT: movq %rsp, %rbp
1706 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1707 ; KNL-NEXT: andq $-32, %rsp
1708 ; KNL-NEXT: subq $64, %rsp
1709 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
1710 ; KNL-NEXT: vpxor %xmm1, %xmm1, %xmm1
1711 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1712 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1713 ; KNL-NEXT: andl $31, %esi
1714 ; KNL-NEXT: testb %dil, %dil
1715 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
1716 ; KNL-NEXT: setne (%rsp,%rsi)
1717 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1718 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1719 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1720 ; KNL-NEXT: kmovw %k0, %ecx
1721 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1722 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1723 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1724 ; KNL-NEXT: kmovw %k0, %eax
1725 ; KNL-NEXT: shll $16, %eax
1726 ; KNL-NEXT: orl %ecx, %eax
1727 ; KNL-NEXT: movq %rbp, %rsp
1728 ; KNL-NEXT: popq %rbp
1729 ; KNL-NEXT: vzeroupper
1732 ; SKX-LABEL: test_insertelement_variable_v32i1:
1734 ; SKX-NEXT: pushq %rbp
1735 ; SKX-NEXT: .cfi_def_cfa_offset 16
1736 ; SKX-NEXT: .cfi_offset %rbp, -16
1737 ; SKX-NEXT: movq %rsp, %rbp
1738 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1739 ; SKX-NEXT: andq $-32, %rsp
1740 ; SKX-NEXT: subq $64, %rsp
1741 ; SKX-NEXT: ## kill: def $esi killed $esi def $rsi
1742 ; SKX-NEXT: vptestmb %ymm0, %ymm0, %k0
1743 ; SKX-NEXT: andl $31, %esi
1744 ; SKX-NEXT: testb %dil, %dil
1745 ; SKX-NEXT: vpmovm2b %k0, %ymm0
1746 ; SKX-NEXT: vmovdqa %ymm0, (%rsp)
1747 ; SKX-NEXT: setne (%rsp,%rsi)
1748 ; SKX-NEXT: vpsllw $7, (%rsp), %ymm0
1749 ; SKX-NEXT: vpmovb2m %ymm0, %k0
1750 ; SKX-NEXT: kmovd %k0, %eax
1751 ; SKX-NEXT: movq %rbp, %rsp
1752 ; SKX-NEXT: popq %rbp
1753 ; SKX-NEXT: vzeroupper
1755 %t1 = icmp ugt <32 x i8> %a, zeroinitializer
1756 %t2 = icmp ugt i8 %b, 0
1757 %t3 = insertelement <32 x i1> %t1, i1 %t2, i32 %index
1758 %t4 = bitcast <32 x i1> %t3 to i32
1762 define i64 @test_insertelement_variable_v64i1(<64 x i8> %a, i8 %b, i32 %index) {
1763 ; KNL-LABEL: test_insertelement_variable_v64i1:
1765 ; KNL-NEXT: pushq %rbp
1766 ; KNL-NEXT: .cfi_def_cfa_offset 16
1767 ; KNL-NEXT: .cfi_offset %rbp, -16
1768 ; KNL-NEXT: movq %rsp, %rbp
1769 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1770 ; KNL-NEXT: andq $-64, %rsp
1771 ; KNL-NEXT: subq $128, %rsp
1772 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
1773 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm1
1774 ; KNL-NEXT: vpxor %xmm2, %xmm2, %xmm2
1775 ; KNL-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
1776 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1777 ; KNL-NEXT: vpcmpeqb %ymm2, %ymm1, %ymm1
1778 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1779 ; KNL-NEXT: andl $63, %esi
1780 ; KNL-NEXT: testb %dil, %dil
1781 ; KNL-NEXT: vmovdqa %ymm1, {{[0-9]+}}(%rsp)
1782 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
1783 ; KNL-NEXT: setne (%rsp,%rsi)
1784 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1785 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1786 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1787 ; KNL-NEXT: kmovw %k0, %eax
1788 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1789 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1790 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1791 ; KNL-NEXT: kmovw %k0, %ecx
1792 ; KNL-NEXT: shll $16, %ecx
1793 ; KNL-NEXT: orl %eax, %ecx
1794 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1795 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1796 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1797 ; KNL-NEXT: kmovw %k0, %edx
1798 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1799 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1800 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1801 ; KNL-NEXT: kmovw %k0, %eax
1802 ; KNL-NEXT: shll $16, %eax
1803 ; KNL-NEXT: orl %edx, %eax
1804 ; KNL-NEXT: shlq $32, %rax
1805 ; KNL-NEXT: orq %rcx, %rax
1806 ; KNL-NEXT: movq %rbp, %rsp
1807 ; KNL-NEXT: popq %rbp
1808 ; KNL-NEXT: vzeroupper
1811 ; SKX-LABEL: test_insertelement_variable_v64i1:
1813 ; SKX-NEXT: pushq %rbp
1814 ; SKX-NEXT: .cfi_def_cfa_offset 16
1815 ; SKX-NEXT: .cfi_offset %rbp, -16
1816 ; SKX-NEXT: movq %rsp, %rbp
1817 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1818 ; SKX-NEXT: andq $-64, %rsp
1819 ; SKX-NEXT: subq $128, %rsp
1820 ; SKX-NEXT: ## kill: def $esi killed $esi def $rsi
1821 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
1822 ; SKX-NEXT: andl $63, %esi
1823 ; SKX-NEXT: testb %dil, %dil
1824 ; SKX-NEXT: vpmovm2b %k0, %zmm0
1825 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
1826 ; SKX-NEXT: setne (%rsp,%rsi)
1827 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
1828 ; SKX-NEXT: vpmovb2m %zmm0, %k0
1829 ; SKX-NEXT: kmovq %k0, %rax
1830 ; SKX-NEXT: movq %rbp, %rsp
1831 ; SKX-NEXT: popq %rbp
1832 ; SKX-NEXT: vzeroupper
1834 %t1 = icmp ugt <64 x i8> %a, zeroinitializer
1835 %t2 = icmp ugt i8 %b, 0
1836 %t3 = insertelement <64 x i1> %t1, i1 %t2, i32 %index
1837 %t4 = bitcast <64 x i1> %t3 to i64
1841 define i96 @test_insertelement_variable_v96i1(<96 x i8> %a, i8 %b, i32 %index) {
1842 ; KNL-LABEL: test_insertelement_variable_v96i1:
1844 ; KNL-NEXT: pushq %rbp
1845 ; KNL-NEXT: .cfi_def_cfa_offset 16
1846 ; KNL-NEXT: .cfi_offset %rbp, -16
1847 ; KNL-NEXT: movq %rsp, %rbp
1848 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1849 ; KNL-NEXT: andq $-128, %rsp
1850 ; KNL-NEXT: subq $256, %rsp ## imm = 0x100
1851 ; KNL-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
1852 ; KNL-NEXT: vpinsrb $1, 232(%rbp), %xmm0, %xmm0
1853 ; KNL-NEXT: vpinsrb $2, 240(%rbp), %xmm0, %xmm0
1854 ; KNL-NEXT: vpinsrb $3, 248(%rbp), %xmm0, %xmm0
1855 ; KNL-NEXT: vpinsrb $4, 256(%rbp), %xmm0, %xmm0
1856 ; KNL-NEXT: vpinsrb $5, 264(%rbp), %xmm0, %xmm0
1857 ; KNL-NEXT: vpinsrb $6, 272(%rbp), %xmm0, %xmm0
1858 ; KNL-NEXT: vpinsrb $7, 280(%rbp), %xmm0, %xmm0
1859 ; KNL-NEXT: vpinsrb $8, 288(%rbp), %xmm0, %xmm0
1860 ; KNL-NEXT: vpinsrb $9, 296(%rbp), %xmm0, %xmm0
1861 ; KNL-NEXT: vpinsrb $10, 304(%rbp), %xmm0, %xmm0
1862 ; KNL-NEXT: vpinsrb $11, 312(%rbp), %xmm0, %xmm0
1863 ; KNL-NEXT: vpinsrb $12, 320(%rbp), %xmm0, %xmm0
1864 ; KNL-NEXT: vpinsrb $13, 328(%rbp), %xmm0, %xmm0
1865 ; KNL-NEXT: vpinsrb $14, 336(%rbp), %xmm0, %xmm0
1866 ; KNL-NEXT: vpinsrb $15, 344(%rbp), %xmm0, %xmm0
1867 ; KNL-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1868 ; KNL-NEXT: vpinsrb $1, 360(%rbp), %xmm1, %xmm1
1869 ; KNL-NEXT: vpinsrb $2, 368(%rbp), %xmm1, %xmm1
1870 ; KNL-NEXT: vpinsrb $3, 376(%rbp), %xmm1, %xmm1
1871 ; KNL-NEXT: vpinsrb $4, 384(%rbp), %xmm1, %xmm1
1872 ; KNL-NEXT: vpinsrb $5, 392(%rbp), %xmm1, %xmm1
1873 ; KNL-NEXT: vpinsrb $6, 400(%rbp), %xmm1, %xmm1
1874 ; KNL-NEXT: vpinsrb $7, 408(%rbp), %xmm1, %xmm1
1875 ; KNL-NEXT: vpinsrb $8, 416(%rbp), %xmm1, %xmm1
1876 ; KNL-NEXT: vpinsrb $9, 424(%rbp), %xmm1, %xmm1
1877 ; KNL-NEXT: vpinsrb $10, 432(%rbp), %xmm1, %xmm1
1878 ; KNL-NEXT: vpinsrb $11, 440(%rbp), %xmm1, %xmm1
1879 ; KNL-NEXT: vpinsrb $12, 448(%rbp), %xmm1, %xmm1
1880 ; KNL-NEXT: vpinsrb $13, 456(%rbp), %xmm1, %xmm1
1881 ; KNL-NEXT: vpinsrb $14, 464(%rbp), %xmm1, %xmm1
1882 ; KNL-NEXT: vpinsrb $15, 472(%rbp), %xmm1, %xmm1
1883 ; KNL-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
1884 ; KNL-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1885 ; KNL-NEXT: vpinsrb $1, 488(%rbp), %xmm1, %xmm1
1886 ; KNL-NEXT: vpinsrb $2, 496(%rbp), %xmm1, %xmm1
1887 ; KNL-NEXT: vpinsrb $3, 504(%rbp), %xmm1, %xmm1
1888 ; KNL-NEXT: vpinsrb $4, 512(%rbp), %xmm1, %xmm1
1889 ; KNL-NEXT: vpinsrb $5, 520(%rbp), %xmm1, %xmm1
1890 ; KNL-NEXT: vpinsrb $6, 528(%rbp), %xmm1, %xmm1
1891 ; KNL-NEXT: vpinsrb $7, 536(%rbp), %xmm1, %xmm1
1892 ; KNL-NEXT: vpinsrb $8, 544(%rbp), %xmm1, %xmm1
1893 ; KNL-NEXT: vpinsrb $9, 552(%rbp), %xmm1, %xmm1
1894 ; KNL-NEXT: vpinsrb $10, 560(%rbp), %xmm1, %xmm1
1895 ; KNL-NEXT: vpinsrb $11, 568(%rbp), %xmm1, %xmm1
1896 ; KNL-NEXT: vpinsrb $12, 576(%rbp), %xmm1, %xmm1
1897 ; KNL-NEXT: vpinsrb $13, 584(%rbp), %xmm1, %xmm1
1898 ; KNL-NEXT: vpinsrb $14, 592(%rbp), %xmm1, %xmm1
1899 ; KNL-NEXT: vpinsrb $15, 600(%rbp), %xmm1, %xmm1
1900 ; KNL-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
1901 ; KNL-NEXT: vpinsrb $1, 616(%rbp), %xmm2, %xmm2
1902 ; KNL-NEXT: vpinsrb $2, 624(%rbp), %xmm2, %xmm2
1903 ; KNL-NEXT: vpinsrb $3, 632(%rbp), %xmm2, %xmm2
1904 ; KNL-NEXT: vpinsrb $4, 640(%rbp), %xmm2, %xmm2
1905 ; KNL-NEXT: vpinsrb $5, 648(%rbp), %xmm2, %xmm2
1906 ; KNL-NEXT: vpinsrb $6, 656(%rbp), %xmm2, %xmm2
1907 ; KNL-NEXT: vpinsrb $7, 664(%rbp), %xmm2, %xmm2
1908 ; KNL-NEXT: vpinsrb $8, 672(%rbp), %xmm2, %xmm2
1909 ; KNL-NEXT: vpinsrb $9, 680(%rbp), %xmm2, %xmm2
1910 ; KNL-NEXT: vpinsrb $10, 688(%rbp), %xmm2, %xmm2
1911 ; KNL-NEXT: vpinsrb $11, 696(%rbp), %xmm2, %xmm2
1912 ; KNL-NEXT: vpinsrb $12, 704(%rbp), %xmm2, %xmm2
1913 ; KNL-NEXT: vpinsrb $13, 712(%rbp), %xmm2, %xmm2
1914 ; KNL-NEXT: vpinsrb $14, 720(%rbp), %xmm2, %xmm2
1915 ; KNL-NEXT: vpinsrb $15, 728(%rbp), %xmm2, %xmm2
1916 ; KNL-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
1917 ; KNL-NEXT: vmovd %edi, %xmm2
1918 ; KNL-NEXT: vpinsrb $1, %esi, %xmm2, %xmm2
1919 ; KNL-NEXT: vpinsrb $2, %edx, %xmm2, %xmm2
1920 ; KNL-NEXT: vpinsrb $3, %ecx, %xmm2, %xmm2
1921 ; KNL-NEXT: vpinsrb $4, %r8d, %xmm2, %xmm2
1922 ; KNL-NEXT: vpinsrb $5, %r9d, %xmm2, %xmm2
1923 ; KNL-NEXT: vpinsrb $6, 16(%rbp), %xmm2, %xmm2
1924 ; KNL-NEXT: vpinsrb $7, 24(%rbp), %xmm2, %xmm2
1925 ; KNL-NEXT: vpinsrb $8, 32(%rbp), %xmm2, %xmm2
1926 ; KNL-NEXT: vpinsrb $9, 40(%rbp), %xmm2, %xmm2
1927 ; KNL-NEXT: vpinsrb $10, 48(%rbp), %xmm2, %xmm2
1928 ; KNL-NEXT: vpinsrb $11, 56(%rbp), %xmm2, %xmm2
1929 ; KNL-NEXT: vpinsrb $12, 64(%rbp), %xmm2, %xmm2
1930 ; KNL-NEXT: vpinsrb $13, 72(%rbp), %xmm2, %xmm2
1931 ; KNL-NEXT: vpinsrb $14, 80(%rbp), %xmm2, %xmm2
1932 ; KNL-NEXT: vpinsrb $15, 88(%rbp), %xmm2, %xmm2
1933 ; KNL-NEXT: vmovd {{.*#+}} xmm3 = mem[0],zero,zero,zero
1934 ; KNL-NEXT: vpinsrb $1, 104(%rbp), %xmm3, %xmm3
1935 ; KNL-NEXT: vpinsrb $2, 112(%rbp), %xmm3, %xmm3
1936 ; KNL-NEXT: vpinsrb $3, 120(%rbp), %xmm3, %xmm3
1937 ; KNL-NEXT: vpinsrb $4, 128(%rbp), %xmm3, %xmm3
1938 ; KNL-NEXT: vpinsrb $5, 136(%rbp), %xmm3, %xmm3
1939 ; KNL-NEXT: vpinsrb $6, 144(%rbp), %xmm3, %xmm3
1940 ; KNL-NEXT: vpinsrb $7, 152(%rbp), %xmm3, %xmm3
1941 ; KNL-NEXT: vpinsrb $8, 160(%rbp), %xmm3, %xmm3
1942 ; KNL-NEXT: vpinsrb $9, 168(%rbp), %xmm3, %xmm3
1943 ; KNL-NEXT: vpinsrb $10, 176(%rbp), %xmm3, %xmm3
1944 ; KNL-NEXT: vpinsrb $11, 184(%rbp), %xmm3, %xmm3
1945 ; KNL-NEXT: vpinsrb $12, 192(%rbp), %xmm3, %xmm3
1946 ; KNL-NEXT: vpinsrb $13, 200(%rbp), %xmm3, %xmm3
1947 ; KNL-NEXT: vpinsrb $14, 208(%rbp), %xmm3, %xmm3
1948 ; KNL-NEXT: vpinsrb $15, 216(%rbp), %xmm3, %xmm3
1949 ; KNL-NEXT: vinserti128 $1, %xmm3, %ymm2, %ymm2
1950 ; KNL-NEXT: movl 744(%rbp), %eax
1951 ; KNL-NEXT: andl $127, %eax
1952 ; KNL-NEXT: vpxor %xmm3, %xmm3, %xmm3
1953 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm2, %ymm2
1954 ; KNL-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1955 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm1, %ymm1
1956 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1957 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm0, %ymm0
1958 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1959 ; KNL-NEXT: cmpb $0, 736(%rbp)
1960 ; KNL-NEXT: vmovdqa %ymm0, {{[0-9]+}}(%rsp)
1961 ; KNL-NEXT: vmovdqa %ymm1, {{[0-9]+}}(%rsp)
1962 ; KNL-NEXT: vmovdqa %ymm2, (%rsp)
1963 ; KNL-NEXT: setne (%rsp,%rax)
1964 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1965 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1966 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1967 ; KNL-NEXT: kmovw %k0, %eax
1968 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1969 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1970 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1971 ; KNL-NEXT: kmovw %k0, %ecx
1972 ; KNL-NEXT: shll $16, %ecx
1973 ; KNL-NEXT: orl %eax, %ecx
1974 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1975 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1976 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1977 ; KNL-NEXT: kmovw %k0, %edx
1978 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1979 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1980 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1981 ; KNL-NEXT: kmovw %k0, %eax
1982 ; KNL-NEXT: shll $16, %eax
1983 ; KNL-NEXT: orl %edx, %eax
1984 ; KNL-NEXT: shlq $32, %rax
1985 ; KNL-NEXT: orq %rcx, %rax
1986 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1987 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1988 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1989 ; KNL-NEXT: kmovw %k0, %ecx
1990 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1991 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1992 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1993 ; KNL-NEXT: kmovw %k0, %esi
1994 ; KNL-NEXT: shll $16, %esi
1995 ; KNL-NEXT: orl %ecx, %esi
1996 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1997 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1998 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1999 ; KNL-NEXT: kmovw %k0, %ecx
2000 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2001 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2002 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2003 ; KNL-NEXT: kmovw %k0, %edx
2004 ; KNL-NEXT: shll $16, %edx
2005 ; KNL-NEXT: orl %ecx, %edx
2006 ; KNL-NEXT: shlq $32, %rdx
2007 ; KNL-NEXT: orq %rsi, %rdx
2008 ; KNL-NEXT: movq %rbp, %rsp
2009 ; KNL-NEXT: popq %rbp
2010 ; KNL-NEXT: vzeroupper
2013 ; SKX-LABEL: test_insertelement_variable_v96i1:
2015 ; SKX-NEXT: pushq %rbp
2016 ; SKX-NEXT: .cfi_def_cfa_offset 16
2017 ; SKX-NEXT: .cfi_offset %rbp, -16
2018 ; SKX-NEXT: movq %rsp, %rbp
2019 ; SKX-NEXT: .cfi_def_cfa_register %rbp
2020 ; SKX-NEXT: andq $-128, %rsp
2021 ; SKX-NEXT: subq $256, %rsp ## imm = 0x100
2022 ; SKX-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
2023 ; SKX-NEXT: vpinsrb $1, 232(%rbp), %xmm0, %xmm0
2024 ; SKX-NEXT: vpinsrb $2, 240(%rbp), %xmm0, %xmm0
2025 ; SKX-NEXT: vpinsrb $3, 248(%rbp), %xmm0, %xmm0
2026 ; SKX-NEXT: vpinsrb $4, 256(%rbp), %xmm0, %xmm0
2027 ; SKX-NEXT: vpinsrb $5, 264(%rbp), %xmm0, %xmm0
2028 ; SKX-NEXT: vpinsrb $6, 272(%rbp), %xmm0, %xmm0
2029 ; SKX-NEXT: vpinsrb $7, 280(%rbp), %xmm0, %xmm0
2030 ; SKX-NEXT: vpinsrb $8, 288(%rbp), %xmm0, %xmm0
2031 ; SKX-NEXT: vpinsrb $9, 296(%rbp), %xmm0, %xmm0
2032 ; SKX-NEXT: vpinsrb $10, 304(%rbp), %xmm0, %xmm0
2033 ; SKX-NEXT: vpinsrb $11, 312(%rbp), %xmm0, %xmm0
2034 ; SKX-NEXT: vpinsrb $12, 320(%rbp), %xmm0, %xmm0
2035 ; SKX-NEXT: vpinsrb $13, 328(%rbp), %xmm0, %xmm0
2036 ; SKX-NEXT: vpinsrb $14, 336(%rbp), %xmm0, %xmm0
2037 ; SKX-NEXT: vpinsrb $15, 344(%rbp), %xmm0, %xmm0
2038 ; SKX-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
2039 ; SKX-NEXT: vpinsrb $1, 360(%rbp), %xmm1, %xmm1
2040 ; SKX-NEXT: vpinsrb $2, 368(%rbp), %xmm1, %xmm1
2041 ; SKX-NEXT: vpinsrb $3, 376(%rbp), %xmm1, %xmm1
2042 ; SKX-NEXT: vpinsrb $4, 384(%rbp), %xmm1, %xmm1
2043 ; SKX-NEXT: vpinsrb $5, 392(%rbp), %xmm1, %xmm1
2044 ; SKX-NEXT: vpinsrb $6, 400(%rbp), %xmm1, %xmm1
2045 ; SKX-NEXT: vpinsrb $7, 408(%rbp), %xmm1, %xmm1
2046 ; SKX-NEXT: vpinsrb $8, 416(%rbp), %xmm1, %xmm1
2047 ; SKX-NEXT: vpinsrb $9, 424(%rbp), %xmm1, %xmm1
2048 ; SKX-NEXT: vpinsrb $10, 432(%rbp), %xmm1, %xmm1
2049 ; SKX-NEXT: vpinsrb $11, 440(%rbp), %xmm1, %xmm1
2050 ; SKX-NEXT: vpinsrb $12, 448(%rbp), %xmm1, %xmm1
2051 ; SKX-NEXT: vpinsrb $13, 456(%rbp), %xmm1, %xmm1
2052 ; SKX-NEXT: vpinsrb $14, 464(%rbp), %xmm1, %xmm1
2053 ; SKX-NEXT: vpinsrb $15, 472(%rbp), %xmm1, %xmm1
2054 ; SKX-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
2055 ; SKX-NEXT: vmovd %edi, %xmm1
2056 ; SKX-NEXT: vpinsrb $1, %esi, %xmm1, %xmm1
2057 ; SKX-NEXT: vpinsrb $2, %edx, %xmm1, %xmm1
2058 ; SKX-NEXT: vpinsrb $3, %ecx, %xmm1, %xmm1
2059 ; SKX-NEXT: vpinsrb $4, %r8d, %xmm1, %xmm1
2060 ; SKX-NEXT: vpinsrb $5, %r9d, %xmm1, %xmm1
2061 ; SKX-NEXT: vpinsrb $6, 16(%rbp), %xmm1, %xmm1
2062 ; SKX-NEXT: vpinsrb $7, 24(%rbp), %xmm1, %xmm1
2063 ; SKX-NEXT: vpinsrb $8, 32(%rbp), %xmm1, %xmm1
2064 ; SKX-NEXT: vpinsrb $9, 40(%rbp), %xmm1, %xmm1
2065 ; SKX-NEXT: vpinsrb $10, 48(%rbp), %xmm1, %xmm1
2066 ; SKX-NEXT: vpinsrb $11, 56(%rbp), %xmm1, %xmm1
2067 ; SKX-NEXT: vpinsrb $12, 64(%rbp), %xmm1, %xmm1
2068 ; SKX-NEXT: vpinsrb $13, 72(%rbp), %xmm1, %xmm1
2069 ; SKX-NEXT: vpinsrb $14, 80(%rbp), %xmm1, %xmm1
2070 ; SKX-NEXT: vpinsrb $15, 88(%rbp), %xmm1, %xmm1
2071 ; SKX-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
2072 ; SKX-NEXT: vpinsrb $1, 104(%rbp), %xmm2, %xmm2
2073 ; SKX-NEXT: vpinsrb $2, 112(%rbp), %xmm2, %xmm2
2074 ; SKX-NEXT: vpinsrb $3, 120(%rbp), %xmm2, %xmm2
2075 ; SKX-NEXT: vpinsrb $4, 128(%rbp), %xmm2, %xmm2
2076 ; SKX-NEXT: vpinsrb $5, 136(%rbp), %xmm2, %xmm2
2077 ; SKX-NEXT: vpinsrb $6, 144(%rbp), %xmm2, %xmm2
2078 ; SKX-NEXT: vpinsrb $7, 152(%rbp), %xmm2, %xmm2
2079 ; SKX-NEXT: vpinsrb $8, 160(%rbp), %xmm2, %xmm2
2080 ; SKX-NEXT: vpinsrb $9, 168(%rbp), %xmm2, %xmm2
2081 ; SKX-NEXT: vpinsrb $10, 176(%rbp), %xmm2, %xmm2
2082 ; SKX-NEXT: vpinsrb $11, 184(%rbp), %xmm2, %xmm2
2083 ; SKX-NEXT: vpinsrb $12, 192(%rbp), %xmm2, %xmm2
2084 ; SKX-NEXT: vpinsrb $13, 200(%rbp), %xmm2, %xmm2
2085 ; SKX-NEXT: vpinsrb $14, 208(%rbp), %xmm2, %xmm2
2086 ; SKX-NEXT: vpinsrb $15, 216(%rbp), %xmm2, %xmm2
2087 ; SKX-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
2088 ; SKX-NEXT: vinserti64x4 $1, %ymm0, %zmm1, %zmm0
2089 ; SKX-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
2090 ; SKX-NEXT: vpinsrb $1, 488(%rbp), %xmm1, %xmm1
2091 ; SKX-NEXT: vpinsrb $2, 496(%rbp), %xmm1, %xmm1
2092 ; SKX-NEXT: vpinsrb $3, 504(%rbp), %xmm1, %xmm1
2093 ; SKX-NEXT: vpinsrb $4, 512(%rbp), %xmm1, %xmm1
2094 ; SKX-NEXT: vpinsrb $5, 520(%rbp), %xmm1, %xmm1
2095 ; SKX-NEXT: vpinsrb $6, 528(%rbp), %xmm1, %xmm1
2096 ; SKX-NEXT: vpinsrb $7, 536(%rbp), %xmm1, %xmm1
2097 ; SKX-NEXT: vpinsrb $8, 544(%rbp), %xmm1, %xmm1
2098 ; SKX-NEXT: vpinsrb $9, 552(%rbp), %xmm1, %xmm1
2099 ; SKX-NEXT: vpinsrb $10, 560(%rbp), %xmm1, %xmm1
2100 ; SKX-NEXT: vpinsrb $11, 568(%rbp), %xmm1, %xmm1
2101 ; SKX-NEXT: vpinsrb $12, 576(%rbp), %xmm1, %xmm1
2102 ; SKX-NEXT: vpinsrb $13, 584(%rbp), %xmm1, %xmm1
2103 ; SKX-NEXT: vpinsrb $14, 592(%rbp), %xmm1, %xmm1
2104 ; SKX-NEXT: vpinsrb $15, 600(%rbp), %xmm1, %xmm1
2105 ; SKX-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
2106 ; SKX-NEXT: vpinsrb $1, 616(%rbp), %xmm2, %xmm2
2107 ; SKX-NEXT: vpinsrb $2, 624(%rbp), %xmm2, %xmm2
2108 ; SKX-NEXT: vpinsrb $3, 632(%rbp), %xmm2, %xmm2
2109 ; SKX-NEXT: vpinsrb $4, 640(%rbp), %xmm2, %xmm2
2110 ; SKX-NEXT: vpinsrb $5, 648(%rbp), %xmm2, %xmm2
2111 ; SKX-NEXT: vpinsrb $6, 656(%rbp), %xmm2, %xmm2
2112 ; SKX-NEXT: vpinsrb $7, 664(%rbp), %xmm2, %xmm2
2113 ; SKX-NEXT: vpinsrb $8, 672(%rbp), %xmm2, %xmm2
2114 ; SKX-NEXT: vpinsrb $9, 680(%rbp), %xmm2, %xmm2
2115 ; SKX-NEXT: vpinsrb $10, 688(%rbp), %xmm2, %xmm2
2116 ; SKX-NEXT: vpinsrb $11, 696(%rbp), %xmm2, %xmm2
2117 ; SKX-NEXT: vpinsrb $12, 704(%rbp), %xmm2, %xmm2
2118 ; SKX-NEXT: vpinsrb $13, 712(%rbp), %xmm2, %xmm2
2119 ; SKX-NEXT: vpinsrb $14, 720(%rbp), %xmm2, %xmm2
2120 ; SKX-NEXT: vpinsrb $15, 728(%rbp), %xmm2, %xmm2
2121 ; SKX-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
2122 ; SKX-NEXT: movl 744(%rbp), %eax
2123 ; SKX-NEXT: andl $127, %eax
2124 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
2125 ; SKX-NEXT: vptestmb %zmm1, %zmm1, %k1
2126 ; SKX-NEXT: cmpb $0, 736(%rbp)
2127 ; SKX-NEXT: vpmovm2b %k1, %zmm0
2128 ; SKX-NEXT: vmovdqa64 %zmm0, {{[0-9]+}}(%rsp)
2129 ; SKX-NEXT: vpmovm2b %k0, %zmm0
2130 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
2131 ; SKX-NEXT: setne (%rsp,%rax)
2132 ; SKX-NEXT: vpsllw $7, {{[0-9]+}}(%rsp), %zmm0
2133 ; SKX-NEXT: vpmovb2m %zmm0, %k0
2134 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
2135 ; SKX-NEXT: vpmovb2m %zmm0, %k1
2136 ; SKX-NEXT: kmovq %k1, %rax
2137 ; SKX-NEXT: kmovq %k0, %rdx
2138 ; SKX-NEXT: movq %rbp, %rsp
2139 ; SKX-NEXT: popq %rbp
2140 ; SKX-NEXT: vzeroupper
2142 %t1 = icmp ugt <96 x i8> %a, zeroinitializer
2143 %t2 = icmp ugt i8 %b, 0
2144 %t3 = insertelement <96 x i1> %t1, i1 %t2, i32 %index
2145 %t4 = bitcast <96 x i1> %t3 to i96
2149 define i128 @test_insertelement_variable_v128i1(<128 x i8> %a, i8 %b, i32 %index) {
2150 ; KNL-LABEL: test_insertelement_variable_v128i1:
2152 ; KNL-NEXT: pushq %rbp
2153 ; KNL-NEXT: .cfi_def_cfa_offset 16
2154 ; KNL-NEXT: .cfi_offset %rbp, -16
2155 ; KNL-NEXT: movq %rsp, %rbp
2156 ; KNL-NEXT: .cfi_def_cfa_register %rbp
2157 ; KNL-NEXT: andq $-128, %rsp
2158 ; KNL-NEXT: subq $256, %rsp ## imm = 0x100
2159 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
2160 ; KNL-NEXT: vpxor %xmm4, %xmm4, %xmm4
2161 ; KNL-NEXT: vpcmpeqb %ymm4, %ymm0, %ymm0
2162 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
2163 ; KNL-NEXT: vpcmpeqb %ymm4, %ymm1, %ymm1
2164 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
2165 ; KNL-NEXT: vpcmpeqb %ymm4, %ymm2, %ymm2
2166 ; KNL-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
2167 ; KNL-NEXT: vpcmpeqb %ymm4, %ymm3, %ymm3
2168 ; KNL-NEXT: vpternlogq $15, %zmm3, %zmm3, %zmm3
2169 ; KNL-NEXT: andl $127, %esi
2170 ; KNL-NEXT: testb %dil, %dil
2171 ; KNL-NEXT: vmovdqa %ymm3, {{[0-9]+}}(%rsp)
2172 ; KNL-NEXT: vmovdqa %ymm2, {{[0-9]+}}(%rsp)
2173 ; KNL-NEXT: vmovdqa %ymm1, {{[0-9]+}}(%rsp)
2174 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
2175 ; KNL-NEXT: setne (%rsp,%rsi)
2176 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
2177 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2178 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2179 ; KNL-NEXT: kmovw %k0, %eax
2180 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2181 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2182 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2183 ; KNL-NEXT: kmovw %k0, %ecx
2184 ; KNL-NEXT: shll $16, %ecx
2185 ; KNL-NEXT: orl %eax, %ecx
2186 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2187 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2188 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2189 ; KNL-NEXT: kmovw %k0, %edx
2190 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2191 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2192 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2193 ; KNL-NEXT: kmovw %k0, %eax
2194 ; KNL-NEXT: shll $16, %eax
2195 ; KNL-NEXT: orl %edx, %eax
2196 ; KNL-NEXT: shlq $32, %rax
2197 ; KNL-NEXT: orq %rcx, %rax
2198 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2199 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2200 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2201 ; KNL-NEXT: kmovw %k0, %ecx
2202 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2203 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2204 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2205 ; KNL-NEXT: kmovw %k0, %esi
2206 ; KNL-NEXT: shll $16, %esi
2207 ; KNL-NEXT: orl %ecx, %esi
2208 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2209 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2210 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2211 ; KNL-NEXT: kmovw %k0, %ecx
2212 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2213 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2214 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2215 ; KNL-NEXT: kmovw %k0, %edx
2216 ; KNL-NEXT: shll $16, %edx
2217 ; KNL-NEXT: orl %ecx, %edx
2218 ; KNL-NEXT: shlq $32, %rdx
2219 ; KNL-NEXT: orq %rsi, %rdx
2220 ; KNL-NEXT: movq %rbp, %rsp
2221 ; KNL-NEXT: popq %rbp
2222 ; KNL-NEXT: vzeroupper
2225 ; SKX-LABEL: test_insertelement_variable_v128i1:
2227 ; SKX-NEXT: pushq %rbp
2228 ; SKX-NEXT: .cfi_def_cfa_offset 16
2229 ; SKX-NEXT: .cfi_offset %rbp, -16
2230 ; SKX-NEXT: movq %rsp, %rbp
2231 ; SKX-NEXT: .cfi_def_cfa_register %rbp
2232 ; SKX-NEXT: andq $-128, %rsp
2233 ; SKX-NEXT: subq $256, %rsp ## imm = 0x100
2234 ; SKX-NEXT: ## kill: def $esi killed $esi def $rsi
2235 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
2236 ; SKX-NEXT: vptestmb %zmm1, %zmm1, %k1
2237 ; SKX-NEXT: andl $127, %esi
2238 ; SKX-NEXT: testb %dil, %dil
2239 ; SKX-NEXT: vpmovm2b %k1, %zmm0
2240 ; SKX-NEXT: vmovdqa64 %zmm0, {{[0-9]+}}(%rsp)
2241 ; SKX-NEXT: vpmovm2b %k0, %zmm0
2242 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
2243 ; SKX-NEXT: setne (%rsp,%rsi)
2244 ; SKX-NEXT: vpsllw $7, {{[0-9]+}}(%rsp), %zmm0
2245 ; SKX-NEXT: vpmovb2m %zmm0, %k0
2246 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
2247 ; SKX-NEXT: vpmovb2m %zmm0, %k1
2248 ; SKX-NEXT: kmovq %k1, %rax
2249 ; SKX-NEXT: kmovq %k0, %rdx
2250 ; SKX-NEXT: movq %rbp, %rsp
2251 ; SKX-NEXT: popq %rbp
2252 ; SKX-NEXT: vzeroupper
2254 %t1 = icmp ugt <128 x i8> %a, zeroinitializer
2255 %t2 = icmp ugt i8 %b, 0
2256 %t3 = insertelement <128 x i1> %t1, i1 %t2, i32 %index
2257 %t4 = bitcast <128 x i1> %t3 to i128
2261 define void @test_concat_v2i1(<2 x half>* %arg, <2 x half>* %arg1, <2 x half>* %arg2) {
2262 ; KNL-LABEL: test_concat_v2i1:
2264 ; KNL-NEXT: movswl (%rdi), %eax
2265 ; KNL-NEXT: vmovd %eax, %xmm0
2266 ; KNL-NEXT: vcvtph2ps %xmm0, %xmm0
2267 ; KNL-NEXT: movswl 2(%rdi), %eax
2268 ; KNL-NEXT: vmovd %eax, %xmm1
2269 ; KNL-NEXT: vcvtph2ps %xmm1, %xmm1
2270 ; KNL-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
2271 ; KNL-NEXT: vucomiss %xmm2, %xmm1
2272 ; KNL-NEXT: setb %al
2273 ; KNL-NEXT: kmovw %eax, %k0
2274 ; KNL-NEXT: kshiftlw $1, %k0, %k0
2275 ; KNL-NEXT: vucomiss %xmm2, %xmm0
2276 ; KNL-NEXT: setb %al
2277 ; KNL-NEXT: andl $1, %eax
2278 ; KNL-NEXT: kmovw %eax, %k1
2279 ; KNL-NEXT: korw %k0, %k1, %k0
2280 ; KNL-NEXT: vxorps %xmm2, %xmm2, %xmm2
2281 ; KNL-NEXT: vucomiss %xmm2, %xmm1
2282 ; KNL-NEXT: seta %al
2283 ; KNL-NEXT: kmovw %eax, %k1
2284 ; KNL-NEXT: kshiftlw $1, %k1, %k1
2285 ; KNL-NEXT: vucomiss %xmm2, %xmm0
2286 ; KNL-NEXT: seta %al
2287 ; KNL-NEXT: andl $1, %eax
2288 ; KNL-NEXT: kmovw %eax, %k2
2289 ; KNL-NEXT: korw %k1, %k2, %k1
2290 ; KNL-NEXT: kandw %k1, %k0, %k1
2291 ; KNL-NEXT: kshiftrw $1, %k1, %k2
2292 ; KNL-NEXT: movswl (%rsi), %eax
2293 ; KNL-NEXT: vmovd %eax, %xmm0
2294 ; KNL-NEXT: vcvtph2ps %xmm0, %xmm0
2295 ; KNL-NEXT: movswl 2(%rsi), %eax
2296 ; KNL-NEXT: vmovd %eax, %xmm1
2297 ; KNL-NEXT: vcvtph2ps %xmm1, %xmm1
2298 ; KNL-NEXT: vmovss %xmm1, %xmm0, %xmm1 {%k2} {z}
2299 ; KNL-NEXT: vmovss %xmm0, %xmm0, %xmm0 {%k1} {z}
2300 ; KNL-NEXT: vcvtps2ph $4, %xmm0, %xmm0
2301 ; KNL-NEXT: vmovd %xmm0, %eax
2302 ; KNL-NEXT: movw %ax, (%rdx)
2303 ; KNL-NEXT: vcvtps2ph $4, %xmm1, %xmm0
2304 ; KNL-NEXT: vmovd %xmm0, %eax
2305 ; KNL-NEXT: movw %ax, 2(%rdx)
2308 ; SKX-LABEL: test_concat_v2i1:
2310 ; SKX-NEXT: movswl (%rdi), %eax
2311 ; SKX-NEXT: vmovd %eax, %xmm0
2312 ; SKX-NEXT: vcvtph2ps %xmm0, %xmm0
2313 ; SKX-NEXT: movswl 2(%rdi), %eax
2314 ; SKX-NEXT: vmovd %eax, %xmm1
2315 ; SKX-NEXT: vcvtph2ps %xmm1, %xmm1
2316 ; SKX-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
2317 ; SKX-NEXT: vucomiss %xmm2, %xmm1
2318 ; SKX-NEXT: setb %al
2319 ; SKX-NEXT: kmovd %eax, %k0
2320 ; SKX-NEXT: kshiftlb $1, %k0, %k0
2321 ; SKX-NEXT: vucomiss %xmm2, %xmm0
2322 ; SKX-NEXT: setb %al
2323 ; SKX-NEXT: kmovd %eax, %k1
2324 ; SKX-NEXT: kshiftlb $7, %k1, %k1
2325 ; SKX-NEXT: kshiftrb $7, %k1, %k1
2326 ; SKX-NEXT: korw %k0, %k1, %k0
2327 ; SKX-NEXT: vxorps %xmm2, %xmm2, %xmm2
2328 ; SKX-NEXT: vucomiss %xmm2, %xmm1
2329 ; SKX-NEXT: seta %al
2330 ; SKX-NEXT: kmovd %eax, %k1
2331 ; SKX-NEXT: kshiftlb $1, %k1, %k1
2332 ; SKX-NEXT: vucomiss %xmm2, %xmm0
2333 ; SKX-NEXT: seta %al
2334 ; SKX-NEXT: kmovd %eax, %k2
2335 ; SKX-NEXT: kshiftlb $7, %k2, %k2
2336 ; SKX-NEXT: kshiftrb $7, %k2, %k2
2337 ; SKX-NEXT: korw %k1, %k2, %k1
2338 ; SKX-NEXT: kandw %k1, %k0, %k1
2339 ; SKX-NEXT: kshiftrb $1, %k1, %k2
2340 ; SKX-NEXT: movswl (%rsi), %eax
2341 ; SKX-NEXT: vmovd %eax, %xmm0
2342 ; SKX-NEXT: vcvtph2ps %xmm0, %xmm0
2343 ; SKX-NEXT: movswl 2(%rsi), %eax
2344 ; SKX-NEXT: vmovd %eax, %xmm1
2345 ; SKX-NEXT: vcvtph2ps %xmm1, %xmm1
2346 ; SKX-NEXT: vmovss %xmm1, %xmm0, %xmm1 {%k2} {z}
2347 ; SKX-NEXT: vmovss %xmm0, %xmm0, %xmm0 {%k1} {z}
2348 ; SKX-NEXT: vcvtps2ph $4, %xmm0, %xmm0
2349 ; SKX-NEXT: vmovd %xmm0, %eax
2350 ; SKX-NEXT: movw %ax, (%rdx)
2351 ; SKX-NEXT: vcvtps2ph $4, %xmm1, %xmm0
2352 ; SKX-NEXT: vmovd %xmm0, %eax
2353 ; SKX-NEXT: movw %ax, 2(%rdx)
2355 %tmp = load <2 x half>, <2 x half>* %arg, align 8
2356 %tmp3 = fcmp fast olt <2 x half> %tmp, <half 0xH4600, half 0xH4600>
2357 %tmp4 = fcmp fast ogt <2 x half> %tmp, zeroinitializer
2358 %tmp5 = and <2 x i1> %tmp3, %tmp4
2359 %tmp6 = load <2 x half>, <2 x half>* %arg1, align 8
2360 %tmp7 = select <2 x i1> %tmp5, <2 x half> %tmp6, <2 x half> zeroinitializer
2361 store <2 x half> %tmp7, <2 x half>* %arg2, align 8