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) {
181 ; SSE2-SSSE3-LABEL: v2i8:
182 ; SSE2-SSSE3: # %bb.0:
183 ; SSE2-SSSE3-NEXT: psllq $56, %xmm2
184 ; SSE2-SSSE3-NEXT: movdqa %xmm2, %xmm4
185 ; SSE2-SSSE3-NEXT: psrad $31, %xmm4
186 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
187 ; SSE2-SSSE3-NEXT: psrad $24, %xmm2
188 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
189 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
190 ; SSE2-SSSE3-NEXT: psllq $56, %xmm3
191 ; SSE2-SSSE3-NEXT: movdqa %xmm3, %xmm4
192 ; SSE2-SSSE3-NEXT: psrad $31, %xmm4
193 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
194 ; SSE2-SSSE3-NEXT: psrad $24, %xmm3
195 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm3[1,3,2,3]
196 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
197 ; SSE2-SSSE3-NEXT: psllq $56, %xmm0
198 ; SSE2-SSSE3-NEXT: movdqa %xmm0, %xmm4
199 ; SSE2-SSSE3-NEXT: psrad $31, %xmm4
200 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
201 ; SSE2-SSSE3-NEXT: psrad $24, %xmm0
202 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3]
203 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
204 ; SSE2-SSSE3-NEXT: psllq $56, %xmm1
205 ; SSE2-SSSE3-NEXT: movdqa %xmm1, %xmm4
206 ; SSE2-SSSE3-NEXT: psrad $31, %xmm4
207 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
208 ; SSE2-SSSE3-NEXT: psrad $24, %xmm1
209 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,3,2,3]
210 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
211 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
212 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm1
213 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm0
214 ; SSE2-SSSE3-NEXT: movdqa %xmm0, %xmm5
215 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm1, %xmm5
216 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
217 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,0,2,2]
218 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm1
219 ; SSE2-SSSE3-NEXT: por %xmm0, %xmm1
220 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm3
221 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm2
222 ; SSE2-SSSE3-NEXT: movdqa %xmm2, %xmm0
223 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm3, %xmm0
224 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
225 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,2,2]
226 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm3
227 ; SSE2-SSSE3-NEXT: por %xmm2, %xmm3
228 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm3
229 ; SSE2-SSSE3-NEXT: movmskpd %xmm3, %eax
230 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
231 ; SSE2-SSSE3-NEXT: retq
235 ; AVX1-NEXT: vpsllq $56, %xmm3, %xmm3
236 ; AVX1-NEXT: vpsrad $31, %xmm3, %xmm4
237 ; AVX1-NEXT: vpsrad $24, %xmm3, %xmm3
238 ; AVX1-NEXT: vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
239 ; AVX1-NEXT: vpblendw {{.*#+}} xmm3 = xmm3[0,1],xmm4[2,3],xmm3[4,5],xmm4[6,7]
240 ; AVX1-NEXT: vpsllq $56, %xmm2, %xmm2
241 ; AVX1-NEXT: vpsrad $31, %xmm2, %xmm4
242 ; AVX1-NEXT: vpsrad $24, %xmm2, %xmm2
243 ; AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
244 ; AVX1-NEXT: vpblendw {{.*#+}} xmm2 = xmm2[0,1],xmm4[2,3],xmm2[4,5],xmm4[6,7]
245 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
246 ; AVX1-NEXT: vpsllq $56, %xmm1, %xmm1
247 ; AVX1-NEXT: vpsrad $31, %xmm1, %xmm3
248 ; AVX1-NEXT: vpsrad $24, %xmm1, %xmm1
249 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
250 ; AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
251 ; AVX1-NEXT: vpsllq $56, %xmm0, %xmm0
252 ; AVX1-NEXT: vpsrad $31, %xmm0, %xmm3
253 ; AVX1-NEXT: vpsrad $24, %xmm0, %xmm0
254 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
255 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm3[2,3],xmm0[4,5],xmm3[6,7]
256 ; AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
257 ; AVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
258 ; AVX1-NEXT: vmovmskpd %xmm0, %eax
259 ; AVX1-NEXT: # kill: def $al killed $al killed $eax
264 ; AVX2-NEXT: vpsllq $56, %xmm3, %xmm3
265 ; AVX2-NEXT: vpsrad $31, %xmm3, %xmm4
266 ; AVX2-NEXT: vpsrad $24, %xmm3, %xmm3
267 ; AVX2-NEXT: vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
268 ; AVX2-NEXT: vpblendd {{.*#+}} xmm3 = xmm3[0],xmm4[1],xmm3[2],xmm4[3]
269 ; AVX2-NEXT: vpsllq $56, %xmm2, %xmm2
270 ; AVX2-NEXT: vpsrad $31, %xmm2, %xmm4
271 ; AVX2-NEXT: vpsrad $24, %xmm2, %xmm2
272 ; AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
273 ; AVX2-NEXT: vpblendd {{.*#+}} xmm2 = xmm2[0],xmm4[1],xmm2[2],xmm4[3]
274 ; AVX2-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
275 ; AVX2-NEXT: vpsllq $56, %xmm1, %xmm1
276 ; AVX2-NEXT: vpsrad $31, %xmm1, %xmm3
277 ; AVX2-NEXT: vpsrad $24, %xmm1, %xmm1
278 ; AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
279 ; AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm3[1],xmm1[2],xmm3[3]
280 ; AVX2-NEXT: vpsllq $56, %xmm0, %xmm0
281 ; AVX2-NEXT: vpsrad $31, %xmm0, %xmm3
282 ; AVX2-NEXT: vpsrad $24, %xmm0, %xmm0
283 ; AVX2-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
284 ; AVX2-NEXT: vpblendd {{.*#+}} xmm0 = xmm0[0],xmm3[1],xmm0[2],xmm3[3]
285 ; AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
286 ; AVX2-NEXT: vpand %xmm2, %xmm0, %xmm0
287 ; AVX2-NEXT: vmovmskpd %xmm0, %eax
288 ; AVX2-NEXT: # kill: def $al killed $al killed $eax
291 ; AVX512F-LABEL: v2i8:
293 ; AVX512F-NEXT: vpsllq $56, %xmm3, %xmm3
294 ; AVX512F-NEXT: vpsraq $56, %xmm3, %xmm3
295 ; AVX512F-NEXT: vpsllq $56, %xmm2, %xmm2
296 ; AVX512F-NEXT: vpsraq $56, %xmm2, %xmm2
297 ; AVX512F-NEXT: vpsllq $56, %xmm1, %xmm1
298 ; AVX512F-NEXT: vpsraq $56, %xmm1, %xmm1
299 ; AVX512F-NEXT: vpsllq $56, %xmm0, %xmm0
300 ; AVX512F-NEXT: vpsraq $56, %xmm0, %xmm0
301 ; AVX512F-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
302 ; AVX512F-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
303 ; AVX512F-NEXT: kmovw %k0, %eax
304 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
307 ; AVX512BW-LABEL: v2i8:
309 ; AVX512BW-NEXT: vpsllq $56, %xmm3, %xmm3
310 ; AVX512BW-NEXT: vpsraq $56, %xmm3, %xmm3
311 ; AVX512BW-NEXT: vpsllq $56, %xmm2, %xmm2
312 ; AVX512BW-NEXT: vpsraq $56, %xmm2, %xmm2
313 ; AVX512BW-NEXT: vpsllq $56, %xmm1, %xmm1
314 ; AVX512BW-NEXT: vpsraq $56, %xmm1, %xmm1
315 ; AVX512BW-NEXT: vpsllq $56, %xmm0, %xmm0
316 ; AVX512BW-NEXT: vpsraq $56, %xmm0, %xmm0
317 ; AVX512BW-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
318 ; AVX512BW-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
319 ; AVX512BW-NEXT: kmovd %k0, %eax
320 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
321 ; AVX512BW-NEXT: retq
322 %x0 = icmp sgt <2 x i8> %a, %b
323 %x1 = icmp sgt <2 x i8> %c, %d
324 %y = and <2 x i1> %x0, %x1
325 %res = bitcast <2 x i1> %y to i2
329 define i2 @v2i16(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c, <2 x i16> %d) {
330 ; SSE2-SSSE3-LABEL: v2i16:
331 ; SSE2-SSSE3: # %bb.0:
332 ; SSE2-SSSE3-NEXT: psllq $48, %xmm2
333 ; SSE2-SSSE3-NEXT: movdqa %xmm2, %xmm4
334 ; SSE2-SSSE3-NEXT: psrad $31, %xmm4
335 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
336 ; SSE2-SSSE3-NEXT: psrad $16, %xmm2
337 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
338 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
339 ; SSE2-SSSE3-NEXT: psllq $48, %xmm3
340 ; SSE2-SSSE3-NEXT: movdqa %xmm3, %xmm4
341 ; SSE2-SSSE3-NEXT: psrad $31, %xmm4
342 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
343 ; SSE2-SSSE3-NEXT: psrad $16, %xmm3
344 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm3[1,3,2,3]
345 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
346 ; SSE2-SSSE3-NEXT: psllq $48, %xmm0
347 ; SSE2-SSSE3-NEXT: movdqa %xmm0, %xmm4
348 ; SSE2-SSSE3-NEXT: psrad $31, %xmm4
349 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
350 ; SSE2-SSSE3-NEXT: psrad $16, %xmm0
351 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3]
352 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
353 ; SSE2-SSSE3-NEXT: psllq $48, %xmm1
354 ; SSE2-SSSE3-NEXT: movdqa %xmm1, %xmm4
355 ; SSE2-SSSE3-NEXT: psrad $31, %xmm4
356 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
357 ; SSE2-SSSE3-NEXT: psrad $16, %xmm1
358 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,3,2,3]
359 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
360 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
361 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm1
362 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm0
363 ; SSE2-SSSE3-NEXT: movdqa %xmm0, %xmm5
364 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm1, %xmm5
365 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
366 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,0,2,2]
367 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm1
368 ; SSE2-SSSE3-NEXT: por %xmm0, %xmm1
369 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm3
370 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm2
371 ; SSE2-SSSE3-NEXT: movdqa %xmm2, %xmm0
372 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm3, %xmm0
373 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
374 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,2,2]
375 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm3
376 ; SSE2-SSSE3-NEXT: por %xmm2, %xmm3
377 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm3
378 ; SSE2-SSSE3-NEXT: movmskpd %xmm3, %eax
379 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
380 ; SSE2-SSSE3-NEXT: retq
384 ; AVX1-NEXT: vpsllq $48, %xmm3, %xmm3
385 ; AVX1-NEXT: vpsrad $31, %xmm3, %xmm4
386 ; AVX1-NEXT: vpsrad $16, %xmm3, %xmm3
387 ; AVX1-NEXT: vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
388 ; AVX1-NEXT: vpblendw {{.*#+}} xmm3 = xmm3[0,1],xmm4[2,3],xmm3[4,5],xmm4[6,7]
389 ; AVX1-NEXT: vpsllq $48, %xmm2, %xmm2
390 ; AVX1-NEXT: vpsrad $31, %xmm2, %xmm4
391 ; AVX1-NEXT: vpsrad $16, %xmm2, %xmm2
392 ; AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
393 ; AVX1-NEXT: vpblendw {{.*#+}} xmm2 = xmm2[0,1],xmm4[2,3],xmm2[4,5],xmm4[6,7]
394 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
395 ; AVX1-NEXT: vpsllq $48, %xmm1, %xmm1
396 ; AVX1-NEXT: vpsrad $31, %xmm1, %xmm3
397 ; AVX1-NEXT: vpsrad $16, %xmm1, %xmm1
398 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
399 ; AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
400 ; AVX1-NEXT: vpsllq $48, %xmm0, %xmm0
401 ; AVX1-NEXT: vpsrad $31, %xmm0, %xmm3
402 ; AVX1-NEXT: vpsrad $16, %xmm0, %xmm0
403 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
404 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm3[2,3],xmm0[4,5],xmm3[6,7]
405 ; AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
406 ; AVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
407 ; AVX1-NEXT: vmovmskpd %xmm0, %eax
408 ; AVX1-NEXT: # kill: def $al killed $al killed $eax
413 ; AVX2-NEXT: vpsllq $48, %xmm3, %xmm3
414 ; AVX2-NEXT: vpsrad $31, %xmm3, %xmm4
415 ; AVX2-NEXT: vpsrad $16, %xmm3, %xmm3
416 ; AVX2-NEXT: vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
417 ; AVX2-NEXT: vpblendd {{.*#+}} xmm3 = xmm3[0],xmm4[1],xmm3[2],xmm4[3]
418 ; AVX2-NEXT: vpsllq $48, %xmm2, %xmm2
419 ; AVX2-NEXT: vpsrad $31, %xmm2, %xmm4
420 ; AVX2-NEXT: vpsrad $16, %xmm2, %xmm2
421 ; AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
422 ; AVX2-NEXT: vpblendd {{.*#+}} xmm2 = xmm2[0],xmm4[1],xmm2[2],xmm4[3]
423 ; AVX2-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
424 ; AVX2-NEXT: vpsllq $48, %xmm1, %xmm1
425 ; AVX2-NEXT: vpsrad $31, %xmm1, %xmm3
426 ; AVX2-NEXT: vpsrad $16, %xmm1, %xmm1
427 ; AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
428 ; AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm3[1],xmm1[2],xmm3[3]
429 ; AVX2-NEXT: vpsllq $48, %xmm0, %xmm0
430 ; AVX2-NEXT: vpsrad $31, %xmm0, %xmm3
431 ; AVX2-NEXT: vpsrad $16, %xmm0, %xmm0
432 ; AVX2-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
433 ; AVX2-NEXT: vpblendd {{.*#+}} xmm0 = xmm0[0],xmm3[1],xmm0[2],xmm3[3]
434 ; AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
435 ; AVX2-NEXT: vpand %xmm2, %xmm0, %xmm0
436 ; AVX2-NEXT: vmovmskpd %xmm0, %eax
437 ; AVX2-NEXT: # kill: def $al killed $al killed $eax
440 ; AVX512F-LABEL: v2i16:
442 ; AVX512F-NEXT: vpsllq $48, %xmm3, %xmm3
443 ; AVX512F-NEXT: vpsraq $48, %xmm3, %xmm3
444 ; AVX512F-NEXT: vpsllq $48, %xmm2, %xmm2
445 ; AVX512F-NEXT: vpsraq $48, %xmm2, %xmm2
446 ; AVX512F-NEXT: vpsllq $48, %xmm1, %xmm1
447 ; AVX512F-NEXT: vpsraq $48, %xmm1, %xmm1
448 ; AVX512F-NEXT: vpsllq $48, %xmm0, %xmm0
449 ; AVX512F-NEXT: vpsraq $48, %xmm0, %xmm0
450 ; AVX512F-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
451 ; AVX512F-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
452 ; AVX512F-NEXT: kmovw %k0, %eax
453 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
456 ; AVX512BW-LABEL: v2i16:
458 ; AVX512BW-NEXT: vpsllq $48, %xmm3, %xmm3
459 ; AVX512BW-NEXT: vpsraq $48, %xmm3, %xmm3
460 ; AVX512BW-NEXT: vpsllq $48, %xmm2, %xmm2
461 ; AVX512BW-NEXT: vpsraq $48, %xmm2, %xmm2
462 ; AVX512BW-NEXT: vpsllq $48, %xmm1, %xmm1
463 ; AVX512BW-NEXT: vpsraq $48, %xmm1, %xmm1
464 ; AVX512BW-NEXT: vpsllq $48, %xmm0, %xmm0
465 ; AVX512BW-NEXT: vpsraq $48, %xmm0, %xmm0
466 ; AVX512BW-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
467 ; AVX512BW-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
468 ; AVX512BW-NEXT: kmovd %k0, %eax
469 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
470 ; AVX512BW-NEXT: retq
471 %x0 = icmp sgt <2 x i16> %a, %b
472 %x1 = icmp sgt <2 x i16> %c, %d
473 %y = and <2 x i1> %x0, %x1
474 %res = bitcast <2 x i1> %y to i2
478 define i2 @v2i32(<2 x i32> %a, <2 x i32> %b, <2 x i32> %c, <2 x i32> %d) {
479 ; SSE2-SSSE3-LABEL: v2i32:
480 ; SSE2-SSSE3: # %bb.0:
481 ; SSE2-SSSE3-NEXT: psllq $32, %xmm2
482 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm2[1,3,2,3]
483 ; SSE2-SSSE3-NEXT: psrad $31, %xmm2
484 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
485 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
486 ; SSE2-SSSE3-NEXT: psllq $32, %xmm3
487 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm3[1,3,2,3]
488 ; SSE2-SSSE3-NEXT: psrad $31, %xmm3
489 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm3[1,3,2,3]
490 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
491 ; SSE2-SSSE3-NEXT: psllq $32, %xmm0
492 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,3,2,3]
493 ; SSE2-SSSE3-NEXT: psrad $31, %xmm0
494 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3]
495 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
496 ; SSE2-SSSE3-NEXT: psllq $32, %xmm1
497 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,3,2,3]
498 ; SSE2-SSSE3-NEXT: psrad $31, %xmm1
499 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,3,2,3]
500 ; SSE2-SSSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
501 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [2147483648,2147483648]
502 ; SSE2-SSSE3-NEXT: pxor %xmm1, %xmm0
503 ; SSE2-SSSE3-NEXT: pxor %xmm1, %xmm3
504 ; SSE2-SSSE3-NEXT: movdqa %xmm3, %xmm5
505 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm0, %xmm5
506 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm0, %xmm3
507 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm3[0,0,2,2]
508 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm0
509 ; SSE2-SSSE3-NEXT: por %xmm3, %xmm0
510 ; SSE2-SSSE3-NEXT: pxor %xmm1, %xmm2
511 ; SSE2-SSSE3-NEXT: pxor %xmm1, %xmm4
512 ; SSE2-SSSE3-NEXT: movdqa %xmm4, %xmm1
513 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm2, %xmm1
514 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm2, %xmm4
515 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm4[0,0,2,2]
516 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm2
517 ; SSE2-SSSE3-NEXT: por %xmm4, %xmm2
518 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm2
519 ; SSE2-SSSE3-NEXT: movmskpd %xmm2, %eax
520 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
521 ; SSE2-SSSE3-NEXT: retq
525 ; AVX1-NEXT: vpsllq $32, %xmm3, %xmm4
526 ; AVX1-NEXT: vpsrad $31, %xmm4, %xmm4
527 ; AVX1-NEXT: vpblendw {{.*#+}} xmm3 = xmm3[0,1],xmm4[2,3],xmm3[4,5],xmm4[6,7]
528 ; AVX1-NEXT: vpsllq $32, %xmm2, %xmm4
529 ; AVX1-NEXT: vpsrad $31, %xmm4, %xmm4
530 ; AVX1-NEXT: vpblendw {{.*#+}} xmm2 = xmm2[0,1],xmm4[2,3],xmm2[4,5],xmm4[6,7]
531 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
532 ; AVX1-NEXT: vpsllq $32, %xmm1, %xmm3
533 ; AVX1-NEXT: vpsrad $31, %xmm3, %xmm3
534 ; AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
535 ; AVX1-NEXT: vpsllq $32, %xmm0, %xmm3
536 ; AVX1-NEXT: vpsrad $31, %xmm3, %xmm3
537 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm3[2,3],xmm0[4,5],xmm3[6,7]
538 ; AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
539 ; AVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
540 ; AVX1-NEXT: vmovmskpd %xmm0, %eax
541 ; AVX1-NEXT: # kill: def $al killed $al killed $eax
546 ; AVX2-NEXT: vpsllq $32, %xmm3, %xmm4
547 ; AVX2-NEXT: vpsrad $31, %xmm4, %xmm4
548 ; AVX2-NEXT: vpblendd {{.*#+}} xmm3 = xmm3[0],xmm4[1],xmm3[2],xmm4[3]
549 ; AVX2-NEXT: vpsllq $32, %xmm2, %xmm4
550 ; AVX2-NEXT: vpsrad $31, %xmm4, %xmm4
551 ; AVX2-NEXT: vpblendd {{.*#+}} xmm2 = xmm2[0],xmm4[1],xmm2[2],xmm4[3]
552 ; AVX2-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
553 ; AVX2-NEXT: vpsllq $32, %xmm1, %xmm3
554 ; AVX2-NEXT: vpsrad $31, %xmm3, %xmm3
555 ; AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm3[1],xmm1[2],xmm3[3]
556 ; AVX2-NEXT: vpsllq $32, %xmm0, %xmm3
557 ; AVX2-NEXT: vpsrad $31, %xmm3, %xmm3
558 ; AVX2-NEXT: vpblendd {{.*#+}} xmm0 = xmm0[0],xmm3[1],xmm0[2],xmm3[3]
559 ; AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
560 ; AVX2-NEXT: vpand %xmm2, %xmm0, %xmm0
561 ; AVX2-NEXT: vmovmskpd %xmm0, %eax
562 ; AVX2-NEXT: # kill: def $al killed $al killed $eax
565 ; AVX512F-LABEL: v2i32:
567 ; AVX512F-NEXT: vpsllq $32, %xmm3, %xmm3
568 ; AVX512F-NEXT: vpsraq $32, %xmm3, %xmm3
569 ; AVX512F-NEXT: vpsllq $32, %xmm2, %xmm2
570 ; AVX512F-NEXT: vpsraq $32, %xmm2, %xmm2
571 ; AVX512F-NEXT: vpsllq $32, %xmm1, %xmm1
572 ; AVX512F-NEXT: vpsraq $32, %xmm1, %xmm1
573 ; AVX512F-NEXT: vpsllq $32, %xmm0, %xmm0
574 ; AVX512F-NEXT: vpsraq $32, %xmm0, %xmm0
575 ; AVX512F-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
576 ; AVX512F-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
577 ; AVX512F-NEXT: kmovw %k0, %eax
578 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
581 ; AVX512BW-LABEL: v2i32:
583 ; AVX512BW-NEXT: vpsllq $32, %xmm3, %xmm3
584 ; AVX512BW-NEXT: vpsraq $32, %xmm3, %xmm3
585 ; AVX512BW-NEXT: vpsllq $32, %xmm2, %xmm2
586 ; AVX512BW-NEXT: vpsraq $32, %xmm2, %xmm2
587 ; AVX512BW-NEXT: vpsllq $32, %xmm1, %xmm1
588 ; AVX512BW-NEXT: vpsraq $32, %xmm1, %xmm1
589 ; AVX512BW-NEXT: vpsllq $32, %xmm0, %xmm0
590 ; AVX512BW-NEXT: vpsraq $32, %xmm0, %xmm0
591 ; AVX512BW-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
592 ; AVX512BW-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
593 ; AVX512BW-NEXT: kmovd %k0, %eax
594 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
595 ; AVX512BW-NEXT: retq
596 %x0 = icmp sgt <2 x i32> %a, %b
597 %x1 = icmp sgt <2 x i32> %c, %d
598 %y = and <2 x i1> %x0, %x1
599 %res = bitcast <2 x i1> %y to i2
603 define i2 @v2i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c, <2 x i64> %d) {
604 ; SSE2-SSSE3-LABEL: v2i64:
605 ; SSE2-SSSE3: # %bb.0:
606 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
607 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm1
608 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm0
609 ; SSE2-SSSE3-NEXT: movdqa %xmm0, %xmm5
610 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm1, %xmm5
611 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
612 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,0,2,2]
613 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm1
614 ; SSE2-SSSE3-NEXT: por %xmm0, %xmm1
615 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm3
616 ; SSE2-SSSE3-NEXT: pxor %xmm4, %xmm2
617 ; SSE2-SSSE3-NEXT: movdqa %xmm2, %xmm0
618 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm3, %xmm0
619 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
620 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,2,2]
621 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm3
622 ; SSE2-SSSE3-NEXT: por %xmm2, %xmm3
623 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm3
624 ; SSE2-SSSE3-NEXT: movmskpd %xmm3, %eax
625 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
626 ; SSE2-SSSE3-NEXT: retq
628 ; AVX12-LABEL: v2i64:
630 ; AVX12-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
631 ; AVX12-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm1
632 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
633 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
634 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
637 ; AVX512F-LABEL: v2i64:
639 ; AVX512F-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
640 ; AVX512F-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
641 ; AVX512F-NEXT: kmovw %k0, %eax
642 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
645 ; AVX512BW-LABEL: v2i64:
647 ; AVX512BW-NEXT: vpcmpgtq %xmm1, %xmm0, %k1
648 ; AVX512BW-NEXT: vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
649 ; AVX512BW-NEXT: kmovd %k0, %eax
650 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
651 ; AVX512BW-NEXT: retq
652 %x0 = icmp sgt <2 x i64> %a, %b
653 %x1 = icmp sgt <2 x i64> %c, %d
654 %y = and <2 x i1> %x0, %x1
655 %res = bitcast <2 x i1> %y to i2
659 define i2 @v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %c, <2 x double> %d) {
660 ; SSE2-SSSE3-LABEL: v2f64:
661 ; SSE2-SSSE3: # %bb.0:
662 ; SSE2-SSSE3-NEXT: cmpltpd %xmm0, %xmm1
663 ; SSE2-SSSE3-NEXT: cmpltpd %xmm2, %xmm3
664 ; SSE2-SSSE3-NEXT: andpd %xmm1, %xmm3
665 ; SSE2-SSSE3-NEXT: movmskpd %xmm3, %eax
666 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
667 ; SSE2-SSSE3-NEXT: retq
669 ; AVX12-LABEL: v2f64:
671 ; AVX12-NEXT: vcmpltpd %xmm0, %xmm1, %xmm0
672 ; AVX12-NEXT: vcmpltpd %xmm2, %xmm3, %xmm1
673 ; AVX12-NEXT: vandpd %xmm1, %xmm0, %xmm0
674 ; AVX12-NEXT: vmovmskpd %xmm0, %eax
675 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
678 ; AVX512F-LABEL: v2f64:
680 ; AVX512F-NEXT: vcmpltpd %xmm0, %xmm1, %k1
681 ; AVX512F-NEXT: vcmpltpd %xmm2, %xmm3, %k0 {%k1}
682 ; AVX512F-NEXT: kmovw %k0, %eax
683 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
686 ; AVX512BW-LABEL: v2f64:
688 ; AVX512BW-NEXT: vcmpltpd %xmm0, %xmm1, %k1
689 ; AVX512BW-NEXT: vcmpltpd %xmm2, %xmm3, %k0 {%k1}
690 ; AVX512BW-NEXT: kmovd %k0, %eax
691 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
692 ; AVX512BW-NEXT: retq
693 %x0 = fcmp ogt <2 x double> %a, %b
694 %x1 = fcmp ogt <2 x double> %c, %d
695 %y = and <2 x i1> %x0, %x1
696 %res = bitcast <2 x i1> %y to i2
700 define i4 @v4i8(<4 x i8> %a, <4 x i8> %b, <4 x i8> %c, <4 x i8> %d) {
701 ; SSE2-SSSE3-LABEL: v4i8:
702 ; SSE2-SSSE3: # %bb.0:
703 ; SSE2-SSSE3-NEXT: pslld $24, %xmm3
704 ; SSE2-SSSE3-NEXT: psrad $24, %xmm3
705 ; SSE2-SSSE3-NEXT: pslld $24, %xmm2
706 ; SSE2-SSSE3-NEXT: psrad $24, %xmm2
707 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
708 ; SSE2-SSSE3-NEXT: pslld $24, %xmm1
709 ; SSE2-SSSE3-NEXT: psrad $24, %xmm1
710 ; SSE2-SSSE3-NEXT: pslld $24, %xmm0
711 ; SSE2-SSSE3-NEXT: psrad $24, %xmm0
712 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
713 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm0
714 ; SSE2-SSSE3-NEXT: movmskps %xmm0, %eax
715 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
716 ; SSE2-SSSE3-NEXT: retq
720 ; AVX12-NEXT: vpslld $24, %xmm3, %xmm3
721 ; AVX12-NEXT: vpsrad $24, %xmm3, %xmm3
722 ; AVX12-NEXT: vpslld $24, %xmm2, %xmm2
723 ; AVX12-NEXT: vpsrad $24, %xmm2, %xmm2
724 ; AVX12-NEXT: vpcmpgtd %xmm3, %xmm2, %xmm2
725 ; AVX12-NEXT: vpslld $24, %xmm1, %xmm1
726 ; AVX12-NEXT: vpsrad $24, %xmm1, %xmm1
727 ; AVX12-NEXT: vpslld $24, %xmm0, %xmm0
728 ; AVX12-NEXT: vpsrad $24, %xmm0, %xmm0
729 ; AVX12-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
730 ; AVX12-NEXT: vpand %xmm2, %xmm0, %xmm0
731 ; AVX12-NEXT: vmovmskps %xmm0, %eax
732 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
735 ; AVX512F-LABEL: v4i8:
737 ; AVX512F-NEXT: vpslld $24, %xmm3, %xmm3
738 ; AVX512F-NEXT: vpsrad $24, %xmm3, %xmm3
739 ; AVX512F-NEXT: vpslld $24, %xmm2, %xmm2
740 ; AVX512F-NEXT: vpsrad $24, %xmm2, %xmm2
741 ; AVX512F-NEXT: vpslld $24, %xmm1, %xmm1
742 ; AVX512F-NEXT: vpsrad $24, %xmm1, %xmm1
743 ; AVX512F-NEXT: vpslld $24, %xmm0, %xmm0
744 ; AVX512F-NEXT: vpsrad $24, %xmm0, %xmm0
745 ; AVX512F-NEXT: vpcmpgtd %xmm1, %xmm0, %k1
746 ; AVX512F-NEXT: vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
747 ; AVX512F-NEXT: kmovw %k0, %eax
748 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
751 ; AVX512BW-LABEL: v4i8:
753 ; AVX512BW-NEXT: vpslld $24, %xmm3, %xmm3
754 ; AVX512BW-NEXT: vpsrad $24, %xmm3, %xmm3
755 ; AVX512BW-NEXT: vpslld $24, %xmm2, %xmm2
756 ; AVX512BW-NEXT: vpsrad $24, %xmm2, %xmm2
757 ; AVX512BW-NEXT: vpslld $24, %xmm1, %xmm1
758 ; AVX512BW-NEXT: vpsrad $24, %xmm1, %xmm1
759 ; AVX512BW-NEXT: vpslld $24, %xmm0, %xmm0
760 ; AVX512BW-NEXT: vpsrad $24, %xmm0, %xmm0
761 ; AVX512BW-NEXT: vpcmpgtd %xmm1, %xmm0, %k1
762 ; AVX512BW-NEXT: vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
763 ; AVX512BW-NEXT: kmovd %k0, %eax
764 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
765 ; AVX512BW-NEXT: retq
766 %x0 = icmp sgt <4 x i8> %a, %b
767 %x1 = icmp sgt <4 x i8> %c, %d
768 %y = and <4 x i1> %x0, %x1
769 %res = bitcast <4 x i1> %y to i4
773 define i4 @v4i16(<4 x i16> %a, <4 x i16> %b, <4 x i16> %c, <4 x i16> %d) {
774 ; SSE2-SSSE3-LABEL: v4i16:
775 ; SSE2-SSSE3: # %bb.0:
776 ; SSE2-SSSE3-NEXT: pslld $16, %xmm3
777 ; SSE2-SSSE3-NEXT: psrad $16, %xmm3
778 ; SSE2-SSSE3-NEXT: pslld $16, %xmm2
779 ; SSE2-SSSE3-NEXT: psrad $16, %xmm2
780 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm3, %xmm2
781 ; SSE2-SSSE3-NEXT: pslld $16, %xmm1
782 ; SSE2-SSSE3-NEXT: psrad $16, %xmm1
783 ; SSE2-SSSE3-NEXT: pslld $16, %xmm0
784 ; SSE2-SSSE3-NEXT: psrad $16, %xmm0
785 ; SSE2-SSSE3-NEXT: pcmpgtd %xmm1, %xmm0
786 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm0
787 ; SSE2-SSSE3-NEXT: movmskps %xmm0, %eax
788 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
789 ; SSE2-SSSE3-NEXT: retq
791 ; AVX12-LABEL: v4i16:
793 ; AVX12-NEXT: vpslld $16, %xmm3, %xmm3
794 ; AVX12-NEXT: vpsrad $16, %xmm3, %xmm3
795 ; AVX12-NEXT: vpslld $16, %xmm2, %xmm2
796 ; AVX12-NEXT: vpsrad $16, %xmm2, %xmm2
797 ; AVX12-NEXT: vpcmpgtd %xmm3, %xmm2, %xmm2
798 ; AVX12-NEXT: vpslld $16, %xmm1, %xmm1
799 ; AVX12-NEXT: vpsrad $16, %xmm1, %xmm1
800 ; AVX12-NEXT: vpslld $16, %xmm0, %xmm0
801 ; AVX12-NEXT: vpsrad $16, %xmm0, %xmm0
802 ; AVX12-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
803 ; AVX12-NEXT: vpand %xmm2, %xmm0, %xmm0
804 ; AVX12-NEXT: vmovmskps %xmm0, %eax
805 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
808 ; AVX512F-LABEL: v4i16:
810 ; AVX512F-NEXT: vpslld $16, %xmm3, %xmm3
811 ; AVX512F-NEXT: vpsrad $16, %xmm3, %xmm3
812 ; AVX512F-NEXT: vpslld $16, %xmm2, %xmm2
813 ; AVX512F-NEXT: vpsrad $16, %xmm2, %xmm2
814 ; AVX512F-NEXT: vpslld $16, %xmm1, %xmm1
815 ; AVX512F-NEXT: vpsrad $16, %xmm1, %xmm1
816 ; AVX512F-NEXT: vpslld $16, %xmm0, %xmm0
817 ; AVX512F-NEXT: vpsrad $16, %xmm0, %xmm0
818 ; AVX512F-NEXT: vpcmpgtd %xmm1, %xmm0, %k1
819 ; AVX512F-NEXT: vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
820 ; AVX512F-NEXT: kmovw %k0, %eax
821 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
824 ; AVX512BW-LABEL: v4i16:
826 ; AVX512BW-NEXT: vpslld $16, %xmm3, %xmm3
827 ; AVX512BW-NEXT: vpsrad $16, %xmm3, %xmm3
828 ; AVX512BW-NEXT: vpslld $16, %xmm2, %xmm2
829 ; AVX512BW-NEXT: vpsrad $16, %xmm2, %xmm2
830 ; AVX512BW-NEXT: vpslld $16, %xmm1, %xmm1
831 ; AVX512BW-NEXT: vpsrad $16, %xmm1, %xmm1
832 ; AVX512BW-NEXT: vpslld $16, %xmm0, %xmm0
833 ; AVX512BW-NEXT: vpsrad $16, %xmm0, %xmm0
834 ; AVX512BW-NEXT: vpcmpgtd %xmm1, %xmm0, %k1
835 ; AVX512BW-NEXT: vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
836 ; AVX512BW-NEXT: kmovd %k0, %eax
837 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
838 ; AVX512BW-NEXT: retq
839 %x0 = icmp sgt <4 x i16> %a, %b
840 %x1 = icmp sgt <4 x i16> %c, %d
841 %y = and <4 x i1> %x0, %x1
842 %res = bitcast <4 x i1> %y to i4
846 define i8 @v8i8(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c, <8 x i8> %d) {
847 ; SSE2-SSSE3-LABEL: v8i8:
848 ; SSE2-SSSE3: # %bb.0:
849 ; SSE2-SSSE3-NEXT: psllw $8, %xmm3
850 ; SSE2-SSSE3-NEXT: psraw $8, %xmm3
851 ; SSE2-SSSE3-NEXT: psllw $8, %xmm2
852 ; SSE2-SSSE3-NEXT: psraw $8, %xmm2
853 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm3, %xmm2
854 ; SSE2-SSSE3-NEXT: psllw $8, %xmm1
855 ; SSE2-SSSE3-NEXT: psraw $8, %xmm1
856 ; SSE2-SSSE3-NEXT: psllw $8, %xmm0
857 ; SSE2-SSSE3-NEXT: psraw $8, %xmm0
858 ; SSE2-SSSE3-NEXT: pcmpgtw %xmm1, %xmm0
859 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm0
860 ; SSE2-SSSE3-NEXT: packsswb %xmm0, %xmm0
861 ; SSE2-SSSE3-NEXT: pmovmskb %xmm0, %eax
862 ; SSE2-SSSE3-NEXT: # kill: def $al killed $al killed $eax
863 ; SSE2-SSSE3-NEXT: retq
867 ; AVX12-NEXT: vpsllw $8, %xmm3, %xmm3
868 ; AVX12-NEXT: vpsraw $8, %xmm3, %xmm3
869 ; AVX12-NEXT: vpsllw $8, %xmm2, %xmm2
870 ; AVX12-NEXT: vpsraw $8, %xmm2, %xmm2
871 ; AVX12-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm2
872 ; AVX12-NEXT: vpsllw $8, %xmm1, %xmm1
873 ; AVX12-NEXT: vpsraw $8, %xmm1, %xmm1
874 ; AVX12-NEXT: vpsllw $8, %xmm0, %xmm0
875 ; AVX12-NEXT: vpsraw $8, %xmm0, %xmm0
876 ; AVX12-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
877 ; AVX12-NEXT: vpand %xmm2, %xmm0, %xmm0
878 ; AVX12-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
879 ; AVX12-NEXT: vpmovmskb %xmm0, %eax
880 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
883 ; AVX512F-LABEL: v8i8:
885 ; AVX512F-NEXT: vpsllw $8, %xmm3, %xmm3
886 ; AVX512F-NEXT: vpsraw $8, %xmm3, %xmm3
887 ; AVX512F-NEXT: vpsllw $8, %xmm2, %xmm2
888 ; AVX512F-NEXT: vpsraw $8, %xmm2, %xmm2
889 ; AVX512F-NEXT: vpcmpgtw %xmm3, %xmm2, %xmm2
890 ; AVX512F-NEXT: vpsllw $8, %xmm1, %xmm1
891 ; AVX512F-NEXT: vpsraw $8, %xmm1, %xmm1
892 ; AVX512F-NEXT: vpsllw $8, %xmm0, %xmm0
893 ; AVX512F-NEXT: vpsraw $8, %xmm0, %xmm0
894 ; AVX512F-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
895 ; AVX512F-NEXT: vpand %xmm2, %xmm0, %xmm0
896 ; AVX512F-NEXT: vpmovsxwd %xmm0, %ymm0
897 ; AVX512F-NEXT: vptestmd %ymm0, %ymm0, %k0
898 ; AVX512F-NEXT: kmovw %k0, %eax
899 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
900 ; AVX512F-NEXT: vzeroupper
903 ; AVX512BW-LABEL: v8i8:
905 ; AVX512BW-NEXT: vpsllw $8, %xmm3, %xmm3
906 ; AVX512BW-NEXT: vpsraw $8, %xmm3, %xmm3
907 ; AVX512BW-NEXT: vpsllw $8, %xmm2, %xmm2
908 ; AVX512BW-NEXT: vpsraw $8, %xmm2, %xmm2
909 ; AVX512BW-NEXT: vpsllw $8, %xmm1, %xmm1
910 ; AVX512BW-NEXT: vpsraw $8, %xmm1, %xmm1
911 ; AVX512BW-NEXT: vpsllw $8, %xmm0, %xmm0
912 ; AVX512BW-NEXT: vpsraw $8, %xmm0, %xmm0
913 ; AVX512BW-NEXT: vpcmpgtw %xmm1, %xmm0, %k1
914 ; AVX512BW-NEXT: vpcmpgtw %xmm3, %xmm2, %k0 {%k1}
915 ; AVX512BW-NEXT: kmovd %k0, %eax
916 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
917 ; AVX512BW-NEXT: retq
918 %x0 = icmp sgt <8 x i8> %a, %b
919 %x1 = icmp sgt <8 x i8> %c, %d
920 %y = and <8 x i1> %x0, %x1
921 %res = bitcast <8 x i1> %y to i8