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: kshiftrw $11, %k0, %k1
306 ; KNL-NEXT: kshiftlw $11, %k1, %k1
307 ; KNL-NEXT: kshiftlw $6, %k0, %k0
308 ; KNL-NEXT: kshiftrw $6, %k0, %k0
309 ; KNL-NEXT: kmovw %eax, %k2
310 ; KNL-NEXT: kshiftlw $15, %k2, %k2
311 ; KNL-NEXT: kshiftrw $5, %k2, %k2
312 ; KNL-NEXT: korw %k2, %k1, %k1
313 ; KNL-NEXT: korw %k1, %k0, %k0
314 ; KNL-NEXT: kmovw %k0, %eax
315 ; KNL-NEXT: ## kill: def $ax killed $ax killed $eax
320 ; SKX-NEXT: kmovb (%rdi), %k0
321 ; SKX-NEXT: kmovd %esi, %k1
322 ; SKX-NEXT: kshiftrw $11, %k1, %k2
323 ; SKX-NEXT: kshiftlw $11, %k2, %k2
324 ; SKX-NEXT: kshiftlw $6, %k1, %k1
325 ; SKX-NEXT: kshiftrw $6, %k1, %k1
326 ; SKX-NEXT: kshiftlw $15, %k0, %k0
327 ; SKX-NEXT: kshiftrw $5, %k0, %k0
328 ; SKX-NEXT: korw %k0, %k2, %k0
329 ; SKX-NEXT: korw %k0, %k1, %k0
330 ; SKX-NEXT: kmovd %k0, %eax
331 ; SKX-NEXT: ## kill: def $ax killed $ax killed $eax
333 %x = load i1 , i1 * %addr, align 128
334 %a1 = bitcast i16 %a to <16 x i1>
335 %x1 = insertelement <16 x i1> %a1, i1 %x, i32 10
336 %x2 = bitcast <16 x i1>%x1 to i16
340 define i8 @test17(i1 *%addr, i8 %a) {
343 ; KNL-NEXT: movb (%rdi), %al
344 ; KNL-NEXT: kmovw %esi, %k0
345 ; KNL-NEXT: kshiftrw $5, %k0, %k1
346 ; KNL-NEXT: kshiftlw $5, %k1, %k1
347 ; KNL-NEXT: kshiftlw $12, %k0, %k0
348 ; KNL-NEXT: kshiftrw $12, %k0, %k0
349 ; KNL-NEXT: korw %k1, %k0, %k0
350 ; KNL-NEXT: kmovw %eax, %k1
351 ; KNL-NEXT: kshiftlw $15, %k1, %k1
352 ; KNL-NEXT: kshiftrw $11, %k1, %k1
353 ; KNL-NEXT: korw %k0, %k1, %k0
354 ; KNL-NEXT: kmovw %k0, %eax
355 ; KNL-NEXT: ## kill: def $al killed $al killed $eax
360 ; SKX-NEXT: kmovb (%rdi), %k0
361 ; SKX-NEXT: kmovd %esi, %k1
362 ; SKX-NEXT: kshiftrb $5, %k1, %k2
363 ; SKX-NEXT: kshiftlb $5, %k2, %k2
364 ; SKX-NEXT: kshiftlb $4, %k1, %k1
365 ; SKX-NEXT: kshiftrb $4, %k1, %k1
366 ; SKX-NEXT: kshiftlb $7, %k0, %k0
367 ; SKX-NEXT: kshiftrb $3, %k0, %k0
368 ; SKX-NEXT: korb %k0, %k2, %k0
369 ; SKX-NEXT: korb %k0, %k1, %k0
370 ; SKX-NEXT: kmovd %k0, %eax
371 ; SKX-NEXT: ## kill: def $al killed $al killed $eax
373 %x = load i1 , i1 * %addr, align 128
374 %a1 = bitcast i8 %a to <8 x i1>
375 %x1 = insertelement <8 x i1> %a1, i1 %x, i32 4
376 %x2 = bitcast <8 x i1>%x1 to i8
380 define i64 @extract_v8i64(<8 x i64> %x, i64* %dst) {
381 ; CHECK-LABEL: extract_v8i64:
383 ; CHECK-NEXT: vpextrq $1, %xmm0, %rax
384 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
385 ; CHECK-NEXT: vpextrq $1, %xmm0, (%rdi)
386 ; CHECK-NEXT: vzeroupper
388 %r1 = extractelement <8 x i64> %x, i32 1
389 %r2 = extractelement <8 x i64> %x, i32 3
390 store i64 %r2, i64* %dst, align 1
394 define i64 @extract_v4i64(<4 x i64> %x, i64* %dst) {
395 ; CHECK-LABEL: extract_v4i64:
397 ; CHECK-NEXT: vpextrq $1, %xmm0, %rax
398 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
399 ; CHECK-NEXT: vpextrq $1, %xmm0, (%rdi)
400 ; CHECK-NEXT: vzeroupper
402 %r1 = extractelement <4 x i64> %x, i32 1
403 %r2 = extractelement <4 x i64> %x, i32 3
404 store i64 %r2, i64* %dst, align 1
408 define i64 @extract_v2i64(<2 x i64> %x, i64* %dst) {
409 ; CHECK-LABEL: extract_v2i64:
411 ; CHECK-NEXT: vmovq %xmm0, %rax
412 ; CHECK-NEXT: vpextrq $1, %xmm0, (%rdi)
414 %r1 = extractelement <2 x i64> %x, i32 0
415 %r2 = extractelement <2 x i64> %x, i32 1
416 store i64 %r2, i64* %dst, align 1
420 define i32 @extract_v16i32(<16 x i32> %x, i32* %dst) {
421 ; CHECK-LABEL: extract_v16i32:
423 ; CHECK-NEXT: vextractps $1, %xmm0, %eax
424 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
425 ; CHECK-NEXT: vextractps $1, %xmm0, (%rdi)
426 ; CHECK-NEXT: vzeroupper
428 %r1 = extractelement <16 x i32> %x, i32 1
429 %r2 = extractelement <16 x i32> %x, i32 5
430 store i32 %r2, i32* %dst, align 1
434 define i32 @extract_v8i32(<8 x i32> %x, i32* %dst) {
435 ; CHECK-LABEL: extract_v8i32:
437 ; CHECK-NEXT: vextractps $1, %xmm0, %eax
438 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
439 ; CHECK-NEXT: vextractps $1, %xmm0, (%rdi)
440 ; CHECK-NEXT: vzeroupper
442 %r1 = extractelement <8 x i32> %x, i32 1
443 %r2 = extractelement <8 x i32> %x, i32 5
444 store i32 %r2, i32* %dst, align 1
448 define i32 @extract_v4i32(<4 x i32> %x, i32* %dst) {
449 ; CHECK-LABEL: extract_v4i32:
451 ; CHECK-NEXT: vextractps $1, %xmm0, %eax
452 ; CHECK-NEXT: vextractps $3, %xmm0, (%rdi)
454 %r1 = extractelement <4 x i32> %x, i32 1
455 %r2 = extractelement <4 x i32> %x, i32 3
456 store i32 %r2, i32* %dst, align 1
460 define i16 @extract_v32i16(<32 x i16> %x, i16* %dst) {
461 ; CHECK-LABEL: extract_v32i16:
463 ; CHECK-NEXT: vpextrw $1, %xmm0, %eax
464 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
465 ; CHECK-NEXT: vpextrw $1, %xmm0, (%rdi)
466 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
467 ; CHECK-NEXT: vzeroupper
469 %r1 = extractelement <32 x i16> %x, i32 1
470 %r2 = extractelement <32 x i16> %x, i32 9
471 store i16 %r2, i16* %dst, align 1
475 define i16 @extract_v16i16(<16 x i16> %x, i16* %dst) {
476 ; CHECK-LABEL: extract_v16i16:
478 ; CHECK-NEXT: vpextrw $1, %xmm0, %eax
479 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
480 ; CHECK-NEXT: vpextrw $1, %xmm0, (%rdi)
481 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
482 ; CHECK-NEXT: vzeroupper
484 %r1 = extractelement <16 x i16> %x, i32 1
485 %r2 = extractelement <16 x i16> %x, i32 9
486 store i16 %r2, i16* %dst, align 1
490 define i16 @extract_v8i16(<8 x i16> %x, i16* %dst) {
491 ; CHECK-LABEL: extract_v8i16:
493 ; CHECK-NEXT: vpextrw $1, %xmm0, %eax
494 ; CHECK-NEXT: vpextrw $3, %xmm0, (%rdi)
495 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
497 %r1 = extractelement <8 x i16> %x, i32 1
498 %r2 = extractelement <8 x i16> %x, i32 3
499 store i16 %r2, i16* %dst, align 1
503 define i8 @extract_v64i8(<64 x i8> %x, i8* %dst) {
504 ; CHECK-LABEL: extract_v64i8:
506 ; CHECK-NEXT: vpextrb $1, %xmm0, %eax
507 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
508 ; CHECK-NEXT: vpextrb $1, %xmm0, (%rdi)
509 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
510 ; CHECK-NEXT: vzeroupper
512 %r1 = extractelement <64 x i8> %x, i32 1
513 %r2 = extractelement <64 x i8> %x, i32 17
514 store i8 %r2, i8* %dst, align 1
518 define i8 @extract_v32i8(<32 x i8> %x, i8* %dst) {
519 ; CHECK-LABEL: extract_v32i8:
521 ; CHECK-NEXT: vpextrb $1, %xmm0, %eax
522 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
523 ; CHECK-NEXT: vpextrb $1, %xmm0, (%rdi)
524 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
525 ; CHECK-NEXT: vzeroupper
527 %r1 = extractelement <32 x i8> %x, i32 1
528 %r2 = extractelement <32 x i8> %x, i32 17
529 store i8 %r2, i8* %dst, align 1
533 define i8 @extract_v16i8(<16 x i8> %x, i8* %dst) {
534 ; CHECK-LABEL: extract_v16i8:
536 ; CHECK-NEXT: vpextrb $1, %xmm0, %eax
537 ; CHECK-NEXT: vpextrb $3, %xmm0, (%rdi)
538 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
540 %r1 = extractelement <16 x i8> %x, i32 1
541 %r2 = extractelement <16 x i8> %x, i32 3
542 store i8 %r2, i8* %dst, align 1
546 define <8 x i64> @insert_v8i64(<8 x i64> %x, i64 %y , i64* %ptr) {
547 ; CHECK-LABEL: insert_v8i64:
549 ; CHECK-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm1
550 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
551 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
552 ; CHECK-NEXT: vpinsrq $1, %rdi, %xmm0, %xmm0
553 ; CHECK-NEXT: vinserti32x4 $1, %xmm0, %zmm1, %zmm0
555 %val = load i64, i64* %ptr
556 %r1 = insertelement <8 x i64> %x, i64 %val, i32 1
557 %r2 = insertelement <8 x i64> %r1, i64 %y, i32 3
561 define <4 x i64> @insert_v4i64(<4 x i64> %x, i64 %y , i64* %ptr) {
562 ; CHECK-LABEL: insert_v4i64:
564 ; CHECK-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm1
565 ; CHECK-NEXT: vpblendd {{.*#+}} ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
566 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
567 ; CHECK-NEXT: vpinsrq $1, %rdi, %xmm0, %xmm0
568 ; CHECK-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
570 %val = load i64, i64* %ptr
571 %r1 = insertelement <4 x i64> %x, i64 %val, i32 1
572 %r2 = insertelement <4 x i64> %r1, i64 %y, i32 3
576 define <2 x i64> @insert_v2i64(<2 x i64> %x, i64 %y , i64* %ptr) {
577 ; CHECK-LABEL: insert_v2i64:
579 ; CHECK-NEXT: vpinsrq $0, %rdi, %xmm0, %xmm0
580 ; CHECK-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm0
582 %val = load i64, i64* %ptr
583 %r1 = insertelement <2 x i64> %x, i64 %val, i32 1
584 %r2 = insertelement <2 x i64> %r1, i64 %y, i32 0
588 define <16 x i32> @insert_v16i32(<16 x i32> %x, i32 %y, i32* %ptr) {
589 ; CHECK-LABEL: insert_v16i32:
591 ; CHECK-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm1
592 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
593 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
594 ; CHECK-NEXT: vpinsrd $1, %edi, %xmm0, %xmm0
595 ; CHECK-NEXT: vinserti32x4 $1, %xmm0, %zmm1, %zmm0
597 %val = load i32, i32* %ptr
598 %r1 = insertelement <16 x i32> %x, i32 %val, i32 1
599 %r2 = insertelement <16 x i32> %r1, i32 %y, i32 5
603 define <8 x i32> @insert_v8i32(<8 x i32> %x, i32 %y, i32* %ptr) {
604 ; CHECK-LABEL: insert_v8i32:
606 ; CHECK-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm1
607 ; CHECK-NEXT: vpblendd {{.*#+}} ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
608 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
609 ; CHECK-NEXT: vpinsrd $1, %edi, %xmm0, %xmm0
610 ; CHECK-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
612 %val = load i32, i32* %ptr
613 %r1 = insertelement <8 x i32> %x, i32 %val, i32 1
614 %r2 = insertelement <8 x i32> %r1, i32 %y, i32 5
618 define <4 x i32> @insert_v4i32(<4 x i32> %x, i32 %y, i32* %ptr) {
619 ; CHECK-LABEL: insert_v4i32:
621 ; CHECK-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm0
622 ; CHECK-NEXT: vpinsrd $3, %edi, %xmm0, %xmm0
624 %val = load i32, i32* %ptr
625 %r1 = insertelement <4 x i32> %x, i32 %val, i32 1
626 %r2 = insertelement <4 x i32> %r1, i32 %y, i32 3
630 define <32 x i16> @insert_v32i16(<32 x i16> %x, i16 %y, i16* %ptr) {
631 ; KNL-LABEL: insert_v32i16:
633 ; KNL-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
634 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm2
635 ; KNL-NEXT: vpinsrw $1, %edi, %xmm2, %xmm2
636 ; KNL-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
637 ; KNL-NEXT: vshufi64x2 {{.*#+}} zmm0 = zmm1[0,1,2,3],zmm0[4,5,6,7]
640 ; SKX-LABEL: insert_v32i16:
642 ; SKX-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
643 ; SKX-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
644 ; SKX-NEXT: vextracti128 $1, %ymm0, %xmm0
645 ; SKX-NEXT: vpinsrw $1, %edi, %xmm0, %xmm0
646 ; SKX-NEXT: vinserti32x4 $1, %xmm0, %zmm1, %zmm0
648 %val = load i16, i16* %ptr
649 %r1 = insertelement <32 x i16> %x, i16 %val, i32 1
650 %r2 = insertelement <32 x i16> %r1, i16 %y, i32 9
654 define <16 x i16> @insert_v16i16(<16 x i16> %x, i16 %y, i16* %ptr) {
655 ; CHECK-LABEL: insert_v16i16:
657 ; CHECK-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
658 ; CHECK-NEXT: vpblendd {{.*#+}} ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
659 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
660 ; CHECK-NEXT: vpinsrw $1, %edi, %xmm0, %xmm0
661 ; CHECK-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
663 %val = load i16, i16* %ptr
664 %r1 = insertelement <16 x i16> %x, i16 %val, i32 1
665 %r2 = insertelement <16 x i16> %r1, i16 %y, i32 9
669 define <8 x i16> @insert_v8i16(<8 x i16> %x, i16 %y, i16* %ptr) {
670 ; CHECK-LABEL: insert_v8i16:
672 ; CHECK-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm0
673 ; CHECK-NEXT: vpinsrw $5, %edi, %xmm0, %xmm0
675 %val = load i16, i16* %ptr
676 %r1 = insertelement <8 x i16> %x, i16 %val, i32 1
677 %r2 = insertelement <8 x i16> %r1, i16 %y, i32 5
681 define <64 x i8> @insert_v64i8(<64 x i8> %x, i8 %y, i8* %ptr) {
682 ; KNL-LABEL: insert_v64i8:
684 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm1
685 ; KNL-NEXT: vpinsrb $1, (%rsi), %xmm0, %xmm2
686 ; KNL-NEXT: vpblendd {{.*#+}} ymm0 = ymm2[0,1,2,3],ymm0[4,5,6,7]
687 ; KNL-NEXT: vextracti128 $1, %ymm1, %xmm2
688 ; KNL-NEXT: vpinsrb $2, %edi, %xmm2, %xmm2
689 ; KNL-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
690 ; KNL-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
693 ; SKX-LABEL: insert_v64i8:
695 ; SKX-NEXT: vpinsrb $1, (%rsi), %xmm0, %xmm1
696 ; SKX-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
697 ; SKX-NEXT: vextracti32x4 $3, %zmm0, %xmm0
698 ; SKX-NEXT: vpinsrb $2, %edi, %xmm0, %xmm0
699 ; SKX-NEXT: vinserti32x4 $3, %xmm0, %zmm1, %zmm0
701 %val = load i8, i8* %ptr
702 %r1 = insertelement <64 x i8> %x, i8 %val, i32 1
703 %r2 = insertelement <64 x i8> %r1, i8 %y, i32 50
707 define <32 x i8> @insert_v32i8(<32 x i8> %x, i8 %y, i8* %ptr) {
708 ; CHECK-LABEL: insert_v32i8:
710 ; CHECK-NEXT: vpinsrb $1, (%rsi), %xmm0, %xmm1
711 ; CHECK-NEXT: vpblendd {{.*#+}} ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
712 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
713 ; CHECK-NEXT: vpinsrb $1, %edi, %xmm0, %xmm0
714 ; CHECK-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
716 %val = load i8, i8* %ptr
717 %r1 = insertelement <32 x i8> %x, i8 %val, i32 1
718 %r2 = insertelement <32 x i8> %r1, i8 %y, i32 17
722 define <16 x i8> @insert_v16i8(<16 x i8> %x, i8 %y, i8* %ptr) {
723 ; CHECK-LABEL: insert_v16i8:
725 ; CHECK-NEXT: vpinsrb $3, (%rsi), %xmm0, %xmm0
726 ; CHECK-NEXT: vpinsrb $10, %edi, %xmm0, %xmm0
728 %val = load i8, i8* %ptr
729 %r1 = insertelement <16 x i8> %x, i8 %val, i32 3
730 %r2 = insertelement <16 x i8> %r1, i8 %y, i32 10
734 define <8 x i64> @test_insert_128_v8i64(<8 x i64> %x, i64 %y) {
735 ; CHECK-LABEL: test_insert_128_v8i64:
737 ; CHECK-NEXT: vpinsrq $1, %rdi, %xmm0, %xmm1
738 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
740 %r = insertelement <8 x i64> %x, i64 %y, i32 1
744 define <16 x i32> @test_insert_128_v16i32(<16 x i32> %x, i32 %y) {
745 ; CHECK-LABEL: test_insert_128_v16i32:
747 ; CHECK-NEXT: vpinsrd $1, %edi, %xmm0, %xmm1
748 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
750 %r = insertelement <16 x i32> %x, i32 %y, i32 1
754 define <8 x double> @test_insert_128_v8f64(<8 x double> %x, double %y) {
755 ; CHECK-LABEL: test_insert_128_v8f64:
757 ; CHECK-NEXT: vmovlhps {{.*#+}} xmm1 = xmm0[0],xmm1[0]
758 ; CHECK-NEXT: vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
760 %r = insertelement <8 x double> %x, double %y, i32 1
764 define <16 x float> @test_insert_128_v16f32(<16 x float> %x, float %y) {
765 ; CHECK-LABEL: test_insert_128_v16f32:
767 ; CHECK-NEXT: vinsertps {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[2,3]
768 ; CHECK-NEXT: vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
770 %r = insertelement <16 x float> %x, float %y, i32 1
774 define <16 x i16> @test_insert_128_v16i16(<16 x i16> %x, i16 %y) {
775 ; CHECK-LABEL: test_insert_128_v16i16:
777 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm1
778 ; CHECK-NEXT: vpinsrw $2, %edi, %xmm1, %xmm1
779 ; CHECK-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
781 %r = insertelement <16 x i16> %x, i16 %y, i32 10
785 define <32 x i8> @test_insert_128_v32i8(<32 x i8> %x, i8 %y) {
786 ; CHECK-LABEL: test_insert_128_v32i8:
788 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm1
789 ; CHECK-NEXT: vpinsrb $4, %edi, %xmm1, %xmm1
790 ; CHECK-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
792 %r = insertelement <32 x i8> %x, i8 %y, i32 20
796 define i32 @test_insertelement_v32i1(i32 %a, i32 %b, <32 x i32> %x , <32 x i32> %y) {
797 ; KNL-LABEL: test_insertelement_v32i1:
799 ; KNL-NEXT: cmpl %esi, %edi
801 ; KNL-NEXT: vpcmpltud %zmm3, %zmm1, %k0
802 ; KNL-NEXT: kmovw %k0, %ecx
803 ; KNL-NEXT: shll $16, %ecx
804 ; KNL-NEXT: vpcmpltud %zmm2, %zmm0, %k0
805 ; KNL-NEXT: kshiftrw $5, %k0, %k1
806 ; KNL-NEXT: kshiftlw $5, %k1, %k1
807 ; KNL-NEXT: kshiftlw $12, %k0, %k0
808 ; KNL-NEXT: kshiftrw $12, %k0, %k0
809 ; KNL-NEXT: kmovw %eax, %k2
810 ; KNL-NEXT: kshiftlw $15, %k2, %k2
811 ; KNL-NEXT: kshiftrw $11, %k2, %k2
812 ; KNL-NEXT: korw %k2, %k1, %k1
813 ; KNL-NEXT: korw %k1, %k0, %k0
814 ; KNL-NEXT: kmovw %k0, %eax
815 ; KNL-NEXT: orl %ecx, %eax
816 ; KNL-NEXT: vzeroupper
819 ; SKX-LABEL: test_insertelement_v32i1:
821 ; SKX-NEXT: cmpl %esi, %edi
823 ; SKX-NEXT: vpcmpltud %zmm2, %zmm0, %k0
824 ; SKX-NEXT: vpcmpltud %zmm3, %zmm1, %k1
825 ; SKX-NEXT: kunpckwd %k0, %k1, %k0
826 ; SKX-NEXT: kshiftrd $5, %k0, %k1
827 ; SKX-NEXT: kshiftld $5, %k1, %k1
828 ; SKX-NEXT: kshiftld $28, %k0, %k0
829 ; SKX-NEXT: kshiftrd $28, %k0, %k0
830 ; SKX-NEXT: kmovd %eax, %k2
831 ; SKX-NEXT: kshiftld $31, %k2, %k2
832 ; SKX-NEXT: kshiftrd $27, %k2, %k2
833 ; SKX-NEXT: kord %k2, %k1, %k1
834 ; SKX-NEXT: kord %k1, %k0, %k0
835 ; SKX-NEXT: kmovd %k0, %eax
836 ; SKX-NEXT: vzeroupper
838 %cmp_res_i1 = icmp ult i32 %a, %b
839 %cmp_cmp_vec = icmp ult <32 x i32> %x, %y
840 %maskv = insertelement <32 x i1> %cmp_cmp_vec, i1 %cmp_res_i1, i32 4
841 %res = bitcast <32 x i1> %maskv to i32
845 define i8 @test_iinsertelement_v4i1(i32 %a, i32 %b, <4 x i32> %x , <4 x i32> %y) {
846 ; KNL-LABEL: test_iinsertelement_v4i1:
848 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
849 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
850 ; KNL-NEXT: cmpl %esi, %edi
852 ; KNL-NEXT: vpcmpltud %zmm1, %zmm0, %k0
853 ; KNL-NEXT: kshiftrw $3, %k0, %k1
854 ; KNL-NEXT: kshiftlw $3, %k1, %k1
855 ; KNL-NEXT: kshiftlw $14, %k0, %k0
856 ; KNL-NEXT: kshiftrw $14, %k0, %k0
857 ; KNL-NEXT: korw %k1, %k0, %k0
858 ; KNL-NEXT: kmovw %eax, %k1
859 ; KNL-NEXT: kshiftlw $15, %k1, %k1
860 ; KNL-NEXT: kshiftrw $13, %k1, %k1
861 ; KNL-NEXT: korw %k0, %k1, %k0
862 ; KNL-NEXT: kmovw %k0, %eax
863 ; KNL-NEXT: ## kill: def $al killed $al killed $eax
864 ; KNL-NEXT: vzeroupper
867 ; SKX-LABEL: test_iinsertelement_v4i1:
869 ; SKX-NEXT: cmpl %esi, %edi
871 ; SKX-NEXT: vpcmpltud %xmm1, %xmm0, %k0
872 ; SKX-NEXT: kshiftrb $3, %k0, %k1
873 ; SKX-NEXT: kshiftlb $3, %k1, %k1
874 ; SKX-NEXT: kshiftlb $6, %k0, %k0
875 ; SKX-NEXT: kshiftrb $6, %k0, %k0
876 ; SKX-NEXT: korw %k1, %k0, %k0
877 ; SKX-NEXT: kmovd %eax, %k1
878 ; SKX-NEXT: kshiftlb $7, %k1, %k1
879 ; SKX-NEXT: kshiftrb $5, %k1, %k1
880 ; SKX-NEXT: korw %k0, %k1, %k0
881 ; SKX-NEXT: kmovd %k0, %eax
882 ; SKX-NEXT: ## kill: def $al killed $al killed $eax
884 %cmp_res_i1 = icmp ult i32 %a, %b
885 %cmp_cmp_vec = icmp ult <4 x i32> %x, %y
886 %maskv = insertelement <4 x i1> %cmp_cmp_vec, i1 %cmp_res_i1, i32 2
887 %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>
888 %res = bitcast <8 x i1> %res0 to i8
892 define i8 @test_iinsertelement_v2i1(i32 %a, i32 %b, <2 x i64> %x , <2 x i64> %y) {
893 ; KNL-LABEL: test_iinsertelement_v2i1:
895 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
896 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
897 ; KNL-NEXT: cmpl %esi, %edi
899 ; KNL-NEXT: vpcmpltuq %zmm1, %zmm0, %k0
900 ; KNL-NEXT: kshiftlw $15, %k0, %k0
901 ; KNL-NEXT: kshiftrw $15, %k0, %k0
902 ; KNL-NEXT: kmovw %eax, %k1
903 ; KNL-NEXT: kshiftlw $1, %k1, %k1
904 ; KNL-NEXT: korw %k1, %k0, %k0
905 ; KNL-NEXT: kmovw %k0, %eax
906 ; KNL-NEXT: ## kill: def $al killed $al killed $eax
907 ; KNL-NEXT: vzeroupper
910 ; SKX-LABEL: test_iinsertelement_v2i1:
912 ; SKX-NEXT: cmpl %esi, %edi
914 ; SKX-NEXT: vpcmpltuq %xmm1, %xmm0, %k0
915 ; SKX-NEXT: kshiftlb $7, %k0, %k0
916 ; SKX-NEXT: kshiftrb $7, %k0, %k0
917 ; SKX-NEXT: kmovd %eax, %k1
918 ; SKX-NEXT: kshiftlb $1, %k1, %k1
919 ; SKX-NEXT: korw %k1, %k0, %k0
920 ; SKX-NEXT: kmovd %k0, %eax
921 ; SKX-NEXT: ## kill: def $al killed $al killed $eax
923 %cmp_res_i1 = icmp ult i32 %a, %b
924 %cmp_cmp_vec = icmp ult <2 x i64> %x, %y
925 %maskv = insertelement <2 x i1> %cmp_cmp_vec, i1 %cmp_res_i1, i32 1
926 %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>
927 %res = bitcast <8 x i1> %res0 to i8
931 define zeroext i8 @test_extractelement_v2i1(<2 x i64> %a, <2 x i64> %b) {
932 ; KNL-LABEL: test_extractelement_v2i1:
934 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
935 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
936 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k0
937 ; KNL-NEXT: kmovw %k0, %ecx
938 ; KNL-NEXT: andl $1, %ecx
939 ; KNL-NEXT: movl $4, %eax
940 ; KNL-NEXT: subl %ecx, %eax
941 ; KNL-NEXT: vzeroupper
944 ; SKX-LABEL: test_extractelement_v2i1:
946 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
947 ; SKX-NEXT: kmovd %k0, %ecx
948 ; SKX-NEXT: andl $1, %ecx
949 ; SKX-NEXT: movl $4, %eax
950 ; SKX-NEXT: subl %ecx, %eax
952 %t1 = icmp ugt <2 x i64> %a, %b
953 %t2 = extractelement <2 x i1> %t1, i32 0
954 %res = select i1 %t2, i8 3, i8 4
958 define zeroext i8 @extractelement_v2i1_alt(<2 x i64> %a, <2 x i64> %b) {
959 ; KNL-LABEL: extractelement_v2i1_alt:
961 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
962 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
963 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k0
964 ; KNL-NEXT: kmovw %k0, %eax
965 ; KNL-NEXT: andb $1, %al
966 ; KNL-NEXT: movb $4, %cl
967 ; KNL-NEXT: subb %al, %cl
968 ; KNL-NEXT: movzbl %cl, %eax
969 ; KNL-NEXT: vzeroupper
972 ; SKX-LABEL: extractelement_v2i1_alt:
974 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
975 ; SKX-NEXT: kmovd %k0, %eax
976 ; SKX-NEXT: andb $1, %al
977 ; SKX-NEXT: movb $4, %cl
978 ; SKX-NEXT: subb %al, %cl
979 ; SKX-NEXT: movzbl %cl, %eax
981 %t1 = icmp ugt <2 x i64> %a, %b
982 %t2 = extractelement <2 x i1> %t1, i32 0
983 %sext = sext i1 %t2 to i8
984 %res = add i8 %sext, 4
988 define zeroext i8 @test_extractelement_v4i1(<4 x i32> %a, <4 x i32> %b) {
989 ; KNL-LABEL: test_extractelement_v4i1:
991 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
992 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
993 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k0
994 ; KNL-NEXT: kshiftrw $3, %k0, %k0
995 ; KNL-NEXT: kmovw %k0, %eax
996 ; KNL-NEXT: andl $1, %eax
997 ; KNL-NEXT: vzeroupper
1000 ; SKX-LABEL: test_extractelement_v4i1:
1002 ; SKX-NEXT: vpcmpnleud %xmm1, %xmm0, %k0
1003 ; SKX-NEXT: kshiftrb $3, %k0, %k0
1004 ; SKX-NEXT: kmovd %k0, %eax
1005 ; SKX-NEXT: andl $1, %eax
1007 %t1 = icmp ugt <4 x i32> %a, %b
1008 %t2 = extractelement <4 x i1> %t1, i32 3
1009 %res = zext i1 %t2 to i8
1013 define zeroext i8 @test_extractelement_v32i1(<32 x i8> %a, <32 x i8> %b) {
1014 ; KNL-LABEL: test_extractelement_v32i1:
1016 ; KNL-NEXT: vpminub %xmm1, %xmm0, %xmm1
1017 ; KNL-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1018 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1019 ; KNL-NEXT: vpmovsxbd %xmm0, %zmm0
1020 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1021 ; KNL-NEXT: kshiftrw $2, %k0, %k0
1022 ; KNL-NEXT: kmovw %k0, %eax
1023 ; KNL-NEXT: andl $1, %eax
1024 ; KNL-NEXT: vzeroupper
1027 ; SKX-LABEL: test_extractelement_v32i1:
1029 ; SKX-NEXT: vpcmpnleub %ymm1, %ymm0, %k0
1030 ; SKX-NEXT: kshiftrd $2, %k0, %k0
1031 ; SKX-NEXT: kmovd %k0, %eax
1032 ; SKX-NEXT: andl $1, %eax
1033 ; SKX-NEXT: vzeroupper
1035 %t1 = icmp ugt <32 x i8> %a, %b
1036 %t2 = extractelement <32 x i1> %t1, i32 2
1037 %res = zext i1 %t2 to i8
1041 define zeroext i8 @test_extractelement_v64i1(<64 x i8> %a, <64 x i8> %b) {
1042 ; KNL-LABEL: test_extractelement_v64i1:
1044 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm0
1045 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm1
1046 ; KNL-NEXT: vextracti128 $1, %ymm1, %xmm1
1047 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm0
1048 ; KNL-NEXT: vpminub %xmm1, %xmm0, %xmm1
1049 ; KNL-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1050 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1051 ; KNL-NEXT: vpmovsxbd %xmm0, %zmm0
1052 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1053 ; KNL-NEXT: kshiftrw $15, %k0, %k0
1054 ; KNL-NEXT: kmovw %k0, %ecx
1055 ; KNL-NEXT: andl $1, %ecx
1056 ; KNL-NEXT: movl $4, %eax
1057 ; KNL-NEXT: subl %ecx, %eax
1058 ; KNL-NEXT: vzeroupper
1061 ; SKX-LABEL: test_extractelement_v64i1:
1063 ; SKX-NEXT: vpcmpnleub %zmm1, %zmm0, %k0
1064 ; SKX-NEXT: kshiftrq $63, %k0, %k0
1065 ; SKX-NEXT: kmovd %k0, %ecx
1066 ; SKX-NEXT: andl $1, %ecx
1067 ; SKX-NEXT: movl $4, %eax
1068 ; SKX-NEXT: subl %ecx, %eax
1069 ; SKX-NEXT: vzeroupper
1071 %t1 = icmp ugt <64 x i8> %a, %b
1072 %t2 = extractelement <64 x i1> %t1, i32 63
1073 %res = select i1 %t2, i8 3, i8 4
1077 define zeroext i8 @extractelement_v64i1_alt(<64 x i8> %a, <64 x i8> %b) {
1078 ; KNL-LABEL: extractelement_v64i1_alt:
1080 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm0
1081 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm1
1082 ; KNL-NEXT: vextracti128 $1, %ymm1, %xmm1
1083 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm0
1084 ; KNL-NEXT: vpminub %xmm1, %xmm0, %xmm1
1085 ; KNL-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1086 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1087 ; KNL-NEXT: vpmovsxbd %xmm0, %zmm0
1088 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1089 ; KNL-NEXT: kshiftrw $15, %k0, %k0
1090 ; KNL-NEXT: kmovw %k0, %eax
1091 ; KNL-NEXT: andb $1, %al
1092 ; KNL-NEXT: movb $4, %cl
1093 ; KNL-NEXT: subb %al, %cl
1094 ; KNL-NEXT: movzbl %cl, %eax
1095 ; KNL-NEXT: vzeroupper
1098 ; SKX-LABEL: extractelement_v64i1_alt:
1100 ; SKX-NEXT: vpcmpnleub %zmm1, %zmm0, %k0
1101 ; SKX-NEXT: kshiftrq $63, %k0, %k0
1102 ; SKX-NEXT: kmovd %k0, %eax
1103 ; SKX-NEXT: andb $1, %al
1104 ; SKX-NEXT: movb $4, %cl
1105 ; SKX-NEXT: subb %al, %cl
1106 ; SKX-NEXT: movzbl %cl, %eax
1107 ; SKX-NEXT: vzeroupper
1109 %t1 = icmp ugt <64 x i8> %a, %b
1110 %t2 = extractelement <64 x i1> %t1, i32 63
1111 %sext = sext i1 %t2 to i8
1112 %res = add i8 %sext, 4
1116 define i64 @test_extractelement_variable_v2i64(<2 x i64> %t1, i32 %index) {
1117 ; CHECK-LABEL: test_extractelement_variable_v2i64:
1119 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1120 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1121 ; CHECK-NEXT: andl $1, %edi
1122 ; CHECK-NEXT: movq -24(%rsp,%rdi,8), %rax
1124 %t2 = extractelement <2 x i64> %t1, i32 %index
1128 define i64 @test_extractelement_variable_v4i64(<4 x i64> %t1, i32 %index) {
1129 ; CHECK-LABEL: test_extractelement_variable_v4i64:
1131 ; CHECK-NEXT: pushq %rbp
1132 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1133 ; CHECK-NEXT: .cfi_offset %rbp, -16
1134 ; CHECK-NEXT: movq %rsp, %rbp
1135 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1136 ; CHECK-NEXT: andq $-32, %rsp
1137 ; CHECK-NEXT: subq $64, %rsp
1138 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1139 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1140 ; CHECK-NEXT: andl $3, %edi
1141 ; CHECK-NEXT: movq (%rsp,%rdi,8), %rax
1142 ; CHECK-NEXT: movq %rbp, %rsp
1143 ; CHECK-NEXT: popq %rbp
1144 ; CHECK-NEXT: vzeroupper
1146 %t2 = extractelement <4 x i64> %t1, i32 %index
1150 define i64 @test_extractelement_variable_v8i64(<8 x i64> %t1, i32 %index) {
1151 ; CHECK-LABEL: test_extractelement_variable_v8i64:
1153 ; CHECK-NEXT: pushq %rbp
1154 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1155 ; CHECK-NEXT: .cfi_offset %rbp, -16
1156 ; CHECK-NEXT: movq %rsp, %rbp
1157 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1158 ; CHECK-NEXT: andq $-64, %rsp
1159 ; CHECK-NEXT: subq $128, %rsp
1160 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1161 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1162 ; CHECK-NEXT: andl $7, %edi
1163 ; CHECK-NEXT: movq (%rsp,%rdi,8), %rax
1164 ; CHECK-NEXT: movq %rbp, %rsp
1165 ; CHECK-NEXT: popq %rbp
1166 ; CHECK-NEXT: vzeroupper
1168 %t2 = extractelement <8 x i64> %t1, i32 %index
1172 define double @test_extractelement_variable_v2f64(<2 x double> %t1, i32 %index) {
1173 ; CHECK-LABEL: test_extractelement_variable_v2f64:
1175 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1176 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1177 ; CHECK-NEXT: andl $1, %edi
1178 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1180 %t2 = extractelement <2 x double> %t1, i32 %index
1184 define double @test_extractelement_variable_v4f64(<4 x double> %t1, i32 %index) {
1185 ; CHECK-LABEL: test_extractelement_variable_v4f64:
1187 ; CHECK-NEXT: pushq %rbp
1188 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1189 ; CHECK-NEXT: .cfi_offset %rbp, -16
1190 ; CHECK-NEXT: movq %rsp, %rbp
1191 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1192 ; CHECK-NEXT: andq $-32, %rsp
1193 ; CHECK-NEXT: subq $64, %rsp
1194 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1195 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1196 ; CHECK-NEXT: andl $3, %edi
1197 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1198 ; CHECK-NEXT: movq %rbp, %rsp
1199 ; CHECK-NEXT: popq %rbp
1200 ; CHECK-NEXT: vzeroupper
1202 %t2 = extractelement <4 x double> %t1, i32 %index
1206 define double @test_extractelement_variable_v8f64(<8 x double> %t1, i32 %index) {
1207 ; CHECK-LABEL: test_extractelement_variable_v8f64:
1209 ; CHECK-NEXT: pushq %rbp
1210 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1211 ; CHECK-NEXT: .cfi_offset %rbp, -16
1212 ; CHECK-NEXT: movq %rsp, %rbp
1213 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1214 ; CHECK-NEXT: andq $-64, %rsp
1215 ; CHECK-NEXT: subq $128, %rsp
1216 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1217 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1218 ; CHECK-NEXT: andl $7, %edi
1219 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1220 ; CHECK-NEXT: movq %rbp, %rsp
1221 ; CHECK-NEXT: popq %rbp
1222 ; CHECK-NEXT: vzeroupper
1224 %t2 = extractelement <8 x double> %t1, i32 %index
1228 define i32 @test_extractelement_variable_v4i32(<4 x i32> %t1, i32 %index) {
1229 ; CHECK-LABEL: test_extractelement_variable_v4i32:
1231 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1232 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1233 ; CHECK-NEXT: andl $3, %edi
1234 ; CHECK-NEXT: movl -24(%rsp,%rdi,4), %eax
1236 %t2 = extractelement <4 x i32> %t1, i32 %index
1240 define i32 @test_extractelement_variable_v8i32(<8 x i32> %t1, i32 %index) {
1241 ; CHECK-LABEL: test_extractelement_variable_v8i32:
1243 ; CHECK-NEXT: pushq %rbp
1244 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1245 ; CHECK-NEXT: .cfi_offset %rbp, -16
1246 ; CHECK-NEXT: movq %rsp, %rbp
1247 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1248 ; CHECK-NEXT: andq $-32, %rsp
1249 ; CHECK-NEXT: subq $64, %rsp
1250 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1251 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1252 ; CHECK-NEXT: andl $7, %edi
1253 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
1254 ; CHECK-NEXT: movq %rbp, %rsp
1255 ; CHECK-NEXT: popq %rbp
1256 ; CHECK-NEXT: vzeroupper
1258 %t2 = extractelement <8 x i32> %t1, i32 %index
1262 define i32 @test_extractelement_variable_v16i32(<16 x i32> %t1, i32 %index) {
1263 ; CHECK-LABEL: test_extractelement_variable_v16i32:
1265 ; CHECK-NEXT: pushq %rbp
1266 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1267 ; CHECK-NEXT: .cfi_offset %rbp, -16
1268 ; CHECK-NEXT: movq %rsp, %rbp
1269 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1270 ; CHECK-NEXT: andq $-64, %rsp
1271 ; CHECK-NEXT: subq $128, %rsp
1272 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1273 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1274 ; CHECK-NEXT: andl $15, %edi
1275 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
1276 ; CHECK-NEXT: movq %rbp, %rsp
1277 ; CHECK-NEXT: popq %rbp
1278 ; CHECK-NEXT: vzeroupper
1280 %t2 = extractelement <16 x i32> %t1, i32 %index
1284 define float @test_extractelement_variable_v4f32(<4 x float> %t1, i32 %index) {
1285 ; CHECK-LABEL: test_extractelement_variable_v4f32:
1287 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1288 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1289 ; CHECK-NEXT: andl $3, %edi
1290 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1292 %t2 = extractelement <4 x float> %t1, i32 %index
1296 define float @test_extractelement_variable_v8f32(<8 x float> %t1, i32 %index) {
1297 ; CHECK-LABEL: test_extractelement_variable_v8f32:
1299 ; CHECK-NEXT: pushq %rbp
1300 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1301 ; CHECK-NEXT: .cfi_offset %rbp, -16
1302 ; CHECK-NEXT: movq %rsp, %rbp
1303 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1304 ; CHECK-NEXT: andq $-32, %rsp
1305 ; CHECK-NEXT: subq $64, %rsp
1306 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1307 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1308 ; CHECK-NEXT: andl $7, %edi
1309 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1310 ; CHECK-NEXT: movq %rbp, %rsp
1311 ; CHECK-NEXT: popq %rbp
1312 ; CHECK-NEXT: vzeroupper
1314 %t2 = extractelement <8 x float> %t1, i32 %index
1318 define float @test_extractelement_variable_v16f32(<16 x float> %t1, i32 %index) {
1319 ; CHECK-LABEL: test_extractelement_variable_v16f32:
1321 ; CHECK-NEXT: pushq %rbp
1322 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1323 ; CHECK-NEXT: .cfi_offset %rbp, -16
1324 ; CHECK-NEXT: movq %rsp, %rbp
1325 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1326 ; CHECK-NEXT: andq $-64, %rsp
1327 ; CHECK-NEXT: subq $128, %rsp
1328 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1329 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1330 ; CHECK-NEXT: andl $15, %edi
1331 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1332 ; CHECK-NEXT: movq %rbp, %rsp
1333 ; CHECK-NEXT: popq %rbp
1334 ; CHECK-NEXT: vzeroupper
1336 %t2 = extractelement <16 x float> %t1, i32 %index
1340 define i16 @test_extractelement_variable_v8i16(<8 x i16> %t1, i32 %index) {
1341 ; CHECK-LABEL: test_extractelement_variable_v8i16:
1343 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1344 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1345 ; CHECK-NEXT: andl $7, %edi
1346 ; CHECK-NEXT: movzwl -24(%rsp,%rdi,2), %eax
1348 %t2 = extractelement <8 x i16> %t1, i32 %index
1352 define i16 @test_extractelement_variable_v16i16(<16 x i16> %t1, i32 %index) {
1353 ; CHECK-LABEL: test_extractelement_variable_v16i16:
1355 ; CHECK-NEXT: pushq %rbp
1356 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1357 ; CHECK-NEXT: .cfi_offset %rbp, -16
1358 ; CHECK-NEXT: movq %rsp, %rbp
1359 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1360 ; CHECK-NEXT: andq $-32, %rsp
1361 ; CHECK-NEXT: subq $64, %rsp
1362 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1363 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1364 ; CHECK-NEXT: andl $15, %edi
1365 ; CHECK-NEXT: movzwl (%rsp,%rdi,2), %eax
1366 ; CHECK-NEXT: movq %rbp, %rsp
1367 ; CHECK-NEXT: popq %rbp
1368 ; CHECK-NEXT: vzeroupper
1370 %t2 = extractelement <16 x i16> %t1, i32 %index
1374 define i16 @test_extractelement_variable_v32i16(<32 x i16> %t1, i32 %index) {
1375 ; KNL-LABEL: test_extractelement_variable_v32i16:
1377 ; KNL-NEXT: pushq %rbp
1378 ; KNL-NEXT: .cfi_def_cfa_offset 16
1379 ; KNL-NEXT: .cfi_offset %rbp, -16
1380 ; KNL-NEXT: movq %rsp, %rbp
1381 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1382 ; KNL-NEXT: andq $-64, %rsp
1383 ; KNL-NEXT: subq $128, %rsp
1384 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1385 ; KNL-NEXT: vextractf64x4 $1, %zmm0, {{[0-9]+}}(%rsp)
1386 ; KNL-NEXT: vmovaps %ymm0, (%rsp)
1387 ; KNL-NEXT: andl $31, %edi
1388 ; KNL-NEXT: movzwl (%rsp,%rdi,2), %eax
1389 ; KNL-NEXT: movq %rbp, %rsp
1390 ; KNL-NEXT: popq %rbp
1391 ; KNL-NEXT: vzeroupper
1394 ; SKX-LABEL: test_extractelement_variable_v32i16:
1396 ; SKX-NEXT: pushq %rbp
1397 ; SKX-NEXT: .cfi_def_cfa_offset 16
1398 ; SKX-NEXT: .cfi_offset %rbp, -16
1399 ; SKX-NEXT: movq %rsp, %rbp
1400 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1401 ; SKX-NEXT: andq $-64, %rsp
1402 ; SKX-NEXT: subq $128, %rsp
1403 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1404 ; SKX-NEXT: vmovaps %zmm0, (%rsp)
1405 ; SKX-NEXT: andl $31, %edi
1406 ; SKX-NEXT: movzwl (%rsp,%rdi,2), %eax
1407 ; SKX-NEXT: movq %rbp, %rsp
1408 ; SKX-NEXT: popq %rbp
1409 ; SKX-NEXT: vzeroupper
1411 %t2 = extractelement <32 x i16> %t1, i32 %index
1415 define i8 @test_extractelement_variable_v16i8(<16 x i8> %t1, i32 %index) {
1416 ; CHECK-LABEL: test_extractelement_variable_v16i8:
1418 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1419 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1420 ; CHECK-NEXT: andl $15, %edi
1421 ; CHECK-NEXT: movb -24(%rsp,%rdi), %al
1423 %t2 = extractelement <16 x i8> %t1, i32 %index
1427 define i8 @test_extractelement_variable_v32i8(<32 x i8> %t1, i32 %index) {
1428 ; CHECK-LABEL: test_extractelement_variable_v32i8:
1430 ; CHECK-NEXT: pushq %rbp
1431 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1432 ; CHECK-NEXT: .cfi_offset %rbp, -16
1433 ; CHECK-NEXT: movq %rsp, %rbp
1434 ; CHECK-NEXT: .cfi_def_cfa_register %rbp
1435 ; CHECK-NEXT: andq $-32, %rsp
1436 ; CHECK-NEXT: subq $64, %rsp
1437 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1438 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1439 ; CHECK-NEXT: andl $31, %edi
1440 ; CHECK-NEXT: movb (%rsp,%rdi), %al
1441 ; CHECK-NEXT: movq %rbp, %rsp
1442 ; CHECK-NEXT: popq %rbp
1443 ; CHECK-NEXT: vzeroupper
1446 %t2 = extractelement <32 x i8> %t1, i32 %index
1450 define i8 @test_extractelement_variable_v64i8(<64 x i8> %t1, i32 %index) {
1451 ; KNL-LABEL: test_extractelement_variable_v64i8:
1453 ; KNL-NEXT: pushq %rbp
1454 ; KNL-NEXT: .cfi_def_cfa_offset 16
1455 ; KNL-NEXT: .cfi_offset %rbp, -16
1456 ; KNL-NEXT: movq %rsp, %rbp
1457 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1458 ; KNL-NEXT: andq $-64, %rsp
1459 ; KNL-NEXT: subq $128, %rsp
1460 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1461 ; KNL-NEXT: vextractf64x4 $1, %zmm0, {{[0-9]+}}(%rsp)
1462 ; KNL-NEXT: vmovaps %ymm0, (%rsp)
1463 ; KNL-NEXT: andl $63, %edi
1464 ; KNL-NEXT: movb (%rsp,%rdi), %al
1465 ; KNL-NEXT: movq %rbp, %rsp
1466 ; KNL-NEXT: popq %rbp
1467 ; KNL-NEXT: vzeroupper
1470 ; SKX-LABEL: test_extractelement_variable_v64i8:
1472 ; SKX-NEXT: pushq %rbp
1473 ; SKX-NEXT: .cfi_def_cfa_offset 16
1474 ; SKX-NEXT: .cfi_offset %rbp, -16
1475 ; SKX-NEXT: movq %rsp, %rbp
1476 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1477 ; SKX-NEXT: andq $-64, %rsp
1478 ; SKX-NEXT: subq $128, %rsp
1479 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1480 ; SKX-NEXT: vmovaps %zmm0, (%rsp)
1481 ; SKX-NEXT: andl $63, %edi
1482 ; SKX-NEXT: movb (%rsp,%rdi), %al
1483 ; SKX-NEXT: movq %rbp, %rsp
1484 ; SKX-NEXT: popq %rbp
1485 ; SKX-NEXT: vzeroupper
1488 %t2 = extractelement <64 x i8> %t1, i32 %index
1492 define i8 @test_extractelement_variable_v64i8_indexi8(<64 x i8> %t1, i8 %index) {
1493 ; KNL-LABEL: test_extractelement_variable_v64i8_indexi8:
1495 ; KNL-NEXT: pushq %rbp
1496 ; KNL-NEXT: .cfi_def_cfa_offset 16
1497 ; KNL-NEXT: .cfi_offset %rbp, -16
1498 ; KNL-NEXT: movq %rsp, %rbp
1499 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1500 ; KNL-NEXT: andq $-64, %rsp
1501 ; KNL-NEXT: subq $128, %rsp
1502 ; KNL-NEXT: addb %dil, %dil
1503 ; KNL-NEXT: vextractf64x4 $1, %zmm0, {{[0-9]+}}(%rsp)
1504 ; KNL-NEXT: vmovaps %ymm0, (%rsp)
1505 ; KNL-NEXT: movzbl %dil, %eax
1506 ; KNL-NEXT: andl $63, %eax
1507 ; KNL-NEXT: movb (%rsp,%rax), %al
1508 ; KNL-NEXT: movq %rbp, %rsp
1509 ; KNL-NEXT: popq %rbp
1510 ; KNL-NEXT: vzeroupper
1513 ; SKX-LABEL: test_extractelement_variable_v64i8_indexi8:
1515 ; SKX-NEXT: pushq %rbp
1516 ; SKX-NEXT: .cfi_def_cfa_offset 16
1517 ; SKX-NEXT: .cfi_offset %rbp, -16
1518 ; SKX-NEXT: movq %rsp, %rbp
1519 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1520 ; SKX-NEXT: andq $-64, %rsp
1521 ; SKX-NEXT: subq $128, %rsp
1522 ; SKX-NEXT: addb %dil, %dil
1523 ; SKX-NEXT: vmovaps %zmm0, (%rsp)
1524 ; SKX-NEXT: movzbl %dil, %eax
1525 ; SKX-NEXT: andl $63, %eax
1526 ; SKX-NEXT: movb (%rsp,%rax), %al
1527 ; SKX-NEXT: movq %rbp, %rsp
1528 ; SKX-NEXT: popq %rbp
1529 ; SKX-NEXT: vzeroupper
1532 %i = add i8 %index, %index
1533 %t2 = extractelement <64 x i8> %t1, i8 %i
1537 define zeroext i8 @test_extractelement_varible_v2i1(<2 x i64> %a, <2 x i64> %b, i32 %index) {
1538 ; KNL-LABEL: test_extractelement_varible_v2i1:
1540 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1541 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1542 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
1543 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k1
1544 ; KNL-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1545 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1546 ; KNL-NEXT: andl $1, %edi
1547 ; KNL-NEXT: movzbl -24(%rsp,%rdi,8), %eax
1548 ; KNL-NEXT: andl $1, %eax
1549 ; KNL-NEXT: vzeroupper
1552 ; SKX-LABEL: test_extractelement_varible_v2i1:
1554 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1555 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
1556 ; SKX-NEXT: vpmovm2q %k0, %xmm0
1557 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1558 ; SKX-NEXT: andl $1, %edi
1559 ; SKX-NEXT: movzbl -24(%rsp,%rdi,8), %eax
1560 ; SKX-NEXT: andl $1, %eax
1562 %t1 = icmp ugt <2 x i64> %a, %b
1563 %t2 = extractelement <2 x i1> %t1, i32 %index
1564 %res = zext i1 %t2 to i8
1568 define zeroext i8 @test_extractelement_varible_v4i1(<4 x i32> %a, <4 x i32> %b, i32 %index) {
1569 ; KNL-LABEL: test_extractelement_varible_v4i1:
1571 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1572 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1573 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
1574 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1575 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1576 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1577 ; KNL-NEXT: andl $3, %edi
1578 ; KNL-NEXT: movzbl -24(%rsp,%rdi,4), %eax
1579 ; KNL-NEXT: andl $1, %eax
1580 ; KNL-NEXT: vzeroupper
1583 ; SKX-LABEL: test_extractelement_varible_v4i1:
1585 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1586 ; SKX-NEXT: vpcmpnleud %xmm1, %xmm0, %k0
1587 ; SKX-NEXT: vpmovm2d %k0, %xmm0
1588 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1589 ; SKX-NEXT: andl $3, %edi
1590 ; SKX-NEXT: movzbl -24(%rsp,%rdi,4), %eax
1591 ; SKX-NEXT: andl $1, %eax
1593 %t1 = icmp ugt <4 x i32> %a, %b
1594 %t2 = extractelement <4 x i1> %t1, i32 %index
1595 %res = zext i1 %t2 to i8
1599 define zeroext i8 @test_extractelement_varible_v8i1(<8 x i32> %a, <8 x i32> %b, i32 %index) {
1600 ; KNL-LABEL: test_extractelement_varible_v8i1:
1602 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1603 ; KNL-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
1604 ; KNL-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
1605 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1606 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1607 ; KNL-NEXT: vpmovdw %zmm0, %ymm0
1608 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1609 ; KNL-NEXT: andl $7, %edi
1610 ; KNL-NEXT: movzbl -24(%rsp,%rdi,2), %eax
1611 ; KNL-NEXT: andl $1, %eax
1612 ; KNL-NEXT: vzeroupper
1615 ; SKX-LABEL: test_extractelement_varible_v8i1:
1617 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1618 ; SKX-NEXT: vpcmpnleud %ymm1, %ymm0, %k0
1619 ; SKX-NEXT: vpmovm2w %k0, %xmm0
1620 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1621 ; SKX-NEXT: andl $7, %edi
1622 ; SKX-NEXT: movzbl -24(%rsp,%rdi,2), %eax
1623 ; SKX-NEXT: andl $1, %eax
1624 ; SKX-NEXT: vzeroupper
1626 %t1 = icmp ugt <8 x i32> %a, %b
1627 %t2 = extractelement <8 x i1> %t1, i32 %index
1628 %res = zext i1 %t2 to i8
1632 define zeroext i8 @test_extractelement_varible_v16i1(<16 x i32> %a, <16 x i32> %b, i32 %index) {
1633 ; KNL-LABEL: test_extractelement_varible_v16i1:
1635 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1636 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1637 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1638 ; KNL-NEXT: vpmovdb %zmm0, -{{[0-9]+}}(%rsp)
1639 ; KNL-NEXT: andl $15, %edi
1640 ; KNL-NEXT: movzbl -24(%rsp,%rdi), %eax
1641 ; KNL-NEXT: andl $1, %eax
1642 ; KNL-NEXT: vzeroupper
1645 ; SKX-LABEL: test_extractelement_varible_v16i1:
1647 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1648 ; SKX-NEXT: vpcmpnleud %zmm1, %zmm0, %k0
1649 ; SKX-NEXT: vpmovm2b %k0, %xmm0
1650 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1651 ; SKX-NEXT: andl $15, %edi
1652 ; SKX-NEXT: movzbl -24(%rsp,%rdi), %eax
1653 ; SKX-NEXT: andl $1, %eax
1654 ; SKX-NEXT: vzeroupper
1656 %t1 = icmp ugt <16 x i32> %a, %b
1657 %t2 = extractelement <16 x i1> %t1, i32 %index
1658 %res = zext i1 %t2 to i8
1662 define zeroext i8 @test_extractelement_varible_v32i1(<32 x i8> %a, <32 x i8> %b, i32 %index) {
1663 ; KNL-LABEL: test_extractelement_varible_v32i1:
1665 ; KNL-NEXT: pushq %rbp
1666 ; KNL-NEXT: .cfi_def_cfa_offset 16
1667 ; KNL-NEXT: .cfi_offset %rbp, -16
1668 ; KNL-NEXT: movq %rsp, %rbp
1669 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1670 ; KNL-NEXT: andq $-32, %rsp
1671 ; KNL-NEXT: subq $64, %rsp
1672 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1673 ; KNL-NEXT: vpminub %ymm1, %ymm0, %ymm1
1674 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1675 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1676 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
1677 ; KNL-NEXT: andl $31, %edi
1678 ; KNL-NEXT: movzbl (%rsp,%rdi), %eax
1679 ; KNL-NEXT: andl $1, %eax
1680 ; KNL-NEXT: movq %rbp, %rsp
1681 ; KNL-NEXT: popq %rbp
1682 ; KNL-NEXT: vzeroupper
1685 ; SKX-LABEL: test_extractelement_varible_v32i1:
1687 ; SKX-NEXT: pushq %rbp
1688 ; SKX-NEXT: .cfi_def_cfa_offset 16
1689 ; SKX-NEXT: .cfi_offset %rbp, -16
1690 ; SKX-NEXT: movq %rsp, %rbp
1691 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1692 ; SKX-NEXT: andq $-32, %rsp
1693 ; SKX-NEXT: subq $64, %rsp
1694 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1695 ; SKX-NEXT: vpcmpnleub %ymm1, %ymm0, %k0
1696 ; SKX-NEXT: vpmovm2b %k0, %ymm0
1697 ; SKX-NEXT: vmovdqa %ymm0, (%rsp)
1698 ; SKX-NEXT: andl $31, %edi
1699 ; SKX-NEXT: movzbl (%rsp,%rdi), %eax
1700 ; SKX-NEXT: andl $1, %eax
1701 ; SKX-NEXT: movq %rbp, %rsp
1702 ; SKX-NEXT: popq %rbp
1703 ; SKX-NEXT: vzeroupper
1705 %t1 = icmp ugt <32 x i8> %a, %b
1706 %t2 = extractelement <32 x i1> %t1, i32 %index
1707 %res = zext i1 %t2 to i8
1711 define <8 x i64> @insert_double_zero(<2 x i64> %a) nounwind {
1712 ; CHECK-LABEL: insert_double_zero:
1714 ; CHECK-NEXT: vxorps %xmm1, %xmm1, %xmm1
1715 ; CHECK-NEXT: vinsertf32x4 $2, %xmm0, %zmm1, %zmm0
1717 %b = shufflevector <2 x i64> %a, <2 x i64> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1718 %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>
1719 %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>
1723 define i32 @test_insertelement_variable_v32i1(<32 x i8> %a, i8 %b, i32 %index) {
1724 ; KNL-LABEL: test_insertelement_variable_v32i1:
1726 ; KNL-NEXT: pushq %rbp
1727 ; KNL-NEXT: .cfi_def_cfa_offset 16
1728 ; KNL-NEXT: .cfi_offset %rbp, -16
1729 ; KNL-NEXT: movq %rsp, %rbp
1730 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1731 ; KNL-NEXT: andq $-32, %rsp
1732 ; KNL-NEXT: subq $64, %rsp
1733 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
1734 ; KNL-NEXT: vpxor %xmm1, %xmm1, %xmm1
1735 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1736 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1737 ; KNL-NEXT: andl $31, %esi
1738 ; KNL-NEXT: testb %dil, %dil
1739 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
1740 ; KNL-NEXT: setne (%rsp,%rsi)
1741 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1742 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1743 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1744 ; KNL-NEXT: kmovw %k0, %ecx
1745 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1746 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1747 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1748 ; KNL-NEXT: kmovw %k0, %eax
1749 ; KNL-NEXT: shll $16, %eax
1750 ; KNL-NEXT: orl %ecx, %eax
1751 ; KNL-NEXT: movq %rbp, %rsp
1752 ; KNL-NEXT: popq %rbp
1753 ; KNL-NEXT: vzeroupper
1756 ; SKX-LABEL: test_insertelement_variable_v32i1:
1758 ; SKX-NEXT: pushq %rbp
1759 ; SKX-NEXT: .cfi_def_cfa_offset 16
1760 ; SKX-NEXT: .cfi_offset %rbp, -16
1761 ; SKX-NEXT: movq %rsp, %rbp
1762 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1763 ; SKX-NEXT: andq $-32, %rsp
1764 ; SKX-NEXT: subq $64, %rsp
1765 ; SKX-NEXT: ## kill: def $esi killed $esi def $rsi
1766 ; SKX-NEXT: vptestmb %ymm0, %ymm0, %k0
1767 ; SKX-NEXT: andl $31, %esi
1768 ; SKX-NEXT: testb %dil, %dil
1769 ; SKX-NEXT: vpmovm2b %k0, %ymm0
1770 ; SKX-NEXT: vmovdqa %ymm0, (%rsp)
1771 ; SKX-NEXT: setne (%rsp,%rsi)
1772 ; SKX-NEXT: vpsllw $7, (%rsp), %ymm0
1773 ; SKX-NEXT: vpmovb2m %ymm0, %k0
1774 ; SKX-NEXT: kmovd %k0, %eax
1775 ; SKX-NEXT: movq %rbp, %rsp
1776 ; SKX-NEXT: popq %rbp
1777 ; SKX-NEXT: vzeroupper
1779 %t1 = icmp ugt <32 x i8> %a, zeroinitializer
1780 %t2 = icmp ugt i8 %b, 0
1781 %t3 = insertelement <32 x i1> %t1, i1 %t2, i32 %index
1782 %t4 = bitcast <32 x i1> %t3 to i32
1786 define i64 @test_insertelement_variable_v64i1(<64 x i8> %a, i8 %b, i32 %index) {
1787 ; KNL-LABEL: test_insertelement_variable_v64i1:
1789 ; KNL-NEXT: pushq %rbp
1790 ; KNL-NEXT: .cfi_def_cfa_offset 16
1791 ; KNL-NEXT: .cfi_offset %rbp, -16
1792 ; KNL-NEXT: movq %rsp, %rbp
1793 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1794 ; KNL-NEXT: andq $-64, %rsp
1795 ; KNL-NEXT: subq $128, %rsp
1796 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
1797 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm1
1798 ; KNL-NEXT: vpxor %xmm2, %xmm2, %xmm2
1799 ; KNL-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
1800 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1801 ; KNL-NEXT: vpcmpeqb %ymm2, %ymm1, %ymm1
1802 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1803 ; KNL-NEXT: andl $63, %esi
1804 ; KNL-NEXT: testb %dil, %dil
1805 ; KNL-NEXT: vmovdqa %ymm1, {{[0-9]+}}(%rsp)
1806 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
1807 ; KNL-NEXT: setne (%rsp,%rsi)
1808 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1809 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1810 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1811 ; KNL-NEXT: kmovw %k0, %eax
1812 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1813 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1814 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1815 ; KNL-NEXT: kmovw %k0, %ecx
1816 ; KNL-NEXT: shll $16, %ecx
1817 ; KNL-NEXT: orl %eax, %ecx
1818 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1819 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1820 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1821 ; KNL-NEXT: kmovw %k0, %edx
1822 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1823 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1824 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1825 ; KNL-NEXT: kmovw %k0, %eax
1826 ; KNL-NEXT: shll $16, %eax
1827 ; KNL-NEXT: orl %edx, %eax
1828 ; KNL-NEXT: shlq $32, %rax
1829 ; KNL-NEXT: orq %rcx, %rax
1830 ; KNL-NEXT: movq %rbp, %rsp
1831 ; KNL-NEXT: popq %rbp
1832 ; KNL-NEXT: vzeroupper
1835 ; SKX-LABEL: test_insertelement_variable_v64i1:
1837 ; SKX-NEXT: pushq %rbp
1838 ; SKX-NEXT: .cfi_def_cfa_offset 16
1839 ; SKX-NEXT: .cfi_offset %rbp, -16
1840 ; SKX-NEXT: movq %rsp, %rbp
1841 ; SKX-NEXT: .cfi_def_cfa_register %rbp
1842 ; SKX-NEXT: andq $-64, %rsp
1843 ; SKX-NEXT: subq $128, %rsp
1844 ; SKX-NEXT: ## kill: def $esi killed $esi def $rsi
1845 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
1846 ; SKX-NEXT: andl $63, %esi
1847 ; SKX-NEXT: testb %dil, %dil
1848 ; SKX-NEXT: vpmovm2b %k0, %zmm0
1849 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
1850 ; SKX-NEXT: setne (%rsp,%rsi)
1851 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
1852 ; SKX-NEXT: vpmovb2m %zmm0, %k0
1853 ; SKX-NEXT: kmovq %k0, %rax
1854 ; SKX-NEXT: movq %rbp, %rsp
1855 ; SKX-NEXT: popq %rbp
1856 ; SKX-NEXT: vzeroupper
1858 %t1 = icmp ugt <64 x i8> %a, zeroinitializer
1859 %t2 = icmp ugt i8 %b, 0
1860 %t3 = insertelement <64 x i1> %t1, i1 %t2, i32 %index
1861 %t4 = bitcast <64 x i1> %t3 to i64
1865 define i96 @test_insertelement_variable_v96i1(<96 x i8> %a, i8 %b, i32 %index) {
1866 ; KNL-LABEL: test_insertelement_variable_v96i1:
1868 ; KNL-NEXT: pushq %rbp
1869 ; KNL-NEXT: .cfi_def_cfa_offset 16
1870 ; KNL-NEXT: .cfi_offset %rbp, -16
1871 ; KNL-NEXT: movq %rsp, %rbp
1872 ; KNL-NEXT: .cfi_def_cfa_register %rbp
1873 ; KNL-NEXT: andq $-128, %rsp
1874 ; KNL-NEXT: subq $256, %rsp ## imm = 0x100
1875 ; KNL-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
1876 ; KNL-NEXT: vpinsrb $1, 232(%rbp), %xmm0, %xmm0
1877 ; KNL-NEXT: vpinsrb $2, 240(%rbp), %xmm0, %xmm0
1878 ; KNL-NEXT: vpinsrb $3, 248(%rbp), %xmm0, %xmm0
1879 ; KNL-NEXT: vpinsrb $4, 256(%rbp), %xmm0, %xmm0
1880 ; KNL-NEXT: vpinsrb $5, 264(%rbp), %xmm0, %xmm0
1881 ; KNL-NEXT: vpinsrb $6, 272(%rbp), %xmm0, %xmm0
1882 ; KNL-NEXT: vpinsrb $7, 280(%rbp), %xmm0, %xmm0
1883 ; KNL-NEXT: vpinsrb $8, 288(%rbp), %xmm0, %xmm0
1884 ; KNL-NEXT: vpinsrb $9, 296(%rbp), %xmm0, %xmm0
1885 ; KNL-NEXT: vpinsrb $10, 304(%rbp), %xmm0, %xmm0
1886 ; KNL-NEXT: vpinsrb $11, 312(%rbp), %xmm0, %xmm0
1887 ; KNL-NEXT: vpinsrb $12, 320(%rbp), %xmm0, %xmm0
1888 ; KNL-NEXT: vpinsrb $13, 328(%rbp), %xmm0, %xmm0
1889 ; KNL-NEXT: vpinsrb $14, 336(%rbp), %xmm0, %xmm0
1890 ; KNL-NEXT: vpinsrb $15, 344(%rbp), %xmm0, %xmm0
1891 ; KNL-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1892 ; KNL-NEXT: vpinsrb $1, 360(%rbp), %xmm1, %xmm1
1893 ; KNL-NEXT: vpinsrb $2, 368(%rbp), %xmm1, %xmm1
1894 ; KNL-NEXT: vpinsrb $3, 376(%rbp), %xmm1, %xmm1
1895 ; KNL-NEXT: vpinsrb $4, 384(%rbp), %xmm1, %xmm1
1896 ; KNL-NEXT: vpinsrb $5, 392(%rbp), %xmm1, %xmm1
1897 ; KNL-NEXT: vpinsrb $6, 400(%rbp), %xmm1, %xmm1
1898 ; KNL-NEXT: vpinsrb $7, 408(%rbp), %xmm1, %xmm1
1899 ; KNL-NEXT: vpinsrb $8, 416(%rbp), %xmm1, %xmm1
1900 ; KNL-NEXT: vpinsrb $9, 424(%rbp), %xmm1, %xmm1
1901 ; KNL-NEXT: vpinsrb $10, 432(%rbp), %xmm1, %xmm1
1902 ; KNL-NEXT: vpinsrb $11, 440(%rbp), %xmm1, %xmm1
1903 ; KNL-NEXT: vpinsrb $12, 448(%rbp), %xmm1, %xmm1
1904 ; KNL-NEXT: vpinsrb $13, 456(%rbp), %xmm1, %xmm1
1905 ; KNL-NEXT: vpinsrb $14, 464(%rbp), %xmm1, %xmm1
1906 ; KNL-NEXT: vpinsrb $15, 472(%rbp), %xmm1, %xmm1
1907 ; KNL-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
1908 ; KNL-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1909 ; KNL-NEXT: vpinsrb $1, 488(%rbp), %xmm1, %xmm1
1910 ; KNL-NEXT: vpinsrb $2, 496(%rbp), %xmm1, %xmm1
1911 ; KNL-NEXT: vpinsrb $3, 504(%rbp), %xmm1, %xmm1
1912 ; KNL-NEXT: vpinsrb $4, 512(%rbp), %xmm1, %xmm1
1913 ; KNL-NEXT: vpinsrb $5, 520(%rbp), %xmm1, %xmm1
1914 ; KNL-NEXT: vpinsrb $6, 528(%rbp), %xmm1, %xmm1
1915 ; KNL-NEXT: vpinsrb $7, 536(%rbp), %xmm1, %xmm1
1916 ; KNL-NEXT: vpinsrb $8, 544(%rbp), %xmm1, %xmm1
1917 ; KNL-NEXT: vpinsrb $9, 552(%rbp), %xmm1, %xmm1
1918 ; KNL-NEXT: vpinsrb $10, 560(%rbp), %xmm1, %xmm1
1919 ; KNL-NEXT: vpinsrb $11, 568(%rbp), %xmm1, %xmm1
1920 ; KNL-NEXT: vpinsrb $12, 576(%rbp), %xmm1, %xmm1
1921 ; KNL-NEXT: vpinsrb $13, 584(%rbp), %xmm1, %xmm1
1922 ; KNL-NEXT: vpinsrb $14, 592(%rbp), %xmm1, %xmm1
1923 ; KNL-NEXT: vpinsrb $15, 600(%rbp), %xmm1, %xmm1
1924 ; KNL-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
1925 ; KNL-NEXT: vpinsrb $1, 616(%rbp), %xmm2, %xmm2
1926 ; KNL-NEXT: vpinsrb $2, 624(%rbp), %xmm2, %xmm2
1927 ; KNL-NEXT: vpinsrb $3, 632(%rbp), %xmm2, %xmm2
1928 ; KNL-NEXT: vpinsrb $4, 640(%rbp), %xmm2, %xmm2
1929 ; KNL-NEXT: vpinsrb $5, 648(%rbp), %xmm2, %xmm2
1930 ; KNL-NEXT: vpinsrb $6, 656(%rbp), %xmm2, %xmm2
1931 ; KNL-NEXT: vpinsrb $7, 664(%rbp), %xmm2, %xmm2
1932 ; KNL-NEXT: vpinsrb $8, 672(%rbp), %xmm2, %xmm2
1933 ; KNL-NEXT: vpinsrb $9, 680(%rbp), %xmm2, %xmm2
1934 ; KNL-NEXT: vpinsrb $10, 688(%rbp), %xmm2, %xmm2
1935 ; KNL-NEXT: vpinsrb $11, 696(%rbp), %xmm2, %xmm2
1936 ; KNL-NEXT: vpinsrb $12, 704(%rbp), %xmm2, %xmm2
1937 ; KNL-NEXT: vpinsrb $13, 712(%rbp), %xmm2, %xmm2
1938 ; KNL-NEXT: vpinsrb $14, 720(%rbp), %xmm2, %xmm2
1939 ; KNL-NEXT: vpinsrb $15, 728(%rbp), %xmm2, %xmm2
1940 ; KNL-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
1941 ; KNL-NEXT: vmovd %edi, %xmm2
1942 ; KNL-NEXT: vpinsrb $1, %esi, %xmm2, %xmm2
1943 ; KNL-NEXT: vpinsrb $2, %edx, %xmm2, %xmm2
1944 ; KNL-NEXT: vpinsrb $3, %ecx, %xmm2, %xmm2
1945 ; KNL-NEXT: vpinsrb $4, %r8d, %xmm2, %xmm2
1946 ; KNL-NEXT: vpinsrb $5, %r9d, %xmm2, %xmm2
1947 ; KNL-NEXT: vpinsrb $6, 16(%rbp), %xmm2, %xmm2
1948 ; KNL-NEXT: vpinsrb $7, 24(%rbp), %xmm2, %xmm2
1949 ; KNL-NEXT: vpinsrb $8, 32(%rbp), %xmm2, %xmm2
1950 ; KNL-NEXT: vpinsrb $9, 40(%rbp), %xmm2, %xmm2
1951 ; KNL-NEXT: vpinsrb $10, 48(%rbp), %xmm2, %xmm2
1952 ; KNL-NEXT: vpinsrb $11, 56(%rbp), %xmm2, %xmm2
1953 ; KNL-NEXT: vpinsrb $12, 64(%rbp), %xmm2, %xmm2
1954 ; KNL-NEXT: vpinsrb $13, 72(%rbp), %xmm2, %xmm2
1955 ; KNL-NEXT: vpinsrb $14, 80(%rbp), %xmm2, %xmm2
1956 ; KNL-NEXT: vpinsrb $15, 88(%rbp), %xmm2, %xmm2
1957 ; KNL-NEXT: vmovd {{.*#+}} xmm3 = mem[0],zero,zero,zero
1958 ; KNL-NEXT: vpinsrb $1, 104(%rbp), %xmm3, %xmm3
1959 ; KNL-NEXT: vpinsrb $2, 112(%rbp), %xmm3, %xmm3
1960 ; KNL-NEXT: vpinsrb $3, 120(%rbp), %xmm3, %xmm3
1961 ; KNL-NEXT: vpinsrb $4, 128(%rbp), %xmm3, %xmm3
1962 ; KNL-NEXT: vpinsrb $5, 136(%rbp), %xmm3, %xmm3
1963 ; KNL-NEXT: vpinsrb $6, 144(%rbp), %xmm3, %xmm3
1964 ; KNL-NEXT: vpinsrb $7, 152(%rbp), %xmm3, %xmm3
1965 ; KNL-NEXT: vpinsrb $8, 160(%rbp), %xmm3, %xmm3
1966 ; KNL-NEXT: vpinsrb $9, 168(%rbp), %xmm3, %xmm3
1967 ; KNL-NEXT: vpinsrb $10, 176(%rbp), %xmm3, %xmm3
1968 ; KNL-NEXT: vpinsrb $11, 184(%rbp), %xmm3, %xmm3
1969 ; KNL-NEXT: vpinsrb $12, 192(%rbp), %xmm3, %xmm3
1970 ; KNL-NEXT: vpinsrb $13, 200(%rbp), %xmm3, %xmm3
1971 ; KNL-NEXT: vpinsrb $14, 208(%rbp), %xmm3, %xmm3
1972 ; KNL-NEXT: vpinsrb $15, 216(%rbp), %xmm3, %xmm3
1973 ; KNL-NEXT: vinserti128 $1, %xmm3, %ymm2, %ymm2
1974 ; KNL-NEXT: movl 744(%rbp), %eax
1975 ; KNL-NEXT: andl $127, %eax
1976 ; KNL-NEXT: vpxor %xmm3, %xmm3, %xmm3
1977 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm2, %ymm2
1978 ; KNL-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1979 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm1, %ymm1
1980 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1981 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm0, %ymm0
1982 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1983 ; KNL-NEXT: cmpb $0, 736(%rbp)
1984 ; KNL-NEXT: vmovdqa %ymm0, {{[0-9]+}}(%rsp)
1985 ; KNL-NEXT: vmovdqa %ymm1, {{[0-9]+}}(%rsp)
1986 ; KNL-NEXT: vmovdqa %ymm2, (%rsp)
1987 ; KNL-NEXT: setne (%rsp,%rax)
1988 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1989 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1990 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1991 ; KNL-NEXT: kmovw %k0, %eax
1992 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1993 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1994 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1995 ; KNL-NEXT: kmovw %k0, %ecx
1996 ; KNL-NEXT: shll $16, %ecx
1997 ; KNL-NEXT: orl %eax, %ecx
1998 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1999 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2000 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2001 ; KNL-NEXT: kmovw %k0, %edx
2002 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2003 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2004 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2005 ; KNL-NEXT: kmovw %k0, %eax
2006 ; KNL-NEXT: shll $16, %eax
2007 ; KNL-NEXT: orl %edx, %eax
2008 ; KNL-NEXT: shlq $32, %rax
2009 ; KNL-NEXT: orq %rcx, %rax
2010 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2011 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2012 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2013 ; KNL-NEXT: kmovw %k0, %ecx
2014 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2015 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2016 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2017 ; KNL-NEXT: kmovw %k0, %esi
2018 ; KNL-NEXT: shll $16, %esi
2019 ; KNL-NEXT: orl %ecx, %esi
2020 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2021 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2022 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2023 ; KNL-NEXT: kmovw %k0, %ecx
2024 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2025 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2026 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2027 ; KNL-NEXT: kmovw %k0, %edx
2028 ; KNL-NEXT: shll $16, %edx
2029 ; KNL-NEXT: orl %ecx, %edx
2030 ; KNL-NEXT: shlq $32, %rdx
2031 ; KNL-NEXT: orq %rsi, %rdx
2032 ; KNL-NEXT: movq %rbp, %rsp
2033 ; KNL-NEXT: popq %rbp
2034 ; KNL-NEXT: vzeroupper
2037 ; SKX-LABEL: test_insertelement_variable_v96i1:
2039 ; SKX-NEXT: pushq %rbp
2040 ; SKX-NEXT: .cfi_def_cfa_offset 16
2041 ; SKX-NEXT: .cfi_offset %rbp, -16
2042 ; SKX-NEXT: movq %rsp, %rbp
2043 ; SKX-NEXT: .cfi_def_cfa_register %rbp
2044 ; SKX-NEXT: andq $-128, %rsp
2045 ; SKX-NEXT: subq $256, %rsp ## imm = 0x100
2046 ; SKX-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
2047 ; SKX-NEXT: vpinsrb $1, 232(%rbp), %xmm0, %xmm0
2048 ; SKX-NEXT: vpinsrb $2, 240(%rbp), %xmm0, %xmm0
2049 ; SKX-NEXT: vpinsrb $3, 248(%rbp), %xmm0, %xmm0
2050 ; SKX-NEXT: vpinsrb $4, 256(%rbp), %xmm0, %xmm0
2051 ; SKX-NEXT: vpinsrb $5, 264(%rbp), %xmm0, %xmm0
2052 ; SKX-NEXT: vpinsrb $6, 272(%rbp), %xmm0, %xmm0
2053 ; SKX-NEXT: vpinsrb $7, 280(%rbp), %xmm0, %xmm0
2054 ; SKX-NEXT: vpinsrb $8, 288(%rbp), %xmm0, %xmm0
2055 ; SKX-NEXT: vpinsrb $9, 296(%rbp), %xmm0, %xmm0
2056 ; SKX-NEXT: vpinsrb $10, 304(%rbp), %xmm0, %xmm0
2057 ; SKX-NEXT: vpinsrb $11, 312(%rbp), %xmm0, %xmm0
2058 ; SKX-NEXT: vpinsrb $12, 320(%rbp), %xmm0, %xmm0
2059 ; SKX-NEXT: vpinsrb $13, 328(%rbp), %xmm0, %xmm0
2060 ; SKX-NEXT: vpinsrb $14, 336(%rbp), %xmm0, %xmm0
2061 ; SKX-NEXT: vpinsrb $15, 344(%rbp), %xmm0, %xmm0
2062 ; SKX-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
2063 ; SKX-NEXT: vpinsrb $1, 360(%rbp), %xmm1, %xmm1
2064 ; SKX-NEXT: vpinsrb $2, 368(%rbp), %xmm1, %xmm1
2065 ; SKX-NEXT: vpinsrb $3, 376(%rbp), %xmm1, %xmm1
2066 ; SKX-NEXT: vpinsrb $4, 384(%rbp), %xmm1, %xmm1
2067 ; SKX-NEXT: vpinsrb $5, 392(%rbp), %xmm1, %xmm1
2068 ; SKX-NEXT: vpinsrb $6, 400(%rbp), %xmm1, %xmm1
2069 ; SKX-NEXT: vpinsrb $7, 408(%rbp), %xmm1, %xmm1
2070 ; SKX-NEXT: vpinsrb $8, 416(%rbp), %xmm1, %xmm1
2071 ; SKX-NEXT: vpinsrb $9, 424(%rbp), %xmm1, %xmm1
2072 ; SKX-NEXT: vpinsrb $10, 432(%rbp), %xmm1, %xmm1
2073 ; SKX-NEXT: vpinsrb $11, 440(%rbp), %xmm1, %xmm1
2074 ; SKX-NEXT: vpinsrb $12, 448(%rbp), %xmm1, %xmm1
2075 ; SKX-NEXT: vpinsrb $13, 456(%rbp), %xmm1, %xmm1
2076 ; SKX-NEXT: vpinsrb $14, 464(%rbp), %xmm1, %xmm1
2077 ; SKX-NEXT: vpinsrb $15, 472(%rbp), %xmm1, %xmm1
2078 ; SKX-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
2079 ; SKX-NEXT: vmovd %edi, %xmm1
2080 ; SKX-NEXT: vpinsrb $1, %esi, %xmm1, %xmm1
2081 ; SKX-NEXT: vpinsrb $2, %edx, %xmm1, %xmm1
2082 ; SKX-NEXT: vpinsrb $3, %ecx, %xmm1, %xmm1
2083 ; SKX-NEXT: vpinsrb $4, %r8d, %xmm1, %xmm1
2084 ; SKX-NEXT: vpinsrb $5, %r9d, %xmm1, %xmm1
2085 ; SKX-NEXT: vpinsrb $6, 16(%rbp), %xmm1, %xmm1
2086 ; SKX-NEXT: vpinsrb $7, 24(%rbp), %xmm1, %xmm1
2087 ; SKX-NEXT: vpinsrb $8, 32(%rbp), %xmm1, %xmm1
2088 ; SKX-NEXT: vpinsrb $9, 40(%rbp), %xmm1, %xmm1
2089 ; SKX-NEXT: vpinsrb $10, 48(%rbp), %xmm1, %xmm1
2090 ; SKX-NEXT: vpinsrb $11, 56(%rbp), %xmm1, %xmm1
2091 ; SKX-NEXT: vpinsrb $12, 64(%rbp), %xmm1, %xmm1
2092 ; SKX-NEXT: vpinsrb $13, 72(%rbp), %xmm1, %xmm1
2093 ; SKX-NEXT: vpinsrb $14, 80(%rbp), %xmm1, %xmm1
2094 ; SKX-NEXT: vpinsrb $15, 88(%rbp), %xmm1, %xmm1
2095 ; SKX-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
2096 ; SKX-NEXT: vpinsrb $1, 104(%rbp), %xmm2, %xmm2
2097 ; SKX-NEXT: vpinsrb $2, 112(%rbp), %xmm2, %xmm2
2098 ; SKX-NEXT: vpinsrb $3, 120(%rbp), %xmm2, %xmm2
2099 ; SKX-NEXT: vpinsrb $4, 128(%rbp), %xmm2, %xmm2
2100 ; SKX-NEXT: vpinsrb $5, 136(%rbp), %xmm2, %xmm2
2101 ; SKX-NEXT: vpinsrb $6, 144(%rbp), %xmm2, %xmm2
2102 ; SKX-NEXT: vpinsrb $7, 152(%rbp), %xmm2, %xmm2
2103 ; SKX-NEXT: vpinsrb $8, 160(%rbp), %xmm2, %xmm2
2104 ; SKX-NEXT: vpinsrb $9, 168(%rbp), %xmm2, %xmm2
2105 ; SKX-NEXT: vpinsrb $10, 176(%rbp), %xmm2, %xmm2
2106 ; SKX-NEXT: vpinsrb $11, 184(%rbp), %xmm2, %xmm2
2107 ; SKX-NEXT: vpinsrb $12, 192(%rbp), %xmm2, %xmm2
2108 ; SKX-NEXT: vpinsrb $13, 200(%rbp), %xmm2, %xmm2
2109 ; SKX-NEXT: vpinsrb $14, 208(%rbp), %xmm2, %xmm2
2110 ; SKX-NEXT: vpinsrb $15, 216(%rbp), %xmm2, %xmm2
2111 ; SKX-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
2112 ; SKX-NEXT: vinserti64x4 $1, %ymm0, %zmm1, %zmm0
2113 ; SKX-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
2114 ; SKX-NEXT: vpinsrb $1, 488(%rbp), %xmm1, %xmm1
2115 ; SKX-NEXT: vpinsrb $2, 496(%rbp), %xmm1, %xmm1
2116 ; SKX-NEXT: vpinsrb $3, 504(%rbp), %xmm1, %xmm1
2117 ; SKX-NEXT: vpinsrb $4, 512(%rbp), %xmm1, %xmm1
2118 ; SKX-NEXT: vpinsrb $5, 520(%rbp), %xmm1, %xmm1
2119 ; SKX-NEXT: vpinsrb $6, 528(%rbp), %xmm1, %xmm1
2120 ; SKX-NEXT: vpinsrb $7, 536(%rbp), %xmm1, %xmm1
2121 ; SKX-NEXT: vpinsrb $8, 544(%rbp), %xmm1, %xmm1
2122 ; SKX-NEXT: vpinsrb $9, 552(%rbp), %xmm1, %xmm1
2123 ; SKX-NEXT: vpinsrb $10, 560(%rbp), %xmm1, %xmm1
2124 ; SKX-NEXT: vpinsrb $11, 568(%rbp), %xmm1, %xmm1
2125 ; SKX-NEXT: vpinsrb $12, 576(%rbp), %xmm1, %xmm1
2126 ; SKX-NEXT: vpinsrb $13, 584(%rbp), %xmm1, %xmm1
2127 ; SKX-NEXT: vpinsrb $14, 592(%rbp), %xmm1, %xmm1
2128 ; SKX-NEXT: vpinsrb $15, 600(%rbp), %xmm1, %xmm1
2129 ; SKX-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
2130 ; SKX-NEXT: vpinsrb $1, 616(%rbp), %xmm2, %xmm2
2131 ; SKX-NEXT: vpinsrb $2, 624(%rbp), %xmm2, %xmm2
2132 ; SKX-NEXT: vpinsrb $3, 632(%rbp), %xmm2, %xmm2
2133 ; SKX-NEXT: vpinsrb $4, 640(%rbp), %xmm2, %xmm2
2134 ; SKX-NEXT: vpinsrb $5, 648(%rbp), %xmm2, %xmm2
2135 ; SKX-NEXT: vpinsrb $6, 656(%rbp), %xmm2, %xmm2
2136 ; SKX-NEXT: vpinsrb $7, 664(%rbp), %xmm2, %xmm2
2137 ; SKX-NEXT: vpinsrb $8, 672(%rbp), %xmm2, %xmm2
2138 ; SKX-NEXT: vpinsrb $9, 680(%rbp), %xmm2, %xmm2
2139 ; SKX-NEXT: vpinsrb $10, 688(%rbp), %xmm2, %xmm2
2140 ; SKX-NEXT: vpinsrb $11, 696(%rbp), %xmm2, %xmm2
2141 ; SKX-NEXT: vpinsrb $12, 704(%rbp), %xmm2, %xmm2
2142 ; SKX-NEXT: vpinsrb $13, 712(%rbp), %xmm2, %xmm2
2143 ; SKX-NEXT: vpinsrb $14, 720(%rbp), %xmm2, %xmm2
2144 ; SKX-NEXT: vpinsrb $15, 728(%rbp), %xmm2, %xmm2
2145 ; SKX-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
2146 ; SKX-NEXT: movl 744(%rbp), %eax
2147 ; SKX-NEXT: andl $127, %eax
2148 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
2149 ; SKX-NEXT: vptestmb %zmm1, %zmm1, %k1
2150 ; SKX-NEXT: cmpb $0, 736(%rbp)
2151 ; SKX-NEXT: vpmovm2b %k1, %zmm0
2152 ; SKX-NEXT: vmovdqa64 %zmm0, {{[0-9]+}}(%rsp)
2153 ; SKX-NEXT: vpmovm2b %k0, %zmm0
2154 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
2155 ; SKX-NEXT: setne (%rsp,%rax)
2156 ; SKX-NEXT: vpsllw $7, {{[0-9]+}}(%rsp), %zmm0
2157 ; SKX-NEXT: vpmovb2m %zmm0, %k0
2158 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
2159 ; SKX-NEXT: vpmovb2m %zmm0, %k1
2160 ; SKX-NEXT: kmovq %k1, %rax
2161 ; SKX-NEXT: kmovq %k0, %rdx
2162 ; SKX-NEXT: movq %rbp, %rsp
2163 ; SKX-NEXT: popq %rbp
2164 ; SKX-NEXT: vzeroupper
2166 %t1 = icmp ugt <96 x i8> %a, zeroinitializer
2167 %t2 = icmp ugt i8 %b, 0
2168 %t3 = insertelement <96 x i1> %t1, i1 %t2, i32 %index
2169 %t4 = bitcast <96 x i1> %t3 to i96
2173 define i128 @test_insertelement_variable_v128i1(<128 x i8> %a, i8 %b, i32 %index) {
2174 ; KNL-LABEL: test_insertelement_variable_v128i1:
2176 ; KNL-NEXT: pushq %rbp
2177 ; KNL-NEXT: .cfi_def_cfa_offset 16
2178 ; KNL-NEXT: .cfi_offset %rbp, -16
2179 ; KNL-NEXT: movq %rsp, %rbp
2180 ; KNL-NEXT: .cfi_def_cfa_register %rbp
2181 ; KNL-NEXT: andq $-128, %rsp
2182 ; KNL-NEXT: subq $256, %rsp ## imm = 0x100
2183 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
2184 ; KNL-NEXT: vpxor %xmm4, %xmm4, %xmm4
2185 ; KNL-NEXT: vpcmpeqb %ymm4, %ymm0, %ymm0
2186 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
2187 ; KNL-NEXT: vpcmpeqb %ymm4, %ymm1, %ymm1
2188 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
2189 ; KNL-NEXT: vpcmpeqb %ymm4, %ymm2, %ymm2
2190 ; KNL-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
2191 ; KNL-NEXT: vpcmpeqb %ymm4, %ymm3, %ymm3
2192 ; KNL-NEXT: vpternlogq $15, %zmm3, %zmm3, %zmm3
2193 ; KNL-NEXT: andl $127, %esi
2194 ; KNL-NEXT: testb %dil, %dil
2195 ; KNL-NEXT: vmovdqa %ymm3, {{[0-9]+}}(%rsp)
2196 ; KNL-NEXT: vmovdqa %ymm2, {{[0-9]+}}(%rsp)
2197 ; KNL-NEXT: vmovdqa %ymm1, {{[0-9]+}}(%rsp)
2198 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
2199 ; KNL-NEXT: setne (%rsp,%rsi)
2200 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
2201 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2202 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2203 ; KNL-NEXT: kmovw %k0, %eax
2204 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2205 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2206 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2207 ; KNL-NEXT: kmovw %k0, %ecx
2208 ; KNL-NEXT: shll $16, %ecx
2209 ; KNL-NEXT: orl %eax, %ecx
2210 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2211 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2212 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2213 ; KNL-NEXT: kmovw %k0, %edx
2214 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2215 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2216 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2217 ; KNL-NEXT: kmovw %k0, %eax
2218 ; KNL-NEXT: shll $16, %eax
2219 ; KNL-NEXT: orl %edx, %eax
2220 ; KNL-NEXT: shlq $32, %rax
2221 ; KNL-NEXT: orq %rcx, %rax
2222 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2223 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2224 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2225 ; KNL-NEXT: kmovw %k0, %ecx
2226 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2227 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2228 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2229 ; KNL-NEXT: kmovw %k0, %esi
2230 ; KNL-NEXT: shll $16, %esi
2231 ; KNL-NEXT: orl %ecx, %esi
2232 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2233 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2234 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2235 ; KNL-NEXT: kmovw %k0, %ecx
2236 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2237 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2238 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2239 ; KNL-NEXT: kmovw %k0, %edx
2240 ; KNL-NEXT: shll $16, %edx
2241 ; KNL-NEXT: orl %ecx, %edx
2242 ; KNL-NEXT: shlq $32, %rdx
2243 ; KNL-NEXT: orq %rsi, %rdx
2244 ; KNL-NEXT: movq %rbp, %rsp
2245 ; KNL-NEXT: popq %rbp
2246 ; KNL-NEXT: vzeroupper
2249 ; SKX-LABEL: test_insertelement_variable_v128i1:
2251 ; SKX-NEXT: pushq %rbp
2252 ; SKX-NEXT: .cfi_def_cfa_offset 16
2253 ; SKX-NEXT: .cfi_offset %rbp, -16
2254 ; SKX-NEXT: movq %rsp, %rbp
2255 ; SKX-NEXT: .cfi_def_cfa_register %rbp
2256 ; SKX-NEXT: andq $-128, %rsp
2257 ; SKX-NEXT: subq $256, %rsp ## imm = 0x100
2258 ; SKX-NEXT: ## kill: def $esi killed $esi def $rsi
2259 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
2260 ; SKX-NEXT: vptestmb %zmm1, %zmm1, %k1
2261 ; SKX-NEXT: andl $127, %esi
2262 ; SKX-NEXT: testb %dil, %dil
2263 ; SKX-NEXT: vpmovm2b %k1, %zmm0
2264 ; SKX-NEXT: vmovdqa64 %zmm0, {{[0-9]+}}(%rsp)
2265 ; SKX-NEXT: vpmovm2b %k0, %zmm0
2266 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
2267 ; SKX-NEXT: setne (%rsp,%rsi)
2268 ; SKX-NEXT: vpsllw $7, {{[0-9]+}}(%rsp), %zmm0
2269 ; SKX-NEXT: vpmovb2m %zmm0, %k0
2270 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
2271 ; SKX-NEXT: vpmovb2m %zmm0, %k1
2272 ; SKX-NEXT: kmovq %k1, %rax
2273 ; SKX-NEXT: kmovq %k0, %rdx
2274 ; SKX-NEXT: movq %rbp, %rsp
2275 ; SKX-NEXT: popq %rbp
2276 ; SKX-NEXT: vzeroupper
2278 %t1 = icmp ugt <128 x i8> %a, zeroinitializer
2279 %t2 = icmp ugt i8 %b, 0
2280 %t3 = insertelement <128 x i1> %t1, i1 %t2, i32 %index
2281 %t4 = bitcast <128 x i1> %t3 to i128
2285 define void @test_concat_v2i1(<2 x half>* %arg, <2 x half>* %arg1, <2 x half>* %arg2) {
2286 ; KNL-LABEL: test_concat_v2i1:
2288 ; KNL-NEXT: movswl (%rdi), %eax
2289 ; KNL-NEXT: vmovd %eax, %xmm0
2290 ; KNL-NEXT: vcvtph2ps %xmm0, %xmm0
2291 ; KNL-NEXT: movswl 2(%rdi), %eax
2292 ; KNL-NEXT: vmovd %eax, %xmm1
2293 ; KNL-NEXT: vcvtph2ps %xmm1, %xmm1
2294 ; KNL-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
2295 ; KNL-NEXT: vucomiss %xmm2, %xmm1
2296 ; KNL-NEXT: setb %al
2297 ; KNL-NEXT: kmovw %eax, %k0
2298 ; KNL-NEXT: kshiftlw $1, %k0, %k0
2299 ; KNL-NEXT: vucomiss %xmm2, %xmm0
2300 ; KNL-NEXT: setb %al
2301 ; KNL-NEXT: andl $1, %eax
2302 ; KNL-NEXT: kmovw %eax, %k1
2303 ; KNL-NEXT: korw %k0, %k1, %k0
2304 ; KNL-NEXT: vxorps %xmm2, %xmm2, %xmm2
2305 ; KNL-NEXT: vucomiss %xmm2, %xmm1
2306 ; KNL-NEXT: seta %al
2307 ; KNL-NEXT: kmovw %eax, %k1
2308 ; KNL-NEXT: kshiftlw $1, %k1, %k1
2309 ; KNL-NEXT: vucomiss %xmm2, %xmm0
2310 ; KNL-NEXT: seta %al
2311 ; KNL-NEXT: andl $1, %eax
2312 ; KNL-NEXT: kmovw %eax, %k2
2313 ; KNL-NEXT: korw %k1, %k2, %k1
2314 ; KNL-NEXT: kandw %k1, %k0, %k1
2315 ; KNL-NEXT: kshiftrw $1, %k1, %k2
2316 ; KNL-NEXT: movswl (%rsi), %eax
2317 ; KNL-NEXT: vmovd %eax, %xmm0
2318 ; KNL-NEXT: vcvtph2ps %xmm0, %xmm0
2319 ; KNL-NEXT: movswl 2(%rsi), %eax
2320 ; KNL-NEXT: vmovd %eax, %xmm1
2321 ; KNL-NEXT: vcvtph2ps %xmm1, %xmm1
2322 ; KNL-NEXT: vmovss %xmm1, %xmm1, %xmm1 {%k2} {z}
2323 ; KNL-NEXT: vmovss %xmm0, %xmm0, %xmm0 {%k1} {z}
2324 ; KNL-NEXT: vcvtps2ph $4, %xmm0, %xmm0
2325 ; KNL-NEXT: vmovd %xmm0, %eax
2326 ; KNL-NEXT: movw %ax, (%rdx)
2327 ; KNL-NEXT: vcvtps2ph $4, %xmm1, %xmm0
2328 ; KNL-NEXT: vmovd %xmm0, %eax
2329 ; KNL-NEXT: movw %ax, 2(%rdx)
2332 ; SKX-LABEL: test_concat_v2i1:
2334 ; SKX-NEXT: movswl (%rdi), %eax
2335 ; SKX-NEXT: vmovd %eax, %xmm0
2336 ; SKX-NEXT: vcvtph2ps %xmm0, %xmm0
2337 ; SKX-NEXT: movswl 2(%rdi), %eax
2338 ; SKX-NEXT: vmovd %eax, %xmm1
2339 ; SKX-NEXT: vcvtph2ps %xmm1, %xmm1
2340 ; SKX-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
2341 ; SKX-NEXT: vucomiss %xmm2, %xmm1
2342 ; SKX-NEXT: setb %al
2343 ; SKX-NEXT: kmovd %eax, %k0
2344 ; SKX-NEXT: kshiftlb $1, %k0, %k0
2345 ; SKX-NEXT: vucomiss %xmm2, %xmm0
2346 ; SKX-NEXT: setb %al
2347 ; SKX-NEXT: kmovd %eax, %k1
2348 ; SKX-NEXT: kshiftlb $7, %k1, %k1
2349 ; SKX-NEXT: kshiftrb $7, %k1, %k1
2350 ; SKX-NEXT: korw %k0, %k1, %k0
2351 ; SKX-NEXT: vxorps %xmm2, %xmm2, %xmm2
2352 ; SKX-NEXT: vucomiss %xmm2, %xmm1
2353 ; SKX-NEXT: seta %al
2354 ; SKX-NEXT: kmovd %eax, %k1
2355 ; SKX-NEXT: kshiftlb $1, %k1, %k1
2356 ; SKX-NEXT: vucomiss %xmm2, %xmm0
2357 ; SKX-NEXT: seta %al
2358 ; SKX-NEXT: kmovd %eax, %k2
2359 ; SKX-NEXT: kshiftlb $7, %k2, %k2
2360 ; SKX-NEXT: kshiftrb $7, %k2, %k2
2361 ; SKX-NEXT: korw %k1, %k2, %k1
2362 ; SKX-NEXT: kandw %k1, %k0, %k1
2363 ; SKX-NEXT: kshiftrb $1, %k1, %k2
2364 ; SKX-NEXT: movswl (%rsi), %eax
2365 ; SKX-NEXT: vmovd %eax, %xmm0
2366 ; SKX-NEXT: vcvtph2ps %xmm0, %xmm0
2367 ; SKX-NEXT: movswl 2(%rsi), %eax
2368 ; SKX-NEXT: vmovd %eax, %xmm1
2369 ; SKX-NEXT: vcvtph2ps %xmm1, %xmm1
2370 ; SKX-NEXT: vmovss %xmm1, %xmm1, %xmm1 {%k2} {z}
2371 ; SKX-NEXT: vmovss %xmm0, %xmm0, %xmm0 {%k1} {z}
2372 ; SKX-NEXT: vcvtps2ph $4, %xmm0, %xmm0
2373 ; SKX-NEXT: vmovd %xmm0, %eax
2374 ; SKX-NEXT: movw %ax, (%rdx)
2375 ; SKX-NEXT: vcvtps2ph $4, %xmm1, %xmm0
2376 ; SKX-NEXT: vmovd %xmm0, %eax
2377 ; SKX-NEXT: movw %ax, 2(%rdx)
2379 %tmp = load <2 x half>, <2 x half>* %arg, align 8
2380 %tmp3 = fcmp fast olt <2 x half> %tmp, <half 0xH4600, half 0xH4600>
2381 %tmp4 = fcmp fast ogt <2 x half> %tmp, zeroinitializer
2382 %tmp5 = and <2 x i1> %tmp3, %tmp4
2383 %tmp6 = load <2 x half>, <2 x half>* %arg1, align 8
2384 %tmp7 = select <2 x i1> %tmp5, <2 x half> %tmp6, <2 x half> zeroinitializer
2385 store <2 x half> %tmp7, <2 x half>* %arg2, align 8