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-prefixes=CHECK,KNL %s
3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq | FileCheck --check-prefixes=CHECK,SKX %s
4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq,+avx512vbmi | FileCheck --check-prefixes=CHECK,SKX %s
6 define <16 x float> @test1(<16 x float> %x, ptr %br, float %y) nounwind {
9 ; KNL-NEXT: vinsertps {{.*#+}} xmm2 = xmm0[0],mem[0],xmm0[2,3]
10 ; KNL-NEXT: vinsertf32x4 $0, %xmm2, %zmm0, %zmm0
11 ; KNL-NEXT: movw $16384, %ax ## imm = 0x4000
12 ; KNL-NEXT: kmovw %eax, %k1
13 ; KNL-NEXT: vbroadcastss %xmm1, %zmm0 {%k1}
18 ; SKX-NEXT: vinsertps {{.*#+}} xmm2 = xmm0[0],mem[0],xmm0[2,3]
19 ; SKX-NEXT: vinsertf32x4 $0, %xmm2, %zmm0, %zmm0
20 ; SKX-NEXT: movw $16384, %ax ## imm = 0x4000
21 ; SKX-NEXT: kmovd %eax, %k1
22 ; SKX-NEXT: vbroadcastss %xmm1, %zmm0 {%k1}
24 %rrr = load float, ptr %br
25 %rrr2 = insertelement <16 x float> %x, float %rrr, i32 1
26 %rrr3 = insertelement <16 x float> %rrr2, float %y, i32 14
27 ret <16 x float> %rrr3
30 define <8 x double> @test2(<8 x double> %x, ptr %br, double %y) nounwind {
33 ; KNL-NEXT: vmovhpd {{.*#+}} xmm2 = xmm0[0],mem[0]
34 ; KNL-NEXT: vinsertf32x4 $0, %xmm2, %zmm0, %zmm0
35 ; KNL-NEXT: movb $64, %al
36 ; KNL-NEXT: kmovw %eax, %k1
37 ; KNL-NEXT: vbroadcastsd %xmm1, %zmm0 {%k1}
42 ; SKX-NEXT: vmovhpd {{.*#+}} xmm2 = xmm0[0],mem[0]
43 ; SKX-NEXT: vinsertf32x4 $0, %xmm2, %zmm0, %zmm0
44 ; SKX-NEXT: movb $64, %al
45 ; SKX-NEXT: kmovd %eax, %k1
46 ; SKX-NEXT: vbroadcastsd %xmm1, %zmm0 {%k1}
48 %rrr = load double, ptr %br
49 %rrr2 = insertelement <8 x double> %x, double %rrr, i32 1
50 %rrr3 = insertelement <8 x double> %rrr2, double %y, i32 6
51 ret <8 x double> %rrr3
54 define <16 x float> @test3(<16 x float> %x) nounwind {
57 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
58 ; CHECK-NEXT: vinsertps {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[2,3]
59 ; CHECK-NEXT: vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
61 %eee = extractelement <16 x float> %x, i32 4
62 %rrr2 = insertelement <16 x float> %x, float %eee, i32 1
63 ret <16 x float> %rrr2
66 define <8 x i64> @test4(<8 x i64> %x) nounwind {
69 ; CHECK-NEXT: vextractf32x4 $2, %zmm0, %xmm1
70 ; CHECK-NEXT: vmovlhps {{.*#+}} xmm1 = xmm0[0],xmm1[0]
71 ; CHECK-NEXT: vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
73 %eee = extractelement <8 x i64> %x, i32 4
74 %rrr2 = insertelement <8 x i64> %x, i64 %eee, i32 1
78 define i32 @test5(<4 x float> %x) nounwind {
81 ; CHECK-NEXT: vextractps $3, %xmm0, %eax
83 %ef = extractelement <4 x float> %x, i32 3
84 %ei = bitcast float %ef to i32
88 define void @test6(<4 x float> %x, ptr %out) nounwind {
91 ; CHECK-NEXT: vextractps $3, %xmm0, (%rdi)
93 %ef = extractelement <4 x float> %x, i32 3
94 store float %ef, ptr %out, align 4
98 define float @test7(<16 x float> %x, i32 %ind) nounwind {
101 ; CHECK-NEXT: pushq %rbp
102 ; CHECK-NEXT: movq %rsp, %rbp
103 ; CHECK-NEXT: andq $-64, %rsp
104 ; CHECK-NEXT: subq $128, %rsp
105 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
106 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
107 ; CHECK-NEXT: andl $15, %edi
108 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
109 ; CHECK-NEXT: movq %rbp, %rsp
110 ; CHECK-NEXT: popq %rbp
111 ; CHECK-NEXT: vzeroupper
113 %e = extractelement <16 x float> %x, i32 %ind
117 define double @test8(<8 x double> %x, i32 %ind) nounwind {
118 ; CHECK-LABEL: test8:
120 ; CHECK-NEXT: pushq %rbp
121 ; CHECK-NEXT: movq %rsp, %rbp
122 ; CHECK-NEXT: andq $-64, %rsp
123 ; CHECK-NEXT: subq $128, %rsp
124 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
125 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
126 ; CHECK-NEXT: andl $7, %edi
127 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
128 ; CHECK-NEXT: movq %rbp, %rsp
129 ; CHECK-NEXT: popq %rbp
130 ; CHECK-NEXT: vzeroupper
132 %e = extractelement <8 x double> %x, i32 %ind
136 define float @test9(<8 x float> %x, i32 %ind) nounwind {
137 ; CHECK-LABEL: test9:
139 ; CHECK-NEXT: pushq %rbp
140 ; CHECK-NEXT: movq %rsp, %rbp
141 ; CHECK-NEXT: andq $-32, %rsp
142 ; CHECK-NEXT: subq $64, %rsp
143 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
144 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
145 ; CHECK-NEXT: andl $7, %edi
146 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
147 ; CHECK-NEXT: movq %rbp, %rsp
148 ; CHECK-NEXT: popq %rbp
149 ; CHECK-NEXT: vzeroupper
151 %e = extractelement <8 x float> %x, i32 %ind
155 define i32 @test10(<16 x i32> %x, i32 %ind) nounwind {
156 ; CHECK-LABEL: test10:
158 ; CHECK-NEXT: pushq %rbp
159 ; CHECK-NEXT: movq %rsp, %rbp
160 ; CHECK-NEXT: andq $-64, %rsp
161 ; CHECK-NEXT: subq $128, %rsp
162 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
163 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
164 ; CHECK-NEXT: andl $15, %edi
165 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
166 ; CHECK-NEXT: movq %rbp, %rsp
167 ; CHECK-NEXT: popq %rbp
168 ; CHECK-NEXT: vzeroupper
170 %e = extractelement <16 x i32> %x, i32 %ind
174 define <16 x i32> @test11(<16 x i32>%a, <16 x i32>%b) nounwind {
177 ; KNL-NEXT: vpcmpltud %zmm1, %zmm0, %k0
178 ; KNL-NEXT: kmovw %k0, %eax
179 ; KNL-NEXT: testb $16, %al
180 ; KNL-NEXT: je LBB10_2
181 ; KNL-NEXT: ## %bb.1: ## %A
182 ; KNL-NEXT: vmovdqa64 %zmm1, %zmm0
184 ; KNL-NEXT: LBB10_2: ## %B
185 ; KNL-NEXT: vpaddd %zmm0, %zmm1, %zmm0
190 ; SKX-NEXT: vpcmpltud %zmm1, %zmm0, %k0
191 ; SKX-NEXT: kmovd %k0, %eax
192 ; SKX-NEXT: testb $16, %al
193 ; SKX-NEXT: je LBB10_2
194 ; SKX-NEXT: ## %bb.1: ## %A
195 ; SKX-NEXT: vmovdqa64 %zmm1, %zmm0
197 ; SKX-NEXT: LBB10_2: ## %B
198 ; SKX-NEXT: vpaddd %zmm0, %zmm1, %zmm0
200 %cmp_res = icmp ult <16 x i32> %a, %b
201 %ia = extractelement <16 x i1> %cmp_res, i32 4
202 br i1 %ia, label %A, label %B
206 %c = add <16 x i32>%b, %a
210 define i64 @test12(<16 x i64>%a, <16 x i64>%b, i64 %a1, i64 %b1) nounwind {
213 ; KNL-NEXT: movq %rdi, %rax
214 ; KNL-NEXT: vpcmpgtq %zmm0, %zmm2, %k0
215 ; KNL-NEXT: kmovw %k0, %ecx
216 ; KNL-NEXT: testb $1, %cl
217 ; KNL-NEXT: cmoveq %rsi, %rax
218 ; KNL-NEXT: vzeroupper
223 ; SKX-NEXT: movq %rdi, %rax
224 ; SKX-NEXT: vpcmpgtq %zmm0, %zmm2, %k0
225 ; SKX-NEXT: kmovd %k0, %ecx
226 ; SKX-NEXT: testb $1, %cl
227 ; SKX-NEXT: cmoveq %rsi, %rax
228 ; SKX-NEXT: vzeroupper
230 %cmpvector_func.i = icmp slt <16 x i64> %a, %b
231 %extract24vector_func.i = extractelement <16 x i1> %cmpvector_func.i, i32 0
232 %res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
236 define i16 @test13(i32 %a, i32 %b) nounwind {
239 ; KNL-NEXT: cmpl %esi, %edi
241 ; KNL-NEXT: movw $-4, %cx
242 ; KNL-NEXT: kmovw %ecx, %k0
243 ; KNL-NEXT: kshiftrw $1, %k0, %k0
244 ; KNL-NEXT: kshiftlw $1, %k0, %k0
245 ; KNL-NEXT: andl $1, %eax
246 ; KNL-NEXT: kmovw %eax, %k1
247 ; KNL-NEXT: korw %k1, %k0, %k0
248 ; KNL-NEXT: kmovw %k0, %eax
249 ; KNL-NEXT: ## kill: def $ax killed $ax killed $eax
254 ; SKX-NEXT: cmpl %esi, %edi
256 ; SKX-NEXT: movw $-4, %cx
257 ; SKX-NEXT: kmovd %ecx, %k0
258 ; SKX-NEXT: kshiftrw $1, %k0, %k0
259 ; SKX-NEXT: kshiftlw $1, %k0, %k0
260 ; SKX-NEXT: andl $1, %eax
261 ; SKX-NEXT: kmovw %eax, %k1
262 ; SKX-NEXT: korw %k1, %k0, %k0
263 ; SKX-NEXT: kmovd %k0, %eax
264 ; SKX-NEXT: ## kill: def $ax killed $ax killed $eax
266 %cmp_res = icmp ult i32 %a, %b
267 %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
268 %res = bitcast <16 x i1> %maskv to i16
272 define i64 @test14(<8 x i64>%a, <8 x i64>%b, i64 %a1, i64 %b1) nounwind {
275 ; KNL-NEXT: movq %rdi, %rax
276 ; KNL-NEXT: vpcmpgtq %zmm0, %zmm1, %k0
277 ; KNL-NEXT: kmovw %k0, %ecx
278 ; KNL-NEXT: testb $16, %cl
279 ; KNL-NEXT: cmoveq %rsi, %rax
280 ; KNL-NEXT: vzeroupper
285 ; SKX-NEXT: movq %rdi, %rax
286 ; SKX-NEXT: vpcmpgtq %zmm0, %zmm1, %k0
287 ; SKX-NEXT: kmovd %k0, %ecx
288 ; SKX-NEXT: testb $16, %cl
289 ; SKX-NEXT: cmoveq %rsi, %rax
290 ; SKX-NEXT: vzeroupper
292 %cmpvector_func.i = icmp slt <8 x i64> %a, %b
293 %extract24vector_func.i = extractelement <8 x i1> %cmpvector_func.i, i32 4
294 %res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
298 define i16 @test15(ptr%addr) nounwind {
299 ; CHECK-LABEL: test15:
301 ; CHECK-NEXT: xorl %ecx, %ecx
302 ; CHECK-NEXT: cmpb $0, (%rdi)
303 ; CHECK-NEXT: movl $65535, %eax ## imm = 0xFFFF
304 ; CHECK-NEXT: cmovel %ecx, %eax
305 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
307 %x = load i1 , ptr %addr, align 1
308 %x1 = insertelement <16 x i1> undef, i1 %x, i32 10
309 %x2 = bitcast <16 x i1>%x1 to i16
313 define i16 @test16(ptr%addr, i16 %a) nounwind {
316 ; KNL-NEXT: movzbl (%rdi), %eax
317 ; KNL-NEXT: kmovw %esi, %k0
318 ; KNL-NEXT: movw $-1025, %cx ## imm = 0xFBFF
319 ; KNL-NEXT: kmovw %ecx, %k1
320 ; KNL-NEXT: kandw %k1, %k0, %k0
321 ; KNL-NEXT: kmovw %eax, %k1
322 ; KNL-NEXT: kshiftlw $15, %k1, %k1
323 ; KNL-NEXT: kshiftrw $5, %k1, %k1
324 ; KNL-NEXT: korw %k1, %k0, %k0
325 ; KNL-NEXT: kmovw %k0, %eax
326 ; KNL-NEXT: ## kill: def $ax killed $ax killed $eax
331 ; SKX-NEXT: kmovb (%rdi), %k0
332 ; SKX-NEXT: kmovd %esi, %k1
333 ; SKX-NEXT: movw $-1025, %ax ## imm = 0xFBFF
334 ; SKX-NEXT: kmovd %eax, %k2
335 ; SKX-NEXT: kandw %k2, %k1, %k1
336 ; SKX-NEXT: kshiftlw $15, %k0, %k0
337 ; SKX-NEXT: kshiftrw $5, %k0, %k0
338 ; SKX-NEXT: korw %k0, %k1, %k0
339 ; SKX-NEXT: kmovd %k0, %eax
340 ; SKX-NEXT: ## kill: def $ax killed $ax killed $eax
342 %x = load i1 , ptr %addr, align 128
343 %a1 = bitcast i16 %a to <16 x i1>
344 %x1 = insertelement <16 x i1> %a1, i1 %x, i32 10
345 %x2 = bitcast <16 x i1>%x1 to i16
349 define i8 @test17(ptr%addr, i8 %a) nounwind {
352 ; KNL-NEXT: movzbl (%rdi), %eax
353 ; KNL-NEXT: kmovw %esi, %k0
354 ; KNL-NEXT: movw $-17, %cx
355 ; KNL-NEXT: kmovw %ecx, %k1
356 ; KNL-NEXT: kandw %k1, %k0, %k0
357 ; KNL-NEXT: kmovw %eax, %k1
358 ; KNL-NEXT: kshiftlw $15, %k1, %k1
359 ; KNL-NEXT: kshiftrw $11, %k1, %k1
360 ; KNL-NEXT: korw %k1, %k0, %k0
361 ; KNL-NEXT: kmovw %k0, %eax
362 ; KNL-NEXT: ## kill: def $al killed $al killed $eax
367 ; SKX-NEXT: kmovb (%rdi), %k0
368 ; SKX-NEXT: kmovd %esi, %k1
369 ; SKX-NEXT: movb $-17, %al
370 ; SKX-NEXT: kmovd %eax, %k2
371 ; SKX-NEXT: kandb %k2, %k1, %k1
372 ; SKX-NEXT: kshiftlb $7, %k0, %k0
373 ; SKX-NEXT: kshiftrb $3, %k0, %k0
374 ; SKX-NEXT: korb %k0, %k1, %k0
375 ; SKX-NEXT: kmovd %k0, %eax
376 ; SKX-NEXT: ## kill: def $al killed $al killed $eax
378 %x = load i1 , ptr %addr, align 128
379 %a1 = bitcast i8 %a to <8 x i1>
380 %x1 = insertelement <8 x i1> %a1, i1 %x, i32 4
381 %x2 = bitcast <8 x i1>%x1 to i8
385 define i64 @extract_v8i64(<8 x i64> %x, ptr %dst) nounwind {
386 ; CHECK-LABEL: extract_v8i64:
388 ; CHECK-NEXT: vpextrq $1, %xmm0, %rax
389 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
390 ; CHECK-NEXT: vpextrq $1, %xmm0, (%rdi)
391 ; CHECK-NEXT: vzeroupper
393 %r1 = extractelement <8 x i64> %x, i32 1
394 %r2 = extractelement <8 x i64> %x, i32 3
395 store i64 %r2, ptr %dst, align 1
399 define i64 @extract_v4i64(<4 x i64> %x, ptr %dst) nounwind {
400 ; CHECK-LABEL: extract_v4i64:
402 ; CHECK-NEXT: vpextrq $1, %xmm0, %rax
403 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
404 ; CHECK-NEXT: vpextrq $1, %xmm0, (%rdi)
405 ; CHECK-NEXT: vzeroupper
407 %r1 = extractelement <4 x i64> %x, i32 1
408 %r2 = extractelement <4 x i64> %x, i32 3
409 store i64 %r2, ptr %dst, align 1
413 define i64 @extract_v2i64(<2 x i64> %x, ptr %dst) nounwind {
414 ; CHECK-LABEL: extract_v2i64:
416 ; CHECK-NEXT: vmovq %xmm0, %rax
417 ; CHECK-NEXT: vpextrq $1, %xmm0, (%rdi)
419 %r1 = extractelement <2 x i64> %x, i32 0
420 %r2 = extractelement <2 x i64> %x, i32 1
421 store i64 %r2, ptr %dst, align 1
425 define i32 @extract_v16i32(<16 x i32> %x, ptr %dst) nounwind {
426 ; CHECK-LABEL: extract_v16i32:
428 ; CHECK-NEXT: vextractps $1, %xmm0, %eax
429 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
430 ; CHECK-NEXT: vextractps $1, %xmm0, (%rdi)
431 ; CHECK-NEXT: vzeroupper
433 %r1 = extractelement <16 x i32> %x, i32 1
434 %r2 = extractelement <16 x i32> %x, i32 5
435 store i32 %r2, ptr %dst, align 1
439 define i32 @extract_v8i32(<8 x i32> %x, ptr %dst) nounwind {
440 ; CHECK-LABEL: extract_v8i32:
442 ; CHECK-NEXT: vextractps $1, %xmm0, %eax
443 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
444 ; CHECK-NEXT: vextractps $1, %xmm0, (%rdi)
445 ; CHECK-NEXT: vzeroupper
447 %r1 = extractelement <8 x i32> %x, i32 1
448 %r2 = extractelement <8 x i32> %x, i32 5
449 store i32 %r2, ptr %dst, align 1
453 define i32 @extract_v4i32(<4 x i32> %x, ptr %dst) nounwind {
454 ; CHECK-LABEL: extract_v4i32:
456 ; CHECK-NEXT: vextractps $1, %xmm0, %eax
457 ; CHECK-NEXT: vextractps $3, %xmm0, (%rdi)
459 %r1 = extractelement <4 x i32> %x, i32 1
460 %r2 = extractelement <4 x i32> %x, i32 3
461 store i32 %r2, ptr %dst, align 1
465 define i16 @extract_v32i16(<32 x i16> %x, ptr %dst) nounwind {
466 ; CHECK-LABEL: extract_v32i16:
468 ; CHECK-NEXT: vpextrw $1, %xmm0, %eax
469 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
470 ; CHECK-NEXT: vpextrw $1, %xmm0, (%rdi)
471 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
472 ; CHECK-NEXT: vzeroupper
474 %r1 = extractelement <32 x i16> %x, i32 1
475 %r2 = extractelement <32 x i16> %x, i32 9
476 store i16 %r2, ptr %dst, align 1
480 define i16 @extract_v16i16(<16 x i16> %x, ptr %dst) nounwind {
481 ; CHECK-LABEL: extract_v16i16:
483 ; CHECK-NEXT: vpextrw $1, %xmm0, %eax
484 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
485 ; CHECK-NEXT: vpextrw $1, %xmm0, (%rdi)
486 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
487 ; CHECK-NEXT: vzeroupper
489 %r1 = extractelement <16 x i16> %x, i32 1
490 %r2 = extractelement <16 x i16> %x, i32 9
491 store i16 %r2, ptr %dst, align 1
495 define i16 @extract_v8i16(<8 x i16> %x, ptr %dst) nounwind {
496 ; CHECK-LABEL: extract_v8i16:
498 ; CHECK-NEXT: vpextrw $1, %xmm0, %eax
499 ; CHECK-NEXT: vpextrw $3, %xmm0, (%rdi)
500 ; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
502 %r1 = extractelement <8 x i16> %x, i32 1
503 %r2 = extractelement <8 x i16> %x, i32 3
504 store i16 %r2, ptr %dst, align 1
508 define i8 @extract_v64i8(<64 x i8> %x, ptr %dst) nounwind {
509 ; CHECK-LABEL: extract_v64i8:
511 ; CHECK-NEXT: vpextrb $1, %xmm0, %eax
512 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
513 ; CHECK-NEXT: vpextrb $1, %xmm0, (%rdi)
514 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
515 ; CHECK-NEXT: vzeroupper
517 %r1 = extractelement <64 x i8> %x, i32 1
518 %r2 = extractelement <64 x i8> %x, i32 17
519 store i8 %r2, ptr %dst, align 1
523 define i8 @extract_v32i8(<32 x i8> %x, ptr %dst) nounwind {
524 ; CHECK-LABEL: extract_v32i8:
526 ; CHECK-NEXT: vpextrb $1, %xmm0, %eax
527 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
528 ; CHECK-NEXT: vpextrb $1, %xmm0, (%rdi)
529 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
530 ; CHECK-NEXT: vzeroupper
532 %r1 = extractelement <32 x i8> %x, i32 1
533 %r2 = extractelement <32 x i8> %x, i32 17
534 store i8 %r2, ptr %dst, align 1
538 define i8 @extract_v16i8(<16 x i8> %x, ptr %dst) nounwind {
539 ; CHECK-LABEL: extract_v16i8:
541 ; CHECK-NEXT: vpextrb $1, %xmm0, %eax
542 ; CHECK-NEXT: vpextrb $3, %xmm0, (%rdi)
543 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
545 %r1 = extractelement <16 x i8> %x, i32 1
546 %r2 = extractelement <16 x i8> %x, i32 3
547 store i8 %r2, ptr %dst, align 1
551 define <8 x i64> @insert_v8i64(<8 x i64> %x, i64 %y , ptr %ptr) nounwind {
552 ; KNL-LABEL: insert_v8i64:
554 ; KNL-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm1
555 ; KNL-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
556 ; KNL-NEXT: movb $8, %al
557 ; KNL-NEXT: kmovw %eax, %k1
558 ; KNL-NEXT: vpbroadcastq %rdi, %zmm0 {%k1}
561 ; SKX-LABEL: insert_v8i64:
563 ; SKX-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm1
564 ; SKX-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
565 ; SKX-NEXT: movb $8, %al
566 ; SKX-NEXT: kmovd %eax, %k1
567 ; SKX-NEXT: vpbroadcastq %rdi, %zmm0 {%k1}
569 %val = load i64, ptr %ptr
570 %r1 = insertelement <8 x i64> %x, i64 %val, i32 1
571 %r2 = insertelement <8 x i64> %r1, i64 %y, i32 3
575 define <4 x i64> @insert_v4i64(<4 x i64> %x, i64 %y , ptr %ptr) nounwind {
576 ; KNL-LABEL: insert_v4i64:
578 ; KNL-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm1
579 ; KNL-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
580 ; KNL-NEXT: vmovq %rdi, %xmm1
581 ; KNL-NEXT: vpbroadcastq %xmm1, %ymm1
582 ; KNL-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
585 ; SKX-LABEL: insert_v4i64:
587 ; SKX-NEXT: vpinsrq $1, (%rsi), %xmm0, %xmm1
588 ; SKX-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
589 ; SKX-NEXT: vpbroadcastq %rdi, %ymm1
590 ; SKX-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
592 %val = load i64, ptr %ptr
593 %r1 = insertelement <4 x i64> %x, i64 %val, i32 1
594 %r2 = insertelement <4 x i64> %r1, i64 %y, i32 3
598 define <2 x i64> @insert_v2i64(<2 x i64> %x, i64 %y , ptr %ptr) nounwind {
599 ; CHECK-LABEL: insert_v2i64:
601 ; CHECK-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
602 ; CHECK-NEXT: vmovq %rdi, %xmm1
603 ; CHECK-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm1[0],xmm0[0]
605 %val = load i64, ptr %ptr
606 %r1 = insertelement <2 x i64> %x, i64 %val, i32 1
607 %r2 = insertelement <2 x i64> %r1, i64 %y, i32 0
611 define <16 x i32> @insert_v16i32(<16 x i32> %x, i32 %y, ptr %ptr) nounwind {
612 ; KNL-LABEL: insert_v16i32:
614 ; KNL-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm1
615 ; KNL-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
616 ; KNL-NEXT: movw $32, %ax
617 ; KNL-NEXT: kmovw %eax, %k1
618 ; KNL-NEXT: vpbroadcastd %edi, %zmm0 {%k1}
621 ; SKX-LABEL: insert_v16i32:
623 ; SKX-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm1
624 ; SKX-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
625 ; SKX-NEXT: movw $32, %ax
626 ; SKX-NEXT: kmovd %eax, %k1
627 ; SKX-NEXT: vpbroadcastd %edi, %zmm0 {%k1}
629 %val = load i32, ptr %ptr
630 %r1 = insertelement <16 x i32> %x, i32 %val, i32 1
631 %r2 = insertelement <16 x i32> %r1, i32 %y, i32 5
635 define <8 x i32> @insert_v8i32(<8 x i32> %x, i32 %y, ptr %ptr) nounwind {
636 ; KNL-LABEL: insert_v8i32:
638 ; KNL-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm1
639 ; KNL-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
640 ; KNL-NEXT: vmovd %edi, %xmm1
641 ; KNL-NEXT: vpbroadcastd %xmm1, %ymm1
642 ; KNL-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3,4],ymm1[5],ymm0[6,7]
645 ; SKX-LABEL: insert_v8i32:
647 ; SKX-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm1
648 ; SKX-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
649 ; SKX-NEXT: vpbroadcastd %edi, %ymm1
650 ; SKX-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3,4],ymm1[5],ymm0[6,7]
652 %val = load i32, ptr %ptr
653 %r1 = insertelement <8 x i32> %x, i32 %val, i32 1
654 %r2 = insertelement <8 x i32> %r1, i32 %y, i32 5
658 define <4 x i32> @insert_v4i32(<4 x i32> %x, i32 %y, ptr %ptr) nounwind {
659 ; CHECK-LABEL: insert_v4i32:
661 ; CHECK-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm0
662 ; CHECK-NEXT: vpinsrd $3, %edi, %xmm0, %xmm0
664 %val = load i32, ptr %ptr
665 %r1 = insertelement <4 x i32> %x, i32 %val, i32 1
666 %r2 = insertelement <4 x i32> %r1, i32 %y, i32 3
670 define <32 x i16> @insert_v32i16(<32 x i16> %x, i16 %y, ptr %ptr) nounwind {
671 ; KNL-LABEL: insert_v32i16:
673 ; KNL-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
674 ; KNL-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
675 ; KNL-NEXT: vmovd %edi, %xmm0
676 ; KNL-NEXT: vpbroadcastw %xmm0, %ymm0
677 ; KNL-NEXT: vpternlogq $216, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm1, %zmm0
680 ; SKX-LABEL: insert_v32i16:
682 ; SKX-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
683 ; SKX-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
684 ; SKX-NEXT: movl $512, %eax ## imm = 0x200
685 ; SKX-NEXT: kmovd %eax, %k1
686 ; SKX-NEXT: vpbroadcastw %edi, %zmm0 {%k1}
688 %val = load i16, ptr %ptr
689 %r1 = insertelement <32 x i16> %x, i16 %val, i32 1
690 %r2 = insertelement <32 x i16> %r1, i16 %y, i32 9
694 define <16 x i16> @insert_v16i16(<16 x i16> %x, i16 %y, ptr %ptr) nounwind {
695 ; KNL-LABEL: insert_v16i16:
697 ; KNL-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
698 ; KNL-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
699 ; KNL-NEXT: vmovd %edi, %xmm1
700 ; KNL-NEXT: vpbroadcastw %xmm1, %ymm1
701 ; KNL-NEXT: vpblendw {{.*#+}} ymm1 = ymm0[0],ymm1[1],ymm0[2,3,4,5,6,7,8],ymm1[9],ymm0[10,11,12,13,14,15]
702 ; KNL-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
705 ; SKX-LABEL: insert_v16i16:
707 ; SKX-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm1
708 ; SKX-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
709 ; SKX-NEXT: vpbroadcastw %edi, %ymm1
710 ; SKX-NEXT: vpblendw {{.*#+}} ymm1 = ymm0[0],ymm1[1],ymm0[2,3,4,5,6,7,8],ymm1[9],ymm0[10,11,12,13,14,15]
711 ; SKX-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
713 %val = load i16, ptr %ptr
714 %r1 = insertelement <16 x i16> %x, i16 %val, i32 1
715 %r2 = insertelement <16 x i16> %r1, i16 %y, i32 9
719 define <8 x i16> @insert_v8i16(<8 x i16> %x, i16 %y, ptr %ptr) nounwind {
720 ; CHECK-LABEL: insert_v8i16:
722 ; CHECK-NEXT: vpinsrw $1, (%rsi), %xmm0, %xmm0
723 ; CHECK-NEXT: vpinsrw $5, %edi, %xmm0, %xmm0
725 %val = load i16, ptr %ptr
726 %r1 = insertelement <8 x i16> %x, i16 %val, i32 1
727 %r2 = insertelement <8 x i16> %r1, i16 %y, i32 5
731 define <64 x i8> @insert_v64i8(<64 x i8> %x, i8 %y, ptr %ptr) nounwind {
732 ; CHECK-LABEL: insert_v64i8:
734 ; CHECK-NEXT: vpinsrb $1, (%rsi), %xmm0, %xmm1
735 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm1
736 ; CHECK-NEXT: vextracti32x4 $3, %zmm0, %xmm0
737 ; CHECK-NEXT: vpinsrb $2, %edi, %xmm0, %xmm0
738 ; CHECK-NEXT: vinserti32x4 $3, %xmm0, %zmm1, %zmm0
740 %val = load i8, ptr %ptr
741 %r1 = insertelement <64 x i8> %x, i8 %val, i32 1
742 %r2 = insertelement <64 x i8> %r1, i8 %y, i32 50
746 define <32 x i8> @insert_v32i8(<32 x i8> %x, i8 %y, ptr %ptr) nounwind {
747 ; CHECK-LABEL: insert_v32i8:
749 ; CHECK-NEXT: vpinsrb $1, (%rsi), %xmm0, %xmm1
750 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm0
751 ; CHECK-NEXT: vpinsrb $1, %edi, %xmm0, %xmm0
752 ; CHECK-NEXT: vinserti128 $1, %xmm0, %ymm1, %ymm0
754 %val = load i8, ptr %ptr
755 %r1 = insertelement <32 x i8> %x, i8 %val, i32 1
756 %r2 = insertelement <32 x i8> %r1, i8 %y, i32 17
760 define <16 x i8> @insert_v16i8(<16 x i8> %x, i8 %y, ptr %ptr) nounwind {
761 ; CHECK-LABEL: insert_v16i8:
763 ; CHECK-NEXT: vpinsrb $3, (%rsi), %xmm0, %xmm0
764 ; CHECK-NEXT: vpinsrb $10, %edi, %xmm0, %xmm0
766 %val = load i8, ptr %ptr
767 %r1 = insertelement <16 x i8> %x, i8 %val, i32 3
768 %r2 = insertelement <16 x i8> %r1, i8 %y, i32 10
772 define <8 x i64> @test_insert_128_v8i64(<8 x i64> %x, i64 %y) nounwind {
773 ; CHECK-LABEL: test_insert_128_v8i64:
775 ; CHECK-NEXT: vpinsrq $1, %rdi, %xmm0, %xmm1
776 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
778 %r = insertelement <8 x i64> %x, i64 %y, i32 1
782 define <16 x i32> @test_insert_128_v16i32(<16 x i32> %x, i32 %y) nounwind {
783 ; CHECK-LABEL: test_insert_128_v16i32:
785 ; CHECK-NEXT: vpinsrd $1, %edi, %xmm0, %xmm1
786 ; CHECK-NEXT: vinserti32x4 $0, %xmm1, %zmm0, %zmm0
788 %r = insertelement <16 x i32> %x, i32 %y, i32 1
792 define <8 x double> @test_insert_128_v8f64(<8 x double> %x, double %y) nounwind {
793 ; CHECK-LABEL: test_insert_128_v8f64:
795 ; CHECK-NEXT: vmovlhps {{.*#+}} xmm1 = xmm0[0],xmm1[0]
796 ; CHECK-NEXT: vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
798 %r = insertelement <8 x double> %x, double %y, i32 1
802 define <16 x float> @test_insert_128_v16f32(<16 x float> %x, float %y) nounwind {
803 ; CHECK-LABEL: test_insert_128_v16f32:
805 ; CHECK-NEXT: vinsertps {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[2,3]
806 ; CHECK-NEXT: vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
808 %r = insertelement <16 x float> %x, float %y, i32 1
812 define <16 x i16> @test_insert_128_v16i16(<16 x i16> %x, i16 %y) nounwind {
813 ; KNL-LABEL: test_insert_128_v16i16:
815 ; KNL-NEXT: vmovd %edi, %xmm1
816 ; KNL-NEXT: vpbroadcastw %xmm1, %ymm1
817 ; KNL-NEXT: vpblendw {{.*#+}} ymm1 = ymm0[0,1],ymm1[2],ymm0[3,4,5,6,7,8,9],ymm1[10],ymm0[11,12,13,14,15]
818 ; KNL-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
821 ; SKX-LABEL: test_insert_128_v16i16:
823 ; SKX-NEXT: vpbroadcastw %edi, %ymm1
824 ; SKX-NEXT: vpblendw {{.*#+}} ymm1 = ymm0[0,1],ymm1[2],ymm0[3,4,5,6,7,8,9],ymm1[10],ymm0[11,12,13,14,15]
825 ; SKX-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
827 %r = insertelement <16 x i16> %x, i16 %y, i32 10
831 define <32 x i8> @test_insert_128_v32i8(<32 x i8> %x, i8 %y) nounwind {
832 ; CHECK-LABEL: test_insert_128_v32i8:
834 ; CHECK-NEXT: vextracti128 $1, %ymm0, %xmm1
835 ; CHECK-NEXT: vpinsrb $4, %edi, %xmm1, %xmm1
836 ; CHECK-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
838 %r = insertelement <32 x i8> %x, i8 %y, i32 20
842 define i32 @test_insertelement_v32i1(i32 %a, i32 %b, <32 x i32> %x , <32 x i32> %y) nounwind {
843 ; KNL-LABEL: test_insertelement_v32i1:
845 ; KNL-NEXT: cmpl %esi, %edi
847 ; KNL-NEXT: vpcmpltud %zmm3, %zmm1, %k0
848 ; KNL-NEXT: kmovw %k0, %ecx
849 ; KNL-NEXT: shll $16, %ecx
850 ; KNL-NEXT: movw $-17, %dx
851 ; KNL-NEXT: kmovw %edx, %k1
852 ; KNL-NEXT: vpcmpltud %zmm2, %zmm0, %k0 {%k1}
853 ; KNL-NEXT: kmovw %eax, %k1
854 ; KNL-NEXT: kshiftlw $15, %k1, %k1
855 ; KNL-NEXT: kshiftrw $11, %k1, %k1
856 ; KNL-NEXT: korw %k1, %k0, %k0
857 ; KNL-NEXT: kmovw %k0, %eax
858 ; KNL-NEXT: orl %ecx, %eax
859 ; KNL-NEXT: vzeroupper
862 ; SKX-LABEL: test_insertelement_v32i1:
864 ; SKX-NEXT: cmpl %esi, %edi
866 ; SKX-NEXT: vpcmpltud %zmm2, %zmm0, %k0
867 ; SKX-NEXT: vpcmpltud %zmm3, %zmm1, %k1
868 ; SKX-NEXT: kunpckwd %k0, %k1, %k0
869 ; SKX-NEXT: movl $-17, %ecx
870 ; SKX-NEXT: kmovd %ecx, %k1
871 ; SKX-NEXT: kandd %k1, %k0, %k0
872 ; SKX-NEXT: kmovd %eax, %k1
873 ; SKX-NEXT: kshiftld $31, %k1, %k1
874 ; SKX-NEXT: kshiftrd $27, %k1, %k1
875 ; SKX-NEXT: kord %k1, %k0, %k0
876 ; SKX-NEXT: kmovd %k0, %eax
877 ; SKX-NEXT: vzeroupper
879 %cmp_res_i1 = icmp ult i32 %a, %b
880 %cmp_cmp_vec = icmp ult <32 x i32> %x, %y
881 %maskv = insertelement <32 x i1> %cmp_cmp_vec, i1 %cmp_res_i1, i32 4
882 %res = bitcast <32 x i1> %maskv to i32
886 define i8 @test_iinsertelement_v4i1(i32 %a, i32 %b, <4 x i32> %x , <4 x i32> %y) nounwind {
887 ; KNL-LABEL: test_iinsertelement_v4i1:
889 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
890 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
891 ; KNL-NEXT: cmpl %esi, %edi
893 ; KNL-NEXT: movw $-5, %cx
894 ; KNL-NEXT: kmovw %ecx, %k1
895 ; KNL-NEXT: vpcmpltud %zmm1, %zmm0, %k0 {%k1}
896 ; KNL-NEXT: kmovw %eax, %k1
897 ; KNL-NEXT: kshiftlw $15, %k1, %k1
898 ; KNL-NEXT: kshiftrw $13, %k1, %k1
899 ; KNL-NEXT: korw %k1, %k0, %k0
900 ; KNL-NEXT: kmovw %k0, %eax
901 ; KNL-NEXT: ## kill: def $al killed $al killed $eax
902 ; KNL-NEXT: vzeroupper
905 ; SKX-LABEL: test_iinsertelement_v4i1:
907 ; SKX-NEXT: cmpl %esi, %edi
909 ; SKX-NEXT: movb $-5, %cl
910 ; SKX-NEXT: kmovd %ecx, %k1
911 ; SKX-NEXT: vpcmpltud %xmm1, %xmm0, %k0 {%k1}
912 ; SKX-NEXT: kmovd %eax, %k1
913 ; SKX-NEXT: kshiftlb $7, %k1, %k1
914 ; SKX-NEXT: kshiftrb $5, %k1, %k1
915 ; SKX-NEXT: korw %k1, %k0, %k0
916 ; SKX-NEXT: kmovd %k0, %eax
917 ; SKX-NEXT: ## kill: def $al killed $al killed $eax
919 %cmp_res_i1 = icmp ult i32 %a, %b
920 %cmp_cmp_vec = icmp ult <4 x i32> %x, %y
921 %maskv = insertelement <4 x i1> %cmp_cmp_vec, i1 %cmp_res_i1, i32 2
922 %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>
923 %res = bitcast <8 x i1> %res0 to i8
927 define i8 @test_iinsertelement_v2i1(i32 %a, i32 %b, <2 x i64> %x , <2 x i64> %y) nounwind {
928 ; KNL-LABEL: test_iinsertelement_v2i1:
930 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
931 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
932 ; KNL-NEXT: cmpl %esi, %edi
934 ; KNL-NEXT: vpcmpltuq %zmm1, %zmm0, %k0
935 ; KNL-NEXT: kshiftlw $15, %k0, %k0
936 ; KNL-NEXT: kshiftrw $15, %k0, %k0
937 ; KNL-NEXT: kmovw %eax, %k1
938 ; KNL-NEXT: kshiftlw $1, %k1, %k1
939 ; KNL-NEXT: korw %k1, %k0, %k0
940 ; KNL-NEXT: kmovw %k0, %eax
941 ; KNL-NEXT: ## kill: def $al killed $al killed $eax
942 ; KNL-NEXT: vzeroupper
945 ; SKX-LABEL: test_iinsertelement_v2i1:
947 ; SKX-NEXT: cmpl %esi, %edi
949 ; SKX-NEXT: vpcmpltuq %xmm1, %xmm0, %k0
950 ; SKX-NEXT: kshiftlb $7, %k0, %k0
951 ; SKX-NEXT: kshiftrb $7, %k0, %k0
952 ; SKX-NEXT: kmovd %eax, %k1
953 ; SKX-NEXT: kshiftlb $1, %k1, %k1
954 ; SKX-NEXT: korw %k1, %k0, %k0
955 ; SKX-NEXT: kmovd %k0, %eax
956 ; SKX-NEXT: ## kill: def $al killed $al killed $eax
958 %cmp_res_i1 = icmp ult i32 %a, %b
959 %cmp_cmp_vec = icmp ult <2 x i64> %x, %y
960 %maskv = insertelement <2 x i1> %cmp_cmp_vec, i1 %cmp_res_i1, i32 1
961 %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>
962 %res = bitcast <8 x i1> %res0 to i8
966 define zeroext i8 @test_extractelement_v2i1(<2 x i64> %a, <2 x i64> %b) nounwind {
967 ; KNL-LABEL: test_extractelement_v2i1:
969 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
970 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
971 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k0
972 ; KNL-NEXT: kmovw %k0, %ecx
973 ; KNL-NEXT: andl $1, %ecx
974 ; KNL-NEXT: movl $4, %eax
975 ; KNL-NEXT: subl %ecx, %eax
976 ; KNL-NEXT: vzeroupper
979 ; SKX-LABEL: test_extractelement_v2i1:
981 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
982 ; SKX-NEXT: kmovd %k0, %ecx
983 ; SKX-NEXT: andl $1, %ecx
984 ; SKX-NEXT: movl $4, %eax
985 ; SKX-NEXT: subl %ecx, %eax
987 %t1 = icmp ugt <2 x i64> %a, %b
988 %t2 = extractelement <2 x i1> %t1, i32 0
989 %res = select i1 %t2, i8 3, i8 4
993 define zeroext i8 @extractelement_v2i1_alt(<2 x i64> %a, <2 x i64> %b) nounwind {
994 ; KNL-LABEL: extractelement_v2i1_alt:
996 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
997 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
998 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k0
999 ; KNL-NEXT: kmovw %k0, %eax
1000 ; KNL-NEXT: andb $1, %al
1001 ; KNL-NEXT: movb $4, %cl
1002 ; KNL-NEXT: subb %al, %cl
1003 ; KNL-NEXT: movzbl %cl, %eax
1004 ; KNL-NEXT: vzeroupper
1007 ; SKX-LABEL: extractelement_v2i1_alt:
1009 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
1010 ; SKX-NEXT: kmovd %k0, %eax
1011 ; SKX-NEXT: andb $1, %al
1012 ; SKX-NEXT: movb $4, %cl
1013 ; SKX-NEXT: subb %al, %cl
1014 ; SKX-NEXT: movzbl %cl, %eax
1016 %t1 = icmp ugt <2 x i64> %a, %b
1017 %t2 = extractelement <2 x i1> %t1, i32 0
1018 %sext = sext i1 %t2 to i8
1019 %res = add i8 %sext, 4
1023 define zeroext i8 @test_extractelement_v4i1(<4 x i32> %a, <4 x i32> %b) nounwind {
1024 ; KNL-LABEL: test_extractelement_v4i1:
1026 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1027 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
1028 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k0
1029 ; KNL-NEXT: kshiftrw $3, %k0, %k0
1030 ; KNL-NEXT: kmovw %k0, %eax
1031 ; KNL-NEXT: andl $1, %eax
1032 ; KNL-NEXT: vzeroupper
1035 ; SKX-LABEL: test_extractelement_v4i1:
1037 ; SKX-NEXT: vpcmpnleud %xmm1, %xmm0, %k0
1038 ; SKX-NEXT: kshiftrb $3, %k0, %k0
1039 ; SKX-NEXT: kmovd %k0, %eax
1040 ; SKX-NEXT: andl $1, %eax
1042 %t1 = icmp ugt <4 x i32> %a, %b
1043 %t2 = extractelement <4 x i1> %t1, i32 3
1044 %res = zext i1 %t2 to i8
1048 define zeroext i8 @test_extractelement_v32i1(<32 x i8> %a, <32 x i8> %b) nounwind {
1049 ; KNL-LABEL: test_extractelement_v32i1:
1051 ; KNL-NEXT: vpminub %xmm1, %xmm0, %xmm1
1052 ; KNL-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1053 ; KNL-NEXT: vpextrb $2, %xmm0, %eax
1054 ; KNL-NEXT: notb %al
1055 ; KNL-NEXT: movzbl %al, %eax
1056 ; KNL-NEXT: andl $1, %eax
1057 ; KNL-NEXT: vzeroupper
1060 ; SKX-LABEL: test_extractelement_v32i1:
1062 ; SKX-NEXT: vpcmpnleub %ymm1, %ymm0, %k0
1063 ; SKX-NEXT: kshiftrd $2, %k0, %k0
1064 ; SKX-NEXT: kmovd %k0, %eax
1065 ; SKX-NEXT: andl $1, %eax
1066 ; SKX-NEXT: vzeroupper
1068 %t1 = icmp ugt <32 x i8> %a, %b
1069 %t2 = extractelement <32 x i1> %t1, i32 2
1070 %res = zext i1 %t2 to i8
1074 define zeroext i8 @test_extractelement_v64i1(<64 x i8> %a, <64 x i8> %b) nounwind {
1075 ; KNL-LABEL: test_extractelement_v64i1:
1077 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm1
1078 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm0
1079 ; KNL-NEXT: vpminub %ymm1, %ymm0, %ymm1
1080 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1081 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm0
1082 ; KNL-NEXT: vpextrb $15, %xmm0, %eax
1083 ; KNL-NEXT: notb %al
1084 ; KNL-NEXT: movzbl %al, %ecx
1085 ; KNL-NEXT: andl $1, %ecx
1086 ; KNL-NEXT: movl $4, %eax
1087 ; KNL-NEXT: subl %ecx, %eax
1088 ; KNL-NEXT: vzeroupper
1091 ; SKX-LABEL: test_extractelement_v64i1:
1093 ; SKX-NEXT: vpcmpnleub %zmm1, %zmm0, %k0
1094 ; SKX-NEXT: kshiftrq $63, %k0, %k0
1095 ; SKX-NEXT: kmovd %k0, %ecx
1096 ; SKX-NEXT: andl $1, %ecx
1097 ; SKX-NEXT: movl $4, %eax
1098 ; SKX-NEXT: subl %ecx, %eax
1099 ; SKX-NEXT: vzeroupper
1101 %t1 = icmp ugt <64 x i8> %a, %b
1102 %t2 = extractelement <64 x i1> %t1, i32 63
1103 %res = select i1 %t2, i8 3, i8 4
1107 define zeroext i8 @extractelement_v64i1_alt(<64 x i8> %a, <64 x i8> %b) nounwind {
1108 ; KNL-LABEL: extractelement_v64i1_alt:
1110 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm1
1111 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm0
1112 ; KNL-NEXT: vpminub %ymm1, %ymm0, %ymm1
1113 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1114 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm0
1115 ; KNL-NEXT: vpextrb $15, %xmm0, %eax
1116 ; KNL-NEXT: notb %al
1117 ; KNL-NEXT: addb $4, %al
1118 ; KNL-NEXT: movzbl %al, %eax
1119 ; KNL-NEXT: vzeroupper
1122 ; SKX-LABEL: extractelement_v64i1_alt:
1124 ; SKX-NEXT: vpcmpnleub %zmm1, %zmm0, %k0
1125 ; SKX-NEXT: kshiftrq $63, %k0, %k0
1126 ; SKX-NEXT: kmovd %k0, %eax
1127 ; SKX-NEXT: andb $1, %al
1128 ; SKX-NEXT: movb $4, %cl
1129 ; SKX-NEXT: subb %al, %cl
1130 ; SKX-NEXT: movzbl %cl, %eax
1131 ; SKX-NEXT: vzeroupper
1133 %t1 = icmp ugt <64 x i8> %a, %b
1134 %t2 = extractelement <64 x i1> %t1, i32 63
1135 %sext = sext i1 %t2 to i8
1136 %res = add i8 %sext, 4
1140 define i64 @test_extractelement_variable_v2i64(<2 x i64> %t1, i32 %index) nounwind {
1141 ; CHECK-LABEL: test_extractelement_variable_v2i64:
1143 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1144 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1145 ; CHECK-NEXT: andl $1, %edi
1146 ; CHECK-NEXT: movq -24(%rsp,%rdi,8), %rax
1148 %t2 = extractelement <2 x i64> %t1, i32 %index
1152 define i64 @test_extractelement_variable_v4i64(<4 x i64> %t1, i32 %index) nounwind {
1153 ; CHECK-LABEL: test_extractelement_variable_v4i64:
1155 ; CHECK-NEXT: pushq %rbp
1156 ; CHECK-NEXT: movq %rsp, %rbp
1157 ; CHECK-NEXT: andq $-32, %rsp
1158 ; CHECK-NEXT: subq $64, %rsp
1159 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1160 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1161 ; CHECK-NEXT: andl $3, %edi
1162 ; CHECK-NEXT: movq (%rsp,%rdi,8), %rax
1163 ; CHECK-NEXT: movq %rbp, %rsp
1164 ; CHECK-NEXT: popq %rbp
1165 ; CHECK-NEXT: vzeroupper
1167 %t2 = extractelement <4 x i64> %t1, i32 %index
1171 define i64 @test_extractelement_variable_v8i64(<8 x i64> %t1, i32 %index) nounwind {
1172 ; CHECK-LABEL: test_extractelement_variable_v8i64:
1174 ; CHECK-NEXT: pushq %rbp
1175 ; CHECK-NEXT: movq %rsp, %rbp
1176 ; CHECK-NEXT: andq $-64, %rsp
1177 ; CHECK-NEXT: subq $128, %rsp
1178 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1179 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1180 ; CHECK-NEXT: andl $7, %edi
1181 ; CHECK-NEXT: movq (%rsp,%rdi,8), %rax
1182 ; CHECK-NEXT: movq %rbp, %rsp
1183 ; CHECK-NEXT: popq %rbp
1184 ; CHECK-NEXT: vzeroupper
1186 %t2 = extractelement <8 x i64> %t1, i32 %index
1190 define double @test_extractelement_variable_v2f64(<2 x double> %t1, i32 %index) nounwind {
1191 ; CHECK-LABEL: test_extractelement_variable_v2f64:
1193 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1194 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1195 ; CHECK-NEXT: andl $1, %edi
1196 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1198 %t2 = extractelement <2 x double> %t1, i32 %index
1202 define double @test_extractelement_variable_v4f64(<4 x double> %t1, i32 %index) nounwind {
1203 ; CHECK-LABEL: test_extractelement_variable_v4f64:
1205 ; CHECK-NEXT: pushq %rbp
1206 ; CHECK-NEXT: movq %rsp, %rbp
1207 ; CHECK-NEXT: andq $-32, %rsp
1208 ; CHECK-NEXT: subq $64, %rsp
1209 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1210 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1211 ; CHECK-NEXT: andl $3, %edi
1212 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1213 ; CHECK-NEXT: movq %rbp, %rsp
1214 ; CHECK-NEXT: popq %rbp
1215 ; CHECK-NEXT: vzeroupper
1217 %t2 = extractelement <4 x double> %t1, i32 %index
1221 define double @test_extractelement_variable_v8f64(<8 x double> %t1, i32 %index) nounwind {
1222 ; CHECK-LABEL: test_extractelement_variable_v8f64:
1224 ; CHECK-NEXT: pushq %rbp
1225 ; CHECK-NEXT: movq %rsp, %rbp
1226 ; CHECK-NEXT: andq $-64, %rsp
1227 ; CHECK-NEXT: subq $128, %rsp
1228 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1229 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1230 ; CHECK-NEXT: andl $7, %edi
1231 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1232 ; CHECK-NEXT: movq %rbp, %rsp
1233 ; CHECK-NEXT: popq %rbp
1234 ; CHECK-NEXT: vzeroupper
1236 %t2 = extractelement <8 x double> %t1, i32 %index
1240 define i32 @test_extractelement_variable_v4i32(<4 x i32> %t1, i32 %index) nounwind {
1241 ; CHECK-LABEL: test_extractelement_variable_v4i32:
1243 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1244 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1245 ; CHECK-NEXT: andl $3, %edi
1246 ; CHECK-NEXT: movl -24(%rsp,%rdi,4), %eax
1248 %t2 = extractelement <4 x i32> %t1, i32 %index
1252 define i32 @test_extractelement_variable_v8i32(<8 x i32> %t1, i32 %index) nounwind {
1253 ; CHECK-LABEL: test_extractelement_variable_v8i32:
1255 ; CHECK-NEXT: pushq %rbp
1256 ; CHECK-NEXT: movq %rsp, %rbp
1257 ; CHECK-NEXT: andq $-32, %rsp
1258 ; CHECK-NEXT: subq $64, %rsp
1259 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1260 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1261 ; CHECK-NEXT: andl $7, %edi
1262 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
1263 ; CHECK-NEXT: movq %rbp, %rsp
1264 ; CHECK-NEXT: popq %rbp
1265 ; CHECK-NEXT: vzeroupper
1267 %t2 = extractelement <8 x i32> %t1, i32 %index
1271 define i32 @test_extractelement_variable_v16i32(<16 x i32> %t1, i32 %index) nounwind {
1272 ; CHECK-LABEL: test_extractelement_variable_v16i32:
1274 ; CHECK-NEXT: pushq %rbp
1275 ; CHECK-NEXT: movq %rsp, %rbp
1276 ; CHECK-NEXT: andq $-64, %rsp
1277 ; CHECK-NEXT: subq $128, %rsp
1278 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1279 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1280 ; CHECK-NEXT: andl $15, %edi
1281 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
1282 ; CHECK-NEXT: movq %rbp, %rsp
1283 ; CHECK-NEXT: popq %rbp
1284 ; CHECK-NEXT: vzeroupper
1286 %t2 = extractelement <16 x i32> %t1, i32 %index
1290 define float @test_extractelement_variable_v4f32(<4 x float> %t1, i32 %index) nounwind {
1291 ; CHECK-LABEL: test_extractelement_variable_v4f32:
1293 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1294 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1295 ; CHECK-NEXT: andl $3, %edi
1296 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1298 %t2 = extractelement <4 x float> %t1, i32 %index
1302 define float @test_extractelement_variable_v8f32(<8 x float> %t1, i32 %index) nounwind {
1303 ; CHECK-LABEL: test_extractelement_variable_v8f32:
1305 ; CHECK-NEXT: pushq %rbp
1306 ; CHECK-NEXT: movq %rsp, %rbp
1307 ; CHECK-NEXT: andq $-32, %rsp
1308 ; CHECK-NEXT: subq $64, %rsp
1309 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1310 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1311 ; CHECK-NEXT: andl $7, %edi
1312 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1313 ; CHECK-NEXT: movq %rbp, %rsp
1314 ; CHECK-NEXT: popq %rbp
1315 ; CHECK-NEXT: vzeroupper
1317 %t2 = extractelement <8 x float> %t1, i32 %index
1321 define float @test_extractelement_variable_v16f32(<16 x float> %t1, i32 %index) nounwind {
1322 ; CHECK-LABEL: test_extractelement_variable_v16f32:
1324 ; CHECK-NEXT: pushq %rbp
1325 ; CHECK-NEXT: movq %rsp, %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) nounwind {
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) nounwind {
1353 ; CHECK-LABEL: test_extractelement_variable_v16i16:
1355 ; CHECK-NEXT: pushq %rbp
1356 ; CHECK-NEXT: movq %rsp, %rbp
1357 ; CHECK-NEXT: andq $-32, %rsp
1358 ; CHECK-NEXT: subq $64, %rsp
1359 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1360 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1361 ; CHECK-NEXT: andl $15, %edi
1362 ; CHECK-NEXT: movzwl (%rsp,%rdi,2), %eax
1363 ; CHECK-NEXT: movq %rbp, %rsp
1364 ; CHECK-NEXT: popq %rbp
1365 ; CHECK-NEXT: vzeroupper
1367 %t2 = extractelement <16 x i16> %t1, i32 %index
1371 define i16 @test_extractelement_variable_v32i16(<32 x i16> %t1, i32 %index) nounwind {
1372 ; CHECK-LABEL: test_extractelement_variable_v32i16:
1374 ; CHECK-NEXT: pushq %rbp
1375 ; CHECK-NEXT: movq %rsp, %rbp
1376 ; CHECK-NEXT: andq $-64, %rsp
1377 ; CHECK-NEXT: subq $128, %rsp
1378 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1379 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1380 ; CHECK-NEXT: andl $31, %edi
1381 ; CHECK-NEXT: movzwl (%rsp,%rdi,2), %eax
1382 ; CHECK-NEXT: movq %rbp, %rsp
1383 ; CHECK-NEXT: popq %rbp
1384 ; CHECK-NEXT: vzeroupper
1386 %t2 = extractelement <32 x i16> %t1, i32 %index
1390 define i8 @test_extractelement_variable_v16i8(<16 x i8> %t1, i32 %index) nounwind {
1391 ; CHECK-LABEL: test_extractelement_variable_v16i8:
1393 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1394 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1395 ; CHECK-NEXT: andl $15, %edi
1396 ; CHECK-NEXT: movzbl -24(%rsp,%rdi), %eax
1398 %t2 = extractelement <16 x i8> %t1, i32 %index
1402 define i8 @test_extractelement_variable_v32i8(<32 x i8> %t1, i32 %index) nounwind {
1403 ; CHECK-LABEL: test_extractelement_variable_v32i8:
1405 ; CHECK-NEXT: pushq %rbp
1406 ; CHECK-NEXT: movq %rsp, %rbp
1407 ; CHECK-NEXT: andq $-32, %rsp
1408 ; CHECK-NEXT: subq $64, %rsp
1409 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1410 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1411 ; CHECK-NEXT: andl $31, %edi
1412 ; CHECK-NEXT: movzbl (%rsp,%rdi), %eax
1413 ; CHECK-NEXT: movq %rbp, %rsp
1414 ; CHECK-NEXT: popq %rbp
1415 ; CHECK-NEXT: vzeroupper
1418 %t2 = extractelement <32 x i8> %t1, i32 %index
1422 define i8 @test_extractelement_variable_v64i8(<64 x i8> %t1, i32 %index) nounwind {
1423 ; CHECK-LABEL: test_extractelement_variable_v64i8:
1425 ; CHECK-NEXT: pushq %rbp
1426 ; CHECK-NEXT: movq %rsp, %rbp
1427 ; CHECK-NEXT: andq $-64, %rsp
1428 ; CHECK-NEXT: subq $128, %rsp
1429 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1430 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1431 ; CHECK-NEXT: andl $63, %edi
1432 ; CHECK-NEXT: movzbl (%rsp,%rdi), %eax
1433 ; CHECK-NEXT: movq %rbp, %rsp
1434 ; CHECK-NEXT: popq %rbp
1435 ; CHECK-NEXT: vzeroupper
1438 %t2 = extractelement <64 x i8> %t1, i32 %index
1442 define i8 @test_extractelement_variable_v64i8_indexi8(<64 x i8> %t1, i8 %index) nounwind {
1443 ; CHECK-LABEL: test_extractelement_variable_v64i8_indexi8:
1445 ; CHECK-NEXT: pushq %rbp
1446 ; CHECK-NEXT: movq %rsp, %rbp
1447 ; CHECK-NEXT: andq $-64, %rsp
1448 ; CHECK-NEXT: subq $128, %rsp
1449 ; CHECK-NEXT: addb %dil, %dil
1450 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1451 ; CHECK-NEXT: movzbl %dil, %eax
1452 ; CHECK-NEXT: andl $63, %eax
1453 ; CHECK-NEXT: movzbl (%rsp,%rax), %eax
1454 ; CHECK-NEXT: movq %rbp, %rsp
1455 ; CHECK-NEXT: popq %rbp
1456 ; CHECK-NEXT: vzeroupper
1459 %i = add i8 %index, %index
1460 %t2 = extractelement <64 x i8> %t1, i8 %i
1464 define zeroext i8 @test_extractelement_varible_v2i1(<2 x i64> %a, <2 x i64> %b, i32 %index) nounwind {
1465 ; KNL-LABEL: test_extractelement_varible_v2i1:
1467 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1468 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1469 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
1470 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k1
1471 ; KNL-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1472 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1473 ; KNL-NEXT: andl $1, %edi
1474 ; KNL-NEXT: movzbl -24(%rsp,%rdi,8), %eax
1475 ; KNL-NEXT: andl $1, %eax
1476 ; KNL-NEXT: vzeroupper
1479 ; SKX-LABEL: test_extractelement_varible_v2i1:
1481 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1482 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
1483 ; SKX-NEXT: vpmovm2q %k0, %xmm0
1484 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1485 ; SKX-NEXT: andl $1, %edi
1486 ; SKX-NEXT: movzbl -24(%rsp,%rdi,8), %eax
1487 ; SKX-NEXT: andl $1, %eax
1489 %t1 = icmp ugt <2 x i64> %a, %b
1490 %t2 = extractelement <2 x i1> %t1, i32 %index
1491 %res = zext i1 %t2 to i8
1495 define zeroext i8 @test_extractelement_varible_v4i1(<4 x i32> %a, <4 x i32> %b, i32 %index) nounwind {
1496 ; KNL-LABEL: test_extractelement_varible_v4i1:
1498 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1499 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1500 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
1501 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1502 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1503 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1504 ; KNL-NEXT: andl $3, %edi
1505 ; KNL-NEXT: movzbl -24(%rsp,%rdi,4), %eax
1506 ; KNL-NEXT: andl $1, %eax
1507 ; KNL-NEXT: vzeroupper
1510 ; SKX-LABEL: test_extractelement_varible_v4i1:
1512 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1513 ; SKX-NEXT: vpcmpnleud %xmm1, %xmm0, %k0
1514 ; SKX-NEXT: vpmovm2d %k0, %xmm0
1515 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1516 ; SKX-NEXT: andl $3, %edi
1517 ; SKX-NEXT: movzbl -24(%rsp,%rdi,4), %eax
1518 ; SKX-NEXT: andl $1, %eax
1520 %t1 = icmp ugt <4 x i32> %a, %b
1521 %t2 = extractelement <4 x i1> %t1, i32 %index
1522 %res = zext i1 %t2 to i8
1526 define zeroext i8 @test_extractelement_varible_v8i1(<8 x i32> %a, <8 x i32> %b, i32 %index) nounwind {
1527 ; KNL-LABEL: test_extractelement_varible_v8i1:
1529 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1530 ; KNL-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
1531 ; KNL-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
1532 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1533 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1534 ; KNL-NEXT: vpmovdw %zmm0, %ymm0
1535 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1536 ; KNL-NEXT: andl $7, %edi
1537 ; KNL-NEXT: movzbl -24(%rsp,%rdi,2), %eax
1538 ; KNL-NEXT: andl $1, %eax
1539 ; KNL-NEXT: vzeroupper
1542 ; SKX-LABEL: test_extractelement_varible_v8i1:
1544 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1545 ; SKX-NEXT: vpcmpnleud %ymm1, %ymm0, %k0
1546 ; SKX-NEXT: vpmovm2w %k0, %xmm0
1547 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1548 ; SKX-NEXT: andl $7, %edi
1549 ; SKX-NEXT: movzbl -24(%rsp,%rdi,2), %eax
1550 ; SKX-NEXT: andl $1, %eax
1551 ; SKX-NEXT: vzeroupper
1553 %t1 = icmp ugt <8 x i32> %a, %b
1554 %t2 = extractelement <8 x i1> %t1, i32 %index
1555 %res = zext i1 %t2 to i8
1559 define zeroext i8 @test_extractelement_varible_v16i1(<16 x i32> %a, <16 x i32> %b, i32 %index) nounwind {
1560 ; KNL-LABEL: test_extractelement_varible_v16i1:
1562 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1563 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1564 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1565 ; KNL-NEXT: vpmovdb %zmm0, -{{[0-9]+}}(%rsp)
1566 ; KNL-NEXT: andl $15, %edi
1567 ; KNL-NEXT: movzbl -24(%rsp,%rdi), %eax
1568 ; KNL-NEXT: andl $1, %eax
1569 ; KNL-NEXT: vzeroupper
1572 ; SKX-LABEL: test_extractelement_varible_v16i1:
1574 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1575 ; SKX-NEXT: vpcmpnleud %zmm1, %zmm0, %k0
1576 ; SKX-NEXT: vpmovm2b %k0, %xmm0
1577 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1578 ; SKX-NEXT: andl $15, %edi
1579 ; SKX-NEXT: movzbl -24(%rsp,%rdi), %eax
1580 ; SKX-NEXT: andl $1, %eax
1581 ; SKX-NEXT: vzeroupper
1583 %t1 = icmp ugt <16 x i32> %a, %b
1584 %t2 = extractelement <16 x i1> %t1, i32 %index
1585 %res = zext i1 %t2 to i8
1589 define zeroext i8 @test_extractelement_varible_v32i1(<32 x i8> %a, <32 x i8> %b, i32 %index) nounwind {
1590 ; KNL-LABEL: test_extractelement_varible_v32i1:
1592 ; KNL-NEXT: vpminub %ymm1, %ymm0, %ymm1
1593 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1594 ; KNL-NEXT: vpmovmskb %ymm0, %ecx
1595 ; KNL-NEXT: xorl %eax, %eax
1596 ; KNL-NEXT: btl %edi, %ecx
1597 ; KNL-NEXT: setae %al
1598 ; KNL-NEXT: vzeroupper
1601 ; SKX-LABEL: test_extractelement_varible_v32i1:
1603 ; SKX-NEXT: pushq %rbp
1604 ; SKX-NEXT: movq %rsp, %rbp
1605 ; SKX-NEXT: andq $-32, %rsp
1606 ; SKX-NEXT: subq $64, %rsp
1607 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1608 ; SKX-NEXT: vpcmpnleub %ymm1, %ymm0, %k0
1609 ; SKX-NEXT: vpmovm2b %k0, %ymm0
1610 ; SKX-NEXT: vmovdqa %ymm0, (%rsp)
1611 ; SKX-NEXT: andl $31, %edi
1612 ; SKX-NEXT: movzbl (%rsp,%rdi), %eax
1613 ; SKX-NEXT: andl $1, %eax
1614 ; SKX-NEXT: movq %rbp, %rsp
1615 ; SKX-NEXT: popq %rbp
1616 ; SKX-NEXT: vzeroupper
1618 %t1 = icmp ugt <32 x i8> %a, %b
1619 %t2 = extractelement <32 x i1> %t1, i32 %index
1620 %res = zext i1 %t2 to i8
1624 define <8 x i64> @insert_double_zero(<2 x i64> %a) nounwind {
1625 ; CHECK-LABEL: insert_double_zero:
1627 ; CHECK-NEXT: vxorps %xmm1, %xmm1, %xmm1
1628 ; CHECK-NEXT: vinsertf32x4 $2, %xmm0, %zmm1, %zmm0
1630 %b = shufflevector <2 x i64> %a, <2 x i64> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1631 %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>
1632 %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>
1636 define i32 @test_insertelement_variable_v32i1(<32 x i8> %a, i8 %b, i32 %index) nounwind {
1637 ; KNL-LABEL: test_insertelement_variable_v32i1:
1639 ; KNL-NEXT: pushq %rbp
1640 ; KNL-NEXT: movq %rsp, %rbp
1641 ; KNL-NEXT: andq $-32, %rsp
1642 ; KNL-NEXT: subq $64, %rsp
1643 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
1644 ; KNL-NEXT: vpxor %xmm1, %xmm1, %xmm1
1645 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1646 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1647 ; KNL-NEXT: andl $31, %esi
1648 ; KNL-NEXT: testb %dil, %dil
1649 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
1650 ; KNL-NEXT: setne (%rsp,%rsi)
1651 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1652 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1653 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1654 ; KNL-NEXT: kmovw %k0, %ecx
1655 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1656 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1657 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1658 ; KNL-NEXT: kmovw %k0, %eax
1659 ; KNL-NEXT: shll $16, %eax
1660 ; KNL-NEXT: orl %ecx, %eax
1661 ; KNL-NEXT: movq %rbp, %rsp
1662 ; KNL-NEXT: popq %rbp
1663 ; KNL-NEXT: vzeroupper
1666 ; SKX-LABEL: test_insertelement_variable_v32i1:
1668 ; SKX-NEXT: vptestmb %ymm0, %ymm0, %k0
1669 ; SKX-NEXT: testb %dil, %dil
1670 ; SKX-NEXT: setne %al
1671 ; SKX-NEXT: vpbroadcastb %esi, %ymm0
1672 ; SKX-NEXT: vpcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %k1
1673 ; SKX-NEXT: vpmovm2b %k0, %ymm0
1674 ; SKX-NEXT: vpbroadcastb %eax, %ymm0 {%k1}
1675 ; SKX-NEXT: vpsllw $7, %ymm0, %ymm0
1676 ; SKX-NEXT: vpmovb2m %ymm0, %k0
1677 ; SKX-NEXT: kmovd %k0, %eax
1678 ; SKX-NEXT: vzeroupper
1680 %t1 = icmp ugt <32 x i8> %a, zeroinitializer
1681 %t2 = icmp ugt i8 %b, 0
1682 %t3 = insertelement <32 x i1> %t1, i1 %t2, i32 %index
1683 %t4 = bitcast <32 x i1> %t3 to i32
1687 define i64 @test_insertelement_variable_v64i1(<64 x i8> %a, i8 %b, i32 %index) nounwind {
1688 ; KNL-LABEL: test_insertelement_variable_v64i1:
1690 ; KNL-NEXT: pushq %rbp
1691 ; KNL-NEXT: movq %rsp, %rbp
1692 ; KNL-NEXT: andq $-64, %rsp
1693 ; KNL-NEXT: subq $128, %rsp
1694 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
1695 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm1
1696 ; KNL-NEXT: vpxor %xmm2, %xmm2, %xmm2
1697 ; KNL-NEXT: vpcmpeqb %ymm2, %ymm1, %ymm1
1698 ; KNL-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
1699 ; KNL-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
1700 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1701 ; KNL-NEXT: andl $63, %esi
1702 ; KNL-NEXT: testb %dil, %dil
1703 ; KNL-NEXT: vmovdqa64 %zmm0, (%rsp)
1704 ; KNL-NEXT: setne (%rsp,%rsi)
1705 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1706 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1707 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1708 ; KNL-NEXT: kmovw %k0, %eax
1709 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1710 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1711 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1712 ; KNL-NEXT: kmovw %k0, %ecx
1713 ; KNL-NEXT: shll $16, %ecx
1714 ; KNL-NEXT: orl %eax, %ecx
1715 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1716 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1717 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1718 ; KNL-NEXT: kmovw %k0, %edx
1719 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1720 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1721 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1722 ; KNL-NEXT: kmovw %k0, %eax
1723 ; KNL-NEXT: shll $16, %eax
1724 ; KNL-NEXT: orl %edx, %eax
1725 ; KNL-NEXT: shlq $32, %rax
1726 ; KNL-NEXT: orq %rcx, %rax
1727 ; KNL-NEXT: movq %rbp, %rsp
1728 ; KNL-NEXT: popq %rbp
1729 ; KNL-NEXT: vzeroupper
1732 ; SKX-LABEL: test_insertelement_variable_v64i1:
1734 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
1735 ; SKX-NEXT: testb %dil, %dil
1736 ; SKX-NEXT: setne %al
1737 ; SKX-NEXT: vpbroadcastb %esi, %zmm0
1738 ; SKX-NEXT: vpcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm0, %k1
1739 ; SKX-NEXT: vpmovm2b %k0, %zmm0
1740 ; SKX-NEXT: vpbroadcastb %eax, %zmm0 {%k1}
1741 ; SKX-NEXT: vpsllw $7, %zmm0, %zmm0
1742 ; SKX-NEXT: vpmovb2m %zmm0, %k0
1743 ; SKX-NEXT: kmovq %k0, %rax
1744 ; SKX-NEXT: vzeroupper
1746 %t1 = icmp ugt <64 x i8> %a, zeroinitializer
1747 %t2 = icmp ugt i8 %b, 0
1748 %t3 = insertelement <64 x i1> %t1, i1 %t2, i32 %index
1749 %t4 = bitcast <64 x i1> %t3 to i64
1753 define i96 @test_insertelement_variable_v96i1(<96 x i8> %a, i8 %b, i32 %index) nounwind {
1754 ; KNL-LABEL: test_insertelement_variable_v96i1:
1756 ; KNL-NEXT: pushq %rbp
1757 ; KNL-NEXT: movq %rsp, %rbp
1758 ; KNL-NEXT: andq $-64, %rsp
1759 ; KNL-NEXT: subq $192, %rsp
1760 ; KNL-NEXT: movl 744(%rbp), %eax
1761 ; KNL-NEXT: andl $127, %eax
1762 ; KNL-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
1763 ; KNL-NEXT: vpinsrb $1, 232(%rbp), %xmm0, %xmm0
1764 ; KNL-NEXT: vpinsrb $2, 240(%rbp), %xmm0, %xmm0
1765 ; KNL-NEXT: vpinsrb $3, 248(%rbp), %xmm0, %xmm0
1766 ; KNL-NEXT: vpinsrb $4, 256(%rbp), %xmm0, %xmm0
1767 ; KNL-NEXT: vpinsrb $5, 264(%rbp), %xmm0, %xmm0
1768 ; KNL-NEXT: vpinsrb $6, 272(%rbp), %xmm0, %xmm0
1769 ; KNL-NEXT: vpinsrb $7, 280(%rbp), %xmm0, %xmm0
1770 ; KNL-NEXT: vpinsrb $8, 288(%rbp), %xmm0, %xmm0
1771 ; KNL-NEXT: vpinsrb $9, 296(%rbp), %xmm0, %xmm0
1772 ; KNL-NEXT: vpinsrb $10, 304(%rbp), %xmm0, %xmm0
1773 ; KNL-NEXT: vpinsrb $11, 312(%rbp), %xmm0, %xmm0
1774 ; KNL-NEXT: vpinsrb $12, 320(%rbp), %xmm0, %xmm0
1775 ; KNL-NEXT: vpinsrb $13, 328(%rbp), %xmm0, %xmm0
1776 ; KNL-NEXT: vpinsrb $14, 336(%rbp), %xmm0, %xmm0
1777 ; KNL-NEXT: vpinsrb $15, 344(%rbp), %xmm0, %xmm0
1778 ; KNL-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1779 ; KNL-NEXT: vpinsrb $1, 360(%rbp), %xmm1, %xmm1
1780 ; KNL-NEXT: vpinsrb $2, 368(%rbp), %xmm1, %xmm1
1781 ; KNL-NEXT: vpinsrb $3, 376(%rbp), %xmm1, %xmm1
1782 ; KNL-NEXT: vpinsrb $4, 384(%rbp), %xmm1, %xmm1
1783 ; KNL-NEXT: vpinsrb $5, 392(%rbp), %xmm1, %xmm1
1784 ; KNL-NEXT: vpinsrb $6, 400(%rbp), %xmm1, %xmm1
1785 ; KNL-NEXT: vpinsrb $7, 408(%rbp), %xmm1, %xmm1
1786 ; KNL-NEXT: vpinsrb $8, 416(%rbp), %xmm1, %xmm1
1787 ; KNL-NEXT: vpinsrb $9, 424(%rbp), %xmm1, %xmm1
1788 ; KNL-NEXT: vpinsrb $10, 432(%rbp), %xmm1, %xmm1
1789 ; KNL-NEXT: vpinsrb $11, 440(%rbp), %xmm1, %xmm1
1790 ; KNL-NEXT: vpinsrb $12, 448(%rbp), %xmm1, %xmm1
1791 ; KNL-NEXT: vpinsrb $13, 456(%rbp), %xmm1, %xmm1
1792 ; KNL-NEXT: vpinsrb $14, 464(%rbp), %xmm1, %xmm1
1793 ; KNL-NEXT: vpinsrb $15, 472(%rbp), %xmm1, %xmm1
1794 ; KNL-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm1
1795 ; KNL-NEXT: vpxor %xmm0, %xmm0, %xmm0
1796 ; KNL-NEXT: vpcmpeqb %ymm0, %ymm1, %ymm1
1797 ; KNL-NEXT: vmovd %edi, %xmm2
1798 ; KNL-NEXT: vpinsrb $1, %esi, %xmm2, %xmm2
1799 ; KNL-NEXT: vpinsrb $2, %edx, %xmm2, %xmm2
1800 ; KNL-NEXT: vpinsrb $3, %ecx, %xmm2, %xmm2
1801 ; KNL-NEXT: vpinsrb $4, %r8d, %xmm2, %xmm2
1802 ; KNL-NEXT: vpinsrb $5, %r9d, %xmm2, %xmm2
1803 ; KNL-NEXT: vpinsrb $6, 16(%rbp), %xmm2, %xmm2
1804 ; KNL-NEXT: vpinsrb $7, 24(%rbp), %xmm2, %xmm2
1805 ; KNL-NEXT: vpinsrb $8, 32(%rbp), %xmm2, %xmm2
1806 ; KNL-NEXT: vpinsrb $9, 40(%rbp), %xmm2, %xmm2
1807 ; KNL-NEXT: vpinsrb $10, 48(%rbp), %xmm2, %xmm2
1808 ; KNL-NEXT: vpinsrb $11, 56(%rbp), %xmm2, %xmm2
1809 ; KNL-NEXT: vpinsrb $12, 64(%rbp), %xmm2, %xmm2
1810 ; KNL-NEXT: vpinsrb $13, 72(%rbp), %xmm2, %xmm2
1811 ; KNL-NEXT: vpinsrb $14, 80(%rbp), %xmm2, %xmm2
1812 ; KNL-NEXT: vpinsrb $15, 88(%rbp), %xmm2, %xmm2
1813 ; KNL-NEXT: vmovd {{.*#+}} xmm3 = mem[0],zero,zero,zero
1814 ; KNL-NEXT: vpinsrb $1, 104(%rbp), %xmm3, %xmm3
1815 ; KNL-NEXT: vpinsrb $2, 112(%rbp), %xmm3, %xmm3
1816 ; KNL-NEXT: vpinsrb $3, 120(%rbp), %xmm3, %xmm3
1817 ; KNL-NEXT: vpinsrb $4, 128(%rbp), %xmm3, %xmm3
1818 ; KNL-NEXT: vpinsrb $5, 136(%rbp), %xmm3, %xmm3
1819 ; KNL-NEXT: vpinsrb $6, 144(%rbp), %xmm3, %xmm3
1820 ; KNL-NEXT: vpinsrb $7, 152(%rbp), %xmm3, %xmm3
1821 ; KNL-NEXT: vpinsrb $8, 160(%rbp), %xmm3, %xmm3
1822 ; KNL-NEXT: vpinsrb $9, 168(%rbp), %xmm3, %xmm3
1823 ; KNL-NEXT: vpinsrb $10, 176(%rbp), %xmm3, %xmm3
1824 ; KNL-NEXT: vpinsrb $11, 184(%rbp), %xmm3, %xmm3
1825 ; KNL-NEXT: vpinsrb $12, 192(%rbp), %xmm3, %xmm3
1826 ; KNL-NEXT: vpinsrb $13, 200(%rbp), %xmm3, %xmm3
1827 ; KNL-NEXT: vpinsrb $14, 208(%rbp), %xmm3, %xmm3
1828 ; KNL-NEXT: vpinsrb $15, 216(%rbp), %xmm3, %xmm3
1829 ; KNL-NEXT: vinserti128 $1, %xmm3, %ymm2, %ymm2
1830 ; KNL-NEXT: vpcmpeqb %ymm0, %ymm2, %ymm2
1831 ; KNL-NEXT: vinserti64x4 $1, %ymm1, %zmm2, %zmm1
1832 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1833 ; KNL-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
1834 ; KNL-NEXT: vpinsrb $1, 488(%rbp), %xmm2, %xmm2
1835 ; KNL-NEXT: vpinsrb $2, 496(%rbp), %xmm2, %xmm2
1836 ; KNL-NEXT: vpinsrb $3, 504(%rbp), %xmm2, %xmm2
1837 ; KNL-NEXT: vpinsrb $4, 512(%rbp), %xmm2, %xmm2
1838 ; KNL-NEXT: vpinsrb $5, 520(%rbp), %xmm2, %xmm2
1839 ; KNL-NEXT: vpinsrb $6, 528(%rbp), %xmm2, %xmm2
1840 ; KNL-NEXT: vpinsrb $7, 536(%rbp), %xmm2, %xmm2
1841 ; KNL-NEXT: vpinsrb $8, 544(%rbp), %xmm2, %xmm2
1842 ; KNL-NEXT: vpinsrb $9, 552(%rbp), %xmm2, %xmm2
1843 ; KNL-NEXT: vpinsrb $10, 560(%rbp), %xmm2, %xmm2
1844 ; KNL-NEXT: vpinsrb $11, 568(%rbp), %xmm2, %xmm2
1845 ; KNL-NEXT: vpinsrb $12, 576(%rbp), %xmm2, %xmm2
1846 ; KNL-NEXT: vpinsrb $13, 584(%rbp), %xmm2, %xmm2
1847 ; KNL-NEXT: vpinsrb $14, 592(%rbp), %xmm2, %xmm2
1848 ; KNL-NEXT: vpinsrb $15, 600(%rbp), %xmm2, %xmm2
1849 ; KNL-NEXT: vmovd {{.*#+}} xmm3 = mem[0],zero,zero,zero
1850 ; KNL-NEXT: vpinsrb $1, 616(%rbp), %xmm3, %xmm3
1851 ; KNL-NEXT: vpinsrb $2, 624(%rbp), %xmm3, %xmm3
1852 ; KNL-NEXT: vpinsrb $3, 632(%rbp), %xmm3, %xmm3
1853 ; KNL-NEXT: vpinsrb $4, 640(%rbp), %xmm3, %xmm3
1854 ; KNL-NEXT: vpinsrb $5, 648(%rbp), %xmm3, %xmm3
1855 ; KNL-NEXT: vpinsrb $6, 656(%rbp), %xmm3, %xmm3
1856 ; KNL-NEXT: vpinsrb $7, 664(%rbp), %xmm3, %xmm3
1857 ; KNL-NEXT: vpinsrb $8, 672(%rbp), %xmm3, %xmm3
1858 ; KNL-NEXT: vpinsrb $9, 680(%rbp), %xmm3, %xmm3
1859 ; KNL-NEXT: vpinsrb $10, 688(%rbp), %xmm3, %xmm3
1860 ; KNL-NEXT: vpinsrb $11, 696(%rbp), %xmm3, %xmm3
1861 ; KNL-NEXT: vpinsrb $12, 704(%rbp), %xmm3, %xmm3
1862 ; KNL-NEXT: vpinsrb $13, 712(%rbp), %xmm3, %xmm3
1863 ; KNL-NEXT: vpinsrb $14, 720(%rbp), %xmm3, %xmm3
1864 ; KNL-NEXT: vpinsrb $15, 728(%rbp), %xmm3, %xmm3
1865 ; KNL-NEXT: vinserti128 $1, %xmm3, %ymm2, %ymm2
1866 ; KNL-NEXT: vpcmpeqb %ymm0, %ymm2, %ymm2
1867 ; KNL-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1868 ; KNL-NEXT: cmpb $0, 736(%rbp)
1869 ; KNL-NEXT: vmovdqa %ymm0, {{[0-9]+}}(%rsp)
1870 ; KNL-NEXT: vmovdqa %ymm2, {{[0-9]+}}(%rsp)
1871 ; KNL-NEXT: vmovdqa64 %zmm1, (%rsp)
1872 ; KNL-NEXT: setne (%rsp,%rax)
1873 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1874 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1875 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1876 ; KNL-NEXT: kmovw %k0, %eax
1877 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1878 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1879 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1880 ; KNL-NEXT: kmovw %k0, %ecx
1881 ; KNL-NEXT: shll $16, %ecx
1882 ; KNL-NEXT: orl %eax, %ecx
1883 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1884 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1885 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1886 ; KNL-NEXT: kmovw %k0, %edx
1887 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1888 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1889 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1890 ; KNL-NEXT: kmovw %k0, %eax
1891 ; KNL-NEXT: shll $16, %eax
1892 ; KNL-NEXT: orl %edx, %eax
1893 ; KNL-NEXT: shlq $32, %rax
1894 ; KNL-NEXT: orq %rcx, %rax
1895 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1896 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1897 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1898 ; KNL-NEXT: kmovw %k0, %ecx
1899 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1900 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1901 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1902 ; KNL-NEXT: kmovw %k0, %esi
1903 ; KNL-NEXT: shll $16, %esi
1904 ; KNL-NEXT: orl %ecx, %esi
1905 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1906 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1907 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1908 ; KNL-NEXT: kmovw %k0, %ecx
1909 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1910 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1911 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1912 ; KNL-NEXT: kmovw %k0, %edx
1913 ; KNL-NEXT: shll $16, %edx
1914 ; KNL-NEXT: orl %ecx, %edx
1915 ; KNL-NEXT: shlq $32, %rdx
1916 ; KNL-NEXT: orq %rsi, %rdx
1917 ; KNL-NEXT: movq %rbp, %rsp
1918 ; KNL-NEXT: popq %rbp
1919 ; KNL-NEXT: vzeroupper
1922 ; SKX-LABEL: test_insertelement_variable_v96i1:
1924 ; SKX-NEXT: pushq %rbp
1925 ; SKX-NEXT: movq %rsp, %rbp
1926 ; SKX-NEXT: andq $-64, %rsp
1927 ; SKX-NEXT: subq $192, %rsp
1928 ; SKX-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
1929 ; SKX-NEXT: vpinsrb $1, 232(%rbp), %xmm0, %xmm0
1930 ; SKX-NEXT: vpinsrb $2, 240(%rbp), %xmm0, %xmm0
1931 ; SKX-NEXT: vpinsrb $3, 248(%rbp), %xmm0, %xmm0
1932 ; SKX-NEXT: vpinsrb $4, 256(%rbp), %xmm0, %xmm0
1933 ; SKX-NEXT: vpinsrb $5, 264(%rbp), %xmm0, %xmm0
1934 ; SKX-NEXT: vpinsrb $6, 272(%rbp), %xmm0, %xmm0
1935 ; SKX-NEXT: vpinsrb $7, 280(%rbp), %xmm0, %xmm0
1936 ; SKX-NEXT: vpinsrb $8, 288(%rbp), %xmm0, %xmm0
1937 ; SKX-NEXT: vpinsrb $9, 296(%rbp), %xmm0, %xmm0
1938 ; SKX-NEXT: vpinsrb $10, 304(%rbp), %xmm0, %xmm0
1939 ; SKX-NEXT: vpinsrb $11, 312(%rbp), %xmm0, %xmm0
1940 ; SKX-NEXT: vpinsrb $12, 320(%rbp), %xmm0, %xmm0
1941 ; SKX-NEXT: vpinsrb $13, 328(%rbp), %xmm0, %xmm0
1942 ; SKX-NEXT: vpinsrb $14, 336(%rbp), %xmm0, %xmm0
1943 ; SKX-NEXT: vpinsrb $15, 344(%rbp), %xmm0, %xmm0
1944 ; SKX-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1945 ; SKX-NEXT: vpinsrb $1, 360(%rbp), %xmm1, %xmm1
1946 ; SKX-NEXT: vpinsrb $2, 368(%rbp), %xmm1, %xmm1
1947 ; SKX-NEXT: vpinsrb $3, 376(%rbp), %xmm1, %xmm1
1948 ; SKX-NEXT: vpinsrb $4, 384(%rbp), %xmm1, %xmm1
1949 ; SKX-NEXT: vpinsrb $5, 392(%rbp), %xmm1, %xmm1
1950 ; SKX-NEXT: vpinsrb $6, 400(%rbp), %xmm1, %xmm1
1951 ; SKX-NEXT: vpinsrb $7, 408(%rbp), %xmm1, %xmm1
1952 ; SKX-NEXT: vpinsrb $8, 416(%rbp), %xmm1, %xmm1
1953 ; SKX-NEXT: vpinsrb $9, 424(%rbp), %xmm1, %xmm1
1954 ; SKX-NEXT: vpinsrb $10, 432(%rbp), %xmm1, %xmm1
1955 ; SKX-NEXT: vpinsrb $11, 440(%rbp), %xmm1, %xmm1
1956 ; SKX-NEXT: vpinsrb $12, 448(%rbp), %xmm1, %xmm1
1957 ; SKX-NEXT: vpinsrb $13, 456(%rbp), %xmm1, %xmm1
1958 ; SKX-NEXT: vpinsrb $14, 464(%rbp), %xmm1, %xmm1
1959 ; SKX-NEXT: vpinsrb $15, 472(%rbp), %xmm1, %xmm1
1960 ; SKX-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
1961 ; SKX-NEXT: vmovd %edi, %xmm1
1962 ; SKX-NEXT: vpinsrb $1, %esi, %xmm1, %xmm1
1963 ; SKX-NEXT: vpinsrb $2, %edx, %xmm1, %xmm1
1964 ; SKX-NEXT: vpinsrb $3, %ecx, %xmm1, %xmm1
1965 ; SKX-NEXT: vpinsrb $4, %r8d, %xmm1, %xmm1
1966 ; SKX-NEXT: vpinsrb $5, %r9d, %xmm1, %xmm1
1967 ; SKX-NEXT: vpinsrb $6, 16(%rbp), %xmm1, %xmm1
1968 ; SKX-NEXT: vpinsrb $7, 24(%rbp), %xmm1, %xmm1
1969 ; SKX-NEXT: vpinsrb $8, 32(%rbp), %xmm1, %xmm1
1970 ; SKX-NEXT: vpinsrb $9, 40(%rbp), %xmm1, %xmm1
1971 ; SKX-NEXT: vpinsrb $10, 48(%rbp), %xmm1, %xmm1
1972 ; SKX-NEXT: vpinsrb $11, 56(%rbp), %xmm1, %xmm1
1973 ; SKX-NEXT: vpinsrb $12, 64(%rbp), %xmm1, %xmm1
1974 ; SKX-NEXT: vpinsrb $13, 72(%rbp), %xmm1, %xmm1
1975 ; SKX-NEXT: vpinsrb $14, 80(%rbp), %xmm1, %xmm1
1976 ; SKX-NEXT: vpinsrb $15, 88(%rbp), %xmm1, %xmm1
1977 ; SKX-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
1978 ; SKX-NEXT: vpinsrb $1, 104(%rbp), %xmm2, %xmm2
1979 ; SKX-NEXT: vpinsrb $2, 112(%rbp), %xmm2, %xmm2
1980 ; SKX-NEXT: vpinsrb $3, 120(%rbp), %xmm2, %xmm2
1981 ; SKX-NEXT: vpinsrb $4, 128(%rbp), %xmm2, %xmm2
1982 ; SKX-NEXT: vpinsrb $5, 136(%rbp), %xmm2, %xmm2
1983 ; SKX-NEXT: vpinsrb $6, 144(%rbp), %xmm2, %xmm2
1984 ; SKX-NEXT: vpinsrb $7, 152(%rbp), %xmm2, %xmm2
1985 ; SKX-NEXT: vpinsrb $8, 160(%rbp), %xmm2, %xmm2
1986 ; SKX-NEXT: vpinsrb $9, 168(%rbp), %xmm2, %xmm2
1987 ; SKX-NEXT: vpinsrb $10, 176(%rbp), %xmm2, %xmm2
1988 ; SKX-NEXT: vpinsrb $11, 184(%rbp), %xmm2, %xmm2
1989 ; SKX-NEXT: vpinsrb $12, 192(%rbp), %xmm2, %xmm2
1990 ; SKX-NEXT: vpinsrb $13, 200(%rbp), %xmm2, %xmm2
1991 ; SKX-NEXT: vpinsrb $14, 208(%rbp), %xmm2, %xmm2
1992 ; SKX-NEXT: vpinsrb $15, 216(%rbp), %xmm2, %xmm2
1993 ; SKX-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
1994 ; SKX-NEXT: vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1995 ; SKX-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1996 ; SKX-NEXT: vpinsrb $1, 488(%rbp), %xmm1, %xmm1
1997 ; SKX-NEXT: vpinsrb $2, 496(%rbp), %xmm1, %xmm1
1998 ; SKX-NEXT: vpinsrb $3, 504(%rbp), %xmm1, %xmm1
1999 ; SKX-NEXT: vpinsrb $4, 512(%rbp), %xmm1, %xmm1
2000 ; SKX-NEXT: vpinsrb $5, 520(%rbp), %xmm1, %xmm1
2001 ; SKX-NEXT: vpinsrb $6, 528(%rbp), %xmm1, %xmm1
2002 ; SKX-NEXT: vpinsrb $7, 536(%rbp), %xmm1, %xmm1
2003 ; SKX-NEXT: vpinsrb $8, 544(%rbp), %xmm1, %xmm1
2004 ; SKX-NEXT: vpinsrb $9, 552(%rbp), %xmm1, %xmm1
2005 ; SKX-NEXT: vpinsrb $10, 560(%rbp), %xmm1, %xmm1
2006 ; SKX-NEXT: vpinsrb $11, 568(%rbp), %xmm1, %xmm1
2007 ; SKX-NEXT: vpinsrb $12, 576(%rbp), %xmm1, %xmm1
2008 ; SKX-NEXT: vpinsrb $13, 584(%rbp), %xmm1, %xmm1
2009 ; SKX-NEXT: vpinsrb $14, 592(%rbp), %xmm1, %xmm1
2010 ; SKX-NEXT: vpinsrb $15, 600(%rbp), %xmm1, %xmm1
2011 ; SKX-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
2012 ; SKX-NEXT: vpinsrb $1, 616(%rbp), %xmm2, %xmm2
2013 ; SKX-NEXT: vpinsrb $2, 624(%rbp), %xmm2, %xmm2
2014 ; SKX-NEXT: vpinsrb $3, 632(%rbp), %xmm2, %xmm2
2015 ; SKX-NEXT: vpinsrb $4, 640(%rbp), %xmm2, %xmm2
2016 ; SKX-NEXT: vpinsrb $5, 648(%rbp), %xmm2, %xmm2
2017 ; SKX-NEXT: vpinsrb $6, 656(%rbp), %xmm2, %xmm2
2018 ; SKX-NEXT: vpinsrb $7, 664(%rbp), %xmm2, %xmm2
2019 ; SKX-NEXT: vpinsrb $8, 672(%rbp), %xmm2, %xmm2
2020 ; SKX-NEXT: vpinsrb $9, 680(%rbp), %xmm2, %xmm2
2021 ; SKX-NEXT: vpinsrb $10, 688(%rbp), %xmm2, %xmm2
2022 ; SKX-NEXT: vpinsrb $11, 696(%rbp), %xmm2, %xmm2
2023 ; SKX-NEXT: vpinsrb $12, 704(%rbp), %xmm2, %xmm2
2024 ; SKX-NEXT: vpinsrb $13, 712(%rbp), %xmm2, %xmm2
2025 ; SKX-NEXT: vpinsrb $14, 720(%rbp), %xmm2, %xmm2
2026 ; SKX-NEXT: vpinsrb $15, 728(%rbp), %xmm2, %xmm2
2027 ; SKX-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
2028 ; SKX-NEXT: movl 744(%rbp), %eax
2029 ; SKX-NEXT: andl $127, %eax
2030 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
2031 ; SKX-NEXT: vptestmb %zmm1, %zmm1, %k1
2032 ; SKX-NEXT: cmpb $0, 736(%rbp)
2033 ; SKX-NEXT: vpmovm2b %k1, %zmm0
2034 ; SKX-NEXT: vmovdqa64 %zmm0, {{[0-9]+}}(%rsp)
2035 ; SKX-NEXT: vpmovm2b %k0, %zmm0
2036 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
2037 ; SKX-NEXT: setne (%rsp,%rax)
2038 ; SKX-NEXT: vpsllw $7, {{[0-9]+}}(%rsp), %zmm0
2039 ; SKX-NEXT: vpmovb2m %zmm0, %k0
2040 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
2041 ; SKX-NEXT: vpmovb2m %zmm0, %k1
2042 ; SKX-NEXT: kmovq %k1, %rax
2043 ; SKX-NEXT: kmovq %k0, %rdx
2044 ; SKX-NEXT: movq %rbp, %rsp
2045 ; SKX-NEXT: popq %rbp
2046 ; SKX-NEXT: vzeroupper
2048 %t1 = icmp ugt <96 x i8> %a, zeroinitializer
2049 %t2 = icmp ugt i8 %b, 0
2050 %t3 = insertelement <96 x i1> %t1, i1 %t2, i32 %index
2051 %t4 = bitcast <96 x i1> %t3 to i96
2055 define i128 @test_insertelement_variable_v128i1(<128 x i8> %a, i8 %b, i32 %index) nounwind {
2056 ; KNL-LABEL: test_insertelement_variable_v128i1:
2058 ; KNL-NEXT: pushq %rbp
2059 ; KNL-NEXT: movq %rsp, %rbp
2060 ; KNL-NEXT: andq $-64, %rsp
2061 ; KNL-NEXT: subq $192, %rsp
2062 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
2063 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm2
2064 ; KNL-NEXT: vpxor %xmm3, %xmm3, %xmm3
2065 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm2, %ymm2
2066 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm0, %ymm0
2067 ; KNL-NEXT: vinserti64x4 $1, %ymm2, %zmm0, %zmm0
2068 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
2069 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm2
2070 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm2, %ymm2
2071 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm1, %ymm1
2072 ; KNL-NEXT: vinserti64x4 $1, %ymm2, %zmm1, %zmm1
2073 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
2074 ; KNL-NEXT: andl $127, %esi
2075 ; KNL-NEXT: testb %dil, %dil
2076 ; KNL-NEXT: vmovdqa64 %zmm1, {{[0-9]+}}(%rsp)
2077 ; KNL-NEXT: vmovdqa64 %zmm0, (%rsp)
2078 ; KNL-NEXT: setne (%rsp,%rsi)
2079 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
2080 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2081 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2082 ; KNL-NEXT: kmovw %k0, %eax
2083 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2084 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2085 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2086 ; KNL-NEXT: kmovw %k0, %ecx
2087 ; KNL-NEXT: shll $16, %ecx
2088 ; KNL-NEXT: orl %eax, %ecx
2089 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2090 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2091 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2092 ; KNL-NEXT: kmovw %k0, %edx
2093 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2094 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2095 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2096 ; KNL-NEXT: kmovw %k0, %eax
2097 ; KNL-NEXT: shll $16, %eax
2098 ; KNL-NEXT: orl %edx, %eax
2099 ; KNL-NEXT: shlq $32, %rax
2100 ; KNL-NEXT: orq %rcx, %rax
2101 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2102 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2103 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2104 ; KNL-NEXT: kmovw %k0, %ecx
2105 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2106 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2107 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2108 ; KNL-NEXT: kmovw %k0, %esi
2109 ; KNL-NEXT: shll $16, %esi
2110 ; KNL-NEXT: orl %ecx, %esi
2111 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2112 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2113 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2114 ; KNL-NEXT: kmovw %k0, %ecx
2115 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2116 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2117 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2118 ; KNL-NEXT: kmovw %k0, %edx
2119 ; KNL-NEXT: shll $16, %edx
2120 ; KNL-NEXT: orl %ecx, %edx
2121 ; KNL-NEXT: shlq $32, %rdx
2122 ; KNL-NEXT: orq %rsi, %rdx
2123 ; KNL-NEXT: movq %rbp, %rsp
2124 ; KNL-NEXT: popq %rbp
2125 ; KNL-NEXT: vzeroupper
2128 ; SKX-LABEL: test_insertelement_variable_v128i1:
2130 ; SKX-NEXT: pushq %rbp
2131 ; SKX-NEXT: movq %rsp, %rbp
2132 ; SKX-NEXT: andq $-64, %rsp
2133 ; SKX-NEXT: subq $192, %rsp
2134 ; SKX-NEXT: ## kill: def $esi killed $esi def $rsi
2135 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
2136 ; SKX-NEXT: vptestmb %zmm1, %zmm1, %k1
2137 ; SKX-NEXT: andl $127, %esi
2138 ; SKX-NEXT: testb %dil, %dil
2139 ; SKX-NEXT: vpmovm2b %k1, %zmm0
2140 ; SKX-NEXT: vmovdqa64 %zmm0, {{[0-9]+}}(%rsp)
2141 ; SKX-NEXT: vpmovm2b %k0, %zmm0
2142 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
2143 ; SKX-NEXT: setne (%rsp,%rsi)
2144 ; SKX-NEXT: vpsllw $7, {{[0-9]+}}(%rsp), %zmm0
2145 ; SKX-NEXT: vpmovb2m %zmm0, %k0
2146 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
2147 ; SKX-NEXT: vpmovb2m %zmm0, %k1
2148 ; SKX-NEXT: kmovq %k1, %rax
2149 ; SKX-NEXT: kmovq %k0, %rdx
2150 ; SKX-NEXT: movq %rbp, %rsp
2151 ; SKX-NEXT: popq %rbp
2152 ; SKX-NEXT: vzeroupper
2154 %t1 = icmp ugt <128 x i8> %a, zeroinitializer
2155 %t2 = icmp ugt i8 %b, 0
2156 %t3 = insertelement <128 x i1> %t1, i1 %t2, i32 %index
2157 %t4 = bitcast <128 x i1> %t3 to i128
2161 define void @test_concat_v2i1(ptr %arg, ptr %arg1, ptr %arg2) nounwind {
2162 ; KNL-LABEL: test_concat_v2i1:
2164 ; KNL-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
2165 ; KNL-NEXT: vcvtph2ps %xmm0, %xmm1
2166 ; KNL-NEXT: vmovss {{.*#+}} xmm2 = [6.0E+0,0.0E+0,0.0E+0,0.0E+0]
2167 ; KNL-NEXT: vucomiss %xmm2, %xmm1
2168 ; KNL-NEXT: setb %al
2169 ; KNL-NEXT: andl $1, %eax
2170 ; KNL-NEXT: kmovw %eax, %k0
2171 ; KNL-NEXT: vpshuflw {{.*#+}} xmm0 = xmm0[1,1,1,1,4,5,6,7]
2172 ; KNL-NEXT: vcvtph2ps %xmm0, %xmm0
2173 ; KNL-NEXT: vucomiss %xmm2, %xmm0
2174 ; KNL-NEXT: setb %al
2175 ; KNL-NEXT: kmovw %eax, %k1
2176 ; KNL-NEXT: kshiftlw $1, %k1, %k1
2177 ; KNL-NEXT: korw %k1, %k0, %k0
2178 ; KNL-NEXT: vxorps %xmm2, %xmm2, %xmm2
2179 ; KNL-NEXT: vucomiss %xmm2, %xmm1
2180 ; KNL-NEXT: seta %al
2181 ; KNL-NEXT: andl $1, %eax
2182 ; KNL-NEXT: kmovw %eax, %k1
2183 ; KNL-NEXT: vucomiss %xmm2, %xmm0
2184 ; KNL-NEXT: seta %al
2185 ; KNL-NEXT: kmovw %eax, %k2
2186 ; KNL-NEXT: kshiftlw $1, %k2, %k2
2187 ; KNL-NEXT: korw %k2, %k1, %k1
2188 ; KNL-NEXT: kandw %k1, %k0, %k1
2189 ; KNL-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
2190 ; KNL-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1 {%k1} {z}
2191 ; KNL-NEXT: vpmovdw %zmm1, %ymm1
2192 ; KNL-NEXT: vpand %xmm0, %xmm1, %xmm0
2193 ; KNL-NEXT: vmovd %xmm0, (%rdx)
2194 ; KNL-NEXT: vzeroupper
2197 ; SKX-LABEL: test_concat_v2i1:
2199 ; SKX-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
2200 ; SKX-NEXT: vpshuflw {{.*#+}} xmm1 = xmm0[1,1,1,1,4,5,6,7]
2201 ; SKX-NEXT: vcvtph2ps %xmm1, %xmm1
2202 ; SKX-NEXT: vmovss {{.*#+}} xmm2 = [6.0E+0,0.0E+0,0.0E+0,0.0E+0]
2203 ; SKX-NEXT: vucomiss %xmm2, %xmm1
2204 ; SKX-NEXT: setb %al
2205 ; SKX-NEXT: kmovd %eax, %k0
2206 ; SKX-NEXT: kshiftlb $1, %k0, %k0
2207 ; SKX-NEXT: vcvtph2ps %xmm0, %xmm0
2208 ; SKX-NEXT: vucomiss %xmm2, %xmm0
2209 ; SKX-NEXT: setb %al
2210 ; SKX-NEXT: kmovd %eax, %k1
2211 ; SKX-NEXT: kshiftlb $7, %k1, %k1
2212 ; SKX-NEXT: kshiftrb $7, %k1, %k1
2213 ; SKX-NEXT: korw %k0, %k1, %k0
2214 ; SKX-NEXT: vxorps %xmm2, %xmm2, %xmm2
2215 ; SKX-NEXT: vucomiss %xmm2, %xmm1
2216 ; SKX-NEXT: seta %al
2217 ; SKX-NEXT: kmovd %eax, %k1
2218 ; SKX-NEXT: kshiftlb $1, %k1, %k1
2219 ; SKX-NEXT: vucomiss %xmm2, %xmm0
2220 ; SKX-NEXT: seta %al
2221 ; SKX-NEXT: kmovd %eax, %k2
2222 ; SKX-NEXT: kshiftlb $7, %k2, %k2
2223 ; SKX-NEXT: kshiftrb $7, %k2, %k2
2224 ; SKX-NEXT: korw %k1, %k2, %k1
2225 ; SKX-NEXT: kandw %k1, %k0, %k1
2226 ; SKX-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
2227 ; SKX-NEXT: vmovdqu16 %xmm0, %xmm0 {%k1} {z}
2228 ; SKX-NEXT: vmovd %xmm0, (%rdx)
2230 %tmp = load <2 x half>, ptr %arg, align 8
2231 %tmp3 = fcmp fast olt <2 x half> %tmp, <half 0xH4600, half 0xH4600>
2232 %tmp4 = fcmp fast ogt <2 x half> %tmp, zeroinitializer
2233 %tmp5 = and <2 x i1> %tmp3, %tmp4
2234 %tmp6 = load <2 x half>, ptr %arg1, align 8
2235 %tmp7 = select <2 x i1> %tmp5, <2 x half> %tmp6, <2 x half> zeroinitializer
2236 store <2 x half> %tmp7, ptr %arg2, align 8
2240 ; Check that an extracted bool element comparison is correctly extended when
2241 ; the bool vector is bitcasted instead.
2242 define void @test_extractelement_v64i1_cmp0(<64 x i1> %0) nounwind {
2243 ; KNL-LABEL: test_extractelement_v64i1_cmp0:
2244 ; KNL: ## %bb.0: ## %entry
2247 ; SKX-LABEL: test_extractelement_v64i1_cmp0:
2248 ; SKX: ## %bb.0: ## %entry
2249 ; SKX-NEXT: vzeroupper
2252 %1 = extractelement <64 x i1> %0, i64 0
2253 br i1 %1, label %common.ret, label %2
2255 common.ret: ; preds = %2, %entry
2259 %3 = extractelement <64 x i1> zeroinitializer, i64 0
2260 br label %common.ret