1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=SSE2-SSSE3,SSE2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+ssse3 | FileCheck %s --check-prefixes=SSE2-SSSE3,SSSE3
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX12,AVX1
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX12,AVX2
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl | FileCheck %s --check-prefixes=AVX512 --check-prefixes=AVX512F
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl,+avx512bw | FileCheck %s --check-prefixes=AVX512 --check-prefixes=AVX512BW
9 define i8 @v8i16(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c, <8 x i16> %d) {
10 ; SSE2-SSSE3-LABEL: v8i16:
11 ; SSE2-SSSE3: # %bb.0:
12 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm1, %xmm0
13 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm3, %xmm2
14 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm2
15 ; SSE2-SSSE3-NEXT: packsswb %xmm0, %xmm2
16 ; SSE2-SSSE3-NEXT: pmovmskb %xmm2, %eax
17 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
18 ; SSE2-SSSE3-NEXT: retq
22 ; AVX12-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
23 ; AVX12-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm1
24 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
25 ; AVX12-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
26 ; AVX12-NEXT: vpmovmskb %xmm0, %eax
27 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
30 ; AVX512F-LABEL: v8i16:
32 ; AVX512F-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
33 ; AVX512F-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm1
34 ; AVX512F-NEXT: vpand %xmm1, %xmm0, %xmm0
35 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
36 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k0
37 ; AVX512F-NEXT: kmovw %k0, %eax
38 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
39 ; AVX512F-NEXT: vzeroupper
42 ; AVX512BW-LABEL: v8i16:
44 ; AVX512BW-NEXT: vpcmpgtw %xmm1, %xmm0, %k1
45 ; AVX512BW-NEXT: vpcmpgtw %xmm3, %xmm2, %k0 {%k1}
46 ; AVX512BW-NEXT: kmovd %k0, %eax
47 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
49 %x0 = icmp sgt <8 x i16> %a, %b
50 %x1 = icmp sgt <8 x i16> %c, %d
51 %y = and <8 x i1> %x0, %x1
52 %res = bitcast <8 x i1> %y to i8
56 define i4 @v4i32(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c, <4 x i32> %d) {
57 ; SSE2-SSSE3-LABEL: v4i32:
58 ; SSE2-SSSE3: # %bb.0:
59 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
60 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
61 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm2
62 ; SSE2-SSSE3-NEXT: movmskps %xmm2, %eax
63 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
64 ; SSE2-SSSE3-NEXT: retq
68 ; AVX12-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
69 ; AVX12-NEXT: vpcmpgtd %xmm3, %xmm2, %xmm1
70 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
71 ; AVX12-NEXT: vmovmskps %xmm0, %eax
72 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
75 ; AVX512F-LABEL: v4i32:
77 ; AVX512F-NEXT: vpcmpgtd %xmm1, %xmm0, %k1
78 ; AVX512F-NEXT: vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
79 ; AVX512F-NEXT: kmovw %k0, %eax
80 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
83 ; AVX512BW-LABEL: v4i32:
85 ; AVX512BW-NEXT: vpcmpgtd %xmm1, %xmm0, %k1
86 ; AVX512BW-NEXT: vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
87 ; AVX512BW-NEXT: kmovd %k0, %eax
88 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
90 %x0 = icmp sgt <4 x i32> %a, %b
91 %x1 = icmp sgt <4 x i32> %c, %d
92 %y = and <4 x i1> %x0, %x1
93 %res = bitcast <4 x i1> %y to i4
97 define i4 @v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %c, <4 x float> %d) {
98 ; SSE2-SSSE3-LABEL: v4f32:
99 ; SSE2-SSSE3: # %bb.0:
100 ; SSE2-SSSE3-NEXT: cmpltps %xmm0, %xmm1
101 ; SSE2-SSSE3-NEXT: cmpltps %xmm2, %xmm3
102 ; SSE2-SSSE3-NEXT: andps %xmm1, %xmm3
103 ; SSE2-SSSE3-NEXT: movmskps %xmm3, %eax
104 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
105 ; SSE2-SSSE3-NEXT: retq
107 ; AVX12-LABEL: v4f32:
109 ; AVX12-NEXT: vcmpltps %xmm0, %xmm1, %xmm0
110 ; AVX12-NEXT: vcmpltps %xmm2, %xmm3, %xmm1
111 ; AVX12-NEXT: vandps %xmm1, %xmm0, %xmm0
112 ; AVX12-NEXT: vmovmskps %xmm0, %eax
113 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
116 ; AVX512F-LABEL: v4f32:
118 ; AVX512F-NEXT: vcmpltps %xmm0, %xmm1, %k1
119 ; AVX512F-NEXT: vcmpltps %xmm2, %xmm3, %k0 {%k1}
120 ; AVX512F-NEXT: kmovw %k0, %eax
121 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
124 ; AVX512BW-LABEL: v4f32:
126 ; AVX512BW-NEXT: vcmpltps %xmm0, %xmm1, %k1
127 ; AVX512BW-NEXT: vcmpltps %xmm2, %xmm3, %k0 {%k1}
128 ; AVX512BW-NEXT: kmovd %k0, %eax
129 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
130 ; AVX512BW-NEXT: retq
131 %x0 = fcmp ogt <4 x float> %a, %b
132 %x1 = fcmp ogt <4 x float> %c, %d
133 %y = and <4 x i1> %x0, %x1
134 %res = bitcast <4 x i1> %y to i4
138 define i16 @v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c, <16 x i8> %d) {
139 ; SSE2-SSSE3-LABEL: v16i8:
140 ; SSE2-SSSE3: # %bb.0:
141 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm1, %xmm0
142 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm3, %xmm2
143 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm2
144 ; SSE2-SSSE3-NEXT: pmovmskb %xmm2, %eax
145 ; SSE2-SSSE3-NEXT: # kill: def $ax killed $ax killed $eax
146 ; SSE2-SSSE3-NEXT: retq
148 ; AVX12-LABEL: v16i8:
150 ; AVX12-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
151 ; AVX12-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm1
152 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
153 ; AVX12-NEXT: vpmovmskb %xmm0, %eax
154 ; AVX12-NEXT: # kill: def $ax killed $ax killed $eax
157 ; AVX512F-LABEL: v16i8:
159 ; AVX512F-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
160 ; AVX512F-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm1
161 ; AVX512F-NEXT: vpand %xmm1, %xmm0, %xmm0
162 ; AVX512F-NEXT: vpmovmskb %xmm0, %eax
163 ; AVX512F-NEXT: # kill: def $ax killed $ax killed $eax
166 ; AVX512BW-LABEL: v16i8:
168 ; AVX512BW-NEXT: vpcmpgtb %xmm1, %xmm0, %k1
169 ; AVX512BW-NEXT: vpcmpgtb %xmm3, %xmm2, %k0 {%k1}
170 ; AVX512BW-NEXT: kmovd %k0, %eax
171 ; AVX512BW-NEXT: # kill: def $ax killed $ax killed $eax
172 ; AVX512BW-NEXT: retq
173 %x0 = icmp sgt <16 x i8> %a, %b
174 %x1 = icmp sgt <16 x i8> %c, %d
175 %y = and <16 x i1> %x0, %x1
176 %res = bitcast <16 x i1> %y to i16
180 define i2 @v2i8(<2 x i8> %a, <2 x i8> %b, <2 x i8> %c, <2 x i8> %d) {
183 ; SSE2-NEXT: pcmpgtb %xmm1, %xmm0
184 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
185 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3]
186 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
187 ; SSE2-NEXT: pcmpgtb %xmm3, %xmm2
188 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
189 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3]
190 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,1,1]
191 ; SSE2-NEXT: pand %xmm0, %xmm1
192 ; SSE2-NEXT: movmskpd %xmm1, %eax
193 ; SSE2-NEXT: # kill: def $al killed $al killed $eax
198 ; SSSE3-NEXT: pcmpgtb %xmm1, %xmm0
199 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = <u,u,u,0,u,u,u,0,u,u,u,1,u,u,u,1>
200 ; SSSE3-NEXT: pshufb %xmm1, %xmm0
201 ; SSSE3-NEXT: pcmpgtb %xmm3, %xmm2
202 ; SSSE3-NEXT: pshufb %xmm1, %xmm2
203 ; SSSE3-NEXT: pand %xmm0, %xmm2
204 ; SSSE3-NEXT: movmskpd %xmm2, %eax
205 ; SSSE3-NEXT: # kill: def $al killed $al killed $eax
210 ; AVX12-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
211 ; AVX12-NEXT: vpmovsxbq %xmm0, %xmm0
212 ; AVX12-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm1
213 ; AVX12-NEXT: vpmovsxbq %xmm1, %xmm1
214 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
215 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
216 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
219 ; AVX512F-LABEL: v2i8:
221 ; AVX512F-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
222 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
223 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
224 ; AVX512F-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm0
225 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
226 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k1
227 ; AVX512F-NEXT: kandw %k1, %k0, %k0
228 ; AVX512F-NEXT: kmovw %k0, %eax
229 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
230 ; AVX512F-NEXT: vzeroupper
233 ; AVX512BW-LABEL: v2i8:
235 ; AVX512BW-NEXT: vpcmpgtb %xmm1, %xmm0, %k0
236 ; AVX512BW-NEXT: vpcmpgtb %xmm3, %xmm2, %k1
237 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
238 ; AVX512BW-NEXT: kmovd %k0, %eax
239 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
240 ; AVX512BW-NEXT: retq
241 %x0 = icmp sgt <2 x i8> %a, %b
242 %x1 = icmp sgt <2 x i8> %c, %d
243 %y = and <2 x i1> %x0, %x1
244 %res = bitcast <2 x i1> %y to i2
248 define i2 @v2i16(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c, <2 x i16> %d) {
249 ; SSE2-SSSE3-LABEL: v2i16:
250 ; SSE2-SSSE3: # %bb.0:
251 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm1, %xmm0
252 ; SSE2-SSSE3-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3]
253 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
254 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm3, %xmm2
255 ; SSE2-SSSE3-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
256 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,1,1]
257 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm1
258 ; SSE2-SSSE3-NEXT: movmskpd %xmm1, %eax
259 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
260 ; SSE2-SSSE3-NEXT: retq
262 ; AVX12-LABEL: v2i16:
264 ; AVX12-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
265 ; AVX12-NEXT: vpmovsxwq %xmm0, %xmm0
266 ; AVX12-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm1
267 ; AVX12-NEXT: vpmovsxwq %xmm1, %xmm1
268 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
269 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
270 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
273 ; AVX512F-LABEL: v2i16:
275 ; AVX512F-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
276 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
277 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k0
278 ; AVX512F-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm0
279 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
280 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k1
281 ; AVX512F-NEXT: kandw %k1, %k0, %k0
282 ; AVX512F-NEXT: kmovw %k0, %eax
283 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
284 ; AVX512F-NEXT: vzeroupper
287 ; AVX512BW-LABEL: v2i16:
289 ; AVX512BW-NEXT: vpcmpgtw %xmm1, %xmm0, %k0
290 ; AVX512BW-NEXT: vpcmpgtw %xmm3, %xmm2, %k1
291 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
292 ; AVX512BW-NEXT: kmovd %k0, %eax
293 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
294 ; AVX512BW-NEXT: retq
295 %x0 = icmp sgt <2 x i16> %a, %b
296 %x1 = icmp sgt <2 x i16> %c, %d
297 %y = and <2 x i1> %x0, %x1
298 %res = bitcast <2 x i1> %y to i2
302 define i2 @v2i32(<2 x i32> %a, <2 x i32> %b, <2 x i32> %c, <2 x i32> %d) {
303 ; SSE2-SSSE3-LABEL: v2i32:
304 ; SSE2-SSSE3: # %bb.0:
305 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
306 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
307 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
308 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm2[0,0,1,1]
309 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm1
310 ; SSE2-SSSE3-NEXT: movmskpd %xmm1, %eax
311 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
312 ; SSE2-SSSE3-NEXT: retq
314 ; AVX12-LABEL: v2i32:
316 ; AVX12-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
317 ; AVX12-NEXT: vpmovsxdq %xmm0, %xmm0
318 ; AVX12-NEXT: vpcmpgtd %xmm3, %xmm2, %xmm1
319 ; AVX12-NEXT: vpmovsxdq %xmm1, %xmm1
320 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
321 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
322 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
325 ; AVX512F-LABEL: v2i32:
327 ; AVX512F-NEXT: vpcmpgtd %xmm1, %xmm0, %k0
328 ; AVX512F-NEXT: vpcmpgtd %xmm3, %xmm2, %k1
329 ; AVX512F-NEXT: kandw %k1, %k0, %k0
330 ; AVX512F-NEXT: kmovw %k0, %eax
331 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
334 ; AVX512BW-LABEL: v2i32:
336 ; AVX512BW-NEXT: vpcmpgtd %xmm1, %xmm0, %k0
337 ; AVX512BW-NEXT: vpcmpgtd %xmm3, %xmm2, %k1
338 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
339 ; AVX512BW-NEXT: kmovd %k0, %eax
340 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
341 ; AVX512BW-NEXT: retq
342 %x0 = icmp sgt <2 x i32> %a, %b
343 %x1 = icmp sgt <2 x i32> %c, %d
344 %y = and <2 x i1> %x0, %x1
345 %res = bitcast <2 x i1> %y to i2
349 define i2 @v2i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c, <2 x i64> %d) {
350 ; SSE2-SSSE3-LABEL: v2i64:
351 ; SSE2-SSSE3: # %bb.0:
352 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
353 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm1
354 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm0
355 ; SSE2-SSSE3-NEXT: movdqa %xmm0, %xmm5
356 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm1, %xmm5
357 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
358 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,0,2,2]
359 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm1
360 ; SSE2-SSSE3-NEXT: por %xmm0, %xmm1
361 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm3
362 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm2
363 ; SSE2-SSSE3-NEXT: movdqa %xmm2, %xmm0
364 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm3, %xmm0
365 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
366 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,2,2]
367 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm3
368 ; SSE2-SSSE3-NEXT: por %xmm2, %xmm3
369 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm3
370 ; SSE2-SSSE3-NEXT: movmskpd %xmm3, %eax
371 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
372 ; SSE2-SSSE3-NEXT: retq
374 ; AVX12-LABEL: v2i64:
376 ; AVX12-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
377 ; AVX12-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm1
378 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
379 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
380 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
383 ; AVX512F-LABEL: v2i64:
385 ; AVX512F-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
386 ; AVX512F-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
387 ; AVX512F-NEXT: kmovw %k0, %eax
388 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
391 ; AVX512BW-LABEL: v2i64:
393 ; AVX512BW-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
394 ; AVX512BW-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
395 ; AVX512BW-NEXT: kmovd %k0, %eax
396 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
397 ; AVX512BW-NEXT: retq
398 %x0 = icmp sgt <2 x i64> %a, %b
399 %x1 = icmp sgt <2 x i64> %c, %d
400 %y = and <2 x i1> %x0, %x1
401 %res = bitcast <2 x i1> %y to i2
405 define i2 @v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %c, <2 x double> %d) {
406 ; SSE2-SSSE3-LABEL: v2f64:
407 ; SSE2-SSSE3: # %bb.0:
408 ; SSE2-SSSE3-NEXT: cmpltpd %xmm0, %xmm1
409 ; SSE2-SSSE3-NEXT: cmpltpd %xmm2, %xmm3
410 ; SSE2-SSSE3-NEXT: andpd %xmm1, %xmm3
411 ; SSE2-SSSE3-NEXT: movmskpd %xmm3, %eax
412 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
413 ; SSE2-SSSE3-NEXT: retq
415 ; AVX12-LABEL: v2f64:
417 ; AVX12-NEXT: vcmpltpd %xmm0, %xmm1, %xmm0
418 ; AVX12-NEXT: vcmpltpd %xmm2, %xmm3, %xmm1
419 ; AVX12-NEXT: vandpd %xmm1, %xmm0, %xmm0
420 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
421 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
424 ; AVX512F-LABEL: v2f64:
426 ; AVX512F-NEXT: vcmpltpd %xmm0, %xmm1, %k1
427 ; AVX512F-NEXT: vcmpltpd %xmm2, %xmm3, %k0 {%k1}
428 ; AVX512F-NEXT: kmovw %k0, %eax
429 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
432 ; AVX512BW-LABEL: v2f64:
434 ; AVX512BW-NEXT: vcmpltpd %xmm0, %xmm1, %k1
435 ; AVX512BW-NEXT: vcmpltpd %xmm2, %xmm3, %k0 {%k1}
436 ; AVX512BW-NEXT: kmovd %k0, %eax
437 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
438 ; AVX512BW-NEXT: retq
439 %x0 = fcmp ogt <2 x double> %a, %b
440 %x1 = fcmp ogt <2 x double> %c, %d
441 %y = and <2 x i1> %x0, %x1
442 %res = bitcast <2 x i1> %y to i2
446 define i4 @v4i8(<4 x i8> %a, <4 x i8> %b, <4 x i8> %c, <4 x i8> %d) {
447 ; SSE2-SSSE3-LABEL: v4i8:
448 ; SSE2-SSSE3: # %bb.0:
449 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm1, %xmm0
450 ; SSE2-SSSE3-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
451 ; SSE2-SSSE3-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3]
452 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm3, %xmm2
453 ; SSE2-SSSE3-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
454 ; SSE2-SSSE3-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3]
455 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm1
456 ; SSE2-SSSE3-NEXT: movmskps %xmm1, %eax
457 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
458 ; SSE2-SSSE3-NEXT: retq
462 ; AVX12-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
463 ; AVX12-NEXT: vpmovsxbd %xmm0, %xmm0
464 ; AVX12-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm1
465 ; AVX12-NEXT: vpmovsxbd %xmm1, %xmm1
466 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
467 ; AVX12-NEXT: vmovmskps %xmm0, %eax
468 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
471 ; AVX512F-LABEL: v4i8:
473 ; AVX512F-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
474 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
475 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
476 ; AVX512F-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm0
477 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
478 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k1
479 ; AVX512F-NEXT: kandw %k1, %k0, %k0
480 ; AVX512F-NEXT: kmovw %k0, %eax
481 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
482 ; AVX512F-NEXT: vzeroupper
485 ; AVX512BW-LABEL: v4i8:
487 ; AVX512BW-NEXT: vpcmpgtb %xmm1, %xmm0, %k0
488 ; AVX512BW-NEXT: vpcmpgtb %xmm3, %xmm2, %k1
489 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
490 ; AVX512BW-NEXT: kmovd %k0, %eax
491 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
492 ; AVX512BW-NEXT: retq
493 %x0 = icmp sgt <4 x i8> %a, %b
494 %x1 = icmp sgt <4 x i8> %c, %d
495 %y = and <4 x i1> %x0, %x1
496 %res = bitcast <4 x i1> %y to i4
500 define i4 @v4i16(<4 x i16> %a, <4 x i16> %b, <4 x i16> %c, <4 x i16> %d) {
501 ; SSE2-SSSE3-LABEL: v4i16:
502 ; SSE2-SSSE3: # %bb.0:
503 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm1, %xmm0
504 ; SSE2-SSSE3-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3]
505 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm3, %xmm2
506 ; SSE2-SSSE3-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
507 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm1
508 ; SSE2-SSSE3-NEXT: movmskps %xmm1, %eax
509 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
510 ; SSE2-SSSE3-NEXT: retq
512 ; AVX12-LABEL: v4i16:
514 ; AVX12-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
515 ; AVX12-NEXT: vpmovsxwd %xmm0, %xmm0
516 ; AVX12-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm1
517 ; AVX12-NEXT: vpmovsxwd %xmm1, %xmm1
518 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
519 ; AVX12-NEXT: vmovmskps %xmm0, %eax
520 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
523 ; AVX512F-LABEL: v4i16:
525 ; AVX512F-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
526 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
527 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k0
528 ; AVX512F-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm0
529 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
530 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k1
531 ; AVX512F-NEXT: kandw %k1, %k0, %k0
532 ; AVX512F-NEXT: kmovw %k0, %eax
533 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
534 ; AVX512F-NEXT: vzeroupper
537 ; AVX512BW-LABEL: v4i16:
539 ; AVX512BW-NEXT: vpcmpgtw %xmm1, %xmm0, %k0
540 ; AVX512BW-NEXT: vpcmpgtw %xmm3, %xmm2, %k1
541 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
542 ; AVX512BW-NEXT: kmovd %k0, %eax
543 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
544 ; AVX512BW-NEXT: retq
545 %x0 = icmp sgt <4 x i16> %a, %b
546 %x1 = icmp sgt <4 x i16> %c, %d
547 %y = and <4 x i1> %x0, %x1
548 %res = bitcast <4 x i1> %y to i4
552 define i8 @v8i8(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c, <8 x i8> %d) {
553 ; SSE2-SSSE3-LABEL: v8i8:
554 ; SSE2-SSSE3: # %bb.0:
555 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm1, %xmm0
556 ; SSE2-SSSE3-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
557 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm3, %xmm2
558 ; SSE2-SSSE3-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
559 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm1
560 ; SSE2-SSSE3-NEXT: packsswb %xmm0, %xmm1
561 ; SSE2-SSSE3-NEXT: pmovmskb %xmm1, %eax
562 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
563 ; SSE2-SSSE3-NEXT: retq
567 ; AVX12-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
568 ; AVX12-NEXT: vpmovsxbw %xmm0, %xmm0
569 ; AVX12-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm1
570 ; AVX12-NEXT: vpmovsxbw %xmm1, %xmm1
571 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
572 ; AVX12-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
573 ; AVX12-NEXT: vpmovmskb %xmm0, %eax
574 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
577 ; AVX512F-LABEL: v8i8:
579 ; AVX512F-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
580 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
581 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
582 ; AVX512F-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm0
583 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
584 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k1
585 ; AVX512F-NEXT: kandw %k1, %k0, %k0
586 ; AVX512F-NEXT: kmovw %k0, %eax
587 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
588 ; AVX512F-NEXT: vzeroupper
591 ; AVX512BW-LABEL: v8i8:
593 ; AVX512BW-NEXT: vpcmpgtb %xmm1, %xmm0, %k0
594 ; AVX512BW-NEXT: vpcmpgtb %xmm3, %xmm2, %k1
595 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
596 ; AVX512BW-NEXT: kmovd %k0, %eax
597 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
598 ; AVX512BW-NEXT: retq
599 %x0 = icmp sgt <8 x i8> %a, %b
600 %x1 = icmp sgt <8 x i8> %c, %d
601 %y = and <8 x i1> %x0, %x1
602 %res = bitcast <8 x i1> %y to i8