1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.2 | FileCheck %s --check-prefixes=SSE
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX12,AVX1
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX12,AVX2
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=AVX512 --check-prefix=AVX512F
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefix=AVX512 --check-prefix=AVX512BW
8 define i32 @v32i16(<32 x i16> %a, <32 x i16> %b) {
11 ; SSE-NEXT: pcmpgtw %xmm5, %xmm1
12 ; SSE-NEXT: pcmpgtw %xmm4, %xmm0
13 ; SSE-NEXT: packsswb %xmm1, %xmm0
14 ; SSE-NEXT: pmovmskb %xmm0, %ecx
15 ; SSE-NEXT: pcmpgtw %xmm7, %xmm3
16 ; SSE-NEXT: pcmpgtw %xmm6, %xmm2
17 ; SSE-NEXT: packsswb %xmm3, %xmm2
18 ; SSE-NEXT: pmovmskb %xmm2, %eax
19 ; SSE-NEXT: shll $16, %eax
20 ; SSE-NEXT: orl %ecx, %eax
25 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm4
26 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm5
27 ; AVX1-NEXT: vpcmpgtw %xmm4, %xmm5, %xmm4
28 ; AVX1-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
29 ; AVX1-NEXT: vpacksswb %xmm4, %xmm0, %xmm0
30 ; AVX1-NEXT: vpmovmskb %xmm0, %ecx
31 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm0
32 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
33 ; AVX1-NEXT: vpcmpgtw %xmm0, %xmm2, %xmm0
34 ; AVX1-NEXT: vpcmpgtw %xmm3, %xmm1, %xmm1
35 ; AVX1-NEXT: vpacksswb %xmm0, %xmm1, %xmm0
36 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
37 ; AVX1-NEXT: shll $16, %eax
38 ; AVX1-NEXT: orl %ecx, %eax
39 ; AVX1-NEXT: vzeroupper
44 ; AVX2-NEXT: vpcmpgtw %ymm3, %ymm1, %ymm1
45 ; AVX2-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
46 ; AVX2-NEXT: vpacksswb %ymm1, %ymm0, %ymm0
47 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
48 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
49 ; AVX2-NEXT: vzeroupper
52 ; AVX512F-LABEL: v32i16:
54 ; AVX512F-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
55 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
56 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
57 ; AVX512F-NEXT: kmovw %k0, %ecx
58 ; AVX512F-NEXT: vpcmpgtw %ymm3, %ymm1, %ymm0
59 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
60 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
61 ; AVX512F-NEXT: kmovw %k0, %eax
62 ; AVX512F-NEXT: shll $16, %eax
63 ; AVX512F-NEXT: orl %ecx, %eax
64 ; AVX512F-NEXT: vzeroupper
67 ; AVX512BW-LABEL: v32i16:
69 ; AVX512BW-NEXT: vpcmpgtw %zmm1, %zmm0, %k0
70 ; AVX512BW-NEXT: kmovd %k0, %eax
71 ; AVX512BW-NEXT: vzeroupper
73 %x = icmp sgt <32 x i16> %a, %b
74 %res = bitcast <32 x i1> %x to i32
78 define i16 @v16i32(<16 x i32> %a, <16 x i32> %b) {
81 ; SSE-NEXT: pcmpgtd %xmm7, %xmm3
82 ; SSE-NEXT: pcmpgtd %xmm6, %xmm2
83 ; SSE-NEXT: packssdw %xmm3, %xmm2
84 ; SSE-NEXT: pcmpgtd %xmm5, %xmm1
85 ; SSE-NEXT: pcmpgtd %xmm4, %xmm0
86 ; SSE-NEXT: packssdw %xmm1, %xmm0
87 ; SSE-NEXT: packsswb %xmm2, %xmm0
88 ; SSE-NEXT: pmovmskb %xmm0, %eax
89 ; SSE-NEXT: # kill: def $ax killed $ax killed $eax
94 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm4
95 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
96 ; AVX1-NEXT: vpcmpgtd %xmm4, %xmm5, %xmm4
97 ; AVX1-NEXT: vpcmpgtd %xmm3, %xmm1, %xmm1
98 ; AVX1-NEXT: vpackssdw %xmm4, %xmm1, %xmm1
99 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
100 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm4
101 ; AVX1-NEXT: vpcmpgtd %xmm3, %xmm4, %xmm3
102 ; AVX1-NEXT: vpcmpgtd %xmm2, %xmm0, %xmm0
103 ; AVX1-NEXT: vpackssdw %xmm3, %xmm0, %xmm0
104 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
105 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
106 ; AVX1-NEXT: # kill: def $ax killed $ax killed $eax
107 ; AVX1-NEXT: vzeroupper
110 ; AVX2-LABEL: v16i32:
112 ; AVX2-NEXT: vpcmpgtd %ymm3, %ymm1, %ymm1
113 ; AVX2-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
114 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
115 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
116 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
117 ; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
118 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
119 ; AVX2-NEXT: # kill: def $ax killed $ax killed $eax
120 ; AVX2-NEXT: vzeroupper
123 ; AVX512F-LABEL: v16i32:
125 ; AVX512F-NEXT: vpcmpgtd %zmm1, %zmm0, %k0
126 ; AVX512F-NEXT: kmovw %k0, %eax
127 ; AVX512F-NEXT: # kill: def $ax killed $ax killed $eax
128 ; AVX512F-NEXT: vzeroupper
131 ; AVX512BW-LABEL: v16i32:
133 ; AVX512BW-NEXT: vpcmpgtd %zmm1, %zmm0, %k0
134 ; AVX512BW-NEXT: kmovd %k0, %eax
135 ; AVX512BW-NEXT: # kill: def $ax killed $ax killed $eax
136 ; AVX512BW-NEXT: vzeroupper
137 ; AVX512BW-NEXT: retq
138 %x = icmp sgt <16 x i32> %a, %b
139 %res = bitcast <16 x i1> %x to i16
143 define i16 @v16f32(<16 x float> %a, <16 x float> %b) {
146 ; SSE-NEXT: cmpltps %xmm3, %xmm7
147 ; SSE-NEXT: cmpltps %xmm2, %xmm6
148 ; SSE-NEXT: packssdw %xmm7, %xmm6
149 ; SSE-NEXT: cmpltps %xmm1, %xmm5
150 ; SSE-NEXT: cmpltps %xmm0, %xmm4
151 ; SSE-NEXT: packssdw %xmm5, %xmm4
152 ; SSE-NEXT: packsswb %xmm6, %xmm4
153 ; SSE-NEXT: pmovmskb %xmm4, %eax
154 ; SSE-NEXT: # kill: def $ax killed $ax killed $eax
157 ; AVX1-LABEL: v16f32:
159 ; AVX1-NEXT: vcmpltps %ymm1, %ymm3, %ymm1
160 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
161 ; AVX1-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
162 ; AVX1-NEXT: vcmpltps %ymm0, %ymm2, %ymm0
163 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
164 ; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
165 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
166 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
167 ; AVX1-NEXT: # kill: def $ax killed $ax killed $eax
168 ; AVX1-NEXT: vzeroupper
171 ; AVX2-LABEL: v16f32:
173 ; AVX2-NEXT: vcmpltps %ymm1, %ymm3, %ymm1
174 ; AVX2-NEXT: vcmpltps %ymm0, %ymm2, %ymm0
175 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
176 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
177 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
178 ; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
179 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
180 ; AVX2-NEXT: # kill: def $ax killed $ax killed $eax
181 ; AVX2-NEXT: vzeroupper
184 ; AVX512F-LABEL: v16f32:
186 ; AVX512F-NEXT: vcmpltps %zmm0, %zmm1, %k0
187 ; AVX512F-NEXT: kmovw %k0, %eax
188 ; AVX512F-NEXT: # kill: def $ax killed $ax killed $eax
189 ; AVX512F-NEXT: vzeroupper
192 ; AVX512BW-LABEL: v16f32:
194 ; AVX512BW-NEXT: vcmpltps %zmm0, %zmm1, %k0
195 ; AVX512BW-NEXT: kmovd %k0, %eax
196 ; AVX512BW-NEXT: # kill: def $ax killed $ax killed $eax
197 ; AVX512BW-NEXT: vzeroupper
198 ; AVX512BW-NEXT: retq
199 %x = fcmp ogt <16 x float> %a, %b
200 %res = bitcast <16 x i1> %x to i16
204 define i64 @v64i8(<64 x i8> %a, <64 x i8> %b) {
207 ; SSE-NEXT: pcmpgtb %xmm4, %xmm0
208 ; SSE-NEXT: pmovmskb %xmm0, %eax
209 ; SSE-NEXT: pcmpgtb %xmm5, %xmm1
210 ; SSE-NEXT: pmovmskb %xmm1, %ecx
211 ; SSE-NEXT: shll $16, %ecx
212 ; SSE-NEXT: orl %eax, %ecx
213 ; SSE-NEXT: pcmpgtb %xmm6, %xmm2
214 ; SSE-NEXT: pmovmskb %xmm2, %edx
215 ; SSE-NEXT: pcmpgtb %xmm7, %xmm3
216 ; SSE-NEXT: pmovmskb %xmm3, %eax
217 ; SSE-NEXT: shll $16, %eax
218 ; SSE-NEXT: orl %edx, %eax
219 ; SSE-NEXT: shlq $32, %rax
220 ; SSE-NEXT: orq %rcx, %rax
225 ; AVX1-NEXT: vpcmpgtb %xmm2, %xmm0, %xmm4
226 ; AVX1-NEXT: vpmovmskb %xmm4, %eax
227 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm2
228 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
229 ; AVX1-NEXT: vpcmpgtb %xmm2, %xmm0, %xmm0
230 ; AVX1-NEXT: vpmovmskb %xmm0, %ecx
231 ; AVX1-NEXT: shll $16, %ecx
232 ; AVX1-NEXT: orl %eax, %ecx
233 ; AVX1-NEXT: vpcmpgtb %xmm3, %xmm1, %xmm0
234 ; AVX1-NEXT: vpmovmskb %xmm0, %edx
235 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm0
236 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
237 ; AVX1-NEXT: vpcmpgtb %xmm0, %xmm1, %xmm0
238 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
239 ; AVX1-NEXT: shll $16, %eax
240 ; AVX1-NEXT: orl %edx, %eax
241 ; AVX1-NEXT: shlq $32, %rax
242 ; AVX1-NEXT: orq %rcx, %rax
243 ; AVX1-NEXT: vzeroupper
248 ; AVX2-NEXT: vpcmpgtb %ymm2, %ymm0, %ymm0
249 ; AVX2-NEXT: vpmovmskb %ymm0, %ecx
250 ; AVX2-NEXT: vpcmpgtb %ymm3, %ymm1, %ymm0
251 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
252 ; AVX2-NEXT: shlq $32, %rax
253 ; AVX2-NEXT: orq %rcx, %rax
254 ; AVX2-NEXT: vzeroupper
257 ; AVX512F-LABEL: v64i8:
259 ; AVX512F-NEXT: vpcmpgtb %ymm3, %ymm1, %ymm1
260 ; AVX512F-NEXT: vpcmpgtb %ymm2, %ymm0, %ymm0
261 ; AVX512F-NEXT: vpmovmskb %ymm0, %ecx
262 ; AVX512F-NEXT: vpmovmskb %ymm1, %eax
263 ; AVX512F-NEXT: shlq $32, %rax
264 ; AVX512F-NEXT: orq %rcx, %rax
265 ; AVX512F-NEXT: vzeroupper
268 ; AVX512BW-LABEL: v64i8:
270 ; AVX512BW-NEXT: vpcmpgtb %zmm1, %zmm0, %k0
271 ; AVX512BW-NEXT: kmovq %k0, %rax
272 ; AVX512BW-NEXT: vzeroupper
273 ; AVX512BW-NEXT: retq
274 %x = icmp sgt <64 x i8> %a, %b
275 %res = bitcast <64 x i1> %x to i64
279 define i8 @v8i64(<8 x i64> %a, <8 x i64> %b) {
282 ; SSE-NEXT: pcmpgtq %xmm7, %xmm3
283 ; SSE-NEXT: pcmpgtq %xmm6, %xmm2
284 ; SSE-NEXT: packssdw %xmm3, %xmm2
285 ; SSE-NEXT: pcmpgtq %xmm5, %xmm1
286 ; SSE-NEXT: pcmpgtq %xmm4, %xmm0
287 ; SSE-NEXT: packssdw %xmm1, %xmm0
288 ; SSE-NEXT: packssdw %xmm2, %xmm0
289 ; SSE-NEXT: packsswb %xmm0, %xmm0
290 ; SSE-NEXT: pmovmskb %xmm0, %eax
291 ; SSE-NEXT: # kill: def $al killed $al killed $eax
296 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm4
297 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
298 ; AVX1-NEXT: vpcmpgtq %xmm4, %xmm5, %xmm4
299 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm1, %xmm1
300 ; AVX1-NEXT: vpackssdw %xmm4, %xmm1, %xmm1
301 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
302 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm4
303 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm4, %xmm3
304 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm0
305 ; AVX1-NEXT: vpackssdw %xmm3, %xmm0, %xmm0
306 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
307 ; AVX1-NEXT: vmovmskps %ymm0, %eax
308 ; AVX1-NEXT: # kill: def $al killed $al killed $eax
309 ; AVX1-NEXT: vzeroupper
314 ; AVX2-NEXT: vpcmpgtq %ymm3, %ymm1, %ymm1
315 ; AVX2-NEXT: vpcmpgtq %ymm2, %ymm0, %ymm0
316 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
317 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
318 ; AVX2-NEXT: vmovmskps %ymm0, %eax
319 ; AVX2-NEXT: # kill: def $al killed $al killed $eax
320 ; AVX2-NEXT: vzeroupper
323 ; AVX512F-LABEL: v8i64:
325 ; AVX512F-NEXT: vpcmpgtq %zmm1, %zmm0, %k0
326 ; AVX512F-NEXT: kmovw %k0, %eax
327 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
328 ; AVX512F-NEXT: vzeroupper
331 ; AVX512BW-LABEL: v8i64:
333 ; AVX512BW-NEXT: vpcmpgtq %zmm1, %zmm0, %k0
334 ; AVX512BW-NEXT: kmovd %k0, %eax
335 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
336 ; AVX512BW-NEXT: vzeroupper
337 ; AVX512BW-NEXT: retq
338 %x = icmp sgt <8 x i64> %a, %b
339 %res = bitcast <8 x i1> %x to i8
343 define i8 @v8f64(<8 x double> %a, <8 x double> %b) {
346 ; SSE-NEXT: cmpltpd %xmm3, %xmm7
347 ; SSE-NEXT: cmpltpd %xmm2, %xmm6
348 ; SSE-NEXT: packssdw %xmm7, %xmm6
349 ; SSE-NEXT: cmpltpd %xmm1, %xmm5
350 ; SSE-NEXT: cmpltpd %xmm0, %xmm4
351 ; SSE-NEXT: packssdw %xmm5, %xmm4
352 ; SSE-NEXT: packssdw %xmm6, %xmm4
353 ; SSE-NEXT: packsswb %xmm0, %xmm4
354 ; SSE-NEXT: pmovmskb %xmm4, %eax
355 ; SSE-NEXT: # kill: def $al killed $al killed $eax
360 ; AVX1-NEXT: vcmpltpd %ymm1, %ymm3, %ymm1
361 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
362 ; AVX1-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
363 ; AVX1-NEXT: vcmpltpd %ymm0, %ymm2, %ymm0
364 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
365 ; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
366 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
367 ; AVX1-NEXT: vmovmskps %ymm0, %eax
368 ; AVX1-NEXT: # kill: def $al killed $al killed $eax
369 ; AVX1-NEXT: vzeroupper
374 ; AVX2-NEXT: vcmpltpd %ymm1, %ymm3, %ymm1
375 ; AVX2-NEXT: vcmpltpd %ymm0, %ymm2, %ymm0
376 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
377 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
378 ; AVX2-NEXT: vmovmskps %ymm0, %eax
379 ; AVX2-NEXT: # kill: def $al killed $al killed $eax
380 ; AVX2-NEXT: vzeroupper
383 ; AVX512F-LABEL: v8f64:
385 ; AVX512F-NEXT: vcmpltpd %zmm0, %zmm1, %k0
386 ; AVX512F-NEXT: kmovw %k0, %eax
387 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
388 ; AVX512F-NEXT: vzeroupper
391 ; AVX512BW-LABEL: v8f64:
393 ; AVX512BW-NEXT: vcmpltpd %zmm0, %zmm1, %k0
394 ; AVX512BW-NEXT: kmovd %k0, %eax
395 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
396 ; AVX512BW-NEXT: vzeroupper
397 ; AVX512BW-NEXT: retq
398 %x = fcmp ogt <8 x double> %a, %b
399 %res = bitcast <8 x i1> %x to i8
403 define void @bitcast_64i8_store(i64* %p, <64 x i8> %a0) {
404 ; SSE-LABEL: bitcast_64i8_store:
406 ; SSE-NEXT: pmovmskb %xmm0, %eax
407 ; SSE-NEXT: pmovmskb %xmm1, %ecx
408 ; SSE-NEXT: shll $16, %ecx
409 ; SSE-NEXT: orl %eax, %ecx
410 ; SSE-NEXT: pmovmskb %xmm2, %eax
411 ; SSE-NEXT: pmovmskb %xmm3, %edx
412 ; SSE-NEXT: shll $16, %edx
413 ; SSE-NEXT: orl %eax, %edx
414 ; SSE-NEXT: shlq $32, %rdx
415 ; SSE-NEXT: orq %rcx, %rdx
416 ; SSE-NEXT: movq %rdx, (%rdi)
419 ; AVX1-LABEL: bitcast_64i8_store:
421 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
422 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
423 ; AVX1-NEXT: vpmovmskb %xmm0, %ecx
424 ; AVX1-NEXT: shll $16, %ecx
425 ; AVX1-NEXT: orl %eax, %ecx
426 ; AVX1-NEXT: vpmovmskb %xmm1, %eax
427 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm0
428 ; AVX1-NEXT: vpmovmskb %xmm0, %edx
429 ; AVX1-NEXT: shll $16, %edx
430 ; AVX1-NEXT: orl %eax, %edx
431 ; AVX1-NEXT: shlq $32, %rdx
432 ; AVX1-NEXT: orq %rcx, %rdx
433 ; AVX1-NEXT: movq %rdx, (%rdi)
434 ; AVX1-NEXT: vzeroupper
437 ; AVX2-LABEL: bitcast_64i8_store:
439 ; AVX2-NEXT: vpmovmskb %ymm1, %eax
440 ; AVX2-NEXT: shlq $32, %rax
441 ; AVX2-NEXT: vpmovmskb %ymm0, %ecx
442 ; AVX2-NEXT: orq %rax, %rcx
443 ; AVX2-NEXT: movq %rcx, (%rdi)
444 ; AVX2-NEXT: vzeroupper
447 ; AVX512F-LABEL: bitcast_64i8_store:
449 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
450 ; AVX512F-NEXT: vpcmpgtb %ymm0, %ymm2, %ymm0
451 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm3
452 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
453 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm0
454 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
455 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k1
456 ; AVX512F-NEXT: vpcmpgtb %ymm1, %ymm2, %ymm0
457 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm1
458 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k2
459 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm0
460 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
461 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k3
462 ; AVX512F-NEXT: kmovw %k3, 6(%rdi)
463 ; AVX512F-NEXT: kmovw %k2, 4(%rdi)
464 ; AVX512F-NEXT: kmovw %k1, 2(%rdi)
465 ; AVX512F-NEXT: kmovw %k0, (%rdi)
466 ; AVX512F-NEXT: vzeroupper
469 ; AVX512BW-LABEL: bitcast_64i8_store:
471 ; AVX512BW-NEXT: vpmovb2m %zmm0, %k0
472 ; AVX512BW-NEXT: kmovq %k0, (%rdi)
473 ; AVX512BW-NEXT: vzeroupper
474 ; AVX512BW-NEXT: retq
475 %a1 = icmp slt <64 x i8> %a0, zeroinitializer
476 %a2 = bitcast <64 x i1> %a1 to i64
477 store i64 %a2, i64* %p
481 define void @bitcast_32i16_store(i32* %p, <32 x i16> %a0) {
482 ; SSE-LABEL: bitcast_32i16_store:
484 ; SSE-NEXT: packsswb %xmm1, %xmm0
485 ; SSE-NEXT: pmovmskb %xmm0, %eax
486 ; SSE-NEXT: packsswb %xmm3, %xmm2
487 ; SSE-NEXT: pmovmskb %xmm2, %ecx
488 ; SSE-NEXT: shll $16, %ecx
489 ; SSE-NEXT: orl %eax, %ecx
490 ; SSE-NEXT: movl %ecx, (%rdi)
493 ; AVX1-LABEL: bitcast_32i16_store:
495 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
496 ; AVX1-NEXT: vpacksswb %xmm2, %xmm0, %xmm0
497 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
498 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm0
499 ; AVX1-NEXT: vpacksswb %xmm0, %xmm1, %xmm0
500 ; AVX1-NEXT: vpmovmskb %xmm0, %ecx
501 ; AVX1-NEXT: shll $16, %ecx
502 ; AVX1-NEXT: orl %eax, %ecx
503 ; AVX1-NEXT: movl %ecx, (%rdi)
504 ; AVX1-NEXT: vzeroupper
507 ; AVX2-LABEL: bitcast_32i16_store:
509 ; AVX2-NEXT: vpacksswb %ymm1, %ymm0, %ymm0
510 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
511 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
512 ; AVX2-NEXT: movl %eax, (%rdi)
513 ; AVX2-NEXT: vzeroupper
516 ; AVX512F-LABEL: bitcast_32i16_store:
518 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
519 ; AVX512F-NEXT: vpcmpgtw %ymm0, %ymm2, %ymm0
520 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
521 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
522 ; AVX512F-NEXT: vpcmpgtw %ymm1, %ymm2, %ymm0
523 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
524 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k1
525 ; AVX512F-NEXT: kmovw %k1, 2(%rdi)
526 ; AVX512F-NEXT: kmovw %k0, (%rdi)
527 ; AVX512F-NEXT: vzeroupper
530 ; AVX512BW-LABEL: bitcast_32i16_store:
532 ; AVX512BW-NEXT: vpmovw2m %zmm0, %k0
533 ; AVX512BW-NEXT: kmovd %k0, (%rdi)
534 ; AVX512BW-NEXT: vzeroupper
535 ; AVX512BW-NEXT: retq
536 %a1 = icmp slt <32 x i16> %a0, zeroinitializer
537 %a2 = bitcast <32 x i1> %a1 to i32
538 store i32 %a2, i32* %p
542 define void @bitcast_16i32_store(i16* %p, <16 x i32> %a0) {
543 ; SSE-LABEL: bitcast_16i32_store:
545 ; SSE-NEXT: packssdw %xmm3, %xmm2
546 ; SSE-NEXT: packssdw %xmm1, %xmm0
547 ; SSE-NEXT: packsswb %xmm2, %xmm0
548 ; SSE-NEXT: pmovmskb %xmm0, %eax
549 ; SSE-NEXT: movw %ax, (%rdi)
552 ; AVX1-LABEL: bitcast_16i32_store:
554 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
555 ; AVX1-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
556 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
557 ; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
558 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
559 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
560 ; AVX1-NEXT: movw %ax, (%rdi)
561 ; AVX1-NEXT: vzeroupper
564 ; AVX2-LABEL: bitcast_16i32_store:
566 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
567 ; AVX2-NEXT: vpcmpgtd %ymm1, %ymm2, %ymm1
568 ; AVX2-NEXT: vpcmpgtd %ymm0, %ymm2, %ymm0
569 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
570 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
571 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
572 ; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
573 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
574 ; AVX2-NEXT: movw %ax, (%rdi)
575 ; AVX2-NEXT: vzeroupper
578 ; AVX512-LABEL: bitcast_16i32_store:
580 ; AVX512-NEXT: vpxor %xmm1, %xmm1, %xmm1
581 ; AVX512-NEXT: vpcmpgtd %zmm0, %zmm1, %k0
582 ; AVX512-NEXT: kmovw %k0, (%rdi)
583 ; AVX512-NEXT: vzeroupper
585 %a1 = icmp slt <16 x i32> %a0, zeroinitializer
586 %a2 = bitcast <16 x i1> %a1 to i16
587 store i16 %a2, i16* %p
591 define void @bitcast_8i64_store(i8* %p, <8 x i64> %a0) {
592 ; SSE-LABEL: bitcast_8i64_store:
594 ; SSE-NEXT: pxor %xmm4, %xmm4
595 ; SSE-NEXT: pxor %xmm5, %xmm5
596 ; SSE-NEXT: pcmpgtq %xmm3, %xmm5
597 ; SSE-NEXT: pxor %xmm3, %xmm3
598 ; SSE-NEXT: pcmpgtq %xmm2, %xmm3
599 ; SSE-NEXT: packssdw %xmm5, %xmm3
600 ; SSE-NEXT: pxor %xmm2, %xmm2
601 ; SSE-NEXT: pcmpgtq %xmm1, %xmm2
602 ; SSE-NEXT: pcmpgtq %xmm0, %xmm4
603 ; SSE-NEXT: packssdw %xmm2, %xmm4
604 ; SSE-NEXT: packssdw %xmm3, %xmm4
605 ; SSE-NEXT: packsswb %xmm0, %xmm4
606 ; SSE-NEXT: pmovmskb %xmm4, %eax
607 ; SSE-NEXT: movb %al, (%rdi)
610 ; AVX1-LABEL: bitcast_8i64_store:
612 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
613 ; AVX1-NEXT: vpxor %xmm3, %xmm3, %xmm3
614 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm2
615 ; AVX1-NEXT: vpcmpgtq %xmm0, %xmm3, %xmm0
616 ; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
617 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
618 ; AVX1-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
619 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
620 ; AVX1-NEXT: vmovmskps %ymm0, %eax
621 ; AVX1-NEXT: movb %al, (%rdi)
622 ; AVX1-NEXT: vzeroupper
625 ; AVX2-LABEL: bitcast_8i64_store:
627 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
628 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
629 ; AVX2-NEXT: vmovmskps %ymm0, %eax
630 ; AVX2-NEXT: movb %al, (%rdi)
631 ; AVX2-NEXT: vzeroupper
634 ; AVX512F-LABEL: bitcast_8i64_store:
636 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
637 ; AVX512F-NEXT: vpcmpgtq %zmm0, %zmm1, %k0
638 ; AVX512F-NEXT: kmovw %k0, %eax
639 ; AVX512F-NEXT: movb %al, (%rdi)
640 ; AVX512F-NEXT: vzeroupper
643 ; AVX512BW-LABEL: bitcast_8i64_store:
645 ; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
646 ; AVX512BW-NEXT: vpcmpgtq %zmm0, %zmm1, %k0
647 ; AVX512BW-NEXT: kmovd %k0, %eax
648 ; AVX512BW-NEXT: movb %al, (%rdi)
649 ; AVX512BW-NEXT: vzeroupper
650 ; AVX512BW-NEXT: retq
651 %a1 = icmp slt <8 x i64> %a0, zeroinitializer
652 %a2 = bitcast <8 x i1> %a1 to i8