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: vpternlogq $15, %zmm0, %zmm0, %zmm0
1054 ; KNL-NEXT: vpmovsxbd %xmm0, %zmm0
1055 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1056 ; KNL-NEXT: kshiftrw $2, %k0, %k0
1057 ; KNL-NEXT: kmovw %k0, %eax
1058 ; KNL-NEXT: andl $1, %eax
1059 ; KNL-NEXT: vzeroupper
1062 ; SKX-LABEL: test_extractelement_v32i1:
1064 ; SKX-NEXT: vpcmpnleub %ymm1, %ymm0, %k0
1065 ; SKX-NEXT: kshiftrd $2, %k0, %k0
1066 ; SKX-NEXT: kmovd %k0, %eax
1067 ; SKX-NEXT: andl $1, %eax
1068 ; SKX-NEXT: vzeroupper
1070 %t1 = icmp ugt <32 x i8> %a, %b
1071 %t2 = extractelement <32 x i1> %t1, i32 2
1072 %res = zext i1 %t2 to i8
1076 define zeroext i8 @test_extractelement_v64i1(<64 x i8> %a, <64 x i8> %b) nounwind {
1077 ; KNL-LABEL: test_extractelement_v64i1:
1079 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm1
1080 ; KNL-NEXT: vextracti128 $1, %ymm1, %xmm1
1081 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm0
1082 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm0
1083 ; KNL-NEXT: vpminub %xmm1, %xmm0, %xmm1
1084 ; KNL-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1085 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1086 ; KNL-NEXT: vpmovsxbd %xmm0, %zmm0
1087 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1088 ; KNL-NEXT: kshiftrw $15, %k0, %k0
1089 ; KNL-NEXT: kmovw %k0, %ecx
1090 ; KNL-NEXT: andl $1, %ecx
1091 ; KNL-NEXT: movl $4, %eax
1092 ; KNL-NEXT: subl %ecx, %eax
1093 ; KNL-NEXT: vzeroupper
1096 ; SKX-LABEL: test_extractelement_v64i1:
1098 ; SKX-NEXT: vpcmpnleub %zmm1, %zmm0, %k0
1099 ; SKX-NEXT: kshiftrq $63, %k0, %k0
1100 ; SKX-NEXT: kmovd %k0, %ecx
1101 ; SKX-NEXT: andl $1, %ecx
1102 ; SKX-NEXT: movl $4, %eax
1103 ; SKX-NEXT: subl %ecx, %eax
1104 ; SKX-NEXT: vzeroupper
1106 %t1 = icmp ugt <64 x i8> %a, %b
1107 %t2 = extractelement <64 x i1> %t1, i32 63
1108 %res = select i1 %t2, i8 3, i8 4
1112 define zeroext i8 @extractelement_v64i1_alt(<64 x i8> %a, <64 x i8> %b) nounwind {
1113 ; KNL-LABEL: extractelement_v64i1_alt:
1115 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm1
1116 ; KNL-NEXT: vextracti128 $1, %ymm1, %xmm1
1117 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm0
1118 ; KNL-NEXT: vextracti128 $1, %ymm0, %xmm0
1119 ; KNL-NEXT: vpminub %xmm1, %xmm0, %xmm1
1120 ; KNL-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1121 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1122 ; KNL-NEXT: vpmovsxbd %xmm0, %zmm0
1123 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1124 ; KNL-NEXT: kshiftrw $15, %k0, %k0
1125 ; KNL-NEXT: kmovw %k0, %eax
1126 ; KNL-NEXT: andb $1, %al
1127 ; KNL-NEXT: movb $4, %cl
1128 ; KNL-NEXT: subb %al, %cl
1129 ; KNL-NEXT: movzbl %cl, %eax
1130 ; KNL-NEXT: vzeroupper
1133 ; SKX-LABEL: extractelement_v64i1_alt:
1135 ; SKX-NEXT: vpcmpnleub %zmm1, %zmm0, %k0
1136 ; SKX-NEXT: kshiftrq $63, %k0, %k0
1137 ; SKX-NEXT: kmovd %k0, %eax
1138 ; SKX-NEXT: andb $1, %al
1139 ; SKX-NEXT: movb $4, %cl
1140 ; SKX-NEXT: subb %al, %cl
1141 ; SKX-NEXT: movzbl %cl, %eax
1142 ; SKX-NEXT: vzeroupper
1144 %t1 = icmp ugt <64 x i8> %a, %b
1145 %t2 = extractelement <64 x i1> %t1, i32 63
1146 %sext = sext i1 %t2 to i8
1147 %res = add i8 %sext, 4
1151 define i64 @test_extractelement_variable_v2i64(<2 x i64> %t1, i32 %index) nounwind {
1152 ; CHECK-LABEL: test_extractelement_variable_v2i64:
1154 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1155 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1156 ; CHECK-NEXT: andl $1, %edi
1157 ; CHECK-NEXT: movq -24(%rsp,%rdi,8), %rax
1159 %t2 = extractelement <2 x i64> %t1, i32 %index
1163 define i64 @test_extractelement_variable_v4i64(<4 x i64> %t1, i32 %index) nounwind {
1164 ; CHECK-LABEL: test_extractelement_variable_v4i64:
1166 ; CHECK-NEXT: pushq %rbp
1167 ; CHECK-NEXT: movq %rsp, %rbp
1168 ; CHECK-NEXT: andq $-32, %rsp
1169 ; CHECK-NEXT: subq $64, %rsp
1170 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1171 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1172 ; CHECK-NEXT: andl $3, %edi
1173 ; CHECK-NEXT: movq (%rsp,%rdi,8), %rax
1174 ; CHECK-NEXT: movq %rbp, %rsp
1175 ; CHECK-NEXT: popq %rbp
1176 ; CHECK-NEXT: vzeroupper
1178 %t2 = extractelement <4 x i64> %t1, i32 %index
1182 define i64 @test_extractelement_variable_v8i64(<8 x i64> %t1, i32 %index) nounwind {
1183 ; CHECK-LABEL: test_extractelement_variable_v8i64:
1185 ; CHECK-NEXT: pushq %rbp
1186 ; CHECK-NEXT: movq %rsp, %rbp
1187 ; CHECK-NEXT: andq $-64, %rsp
1188 ; CHECK-NEXT: subq $128, %rsp
1189 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1190 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1191 ; CHECK-NEXT: andl $7, %edi
1192 ; CHECK-NEXT: movq (%rsp,%rdi,8), %rax
1193 ; CHECK-NEXT: movq %rbp, %rsp
1194 ; CHECK-NEXT: popq %rbp
1195 ; CHECK-NEXT: vzeroupper
1197 %t2 = extractelement <8 x i64> %t1, i32 %index
1201 define double @test_extractelement_variable_v2f64(<2 x double> %t1, i32 %index) nounwind {
1202 ; CHECK-LABEL: test_extractelement_variable_v2f64:
1204 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1205 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1206 ; CHECK-NEXT: andl $1, %edi
1207 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1209 %t2 = extractelement <2 x double> %t1, i32 %index
1213 define double @test_extractelement_variable_v4f64(<4 x double> %t1, i32 %index) nounwind {
1214 ; CHECK-LABEL: test_extractelement_variable_v4f64:
1216 ; CHECK-NEXT: pushq %rbp
1217 ; CHECK-NEXT: movq %rsp, %rbp
1218 ; CHECK-NEXT: andq $-32, %rsp
1219 ; CHECK-NEXT: subq $64, %rsp
1220 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1221 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1222 ; CHECK-NEXT: andl $3, %edi
1223 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1224 ; CHECK-NEXT: movq %rbp, %rsp
1225 ; CHECK-NEXT: popq %rbp
1226 ; CHECK-NEXT: vzeroupper
1228 %t2 = extractelement <4 x double> %t1, i32 %index
1232 define double @test_extractelement_variable_v8f64(<8 x double> %t1, i32 %index) nounwind {
1233 ; CHECK-LABEL: test_extractelement_variable_v8f64:
1235 ; CHECK-NEXT: pushq %rbp
1236 ; CHECK-NEXT: movq %rsp, %rbp
1237 ; CHECK-NEXT: andq $-64, %rsp
1238 ; CHECK-NEXT: subq $128, %rsp
1239 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1240 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1241 ; CHECK-NEXT: andl $7, %edi
1242 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1243 ; CHECK-NEXT: movq %rbp, %rsp
1244 ; CHECK-NEXT: popq %rbp
1245 ; CHECK-NEXT: vzeroupper
1247 %t2 = extractelement <8 x double> %t1, i32 %index
1251 define i32 @test_extractelement_variable_v4i32(<4 x i32> %t1, i32 %index) nounwind {
1252 ; CHECK-LABEL: test_extractelement_variable_v4i32:
1254 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1255 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1256 ; CHECK-NEXT: andl $3, %edi
1257 ; CHECK-NEXT: movl -24(%rsp,%rdi,4), %eax
1259 %t2 = extractelement <4 x i32> %t1, i32 %index
1263 define i32 @test_extractelement_variable_v8i32(<8 x i32> %t1, i32 %index) nounwind {
1264 ; CHECK-LABEL: test_extractelement_variable_v8i32:
1266 ; CHECK-NEXT: pushq %rbp
1267 ; CHECK-NEXT: movq %rsp, %rbp
1268 ; CHECK-NEXT: andq $-32, %rsp
1269 ; CHECK-NEXT: subq $64, %rsp
1270 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1271 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1272 ; CHECK-NEXT: andl $7, %edi
1273 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
1274 ; CHECK-NEXT: movq %rbp, %rsp
1275 ; CHECK-NEXT: popq %rbp
1276 ; CHECK-NEXT: vzeroupper
1278 %t2 = extractelement <8 x i32> %t1, i32 %index
1282 define i32 @test_extractelement_variable_v16i32(<16 x i32> %t1, i32 %index) nounwind {
1283 ; CHECK-LABEL: test_extractelement_variable_v16i32:
1285 ; CHECK-NEXT: pushq %rbp
1286 ; CHECK-NEXT: movq %rsp, %rbp
1287 ; CHECK-NEXT: andq $-64, %rsp
1288 ; CHECK-NEXT: subq $128, %rsp
1289 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1290 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1291 ; CHECK-NEXT: andl $15, %edi
1292 ; CHECK-NEXT: movl (%rsp,%rdi,4), %eax
1293 ; CHECK-NEXT: movq %rbp, %rsp
1294 ; CHECK-NEXT: popq %rbp
1295 ; CHECK-NEXT: vzeroupper
1297 %t2 = extractelement <16 x i32> %t1, i32 %index
1301 define float @test_extractelement_variable_v4f32(<4 x float> %t1, i32 %index) nounwind {
1302 ; CHECK-LABEL: test_extractelement_variable_v4f32:
1304 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1305 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1306 ; CHECK-NEXT: andl $3, %edi
1307 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1309 %t2 = extractelement <4 x float> %t1, i32 %index
1313 define float @test_extractelement_variable_v8f32(<8 x float> %t1, i32 %index) nounwind {
1314 ; CHECK-LABEL: test_extractelement_variable_v8f32:
1316 ; CHECK-NEXT: pushq %rbp
1317 ; CHECK-NEXT: movq %rsp, %rbp
1318 ; CHECK-NEXT: andq $-32, %rsp
1319 ; CHECK-NEXT: subq $64, %rsp
1320 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1321 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1322 ; CHECK-NEXT: andl $7, %edi
1323 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1324 ; CHECK-NEXT: movq %rbp, %rsp
1325 ; CHECK-NEXT: popq %rbp
1326 ; CHECK-NEXT: vzeroupper
1328 %t2 = extractelement <8 x float> %t1, i32 %index
1332 define float @test_extractelement_variable_v16f32(<16 x float> %t1, i32 %index) nounwind {
1333 ; CHECK-LABEL: test_extractelement_variable_v16f32:
1335 ; CHECK-NEXT: pushq %rbp
1336 ; CHECK-NEXT: movq %rsp, %rbp
1337 ; CHECK-NEXT: andq $-64, %rsp
1338 ; CHECK-NEXT: subq $128, %rsp
1339 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1340 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1341 ; CHECK-NEXT: andl $15, %edi
1342 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1343 ; CHECK-NEXT: movq %rbp, %rsp
1344 ; CHECK-NEXT: popq %rbp
1345 ; CHECK-NEXT: vzeroupper
1347 %t2 = extractelement <16 x float> %t1, i32 %index
1351 define i16 @test_extractelement_variable_v8i16(<8 x i16> %t1, i32 %index) nounwind {
1352 ; CHECK-LABEL: test_extractelement_variable_v8i16:
1354 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1355 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1356 ; CHECK-NEXT: andl $7, %edi
1357 ; CHECK-NEXT: movzwl -24(%rsp,%rdi,2), %eax
1359 %t2 = extractelement <8 x i16> %t1, i32 %index
1363 define i16 @test_extractelement_variable_v16i16(<16 x i16> %t1, i32 %index) nounwind {
1364 ; CHECK-LABEL: test_extractelement_variable_v16i16:
1366 ; CHECK-NEXT: pushq %rbp
1367 ; CHECK-NEXT: movq %rsp, %rbp
1368 ; CHECK-NEXT: andq $-32, %rsp
1369 ; CHECK-NEXT: subq $64, %rsp
1370 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1371 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1372 ; CHECK-NEXT: andl $15, %edi
1373 ; CHECK-NEXT: movzwl (%rsp,%rdi,2), %eax
1374 ; CHECK-NEXT: movq %rbp, %rsp
1375 ; CHECK-NEXT: popq %rbp
1376 ; CHECK-NEXT: vzeroupper
1378 %t2 = extractelement <16 x i16> %t1, i32 %index
1382 define i16 @test_extractelement_variable_v32i16(<32 x i16> %t1, i32 %index) nounwind {
1383 ; CHECK-LABEL: test_extractelement_variable_v32i16:
1385 ; CHECK-NEXT: pushq %rbp
1386 ; CHECK-NEXT: movq %rsp, %rbp
1387 ; CHECK-NEXT: andq $-64, %rsp
1388 ; CHECK-NEXT: subq $128, %rsp
1389 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1390 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1391 ; CHECK-NEXT: andl $31, %edi
1392 ; CHECK-NEXT: movzwl (%rsp,%rdi,2), %eax
1393 ; CHECK-NEXT: movq %rbp, %rsp
1394 ; CHECK-NEXT: popq %rbp
1395 ; CHECK-NEXT: vzeroupper
1397 %t2 = extractelement <32 x i16> %t1, i32 %index
1401 define i8 @test_extractelement_variable_v16i8(<16 x i8> %t1, i32 %index) nounwind {
1402 ; CHECK-LABEL: test_extractelement_variable_v16i8:
1404 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1405 ; CHECK-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
1406 ; CHECK-NEXT: andl $15, %edi
1407 ; CHECK-NEXT: movzbl -24(%rsp,%rdi), %eax
1409 %t2 = extractelement <16 x i8> %t1, i32 %index
1413 define i8 @test_extractelement_variable_v32i8(<32 x i8> %t1, i32 %index) nounwind {
1414 ; CHECK-LABEL: test_extractelement_variable_v32i8:
1416 ; CHECK-NEXT: pushq %rbp
1417 ; CHECK-NEXT: movq %rsp, %rbp
1418 ; CHECK-NEXT: andq $-32, %rsp
1419 ; CHECK-NEXT: subq $64, %rsp
1420 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1421 ; CHECK-NEXT: vmovaps %ymm0, (%rsp)
1422 ; CHECK-NEXT: andl $31, %edi
1423 ; CHECK-NEXT: movzbl (%rsp,%rdi), %eax
1424 ; CHECK-NEXT: movq %rbp, %rsp
1425 ; CHECK-NEXT: popq %rbp
1426 ; CHECK-NEXT: vzeroupper
1429 %t2 = extractelement <32 x i8> %t1, i32 %index
1433 define i8 @test_extractelement_variable_v64i8(<64 x i8> %t1, i32 %index) nounwind {
1434 ; CHECK-LABEL: test_extractelement_variable_v64i8:
1436 ; CHECK-NEXT: pushq %rbp
1437 ; CHECK-NEXT: movq %rsp, %rbp
1438 ; CHECK-NEXT: andq $-64, %rsp
1439 ; CHECK-NEXT: subq $128, %rsp
1440 ; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi
1441 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1442 ; CHECK-NEXT: andl $63, %edi
1443 ; CHECK-NEXT: movzbl (%rsp,%rdi), %eax
1444 ; CHECK-NEXT: movq %rbp, %rsp
1445 ; CHECK-NEXT: popq %rbp
1446 ; CHECK-NEXT: vzeroupper
1449 %t2 = extractelement <64 x i8> %t1, i32 %index
1453 define i8 @test_extractelement_variable_v64i8_indexi8(<64 x i8> %t1, i8 %index) nounwind {
1454 ; CHECK-LABEL: test_extractelement_variable_v64i8_indexi8:
1456 ; CHECK-NEXT: pushq %rbp
1457 ; CHECK-NEXT: movq %rsp, %rbp
1458 ; CHECK-NEXT: andq $-64, %rsp
1459 ; CHECK-NEXT: subq $128, %rsp
1460 ; CHECK-NEXT: addb %dil, %dil
1461 ; CHECK-NEXT: vmovaps %zmm0, (%rsp)
1462 ; CHECK-NEXT: movzbl %dil, %eax
1463 ; CHECK-NEXT: andl $63, %eax
1464 ; CHECK-NEXT: movzbl (%rsp,%rax), %eax
1465 ; CHECK-NEXT: movq %rbp, %rsp
1466 ; CHECK-NEXT: popq %rbp
1467 ; CHECK-NEXT: vzeroupper
1470 %i = add i8 %index, %index
1471 %t2 = extractelement <64 x i8> %t1, i8 %i
1475 define zeroext i8 @test_extractelement_varible_v2i1(<2 x i64> %a, <2 x i64> %b, i32 %index) nounwind {
1476 ; KNL-LABEL: test_extractelement_varible_v2i1:
1478 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1479 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1480 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
1481 ; KNL-NEXT: vpcmpnleuq %zmm1, %zmm0, %k1
1482 ; KNL-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1483 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1484 ; KNL-NEXT: andl $1, %edi
1485 ; KNL-NEXT: movzbl -24(%rsp,%rdi,8), %eax
1486 ; KNL-NEXT: andl $1, %eax
1487 ; KNL-NEXT: vzeroupper
1490 ; SKX-LABEL: test_extractelement_varible_v2i1:
1492 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1493 ; SKX-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
1494 ; SKX-NEXT: vpmovm2q %k0, %xmm0
1495 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1496 ; SKX-NEXT: andl $1, %edi
1497 ; SKX-NEXT: movzbl -24(%rsp,%rdi,8), %eax
1498 ; SKX-NEXT: andl $1, %eax
1500 %t1 = icmp ugt <2 x i64> %a, %b
1501 %t2 = extractelement <2 x i1> %t1, i32 %index
1502 %res = zext i1 %t2 to i8
1506 define zeroext i8 @test_extractelement_varible_v4i1(<4 x i32> %a, <4 x i32> %b, i32 %index) nounwind {
1507 ; KNL-LABEL: test_extractelement_varible_v4i1:
1509 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1510 ; KNL-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1511 ; KNL-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
1512 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1513 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1514 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1515 ; KNL-NEXT: andl $3, %edi
1516 ; KNL-NEXT: movzbl -24(%rsp,%rdi,4), %eax
1517 ; KNL-NEXT: andl $1, %eax
1518 ; KNL-NEXT: vzeroupper
1521 ; SKX-LABEL: test_extractelement_varible_v4i1:
1523 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1524 ; SKX-NEXT: vpcmpnleud %xmm1, %xmm0, %k0
1525 ; SKX-NEXT: vpmovm2d %k0, %xmm0
1526 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1527 ; SKX-NEXT: andl $3, %edi
1528 ; SKX-NEXT: movzbl -24(%rsp,%rdi,4), %eax
1529 ; SKX-NEXT: andl $1, %eax
1531 %t1 = icmp ugt <4 x i32> %a, %b
1532 %t2 = extractelement <4 x i1> %t1, i32 %index
1533 %res = zext i1 %t2 to i8
1537 define zeroext i8 @test_extractelement_varible_v8i1(<8 x i32> %a, <8 x i32> %b, i32 %index) nounwind {
1538 ; KNL-LABEL: test_extractelement_varible_v8i1:
1540 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1541 ; KNL-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
1542 ; KNL-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
1543 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1544 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1545 ; KNL-NEXT: vpmovdw %zmm0, %ymm0
1546 ; KNL-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1547 ; KNL-NEXT: andl $7, %edi
1548 ; KNL-NEXT: movzbl -24(%rsp,%rdi,2), %eax
1549 ; KNL-NEXT: andl $1, %eax
1550 ; KNL-NEXT: vzeroupper
1553 ; SKX-LABEL: test_extractelement_varible_v8i1:
1555 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1556 ; SKX-NEXT: vpcmpnleud %ymm1, %ymm0, %k0
1557 ; SKX-NEXT: vpmovm2w %k0, %xmm0
1558 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1559 ; SKX-NEXT: andl $7, %edi
1560 ; SKX-NEXT: movzbl -24(%rsp,%rdi,2), %eax
1561 ; SKX-NEXT: andl $1, %eax
1562 ; SKX-NEXT: vzeroupper
1564 %t1 = icmp ugt <8 x i32> %a, %b
1565 %t2 = extractelement <8 x i1> %t1, i32 %index
1566 %res = zext i1 %t2 to i8
1570 define zeroext i8 @test_extractelement_varible_v16i1(<16 x i32> %a, <16 x i32> %b, i32 %index) nounwind {
1571 ; KNL-LABEL: test_extractelement_varible_v16i1:
1573 ; KNL-NEXT: ## kill: def $edi killed $edi def $rdi
1574 ; KNL-NEXT: vpcmpnleud %zmm1, %zmm0, %k1
1575 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
1576 ; KNL-NEXT: vpmovdb %zmm0, -{{[0-9]+}}(%rsp)
1577 ; KNL-NEXT: andl $15, %edi
1578 ; KNL-NEXT: movzbl -24(%rsp,%rdi), %eax
1579 ; KNL-NEXT: andl $1, %eax
1580 ; KNL-NEXT: vzeroupper
1583 ; SKX-LABEL: test_extractelement_varible_v16i1:
1585 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1586 ; SKX-NEXT: vpcmpnleud %zmm1, %zmm0, %k0
1587 ; SKX-NEXT: vpmovm2b %k0, %xmm0
1588 ; SKX-NEXT: vmovdqa %xmm0, -{{[0-9]+}}(%rsp)
1589 ; SKX-NEXT: andl $15, %edi
1590 ; SKX-NEXT: movzbl -24(%rsp,%rdi), %eax
1591 ; SKX-NEXT: andl $1, %eax
1592 ; SKX-NEXT: vzeroupper
1594 %t1 = icmp ugt <16 x i32> %a, %b
1595 %t2 = extractelement <16 x i1> %t1, i32 %index
1596 %res = zext i1 %t2 to i8
1600 define zeroext i8 @test_extractelement_varible_v32i1(<32 x i8> %a, <32 x i8> %b, i32 %index) nounwind {
1601 ; KNL-LABEL: test_extractelement_varible_v32i1:
1603 ; KNL-NEXT: vpminub %ymm1, %ymm0, %ymm1
1604 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1605 ; KNL-NEXT: vpmovmskb %ymm0, %ecx
1606 ; KNL-NEXT: xorl %eax, %eax
1607 ; KNL-NEXT: btl %edi, %ecx
1608 ; KNL-NEXT: setae %al
1609 ; KNL-NEXT: vzeroupper
1612 ; SKX-LABEL: test_extractelement_varible_v32i1:
1614 ; SKX-NEXT: pushq %rbp
1615 ; SKX-NEXT: movq %rsp, %rbp
1616 ; SKX-NEXT: andq $-32, %rsp
1617 ; SKX-NEXT: subq $64, %rsp
1618 ; SKX-NEXT: ## kill: def $edi killed $edi def $rdi
1619 ; SKX-NEXT: vpcmpnleub %ymm1, %ymm0, %k0
1620 ; SKX-NEXT: vpmovm2b %k0, %ymm0
1621 ; SKX-NEXT: vmovdqa %ymm0, (%rsp)
1622 ; SKX-NEXT: andl $31, %edi
1623 ; SKX-NEXT: movzbl (%rsp,%rdi), %eax
1624 ; SKX-NEXT: andl $1, %eax
1625 ; SKX-NEXT: movq %rbp, %rsp
1626 ; SKX-NEXT: popq %rbp
1627 ; SKX-NEXT: vzeroupper
1629 %t1 = icmp ugt <32 x i8> %a, %b
1630 %t2 = extractelement <32 x i1> %t1, i32 %index
1631 %res = zext i1 %t2 to i8
1635 define <8 x i64> @insert_double_zero(<2 x i64> %a) nounwind {
1636 ; CHECK-LABEL: insert_double_zero:
1638 ; CHECK-NEXT: vxorps %xmm1, %xmm1, %xmm1
1639 ; CHECK-NEXT: vinsertf32x4 $2, %xmm0, %zmm1, %zmm0
1641 %b = shufflevector <2 x i64> %a, <2 x i64> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1642 %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>
1643 %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>
1647 define i32 @test_insertelement_variable_v32i1(<32 x i8> %a, i8 %b, i32 %index) nounwind {
1648 ; KNL-LABEL: test_insertelement_variable_v32i1:
1650 ; KNL-NEXT: pushq %rbp
1651 ; KNL-NEXT: movq %rsp, %rbp
1652 ; KNL-NEXT: andq $-32, %rsp
1653 ; KNL-NEXT: subq $64, %rsp
1654 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
1655 ; KNL-NEXT: vpxor %xmm1, %xmm1, %xmm1
1656 ; KNL-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1657 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1658 ; KNL-NEXT: andl $31, %esi
1659 ; KNL-NEXT: testb %dil, %dil
1660 ; KNL-NEXT: vmovdqa %ymm0, (%rsp)
1661 ; KNL-NEXT: setne (%rsp,%rsi)
1662 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1663 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1664 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1665 ; KNL-NEXT: kmovw %k0, %ecx
1666 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1667 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1668 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1669 ; KNL-NEXT: kmovw %k0, %eax
1670 ; KNL-NEXT: shll $16, %eax
1671 ; KNL-NEXT: orl %ecx, %eax
1672 ; KNL-NEXT: movq %rbp, %rsp
1673 ; KNL-NEXT: popq %rbp
1674 ; KNL-NEXT: vzeroupper
1677 ; SKX-LABEL: test_insertelement_variable_v32i1:
1679 ; SKX-NEXT: vptestmb %ymm0, %ymm0, %k0
1680 ; SKX-NEXT: testb %dil, %dil
1681 ; SKX-NEXT: setne %al
1682 ; SKX-NEXT: vpbroadcastb %esi, %ymm0
1683 ; SKX-NEXT: vpcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %k1
1684 ; SKX-NEXT: vpmovm2b %k0, %ymm0
1685 ; SKX-NEXT: vpbroadcastb %eax, %ymm0 {%k1}
1686 ; SKX-NEXT: vpsllw $7, %ymm0, %ymm0
1687 ; SKX-NEXT: vpmovb2m %ymm0, %k0
1688 ; SKX-NEXT: kmovd %k0, %eax
1689 ; SKX-NEXT: vzeroupper
1691 %t1 = icmp ugt <32 x i8> %a, zeroinitializer
1692 %t2 = icmp ugt i8 %b, 0
1693 %t3 = insertelement <32 x i1> %t1, i1 %t2, i32 %index
1694 %t4 = bitcast <32 x i1> %t3 to i32
1698 define i64 @test_insertelement_variable_v64i1(<64 x i8> %a, i8 %b, i32 %index) nounwind {
1699 ; KNL-LABEL: test_insertelement_variable_v64i1:
1701 ; KNL-NEXT: pushq %rbp
1702 ; KNL-NEXT: movq %rsp, %rbp
1703 ; KNL-NEXT: andq $-64, %rsp
1704 ; KNL-NEXT: subq $128, %rsp
1705 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
1706 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm1
1707 ; KNL-NEXT: vpxor %xmm2, %xmm2, %xmm2
1708 ; KNL-NEXT: vpcmpeqb %ymm2, %ymm1, %ymm1
1709 ; KNL-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
1710 ; KNL-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
1711 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
1712 ; KNL-NEXT: andl $63, %esi
1713 ; KNL-NEXT: testb %dil, %dil
1714 ; KNL-NEXT: vmovdqa64 %zmm0, (%rsp)
1715 ; KNL-NEXT: setne (%rsp,%rsi)
1716 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1717 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1718 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1719 ; KNL-NEXT: kmovw %k0, %eax
1720 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1721 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1722 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1723 ; KNL-NEXT: kmovw %k0, %ecx
1724 ; KNL-NEXT: shll $16, %ecx
1725 ; KNL-NEXT: orl %eax, %ecx
1726 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1727 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1728 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1729 ; KNL-NEXT: kmovw %k0, %edx
1730 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1731 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1732 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1733 ; KNL-NEXT: kmovw %k0, %eax
1734 ; KNL-NEXT: shll $16, %eax
1735 ; KNL-NEXT: orl %edx, %eax
1736 ; KNL-NEXT: shlq $32, %rax
1737 ; KNL-NEXT: orq %rcx, %rax
1738 ; KNL-NEXT: movq %rbp, %rsp
1739 ; KNL-NEXT: popq %rbp
1740 ; KNL-NEXT: vzeroupper
1743 ; SKX-LABEL: test_insertelement_variable_v64i1:
1745 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
1746 ; SKX-NEXT: testb %dil, %dil
1747 ; SKX-NEXT: setne %al
1748 ; SKX-NEXT: vpbroadcastb %esi, %zmm0
1749 ; SKX-NEXT: vpcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm0, %k1
1750 ; SKX-NEXT: vpmovm2b %k0, %zmm0
1751 ; SKX-NEXT: vpbroadcastb %eax, %zmm0 {%k1}
1752 ; SKX-NEXT: vpsllw $7, %zmm0, %zmm0
1753 ; SKX-NEXT: vpmovb2m %zmm0, %k0
1754 ; SKX-NEXT: kmovq %k0, %rax
1755 ; SKX-NEXT: vzeroupper
1757 %t1 = icmp ugt <64 x i8> %a, zeroinitializer
1758 %t2 = icmp ugt i8 %b, 0
1759 %t3 = insertelement <64 x i1> %t1, i1 %t2, i32 %index
1760 %t4 = bitcast <64 x i1> %t3 to i64
1764 define i96 @test_insertelement_variable_v96i1(<96 x i8> %a, i8 %b, i32 %index) nounwind {
1765 ; KNL-LABEL: test_insertelement_variable_v96i1:
1767 ; KNL-NEXT: pushq %rbp
1768 ; KNL-NEXT: movq %rsp, %rbp
1769 ; KNL-NEXT: andq $-64, %rsp
1770 ; KNL-NEXT: subq $192, %rsp
1771 ; KNL-NEXT: movl 744(%rbp), %eax
1772 ; KNL-NEXT: andl $127, %eax
1773 ; KNL-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
1774 ; KNL-NEXT: vpinsrb $1, 232(%rbp), %xmm0, %xmm0
1775 ; KNL-NEXT: vpinsrb $2, 240(%rbp), %xmm0, %xmm0
1776 ; KNL-NEXT: vpinsrb $3, 248(%rbp), %xmm0, %xmm0
1777 ; KNL-NEXT: vpinsrb $4, 256(%rbp), %xmm0, %xmm0
1778 ; KNL-NEXT: vpinsrb $5, 264(%rbp), %xmm0, %xmm0
1779 ; KNL-NEXT: vpinsrb $6, 272(%rbp), %xmm0, %xmm0
1780 ; KNL-NEXT: vpinsrb $7, 280(%rbp), %xmm0, %xmm0
1781 ; KNL-NEXT: vpinsrb $8, 288(%rbp), %xmm0, %xmm0
1782 ; KNL-NEXT: vpinsrb $9, 296(%rbp), %xmm0, %xmm0
1783 ; KNL-NEXT: vpinsrb $10, 304(%rbp), %xmm0, %xmm0
1784 ; KNL-NEXT: vpinsrb $11, 312(%rbp), %xmm0, %xmm0
1785 ; KNL-NEXT: vpinsrb $12, 320(%rbp), %xmm0, %xmm0
1786 ; KNL-NEXT: vpinsrb $13, 328(%rbp), %xmm0, %xmm0
1787 ; KNL-NEXT: vpinsrb $14, 336(%rbp), %xmm0, %xmm0
1788 ; KNL-NEXT: vpinsrb $15, 344(%rbp), %xmm0, %xmm0
1789 ; KNL-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1790 ; KNL-NEXT: vpinsrb $1, 360(%rbp), %xmm1, %xmm1
1791 ; KNL-NEXT: vpinsrb $2, 368(%rbp), %xmm1, %xmm1
1792 ; KNL-NEXT: vpinsrb $3, 376(%rbp), %xmm1, %xmm1
1793 ; KNL-NEXT: vpinsrb $4, 384(%rbp), %xmm1, %xmm1
1794 ; KNL-NEXT: vpinsrb $5, 392(%rbp), %xmm1, %xmm1
1795 ; KNL-NEXT: vpinsrb $6, 400(%rbp), %xmm1, %xmm1
1796 ; KNL-NEXT: vpinsrb $7, 408(%rbp), %xmm1, %xmm1
1797 ; KNL-NEXT: vpinsrb $8, 416(%rbp), %xmm1, %xmm1
1798 ; KNL-NEXT: vpinsrb $9, 424(%rbp), %xmm1, %xmm1
1799 ; KNL-NEXT: vpinsrb $10, 432(%rbp), %xmm1, %xmm1
1800 ; KNL-NEXT: vpinsrb $11, 440(%rbp), %xmm1, %xmm1
1801 ; KNL-NEXT: vpinsrb $12, 448(%rbp), %xmm1, %xmm1
1802 ; KNL-NEXT: vpinsrb $13, 456(%rbp), %xmm1, %xmm1
1803 ; KNL-NEXT: vpinsrb $14, 464(%rbp), %xmm1, %xmm1
1804 ; KNL-NEXT: vpinsrb $15, 472(%rbp), %xmm1, %xmm1
1805 ; KNL-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm1
1806 ; KNL-NEXT: vpxor %xmm0, %xmm0, %xmm0
1807 ; KNL-NEXT: vpcmpeqb %ymm0, %ymm1, %ymm1
1808 ; KNL-NEXT: vmovd %edi, %xmm2
1809 ; KNL-NEXT: vpinsrb $1, %esi, %xmm2, %xmm2
1810 ; KNL-NEXT: vpinsrb $2, %edx, %xmm2, %xmm2
1811 ; KNL-NEXT: vpinsrb $3, %ecx, %xmm2, %xmm2
1812 ; KNL-NEXT: vpinsrb $4, %r8d, %xmm2, %xmm2
1813 ; KNL-NEXT: vpinsrb $5, %r9d, %xmm2, %xmm2
1814 ; KNL-NEXT: vpinsrb $6, 16(%rbp), %xmm2, %xmm2
1815 ; KNL-NEXT: vpinsrb $7, 24(%rbp), %xmm2, %xmm2
1816 ; KNL-NEXT: vpinsrb $8, 32(%rbp), %xmm2, %xmm2
1817 ; KNL-NEXT: vpinsrb $9, 40(%rbp), %xmm2, %xmm2
1818 ; KNL-NEXT: vpinsrb $10, 48(%rbp), %xmm2, %xmm2
1819 ; KNL-NEXT: vpinsrb $11, 56(%rbp), %xmm2, %xmm2
1820 ; KNL-NEXT: vpinsrb $12, 64(%rbp), %xmm2, %xmm2
1821 ; KNL-NEXT: vpinsrb $13, 72(%rbp), %xmm2, %xmm2
1822 ; KNL-NEXT: vpinsrb $14, 80(%rbp), %xmm2, %xmm2
1823 ; KNL-NEXT: vpinsrb $15, 88(%rbp), %xmm2, %xmm2
1824 ; KNL-NEXT: vmovd {{.*#+}} xmm3 = mem[0],zero,zero,zero
1825 ; KNL-NEXT: vpinsrb $1, 104(%rbp), %xmm3, %xmm3
1826 ; KNL-NEXT: vpinsrb $2, 112(%rbp), %xmm3, %xmm3
1827 ; KNL-NEXT: vpinsrb $3, 120(%rbp), %xmm3, %xmm3
1828 ; KNL-NEXT: vpinsrb $4, 128(%rbp), %xmm3, %xmm3
1829 ; KNL-NEXT: vpinsrb $5, 136(%rbp), %xmm3, %xmm3
1830 ; KNL-NEXT: vpinsrb $6, 144(%rbp), %xmm3, %xmm3
1831 ; KNL-NEXT: vpinsrb $7, 152(%rbp), %xmm3, %xmm3
1832 ; KNL-NEXT: vpinsrb $8, 160(%rbp), %xmm3, %xmm3
1833 ; KNL-NEXT: vpinsrb $9, 168(%rbp), %xmm3, %xmm3
1834 ; KNL-NEXT: vpinsrb $10, 176(%rbp), %xmm3, %xmm3
1835 ; KNL-NEXT: vpinsrb $11, 184(%rbp), %xmm3, %xmm3
1836 ; KNL-NEXT: vpinsrb $12, 192(%rbp), %xmm3, %xmm3
1837 ; KNL-NEXT: vpinsrb $13, 200(%rbp), %xmm3, %xmm3
1838 ; KNL-NEXT: vpinsrb $14, 208(%rbp), %xmm3, %xmm3
1839 ; KNL-NEXT: vpinsrb $15, 216(%rbp), %xmm3, %xmm3
1840 ; KNL-NEXT: vinserti128 $1, %xmm3, %ymm2, %ymm2
1841 ; KNL-NEXT: vpcmpeqb %ymm0, %ymm2, %ymm2
1842 ; KNL-NEXT: vinserti64x4 $1, %ymm1, %zmm2, %zmm1
1843 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1844 ; KNL-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
1845 ; KNL-NEXT: vpinsrb $1, 488(%rbp), %xmm2, %xmm2
1846 ; KNL-NEXT: vpinsrb $2, 496(%rbp), %xmm2, %xmm2
1847 ; KNL-NEXT: vpinsrb $3, 504(%rbp), %xmm2, %xmm2
1848 ; KNL-NEXT: vpinsrb $4, 512(%rbp), %xmm2, %xmm2
1849 ; KNL-NEXT: vpinsrb $5, 520(%rbp), %xmm2, %xmm2
1850 ; KNL-NEXT: vpinsrb $6, 528(%rbp), %xmm2, %xmm2
1851 ; KNL-NEXT: vpinsrb $7, 536(%rbp), %xmm2, %xmm2
1852 ; KNL-NEXT: vpinsrb $8, 544(%rbp), %xmm2, %xmm2
1853 ; KNL-NEXT: vpinsrb $9, 552(%rbp), %xmm2, %xmm2
1854 ; KNL-NEXT: vpinsrb $10, 560(%rbp), %xmm2, %xmm2
1855 ; KNL-NEXT: vpinsrb $11, 568(%rbp), %xmm2, %xmm2
1856 ; KNL-NEXT: vpinsrb $12, 576(%rbp), %xmm2, %xmm2
1857 ; KNL-NEXT: vpinsrb $13, 584(%rbp), %xmm2, %xmm2
1858 ; KNL-NEXT: vpinsrb $14, 592(%rbp), %xmm2, %xmm2
1859 ; KNL-NEXT: vpinsrb $15, 600(%rbp), %xmm2, %xmm2
1860 ; KNL-NEXT: vmovd {{.*#+}} xmm3 = mem[0],zero,zero,zero
1861 ; KNL-NEXT: vpinsrb $1, 616(%rbp), %xmm3, %xmm3
1862 ; KNL-NEXT: vpinsrb $2, 624(%rbp), %xmm3, %xmm3
1863 ; KNL-NEXT: vpinsrb $3, 632(%rbp), %xmm3, %xmm3
1864 ; KNL-NEXT: vpinsrb $4, 640(%rbp), %xmm3, %xmm3
1865 ; KNL-NEXT: vpinsrb $5, 648(%rbp), %xmm3, %xmm3
1866 ; KNL-NEXT: vpinsrb $6, 656(%rbp), %xmm3, %xmm3
1867 ; KNL-NEXT: vpinsrb $7, 664(%rbp), %xmm3, %xmm3
1868 ; KNL-NEXT: vpinsrb $8, 672(%rbp), %xmm3, %xmm3
1869 ; KNL-NEXT: vpinsrb $9, 680(%rbp), %xmm3, %xmm3
1870 ; KNL-NEXT: vpinsrb $10, 688(%rbp), %xmm3, %xmm3
1871 ; KNL-NEXT: vpinsrb $11, 696(%rbp), %xmm3, %xmm3
1872 ; KNL-NEXT: vpinsrb $12, 704(%rbp), %xmm3, %xmm3
1873 ; KNL-NEXT: vpinsrb $13, 712(%rbp), %xmm3, %xmm3
1874 ; KNL-NEXT: vpinsrb $14, 720(%rbp), %xmm3, %xmm3
1875 ; KNL-NEXT: vpinsrb $15, 728(%rbp), %xmm3, %xmm3
1876 ; KNL-NEXT: vinserti128 $1, %xmm3, %ymm2, %ymm2
1877 ; KNL-NEXT: vpcmpeqb %ymm0, %ymm2, %ymm2
1878 ; KNL-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1879 ; KNL-NEXT: cmpb $0, 736(%rbp)
1880 ; KNL-NEXT: vmovdqa %ymm0, {{[0-9]+}}(%rsp)
1881 ; KNL-NEXT: vmovdqa %ymm2, {{[0-9]+}}(%rsp)
1882 ; KNL-NEXT: vmovdqa64 %zmm1, (%rsp)
1883 ; KNL-NEXT: setne (%rsp,%rax)
1884 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
1885 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1886 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1887 ; KNL-NEXT: kmovw %k0, %eax
1888 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1889 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1890 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1891 ; KNL-NEXT: kmovw %k0, %ecx
1892 ; KNL-NEXT: shll $16, %ecx
1893 ; KNL-NEXT: orl %eax, %ecx
1894 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1895 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1896 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1897 ; KNL-NEXT: kmovw %k0, %edx
1898 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1899 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1900 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1901 ; KNL-NEXT: kmovw %k0, %eax
1902 ; KNL-NEXT: shll $16, %eax
1903 ; KNL-NEXT: orl %edx, %eax
1904 ; KNL-NEXT: shlq $32, %rax
1905 ; KNL-NEXT: orq %rcx, %rax
1906 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1907 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1908 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1909 ; KNL-NEXT: kmovw %k0, %ecx
1910 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1911 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1912 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1913 ; KNL-NEXT: kmovw %k0, %esi
1914 ; KNL-NEXT: shll $16, %esi
1915 ; KNL-NEXT: orl %ecx, %esi
1916 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1917 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1918 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1919 ; KNL-NEXT: kmovw %k0, %ecx
1920 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
1921 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
1922 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
1923 ; KNL-NEXT: kmovw %k0, %edx
1924 ; KNL-NEXT: shll $16, %edx
1925 ; KNL-NEXT: orl %ecx, %edx
1926 ; KNL-NEXT: shlq $32, %rdx
1927 ; KNL-NEXT: orq %rsi, %rdx
1928 ; KNL-NEXT: movq %rbp, %rsp
1929 ; KNL-NEXT: popq %rbp
1930 ; KNL-NEXT: vzeroupper
1933 ; SKX-LABEL: test_insertelement_variable_v96i1:
1935 ; SKX-NEXT: pushq %rbp
1936 ; SKX-NEXT: movq %rsp, %rbp
1937 ; SKX-NEXT: andq $-64, %rsp
1938 ; SKX-NEXT: subq $192, %rsp
1939 ; SKX-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
1940 ; SKX-NEXT: vpinsrb $1, 232(%rbp), %xmm0, %xmm0
1941 ; SKX-NEXT: vpinsrb $2, 240(%rbp), %xmm0, %xmm0
1942 ; SKX-NEXT: vpinsrb $3, 248(%rbp), %xmm0, %xmm0
1943 ; SKX-NEXT: vpinsrb $4, 256(%rbp), %xmm0, %xmm0
1944 ; SKX-NEXT: vpinsrb $5, 264(%rbp), %xmm0, %xmm0
1945 ; SKX-NEXT: vpinsrb $6, 272(%rbp), %xmm0, %xmm0
1946 ; SKX-NEXT: vpinsrb $7, 280(%rbp), %xmm0, %xmm0
1947 ; SKX-NEXT: vpinsrb $8, 288(%rbp), %xmm0, %xmm0
1948 ; SKX-NEXT: vpinsrb $9, 296(%rbp), %xmm0, %xmm0
1949 ; SKX-NEXT: vpinsrb $10, 304(%rbp), %xmm0, %xmm0
1950 ; SKX-NEXT: vpinsrb $11, 312(%rbp), %xmm0, %xmm0
1951 ; SKX-NEXT: vpinsrb $12, 320(%rbp), %xmm0, %xmm0
1952 ; SKX-NEXT: vpinsrb $13, 328(%rbp), %xmm0, %xmm0
1953 ; SKX-NEXT: vpinsrb $14, 336(%rbp), %xmm0, %xmm0
1954 ; SKX-NEXT: vpinsrb $15, 344(%rbp), %xmm0, %xmm0
1955 ; SKX-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1956 ; SKX-NEXT: vpinsrb $1, 360(%rbp), %xmm1, %xmm1
1957 ; SKX-NEXT: vpinsrb $2, 368(%rbp), %xmm1, %xmm1
1958 ; SKX-NEXT: vpinsrb $3, 376(%rbp), %xmm1, %xmm1
1959 ; SKX-NEXT: vpinsrb $4, 384(%rbp), %xmm1, %xmm1
1960 ; SKX-NEXT: vpinsrb $5, 392(%rbp), %xmm1, %xmm1
1961 ; SKX-NEXT: vpinsrb $6, 400(%rbp), %xmm1, %xmm1
1962 ; SKX-NEXT: vpinsrb $7, 408(%rbp), %xmm1, %xmm1
1963 ; SKX-NEXT: vpinsrb $8, 416(%rbp), %xmm1, %xmm1
1964 ; SKX-NEXT: vpinsrb $9, 424(%rbp), %xmm1, %xmm1
1965 ; SKX-NEXT: vpinsrb $10, 432(%rbp), %xmm1, %xmm1
1966 ; SKX-NEXT: vpinsrb $11, 440(%rbp), %xmm1, %xmm1
1967 ; SKX-NEXT: vpinsrb $12, 448(%rbp), %xmm1, %xmm1
1968 ; SKX-NEXT: vpinsrb $13, 456(%rbp), %xmm1, %xmm1
1969 ; SKX-NEXT: vpinsrb $14, 464(%rbp), %xmm1, %xmm1
1970 ; SKX-NEXT: vpinsrb $15, 472(%rbp), %xmm1, %xmm1
1971 ; SKX-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
1972 ; SKX-NEXT: vmovd %edi, %xmm1
1973 ; SKX-NEXT: vpinsrb $1, %esi, %xmm1, %xmm1
1974 ; SKX-NEXT: vpinsrb $2, %edx, %xmm1, %xmm1
1975 ; SKX-NEXT: vpinsrb $3, %ecx, %xmm1, %xmm1
1976 ; SKX-NEXT: vpinsrb $4, %r8d, %xmm1, %xmm1
1977 ; SKX-NEXT: vpinsrb $5, %r9d, %xmm1, %xmm1
1978 ; SKX-NEXT: vpinsrb $6, 16(%rbp), %xmm1, %xmm1
1979 ; SKX-NEXT: vpinsrb $7, 24(%rbp), %xmm1, %xmm1
1980 ; SKX-NEXT: vpinsrb $8, 32(%rbp), %xmm1, %xmm1
1981 ; SKX-NEXT: vpinsrb $9, 40(%rbp), %xmm1, %xmm1
1982 ; SKX-NEXT: vpinsrb $10, 48(%rbp), %xmm1, %xmm1
1983 ; SKX-NEXT: vpinsrb $11, 56(%rbp), %xmm1, %xmm1
1984 ; SKX-NEXT: vpinsrb $12, 64(%rbp), %xmm1, %xmm1
1985 ; SKX-NEXT: vpinsrb $13, 72(%rbp), %xmm1, %xmm1
1986 ; SKX-NEXT: vpinsrb $14, 80(%rbp), %xmm1, %xmm1
1987 ; SKX-NEXT: vpinsrb $15, 88(%rbp), %xmm1, %xmm1
1988 ; SKX-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
1989 ; SKX-NEXT: vpinsrb $1, 104(%rbp), %xmm2, %xmm2
1990 ; SKX-NEXT: vpinsrb $2, 112(%rbp), %xmm2, %xmm2
1991 ; SKX-NEXT: vpinsrb $3, 120(%rbp), %xmm2, %xmm2
1992 ; SKX-NEXT: vpinsrb $4, 128(%rbp), %xmm2, %xmm2
1993 ; SKX-NEXT: vpinsrb $5, 136(%rbp), %xmm2, %xmm2
1994 ; SKX-NEXT: vpinsrb $6, 144(%rbp), %xmm2, %xmm2
1995 ; SKX-NEXT: vpinsrb $7, 152(%rbp), %xmm2, %xmm2
1996 ; SKX-NEXT: vpinsrb $8, 160(%rbp), %xmm2, %xmm2
1997 ; SKX-NEXT: vpinsrb $9, 168(%rbp), %xmm2, %xmm2
1998 ; SKX-NEXT: vpinsrb $10, 176(%rbp), %xmm2, %xmm2
1999 ; SKX-NEXT: vpinsrb $11, 184(%rbp), %xmm2, %xmm2
2000 ; SKX-NEXT: vpinsrb $12, 192(%rbp), %xmm2, %xmm2
2001 ; SKX-NEXT: vpinsrb $13, 200(%rbp), %xmm2, %xmm2
2002 ; SKX-NEXT: vpinsrb $14, 208(%rbp), %xmm2, %xmm2
2003 ; SKX-NEXT: vpinsrb $15, 216(%rbp), %xmm2, %xmm2
2004 ; SKX-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
2005 ; SKX-NEXT: vinserti64x4 $1, %ymm0, %zmm1, %zmm0
2006 ; SKX-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
2007 ; SKX-NEXT: vpinsrb $1, 488(%rbp), %xmm1, %xmm1
2008 ; SKX-NEXT: vpinsrb $2, 496(%rbp), %xmm1, %xmm1
2009 ; SKX-NEXT: vpinsrb $3, 504(%rbp), %xmm1, %xmm1
2010 ; SKX-NEXT: vpinsrb $4, 512(%rbp), %xmm1, %xmm1
2011 ; SKX-NEXT: vpinsrb $5, 520(%rbp), %xmm1, %xmm1
2012 ; SKX-NEXT: vpinsrb $6, 528(%rbp), %xmm1, %xmm1
2013 ; SKX-NEXT: vpinsrb $7, 536(%rbp), %xmm1, %xmm1
2014 ; SKX-NEXT: vpinsrb $8, 544(%rbp), %xmm1, %xmm1
2015 ; SKX-NEXT: vpinsrb $9, 552(%rbp), %xmm1, %xmm1
2016 ; SKX-NEXT: vpinsrb $10, 560(%rbp), %xmm1, %xmm1
2017 ; SKX-NEXT: vpinsrb $11, 568(%rbp), %xmm1, %xmm1
2018 ; SKX-NEXT: vpinsrb $12, 576(%rbp), %xmm1, %xmm1
2019 ; SKX-NEXT: vpinsrb $13, 584(%rbp), %xmm1, %xmm1
2020 ; SKX-NEXT: vpinsrb $14, 592(%rbp), %xmm1, %xmm1
2021 ; SKX-NEXT: vpinsrb $15, 600(%rbp), %xmm1, %xmm1
2022 ; SKX-NEXT: vmovd {{.*#+}} xmm2 = mem[0],zero,zero,zero
2023 ; SKX-NEXT: vpinsrb $1, 616(%rbp), %xmm2, %xmm2
2024 ; SKX-NEXT: vpinsrb $2, 624(%rbp), %xmm2, %xmm2
2025 ; SKX-NEXT: vpinsrb $3, 632(%rbp), %xmm2, %xmm2
2026 ; SKX-NEXT: vpinsrb $4, 640(%rbp), %xmm2, %xmm2
2027 ; SKX-NEXT: vpinsrb $5, 648(%rbp), %xmm2, %xmm2
2028 ; SKX-NEXT: vpinsrb $6, 656(%rbp), %xmm2, %xmm2
2029 ; SKX-NEXT: vpinsrb $7, 664(%rbp), %xmm2, %xmm2
2030 ; SKX-NEXT: vpinsrb $8, 672(%rbp), %xmm2, %xmm2
2031 ; SKX-NEXT: vpinsrb $9, 680(%rbp), %xmm2, %xmm2
2032 ; SKX-NEXT: vpinsrb $10, 688(%rbp), %xmm2, %xmm2
2033 ; SKX-NEXT: vpinsrb $11, 696(%rbp), %xmm2, %xmm2
2034 ; SKX-NEXT: vpinsrb $12, 704(%rbp), %xmm2, %xmm2
2035 ; SKX-NEXT: vpinsrb $13, 712(%rbp), %xmm2, %xmm2
2036 ; SKX-NEXT: vpinsrb $14, 720(%rbp), %xmm2, %xmm2
2037 ; SKX-NEXT: vpinsrb $15, 728(%rbp), %xmm2, %xmm2
2038 ; SKX-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
2039 ; SKX-NEXT: movl 744(%rbp), %eax
2040 ; SKX-NEXT: andl $127, %eax
2041 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
2042 ; SKX-NEXT: vptestmb %zmm1, %zmm1, %k1
2043 ; SKX-NEXT: cmpb $0, 736(%rbp)
2044 ; SKX-NEXT: vpmovm2b %k1, %zmm0
2045 ; SKX-NEXT: vmovdqa64 %zmm0, {{[0-9]+}}(%rsp)
2046 ; SKX-NEXT: vpmovm2b %k0, %zmm0
2047 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
2048 ; SKX-NEXT: setne (%rsp,%rax)
2049 ; SKX-NEXT: vpsllw $7, {{[0-9]+}}(%rsp), %zmm0
2050 ; SKX-NEXT: vpmovb2m %zmm0, %k0
2051 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
2052 ; SKX-NEXT: vpmovb2m %zmm0, %k1
2053 ; SKX-NEXT: kmovq %k1, %rax
2054 ; SKX-NEXT: kmovq %k0, %rdx
2055 ; SKX-NEXT: movq %rbp, %rsp
2056 ; SKX-NEXT: popq %rbp
2057 ; SKX-NEXT: vzeroupper
2059 %t1 = icmp ugt <96 x i8> %a, zeroinitializer
2060 %t2 = icmp ugt i8 %b, 0
2061 %t3 = insertelement <96 x i1> %t1, i1 %t2, i32 %index
2062 %t4 = bitcast <96 x i1> %t3 to i96
2066 define i128 @test_insertelement_variable_v128i1(<128 x i8> %a, i8 %b, i32 %index) nounwind {
2067 ; KNL-LABEL: test_insertelement_variable_v128i1:
2069 ; KNL-NEXT: pushq %rbp
2070 ; KNL-NEXT: movq %rsp, %rbp
2071 ; KNL-NEXT: andq $-64, %rsp
2072 ; KNL-NEXT: subq $192, %rsp
2073 ; KNL-NEXT: ## kill: def $esi killed $esi def $rsi
2074 ; KNL-NEXT: vextracti64x4 $1, %zmm0, %ymm2
2075 ; KNL-NEXT: vpxor %xmm3, %xmm3, %xmm3
2076 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm2, %ymm2
2077 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm0, %ymm0
2078 ; KNL-NEXT: vinserti64x4 $1, %ymm2, %zmm0, %zmm0
2079 ; KNL-NEXT: vpternlogq $15, %zmm0, %zmm0, %zmm0
2080 ; KNL-NEXT: vextracti64x4 $1, %zmm1, %ymm2
2081 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm2, %ymm2
2082 ; KNL-NEXT: vpcmpeqb %ymm3, %ymm1, %ymm1
2083 ; KNL-NEXT: vinserti64x4 $1, %ymm2, %zmm1, %zmm1
2084 ; KNL-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
2085 ; KNL-NEXT: andl $127, %esi
2086 ; KNL-NEXT: testb %dil, %dil
2087 ; KNL-NEXT: vmovdqa64 %zmm1, {{[0-9]+}}(%rsp)
2088 ; KNL-NEXT: vmovdqa64 %zmm0, (%rsp)
2089 ; KNL-NEXT: setne (%rsp,%rsi)
2090 ; KNL-NEXT: vpmovsxbd (%rsp), %zmm0
2091 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2092 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2093 ; KNL-NEXT: kmovw %k0, %eax
2094 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2095 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2096 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2097 ; KNL-NEXT: kmovw %k0, %ecx
2098 ; KNL-NEXT: shll $16, %ecx
2099 ; KNL-NEXT: orl %eax, %ecx
2100 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2101 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2102 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2103 ; KNL-NEXT: kmovw %k0, %edx
2104 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2105 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2106 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2107 ; KNL-NEXT: kmovw %k0, %eax
2108 ; KNL-NEXT: shll $16, %eax
2109 ; KNL-NEXT: orl %edx, %eax
2110 ; KNL-NEXT: shlq $32, %rax
2111 ; KNL-NEXT: orq %rcx, %rax
2112 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2113 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2114 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2115 ; KNL-NEXT: kmovw %k0, %ecx
2116 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2117 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2118 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2119 ; KNL-NEXT: kmovw %k0, %esi
2120 ; KNL-NEXT: shll $16, %esi
2121 ; KNL-NEXT: orl %ecx, %esi
2122 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2123 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2124 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2125 ; KNL-NEXT: kmovw %k0, %ecx
2126 ; KNL-NEXT: vpmovsxbd {{[0-9]+}}(%rsp), %zmm0
2127 ; KNL-NEXT: vpslld $31, %zmm0, %zmm0
2128 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0
2129 ; KNL-NEXT: kmovw %k0, %edx
2130 ; KNL-NEXT: shll $16, %edx
2131 ; KNL-NEXT: orl %ecx, %edx
2132 ; KNL-NEXT: shlq $32, %rdx
2133 ; KNL-NEXT: orq %rsi, %rdx
2134 ; KNL-NEXT: movq %rbp, %rsp
2135 ; KNL-NEXT: popq %rbp
2136 ; KNL-NEXT: vzeroupper
2139 ; SKX-LABEL: test_insertelement_variable_v128i1:
2141 ; SKX-NEXT: pushq %rbp
2142 ; SKX-NEXT: movq %rsp, %rbp
2143 ; SKX-NEXT: andq $-64, %rsp
2144 ; SKX-NEXT: subq $192, %rsp
2145 ; SKX-NEXT: ## kill: def $esi killed $esi def $rsi
2146 ; SKX-NEXT: vptestmb %zmm0, %zmm0, %k0
2147 ; SKX-NEXT: vptestmb %zmm1, %zmm1, %k1
2148 ; SKX-NEXT: andl $127, %esi
2149 ; SKX-NEXT: testb %dil, %dil
2150 ; SKX-NEXT: vpmovm2b %k1, %zmm0
2151 ; SKX-NEXT: vmovdqa64 %zmm0, {{[0-9]+}}(%rsp)
2152 ; SKX-NEXT: vpmovm2b %k0, %zmm0
2153 ; SKX-NEXT: vmovdqa64 %zmm0, (%rsp)
2154 ; SKX-NEXT: setne (%rsp,%rsi)
2155 ; SKX-NEXT: vpsllw $7, {{[0-9]+}}(%rsp), %zmm0
2156 ; SKX-NEXT: vpmovb2m %zmm0, %k0
2157 ; SKX-NEXT: vpsllw $7, (%rsp), %zmm0
2158 ; SKX-NEXT: vpmovb2m %zmm0, %k1
2159 ; SKX-NEXT: kmovq %k1, %rax
2160 ; SKX-NEXT: kmovq %k0, %rdx
2161 ; SKX-NEXT: movq %rbp, %rsp
2162 ; SKX-NEXT: popq %rbp
2163 ; SKX-NEXT: vzeroupper
2165 %t1 = icmp ugt <128 x i8> %a, zeroinitializer
2166 %t2 = icmp ugt i8 %b, 0
2167 %t3 = insertelement <128 x i1> %t1, i1 %t2, i32 %index
2168 %t4 = bitcast <128 x i1> %t3 to i128
2172 define void @test_concat_v2i1(ptr %arg, ptr %arg1, ptr %arg2) nounwind {
2173 ; KNL-LABEL: test_concat_v2i1:
2175 ; KNL-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
2176 ; KNL-NEXT: vpextrw $0, %xmm0, %eax
2177 ; KNL-NEXT: movzwl %ax, %eax
2178 ; KNL-NEXT: vmovd %eax, %xmm1
2179 ; KNL-NEXT: vcvtph2ps %xmm1, %xmm1
2180 ; KNL-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
2181 ; KNL-NEXT: vucomiss %xmm2, %xmm1
2182 ; KNL-NEXT: setb %al
2183 ; KNL-NEXT: andl $1, %eax
2184 ; KNL-NEXT: kmovw %eax, %k0
2185 ; KNL-NEXT: vpsrld $16, %xmm0, %xmm0
2186 ; KNL-NEXT: vpextrw $0, %xmm0, %eax
2187 ; KNL-NEXT: movzwl %ax, %eax
2188 ; KNL-NEXT: vmovd %eax, %xmm0
2189 ; KNL-NEXT: vcvtph2ps %xmm0, %xmm0
2190 ; KNL-NEXT: vucomiss %xmm2, %xmm0
2191 ; KNL-NEXT: setb %al
2192 ; KNL-NEXT: kmovw %eax, %k1
2193 ; KNL-NEXT: kshiftlw $1, %k1, %k1
2194 ; KNL-NEXT: korw %k1, %k0, %k0
2195 ; KNL-NEXT: vxorps %xmm2, %xmm2, %xmm2
2196 ; KNL-NEXT: vucomiss %xmm2, %xmm1
2197 ; KNL-NEXT: seta %al
2198 ; KNL-NEXT: andl $1, %eax
2199 ; KNL-NEXT: kmovw %eax, %k1
2200 ; KNL-NEXT: vucomiss %xmm2, %xmm0
2201 ; KNL-NEXT: seta %al
2202 ; KNL-NEXT: kmovw %eax, %k2
2203 ; KNL-NEXT: kshiftlw $1, %k2, %k2
2204 ; KNL-NEXT: korw %k2, %k1, %k1
2205 ; KNL-NEXT: kandw %k1, %k0, %k1
2206 ; KNL-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
2207 ; KNL-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1 {%k1} {z}
2208 ; KNL-NEXT: vpmovdw %zmm1, %ymm1
2209 ; KNL-NEXT: vpand %xmm0, %xmm1, %xmm0
2210 ; KNL-NEXT: vmovd %xmm0, (%rdx)
2211 ; KNL-NEXT: vzeroupper
2214 ; SKX-LABEL: test_concat_v2i1:
2216 ; SKX-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
2217 ; SKX-NEXT: vpsrld $16, %xmm0, %xmm1
2218 ; SKX-NEXT: vpextrw $0, %xmm1, %eax
2219 ; SKX-NEXT: movzwl %ax, %eax
2220 ; SKX-NEXT: vmovd %eax, %xmm1
2221 ; SKX-NEXT: vcvtph2ps %xmm1, %xmm1
2222 ; SKX-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
2223 ; SKX-NEXT: vucomiss %xmm2, %xmm1
2224 ; SKX-NEXT: setb %al
2225 ; SKX-NEXT: kmovd %eax, %k0
2226 ; SKX-NEXT: kshiftlb $1, %k0, %k0
2227 ; SKX-NEXT: vpextrw $0, %xmm0, %eax
2228 ; SKX-NEXT: movzwl %ax, %eax
2229 ; SKX-NEXT: vmovd %eax, %xmm0
2230 ; SKX-NEXT: vcvtph2ps %xmm0, %xmm0
2231 ; SKX-NEXT: vucomiss %xmm2, %xmm0
2232 ; SKX-NEXT: setb %al
2233 ; SKX-NEXT: kmovd %eax, %k1
2234 ; SKX-NEXT: kshiftlb $7, %k1, %k1
2235 ; SKX-NEXT: kshiftrb $7, %k1, %k1
2236 ; SKX-NEXT: korw %k0, %k1, %k0
2237 ; SKX-NEXT: vxorps %xmm2, %xmm2, %xmm2
2238 ; SKX-NEXT: vucomiss %xmm2, %xmm1
2239 ; SKX-NEXT: seta %al
2240 ; SKX-NEXT: kmovd %eax, %k1
2241 ; SKX-NEXT: kshiftlb $1, %k1, %k1
2242 ; SKX-NEXT: vucomiss %xmm2, %xmm0
2243 ; SKX-NEXT: seta %al
2244 ; SKX-NEXT: kmovd %eax, %k2
2245 ; SKX-NEXT: kshiftlb $7, %k2, %k2
2246 ; SKX-NEXT: kshiftrb $7, %k2, %k2
2247 ; SKX-NEXT: korw %k1, %k2, %k1
2248 ; SKX-NEXT: kandw %k1, %k0, %k1
2249 ; SKX-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
2250 ; SKX-NEXT: vmovdqu16 %xmm0, %xmm0 {%k1} {z}
2251 ; SKX-NEXT: vmovd %xmm0, (%rdx)
2253 %tmp = load <2 x half>, ptr %arg, align 8
2254 %tmp3 = fcmp fast olt <2 x half> %tmp, <half 0xH4600, half 0xH4600>
2255 %tmp4 = fcmp fast ogt <2 x half> %tmp, zeroinitializer
2256 %tmp5 = and <2 x i1> %tmp3, %tmp4
2257 %tmp6 = load <2 x half>, ptr %arg1, align 8
2258 %tmp7 = select <2 x i1> %tmp5, <2 x half> %tmp6, <2 x half> zeroinitializer
2259 store <2 x half> %tmp7, ptr %arg2, align 8
2263 ; Check that an extracted bool element comparison is correctly extended when
2264 ; the bool vector is bitcasted instead.
2265 define void @test_extractelement_v64i1_cmp0(<64 x i1> %0) nounwind {
2266 ; KNL-LABEL: test_extractelement_v64i1_cmp0:
2267 ; KNL: ## %bb.0: ## %entry
2270 ; SKX-LABEL: test_extractelement_v64i1_cmp0:
2271 ; SKX: ## %bb.0: ## %entry
2272 ; SKX-NEXT: vzeroupper
2275 %1 = extractelement <64 x i1> %0, i64 0
2276 br i1 %1, label %common.ret, label %2
2278 common.ret: ; preds = %2, %entry
2282 %3 = extractelement <64 x i1> zeroinitializer, i64 0
2283 br label %common.ret