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-prefix=AVX12
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=AVX12
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl | FileCheck %s --check-prefix=AVX512F
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl,+avx512bw | FileCheck %s --check-prefix=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 %xmm2, %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: pcmpgtb %xmm3, %xmm2
185 ; SSE2-NEXT: pand %xmm0, %xmm2
186 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
187 ; SSE2-NEXT: pshuflw {{.*#+}} xmm0 = xmm2[0,0,1,1,4,5,6,7]
188 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
189 ; SSE2-NEXT: movmskpd %xmm0, %eax
190 ; SSE2-NEXT: # kill: def $al killed $al killed $eax
195 ; SSSE3-NEXT: pcmpgtb %xmm1, %xmm0
196 ; SSSE3-NEXT: pcmpgtb %xmm3, %xmm2
197 ; SSSE3-NEXT: pand %xmm0, %xmm2
198 ; SSSE3-NEXT: pshufb {{.*#+}} xmm2 = xmm2[u,u,u,u,u,u,u,0,u,u,u,u,u,u,u,1]
199 ; SSSE3-NEXT: movmskpd %xmm2, %eax
200 ; SSSE3-NEXT: # kill: def $al killed $al killed $eax
205 ; AVX12-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
206 ; AVX12-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm1
207 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
208 ; AVX12-NEXT: vpmovsxbq %xmm0, %xmm0
209 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
210 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
213 ; AVX512F-LABEL: v2i8:
215 ; AVX512F-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
216 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
217 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
218 ; AVX512F-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm0
219 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
220 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k1
221 ; AVX512F-NEXT: kandw %k1, %k0, %k0
222 ; AVX512F-NEXT: kmovw %k0, %eax
223 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
224 ; AVX512F-NEXT: vzeroupper
227 ; AVX512BW-LABEL: v2i8:
229 ; AVX512BW-NEXT: vpcmpgtb %xmm1, %xmm0, %k0
230 ; AVX512BW-NEXT: vpcmpgtb %xmm3, %xmm2, %k1
231 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
232 ; AVX512BW-NEXT: kmovd %k0, %eax
233 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
234 ; AVX512BW-NEXT: retq
235 %x0 = icmp sgt <2 x i8> %a, %b
236 %x1 = icmp sgt <2 x i8> %c, %d
237 %y = and <2 x i1> %x0, %x1
238 %res = bitcast <2 x i1> %y to i2
242 define i2 @v2i16(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c, <2 x i16> %d) {
243 ; SSE2-SSSE3-LABEL: v2i16:
244 ; SSE2-SSSE3: # %bb.0:
245 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm1, %xmm0
246 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm3, %xmm2
247 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm2
248 ; SSE2-SSSE3-NEXT: pshuflw {{.*#+}} xmm0 = xmm2[0,0,1,1,4,5,6,7]
249 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
250 ; SSE2-SSSE3-NEXT: movmskpd %xmm0, %eax
251 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
252 ; SSE2-SSSE3-NEXT: retq
254 ; AVX12-LABEL: v2i16:
256 ; AVX12-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
257 ; AVX12-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm1
258 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
259 ; AVX12-NEXT: vpmovsxwq %xmm0, %xmm0
260 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
261 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
264 ; AVX512F-LABEL: v2i16:
266 ; AVX512F-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
267 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
268 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k0
269 ; AVX512F-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm0
270 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
271 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k1
272 ; AVX512F-NEXT: kandw %k1, %k0, %k0
273 ; AVX512F-NEXT: kmovw %k0, %eax
274 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
275 ; AVX512F-NEXT: vzeroupper
278 ; AVX512BW-LABEL: v2i16:
280 ; AVX512BW-NEXT: vpcmpgtw %xmm1, %xmm0, %k0
281 ; AVX512BW-NEXT: vpcmpgtw %xmm3, %xmm2, %k1
282 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
283 ; AVX512BW-NEXT: kmovd %k0, %eax
284 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
285 ; AVX512BW-NEXT: retq
286 %x0 = icmp sgt <2 x i16> %a, %b
287 %x1 = icmp sgt <2 x i16> %c, %d
288 %y = and <2 x i1> %x0, %x1
289 %res = bitcast <2 x i1> %y to i2
293 define i2 @v2i32(<2 x i32> %a, <2 x i32> %b, <2 x i32> %c, <2 x i32> %d) {
294 ; SSE2-SSSE3-LABEL: v2i32:
295 ; SSE2-SSSE3: # %bb.0:
296 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
297 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
298 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm2
299 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm2[0,0,1,1]
300 ; SSE2-SSSE3-NEXT: movmskpd %xmm0, %eax
301 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
302 ; SSE2-SSSE3-NEXT: retq
304 ; AVX12-LABEL: v2i32:
306 ; AVX12-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
307 ; AVX12-NEXT: vpcmpgtd %xmm3, %xmm2, %xmm1
308 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
309 ; AVX12-NEXT: vpmovsxdq %xmm0, %xmm0
310 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
311 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
314 ; AVX512F-LABEL: v2i32:
316 ; AVX512F-NEXT: vpcmpgtd %xmm1, %xmm0, %k0
317 ; AVX512F-NEXT: vpcmpgtd %xmm3, %xmm2, %k1
318 ; AVX512F-NEXT: kandw %k1, %k0, %k0
319 ; AVX512F-NEXT: kmovw %k0, %eax
320 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
323 ; AVX512BW-LABEL: v2i32:
325 ; AVX512BW-NEXT: vpcmpgtd %xmm1, %xmm0, %k0
326 ; AVX512BW-NEXT: vpcmpgtd %xmm3, %xmm2, %k1
327 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
328 ; AVX512BW-NEXT: kmovd %k0, %eax
329 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
330 ; AVX512BW-NEXT: retq
331 %x0 = icmp sgt <2 x i32> %a, %b
332 %x1 = icmp sgt <2 x i32> %c, %d
333 %y = and <2 x i1> %x0, %x1
334 %res = bitcast <2 x i1> %y to i2
338 define i2 @v2i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c, <2 x i64> %d) {
339 ; SSE2-SSSE3-LABEL: v2i64:
340 ; SSE2-SSSE3: # %bb.0:
341 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
342 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm1
343 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm0
344 ; SSE2-SSSE3-NEXT: movdqa %xmm0, %xmm5
345 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm1, %xmm5
346 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
347 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,0,2,2]
348 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm1
349 ; SSE2-SSSE3-NEXT: por %xmm0, %xmm1
350 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm3
351 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm2
352 ; SSE2-SSSE3-NEXT: movdqa %xmm2, %xmm0
353 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm3, %xmm0
354 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
355 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,2,2]
356 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm3
357 ; SSE2-SSSE3-NEXT: por %xmm2, %xmm3
358 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm3
359 ; SSE2-SSSE3-NEXT: movmskpd %xmm3, %eax
360 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
361 ; SSE2-SSSE3-NEXT: retq
363 ; AVX12-LABEL: v2i64:
365 ; AVX12-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
366 ; AVX12-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm1
367 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
368 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
369 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
372 ; AVX512F-LABEL: v2i64:
374 ; AVX512F-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
375 ; AVX512F-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
376 ; AVX512F-NEXT: kmovw %k0, %eax
377 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
380 ; AVX512BW-LABEL: v2i64:
382 ; AVX512BW-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
383 ; AVX512BW-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
384 ; AVX512BW-NEXT: kmovd %k0, %eax
385 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
386 ; AVX512BW-NEXT: retq
387 %x0 = icmp sgt <2 x i64> %a, %b
388 %x1 = icmp sgt <2 x i64> %c, %d
389 %y = and <2 x i1> %x0, %x1
390 %res = bitcast <2 x i1> %y to i2
394 define i2 @v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %c, <2 x double> %d) {
395 ; SSE2-SSSE3-LABEL: v2f64:
396 ; SSE2-SSSE3: # %bb.0:
397 ; SSE2-SSSE3-NEXT: cmpltpd %xmm0, %xmm1
398 ; SSE2-SSSE3-NEXT: cmpltpd %xmm2, %xmm3
399 ; SSE2-SSSE3-NEXT: andpd %xmm1, %xmm3
400 ; SSE2-SSSE3-NEXT: movmskpd %xmm3, %eax
401 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
402 ; SSE2-SSSE3-NEXT: retq
404 ; AVX12-LABEL: v2f64:
406 ; AVX12-NEXT: vcmpltpd %xmm0, %xmm1, %xmm0
407 ; AVX12-NEXT: vcmpltpd %xmm2, %xmm3, %xmm1
408 ; AVX12-NEXT: vandpd %xmm1, %xmm0, %xmm0
409 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
410 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
413 ; AVX512F-LABEL: v2f64:
415 ; AVX512F-NEXT: vcmpltpd %xmm0, %xmm1, %k1
416 ; AVX512F-NEXT: vcmpltpd %xmm2, %xmm3, %k0 {%k1}
417 ; AVX512F-NEXT: kmovw %k0, %eax
418 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
421 ; AVX512BW-LABEL: v2f64:
423 ; AVX512BW-NEXT: vcmpltpd %xmm0, %xmm1, %k1
424 ; AVX512BW-NEXT: vcmpltpd %xmm2, %xmm3, %k0 {%k1}
425 ; AVX512BW-NEXT: kmovd %k0, %eax
426 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
427 ; AVX512BW-NEXT: retq
428 %x0 = fcmp ogt <2 x double> %a, %b
429 %x1 = fcmp ogt <2 x double> %c, %d
430 %y = and <2 x i1> %x0, %x1
431 %res = bitcast <2 x i1> %y to i2
435 define i4 @v4i8(<4 x i8> %a, <4 x i8> %b, <4 x i8> %c, <4 x i8> %d) {
436 ; SSE2-SSSE3-LABEL: v4i8:
437 ; SSE2-SSSE3: # %bb.0:
438 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm1, %xmm0
439 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm3, %xmm2
440 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm2
441 ; SSE2-SSSE3-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
442 ; SSE2-SSSE3-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3]
443 ; SSE2-SSSE3-NEXT: movmskps %xmm2, %eax
444 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
445 ; SSE2-SSSE3-NEXT: retq
449 ; AVX12-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
450 ; AVX12-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm1
451 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
452 ; AVX12-NEXT: vpmovsxbd %xmm0, %xmm0
453 ; AVX12-NEXT: vmovmskps %xmm0, %eax
454 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
457 ; AVX512F-LABEL: v4i8:
459 ; AVX512F-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
460 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
461 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
462 ; AVX512F-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm0
463 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
464 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k1
465 ; AVX512F-NEXT: kandw %k1, %k0, %k0
466 ; AVX512F-NEXT: kmovw %k0, %eax
467 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
468 ; AVX512F-NEXT: vzeroupper
471 ; AVX512BW-LABEL: v4i8:
473 ; AVX512BW-NEXT: vpcmpgtb %xmm1, %xmm0, %k0
474 ; AVX512BW-NEXT: vpcmpgtb %xmm3, %xmm2, %k1
475 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
476 ; AVX512BW-NEXT: kmovd %k0, %eax
477 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
478 ; AVX512BW-NEXT: retq
479 %x0 = icmp sgt <4 x i8> %a, %b
480 %x1 = icmp sgt <4 x i8> %c, %d
481 %y = and <4 x i1> %x0, %x1
482 %res = bitcast <4 x i1> %y to i4
486 define i4 @v4i16(<4 x i16> %a, <4 x i16> %b, <4 x i16> %c, <4 x i16> %d) {
487 ; SSE2-SSSE3-LABEL: v4i16:
488 ; SSE2-SSSE3: # %bb.0:
489 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm1, %xmm0
490 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm3, %xmm2
491 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm2
492 ; SSE2-SSSE3-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3]
493 ; SSE2-SSSE3-NEXT: movmskps %xmm2, %eax
494 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
495 ; SSE2-SSSE3-NEXT: retq
497 ; AVX12-LABEL: v4i16:
499 ; AVX12-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
500 ; AVX12-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm1
501 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
502 ; AVX12-NEXT: vpmovsxwd %xmm0, %xmm0
503 ; AVX12-NEXT: vmovmskps %xmm0, %eax
504 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
507 ; AVX512F-LABEL: v4i16:
509 ; AVX512F-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
510 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
511 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k0
512 ; AVX512F-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm0
513 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
514 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k1
515 ; AVX512F-NEXT: kandw %k1, %k0, %k0
516 ; AVX512F-NEXT: kmovw %k0, %eax
517 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
518 ; AVX512F-NEXT: vzeroupper
521 ; AVX512BW-LABEL: v4i16:
523 ; AVX512BW-NEXT: vpcmpgtw %xmm1, %xmm0, %k0
524 ; AVX512BW-NEXT: vpcmpgtw %xmm3, %xmm2, %k1
525 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
526 ; AVX512BW-NEXT: kmovd %k0, %eax
527 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
528 ; AVX512BW-NEXT: retq
529 %x0 = icmp sgt <4 x i16> %a, %b
530 %x1 = icmp sgt <4 x i16> %c, %d
531 %y = and <4 x i1> %x0, %x1
532 %res = bitcast <4 x i1> %y to i4
536 define i8 @v8i8(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c, <8 x i8> %d) {
537 ; SSE2-SSSE3-LABEL: v8i8:
538 ; SSE2-SSSE3: # %bb.0:
539 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm1, %xmm0
540 ; SSE2-SSSE3-NEXT: pcmpgtb %xmm3, %xmm2
541 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm2
542 ; SSE2-SSSE3-NEXT: pmovmskb %xmm2, %eax
543 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
544 ; SSE2-SSSE3-NEXT: retq
548 ; AVX12-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
549 ; AVX12-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm1
550 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
551 ; AVX12-NEXT: vpmovmskb %xmm0, %eax
552 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
555 ; AVX512F-LABEL: v8i8:
557 ; AVX512F-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
558 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
559 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
560 ; AVX512F-NEXT: vpcmpgtb %xmm3, %xmm2, %xmm0
561 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
562 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k1
563 ; AVX512F-NEXT: kandw %k1, %k0, %k0
564 ; AVX512F-NEXT: kmovw %k0, %eax
565 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
566 ; AVX512F-NEXT: vzeroupper
569 ; AVX512BW-LABEL: v8i8:
571 ; AVX512BW-NEXT: vpcmpgtb %xmm1, %xmm0, %k0
572 ; AVX512BW-NEXT: vpcmpgtb %xmm3, %xmm2, %k1
573 ; AVX512BW-NEXT: kandw %k1, %k0, %k0
574 ; AVX512BW-NEXT: kmovd %k0, %eax
575 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
576 ; AVX512BW-NEXT: retq
577 %x0 = icmp sgt <8 x i8> %a, %b
578 %x1 = icmp sgt <8 x i8> %c, %d
579 %y = and <8 x i1> %x0, %x1
580 %res = bitcast <8 x i1> %y to i8