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 i8 @v8i64(<8 x i64> %a, <8 x i64> %b, <8 x i64> %c, <8 x i64> %d) {
11 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm8
12 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
13 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm10
14 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm11
15 ; SSE-NEXT: pcmpgtq %xmm7, %xmm3
16 ; SSE-NEXT: pshufd {{.*#+}} xmm3 = xmm3[0,2,2,3]
17 ; SSE-NEXT: pshuflw {{.*#+}} xmm3 = xmm3[0,1,0,2,4,5,6,7]
18 ; SSE-NEXT: pcmpgtq %xmm6, %xmm2
19 ; SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,2,2,3]
20 ; SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[0,1,0,2,4,5,6,7]
21 ; SSE-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
22 ; SSE-NEXT: pcmpgtq %xmm5, %xmm1
23 ; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
24 ; SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,2,2,3,4,5,6,7]
25 ; SSE-NEXT: pcmpgtq %xmm4, %xmm0
26 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
27 ; SSE-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,2,2,3,4,5,6,7]
28 ; SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
29 ; SSE-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm2[4,5,6,7]
30 ; SSE-NEXT: pcmpgtq {{[0-9]+}}(%rsp), %xmm11
31 ; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm11[0,2,2,3]
32 ; SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,1,0,2,4,5,6,7]
33 ; SSE-NEXT: pcmpgtq {{[0-9]+}}(%rsp), %xmm10
34 ; SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm10[0,2,2,3]
35 ; SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[0,1,0,2,4,5,6,7]
36 ; SSE-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
37 ; SSE-NEXT: pcmpgtq {{[0-9]+}}(%rsp), %xmm9
38 ; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm9[0,2,2,3]
39 ; SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,2,2,3,4,5,6,7]
40 ; SSE-NEXT: pcmpgtq {{[0-9]+}}(%rsp), %xmm8
41 ; SSE-NEXT: pshufd {{.*#+}} xmm3 = xmm8[0,2,2,3]
42 ; SSE-NEXT: pshuflw {{.*#+}} xmm3 = xmm3[0,2,2,3,4,5,6,7]
43 ; SSE-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
44 ; SSE-NEXT: pblendw {{.*#+}} xmm3 = xmm3[0,1,2,3],xmm2[4,5,6,7]
45 ; SSE-NEXT: pand %xmm0, %xmm3
46 ; SSE-NEXT: packsswb %xmm0, %xmm3
47 ; SSE-NEXT: pmovmskb %xmm3, %eax
48 ; SSE-NEXT: # kill: def $al killed $al killed $eax
53 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm8
54 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm9
55 ; AVX1-NEXT: vpcmpgtq %xmm8, %xmm9, %xmm8
56 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm1, %xmm1
57 ; AVX1-NEXT: vpackssdw %xmm8, %xmm1, %xmm8
58 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
59 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
60 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm1, %xmm1
61 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm0
62 ; AVX1-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
63 ; AVX1-NEXT: vpackssdw %xmm8, %xmm0, %xmm0
64 ; AVX1-NEXT: vextractf128 $1, %ymm7, %xmm1
65 ; AVX1-NEXT: vextractf128 $1, %ymm5, %xmm2
66 ; AVX1-NEXT: vpcmpgtq %xmm1, %xmm2, %xmm1
67 ; AVX1-NEXT: vpcmpgtq %xmm7, %xmm5, %xmm2
68 ; AVX1-NEXT: vpackssdw %xmm1, %xmm2, %xmm1
69 ; AVX1-NEXT: vextractf128 $1, %ymm6, %xmm2
70 ; AVX1-NEXT: vextractf128 $1, %ymm4, %xmm3
71 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm2
72 ; AVX1-NEXT: vpcmpgtq %xmm6, %xmm4, %xmm3
73 ; AVX1-NEXT: vpackssdw %xmm2, %xmm3, %xmm2
74 ; AVX1-NEXT: vpackssdw %xmm1, %xmm2, %xmm1
75 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
76 ; AVX1-NEXT: vpsllw $15, %xmm0, %xmm0
77 ; AVX1-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
78 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
79 ; AVX1-NEXT: # kill: def $al killed $al killed $eax
80 ; AVX1-NEXT: vzeroupper
85 ; AVX2-NEXT: vpcmpgtq %ymm3, %ymm1, %ymm1
86 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm3
87 ; AVX2-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
88 ; AVX2-NEXT: vpcmpgtq %ymm2, %ymm0, %ymm0
89 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm2
90 ; AVX2-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
91 ; AVX2-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
92 ; AVX2-NEXT: vpcmpgtq %ymm7, %ymm5, %ymm1
93 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm2
94 ; AVX2-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
95 ; AVX2-NEXT: vpcmpgtq %ymm6, %ymm4, %ymm2
96 ; AVX2-NEXT: vextracti128 $1, %ymm2, %xmm3
97 ; AVX2-NEXT: vpackssdw %xmm3, %xmm2, %xmm2
98 ; AVX2-NEXT: vpackssdw %xmm1, %xmm2, %xmm1
99 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
100 ; AVX2-NEXT: vpsllw $15, %xmm0, %xmm0
101 ; AVX2-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
102 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
103 ; AVX2-NEXT: # kill: def $al killed $al killed $eax
104 ; AVX2-NEXT: vzeroupper
107 ; AVX512F-LABEL: v8i64:
109 ; AVX512F-NEXT: vpcmpgtq %zmm1, %zmm0, %k1
110 ; AVX512F-NEXT: vpcmpgtq %zmm3, %zmm2, %k0 {%k1}
111 ; AVX512F-NEXT: kmovw %k0, %eax
112 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
113 ; AVX512F-NEXT: vzeroupper
116 ; AVX512BW-LABEL: v8i64:
118 ; AVX512BW-NEXT: vpcmpgtq %zmm1, %zmm0, %k1
119 ; AVX512BW-NEXT: vpcmpgtq %zmm3, %zmm2, %k0 {%k1}
120 ; AVX512BW-NEXT: kmovd %k0, %eax
121 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
122 ; AVX512BW-NEXT: vzeroupper
123 ; AVX512BW-NEXT: retq
124 %x0 = icmp sgt <8 x i64> %a, %b
125 %x1 = icmp sgt <8 x i64> %c, %d
126 %y = and <8 x i1> %x0, %x1
127 %res = bitcast <8 x i1> %y to i8
131 define i8 @v8f64(<8 x double> %a, <8 x double> %b, <8 x double> %c, <8 x double> %d) {
134 ; SSE-NEXT: movapd {{[0-9]+}}(%rsp), %xmm8
135 ; SSE-NEXT: movapd {{[0-9]+}}(%rsp), %xmm9
136 ; SSE-NEXT: movapd {{[0-9]+}}(%rsp), %xmm10
137 ; SSE-NEXT: movapd {{[0-9]+}}(%rsp), %xmm11
138 ; SSE-NEXT: cmpltpd %xmm3, %xmm7
139 ; SSE-NEXT: shufps {{.*#+}} xmm7 = xmm7[0,2,2,3]
140 ; SSE-NEXT: pshuflw {{.*#+}} xmm3 = xmm7[0,1,0,2,4,5,6,7]
141 ; SSE-NEXT: cmpltpd %xmm2, %xmm6
142 ; SSE-NEXT: shufps {{.*#+}} xmm6 = xmm6[0,2,2,3]
143 ; SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm6[0,1,0,2,4,5,6,7]
144 ; SSE-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
145 ; SSE-NEXT: cmpltpd %xmm1, %xmm5
146 ; SSE-NEXT: shufps {{.*#+}} xmm5 = xmm5[0,2,2,3]
147 ; SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm5[0,2,2,3,4,5,6,7]
148 ; SSE-NEXT: cmpltpd %xmm0, %xmm4
149 ; SSE-NEXT: shufps {{.*#+}} xmm4 = xmm4[0,2,2,3]
150 ; SSE-NEXT: pshuflw {{.*#+}} xmm0 = xmm4[0,2,2,3,4,5,6,7]
151 ; SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
152 ; SSE-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm2[4,5,6,7]
153 ; SSE-NEXT: cmpltpd {{[0-9]+}}(%rsp), %xmm11
154 ; SSE-NEXT: shufps {{.*#+}} xmm11 = xmm11[0,2,2,3]
155 ; SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm11[0,1,0,2,4,5,6,7]
156 ; SSE-NEXT: cmpltpd {{[0-9]+}}(%rsp), %xmm10
157 ; SSE-NEXT: shufps {{.*#+}} xmm10 = xmm10[0,2,2,3]
158 ; SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm10[0,1,0,2,4,5,6,7]
159 ; SSE-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
160 ; SSE-NEXT: cmpltpd {{[0-9]+}}(%rsp), %xmm9
161 ; SSE-NEXT: shufps {{.*#+}} xmm9 = xmm9[0,2,2,3]
162 ; SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm9[0,2,2,3,4,5,6,7]
163 ; SSE-NEXT: cmpltpd {{[0-9]+}}(%rsp), %xmm8
164 ; SSE-NEXT: shufps {{.*#+}} xmm8 = xmm8[0,2,2,3]
165 ; SSE-NEXT: pshuflw {{.*#+}} xmm3 = xmm8[0,2,2,3,4,5,6,7]
166 ; SSE-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
167 ; SSE-NEXT: pblendw {{.*#+}} xmm3 = xmm3[0,1,2,3],xmm2[4,5,6,7]
168 ; SSE-NEXT: pand %xmm0, %xmm3
169 ; SSE-NEXT: packsswb %xmm0, %xmm3
170 ; SSE-NEXT: pmovmskb %xmm3, %eax
171 ; SSE-NEXT: # kill: def $al killed $al killed $eax
174 ; AVX12-LABEL: v8f64:
176 ; AVX12-NEXT: vcmpltpd %ymm1, %ymm3, %ymm1
177 ; AVX12-NEXT: vextractf128 $1, %ymm1, %xmm3
178 ; AVX12-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
179 ; AVX12-NEXT: vcmpltpd %ymm0, %ymm2, %ymm0
180 ; AVX12-NEXT: vextractf128 $1, %ymm0, %xmm2
181 ; AVX12-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
182 ; AVX12-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
183 ; AVX12-NEXT: vcmpltpd %ymm5, %ymm7, %ymm1
184 ; AVX12-NEXT: vextractf128 $1, %ymm1, %xmm2
185 ; AVX12-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
186 ; AVX12-NEXT: vcmpltpd %ymm4, %ymm6, %ymm2
187 ; AVX12-NEXT: vextractf128 $1, %ymm2, %xmm3
188 ; AVX12-NEXT: vpackssdw %xmm3, %xmm2, %xmm2
189 ; AVX12-NEXT: vpackssdw %xmm1, %xmm2, %xmm1
190 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
191 ; AVX12-NEXT: vpsllw $15, %xmm0, %xmm0
192 ; AVX12-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
193 ; AVX12-NEXT: vpmovmskb %xmm0, %eax
194 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
195 ; AVX12-NEXT: vzeroupper
198 ; AVX512F-LABEL: v8f64:
200 ; AVX512F-NEXT: vcmpltpd %zmm0, %zmm1, %k1
201 ; AVX512F-NEXT: vcmpltpd %zmm2, %zmm3, %k0 {%k1}
202 ; AVX512F-NEXT: kmovw %k0, %eax
203 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
204 ; AVX512F-NEXT: vzeroupper
207 ; AVX512BW-LABEL: v8f64:
209 ; AVX512BW-NEXT: vcmpltpd %zmm0, %zmm1, %k1
210 ; AVX512BW-NEXT: vcmpltpd %zmm2, %zmm3, %k0 {%k1}
211 ; AVX512BW-NEXT: kmovd %k0, %eax
212 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
213 ; AVX512BW-NEXT: vzeroupper
214 ; AVX512BW-NEXT: retq
215 %x0 = fcmp ogt <8 x double> %a, %b
216 %x1 = fcmp ogt <8 x double> %c, %d
217 %y = and <8 x i1> %x0, %x1
218 %res = bitcast <8 x i1> %y to i8
222 define i32 @v32i16(<32 x i16> %a, <32 x i16> %b, <32 x i16> %c, <32 x i16> %d) {
225 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm8
226 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
227 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm10
228 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm11
229 ; SSE-NEXT: pcmpgtw %xmm5, %xmm1
230 ; SSE-NEXT: pcmpgtw %xmm4, %xmm0
231 ; SSE-NEXT: packsswb %xmm1, %xmm0
232 ; SSE-NEXT: pcmpgtw %xmm7, %xmm3
233 ; SSE-NEXT: pcmpgtw %xmm6, %xmm2
234 ; SSE-NEXT: packsswb %xmm3, %xmm2
235 ; SSE-NEXT: pcmpgtw {{[0-9]+}}(%rsp), %xmm11
236 ; SSE-NEXT: pcmpgtw {{[0-9]+}}(%rsp), %xmm10
237 ; SSE-NEXT: packsswb %xmm11, %xmm10
238 ; SSE-NEXT: pand %xmm0, %xmm10
239 ; SSE-NEXT: pcmpgtw {{[0-9]+}}(%rsp), %xmm9
240 ; SSE-NEXT: pcmpgtw {{[0-9]+}}(%rsp), %xmm8
241 ; SSE-NEXT: packsswb %xmm9, %xmm8
242 ; SSE-NEXT: pand %xmm2, %xmm8
243 ; SSE-NEXT: pmovmskb %xmm10, %ecx
244 ; SSE-NEXT: pmovmskb %xmm8, %eax
245 ; SSE-NEXT: shll $16, %eax
246 ; SSE-NEXT: orl %ecx, %eax
249 ; AVX1-LABEL: v32i16:
251 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm8
252 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm9
253 ; AVX1-NEXT: vpcmpgtw %xmm8, %xmm9, %xmm8
254 ; AVX1-NEXT: vpcmpgtw %xmm3, %xmm1, %xmm1
255 ; AVX1-NEXT: vpacksswb %xmm8, %xmm1, %xmm8
256 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
257 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
258 ; AVX1-NEXT: vpcmpgtw %xmm3, %xmm1, %xmm1
259 ; AVX1-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
260 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
261 ; AVX1-NEXT: vextractf128 $1, %ymm7, %xmm1
262 ; AVX1-NEXT: vextractf128 $1, %ymm5, %xmm2
263 ; AVX1-NEXT: vpcmpgtw %xmm1, %xmm2, %xmm1
264 ; AVX1-NEXT: vpcmpgtw %xmm7, %xmm5, %xmm2
265 ; AVX1-NEXT: vpacksswb %xmm1, %xmm2, %xmm1
266 ; AVX1-NEXT: vpand %xmm1, %xmm8, %xmm1
267 ; AVX1-NEXT: vextractf128 $1, %ymm6, %xmm2
268 ; AVX1-NEXT: vextractf128 $1, %ymm4, %xmm3
269 ; AVX1-NEXT: vpcmpgtw %xmm2, %xmm3, %xmm2
270 ; AVX1-NEXT: vpcmpgtw %xmm6, %xmm4, %xmm3
271 ; AVX1-NEXT: vpacksswb %xmm2, %xmm3, %xmm2
272 ; AVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
273 ; AVX1-NEXT: vpmovmskb %xmm0, %ecx
274 ; AVX1-NEXT: vpmovmskb %xmm1, %eax
275 ; AVX1-NEXT: shll $16, %eax
276 ; AVX1-NEXT: orl %ecx, %eax
277 ; AVX1-NEXT: vzeroupper
280 ; AVX2-LABEL: v32i16:
282 ; AVX2-NEXT: vpcmpgtw %ymm3, %ymm1, %ymm1
283 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm3
284 ; AVX2-NEXT: vpacksswb %xmm3, %xmm1, %xmm1
285 ; AVX2-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
286 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm2
287 ; AVX2-NEXT: vpacksswb %xmm2, %xmm0, %xmm0
288 ; AVX2-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
289 ; AVX2-NEXT: vpcmpgtw %ymm7, %ymm5, %ymm1
290 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm2
291 ; AVX2-NEXT: vpacksswb %xmm2, %xmm1, %xmm1
292 ; AVX2-NEXT: vpcmpgtw %ymm6, %ymm4, %ymm2
293 ; AVX2-NEXT: vextracti128 $1, %ymm2, %xmm3
294 ; AVX2-NEXT: vpacksswb %xmm3, %xmm2, %xmm2
295 ; AVX2-NEXT: vinserti128 $1, %xmm1, %ymm2, %ymm1
296 ; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
297 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
298 ; AVX2-NEXT: vzeroupper
301 ; AVX512F-LABEL: v32i16:
303 ; AVX512F-NEXT: vextracti64x4 $1, %zmm3, %ymm4
304 ; AVX512F-NEXT: vextracti64x4 $1, %zmm2, %ymm5
305 ; AVX512F-NEXT: vpcmpgtw %ymm4, %ymm5, %ymm4
306 ; AVX512F-NEXT: vextracti64x4 $1, %zmm1, %ymm5
307 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm6
308 ; AVX512F-NEXT: vpcmpgtw %ymm5, %ymm6, %ymm5
309 ; AVX512F-NEXT: vpand %ymm4, %ymm5, %ymm4
310 ; AVX512F-NEXT: vpcmpgtw %ymm1, %ymm0, %ymm0
311 ; AVX512F-NEXT: vpcmpgtw %ymm3, %ymm2, %ymm1
312 ; AVX512F-NEXT: vpand %ymm1, %ymm0, %ymm0
313 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
314 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
315 ; AVX512F-NEXT: kmovw %k0, %ecx
316 ; AVX512F-NEXT: vpmovsxwd %ymm4, %zmm0
317 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
318 ; AVX512F-NEXT: kmovw %k0, %eax
319 ; AVX512F-NEXT: shll $16, %eax
320 ; AVX512F-NEXT: orl %ecx, %eax
321 ; AVX512F-NEXT: vzeroupper
324 ; AVX512BW-LABEL: v32i16:
326 ; AVX512BW-NEXT: vpcmpgtw %zmm1, %zmm0, %k1
327 ; AVX512BW-NEXT: vpcmpgtw %zmm3, %zmm2, %k0 {%k1}
328 ; AVX512BW-NEXT: kmovd %k0, %eax
329 ; AVX512BW-NEXT: vzeroupper
330 ; AVX512BW-NEXT: retq
331 %x0 = icmp sgt <32 x i16> %a, %b
332 %x1 = icmp sgt <32 x i16> %c, %d
333 %y = and <32 x i1> %x0, %x1
334 %res = bitcast <32 x i1> %y to i32
338 define i16 @v16i32(<16 x i32> %a, <16 x i32> %b, <16 x i32> %c, <16 x i32> %d) {
341 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm8
342 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm10
343 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
344 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm11
345 ; SSE-NEXT: pcmpgtd %xmm7, %xmm3
346 ; SSE-NEXT: movdqa {{.*#+}} xmm7 = <u,u,u,u,0,4,8,12,u,u,u,u,u,u,u,u>
347 ; SSE-NEXT: pshufb %xmm7, %xmm3
348 ; SSE-NEXT: pcmpgtd %xmm6, %xmm2
349 ; SSE-NEXT: pshufb %xmm7, %xmm2
350 ; SSE-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
351 ; SSE-NEXT: pcmpgtd %xmm5, %xmm1
352 ; SSE-NEXT: movdqa {{.*#+}} xmm3 = <0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u>
353 ; SSE-NEXT: pshufb %xmm3, %xmm1
354 ; SSE-NEXT: pcmpgtd %xmm4, %xmm0
355 ; SSE-NEXT: pshufb %xmm3, %xmm0
356 ; SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
357 ; SSE-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm2[4,5,6,7]
358 ; SSE-NEXT: pcmpgtd {{[0-9]+}}(%rsp), %xmm11
359 ; SSE-NEXT: pshufb %xmm7, %xmm11
360 ; SSE-NEXT: pcmpgtd {{[0-9]+}}(%rsp), %xmm9
361 ; SSE-NEXT: pshufb %xmm7, %xmm9
362 ; SSE-NEXT: punpckldq {{.*#+}} xmm9 = xmm9[0],xmm11[0],xmm9[1],xmm11[1]
363 ; SSE-NEXT: pcmpgtd {{[0-9]+}}(%rsp), %xmm10
364 ; SSE-NEXT: pshufb %xmm3, %xmm10
365 ; SSE-NEXT: pcmpgtd {{[0-9]+}}(%rsp), %xmm8
366 ; SSE-NEXT: pshufb %xmm3, %xmm8
367 ; SSE-NEXT: punpckldq {{.*#+}} xmm8 = xmm8[0],xmm10[0],xmm8[1],xmm10[1]
368 ; SSE-NEXT: pblendw {{.*#+}} xmm8 = xmm8[0,1,2,3],xmm9[4,5,6,7]
369 ; SSE-NEXT: pand %xmm0, %xmm8
370 ; SSE-NEXT: pmovmskb %xmm8, %eax
371 ; SSE-NEXT: # kill: def $ax killed $ax killed $eax
374 ; AVX1-LABEL: v16i32:
376 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm8
377 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm9
378 ; AVX1-NEXT: vpcmpgtd %xmm8, %xmm9, %xmm8
379 ; AVX1-NEXT: vpcmpgtd %xmm3, %xmm1, %xmm1
380 ; AVX1-NEXT: vpackssdw %xmm8, %xmm1, %xmm8
381 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
382 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
383 ; AVX1-NEXT: vpcmpgtd %xmm3, %xmm1, %xmm1
384 ; AVX1-NEXT: vpcmpgtd %xmm2, %xmm0, %xmm0
385 ; AVX1-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
386 ; AVX1-NEXT: vpacksswb %xmm8, %xmm0, %xmm0
387 ; AVX1-NEXT: vextractf128 $1, %ymm7, %xmm1
388 ; AVX1-NEXT: vextractf128 $1, %ymm5, %xmm2
389 ; AVX1-NEXT: vpcmpgtd %xmm1, %xmm2, %xmm1
390 ; AVX1-NEXT: vpcmpgtd %xmm7, %xmm5, %xmm2
391 ; AVX1-NEXT: vpackssdw %xmm1, %xmm2, %xmm1
392 ; AVX1-NEXT: vextractf128 $1, %ymm6, %xmm2
393 ; AVX1-NEXT: vextractf128 $1, %ymm4, %xmm3
394 ; AVX1-NEXT: vpcmpgtd %xmm2, %xmm3, %xmm2
395 ; AVX1-NEXT: vpcmpgtd %xmm6, %xmm4, %xmm3
396 ; AVX1-NEXT: vpackssdw %xmm2, %xmm3, %xmm2
397 ; AVX1-NEXT: vpacksswb %xmm1, %xmm2, %xmm1
398 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
399 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
400 ; AVX1-NEXT: # kill: def $ax killed $ax killed $eax
401 ; AVX1-NEXT: vzeroupper
404 ; AVX2-LABEL: v16i32:
406 ; AVX2-NEXT: vpcmpgtd %ymm3, %ymm1, %ymm1
407 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm3
408 ; AVX2-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
409 ; AVX2-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
410 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm2
411 ; AVX2-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
412 ; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
413 ; AVX2-NEXT: vpcmpgtd %ymm7, %ymm5, %ymm1
414 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm2
415 ; AVX2-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
416 ; AVX2-NEXT: vpcmpgtd %ymm6, %ymm4, %ymm2
417 ; AVX2-NEXT: vextracti128 $1, %ymm2, %xmm3
418 ; AVX2-NEXT: vpackssdw %xmm3, %xmm2, %xmm2
419 ; AVX2-NEXT: vpacksswb %xmm1, %xmm2, %xmm1
420 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
421 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
422 ; AVX2-NEXT: # kill: def $ax killed $ax killed $eax
423 ; AVX2-NEXT: vzeroupper
426 ; AVX512F-LABEL: v16i32:
428 ; AVX512F-NEXT: vpcmpgtd %zmm1, %zmm0, %k1
429 ; AVX512F-NEXT: vpcmpgtd %zmm3, %zmm2, %k0 {%k1}
430 ; AVX512F-NEXT: kmovw %k0, %eax
431 ; AVX512F-NEXT: # kill: def $ax killed $ax killed $eax
432 ; AVX512F-NEXT: vzeroupper
435 ; AVX512BW-LABEL: v16i32:
437 ; AVX512BW-NEXT: vpcmpgtd %zmm1, %zmm0, %k1
438 ; AVX512BW-NEXT: vpcmpgtd %zmm3, %zmm2, %k0 {%k1}
439 ; AVX512BW-NEXT: kmovd %k0, %eax
440 ; AVX512BW-NEXT: # kill: def $ax killed $ax killed $eax
441 ; AVX512BW-NEXT: vzeroupper
442 ; AVX512BW-NEXT: retq
443 %x0 = icmp sgt <16 x i32> %a, %b
444 %x1 = icmp sgt <16 x i32> %c, %d
445 %y = and <16 x i1> %x0, %x1
446 %res = bitcast <16 x i1> %y to i16
450 define i16 @v16f32(<16 x float> %a, <16 x float> %b, <16 x float> %c, <16 x float> %d) {
453 ; SSE-NEXT: movaps {{[0-9]+}}(%rsp), %xmm8
454 ; SSE-NEXT: movaps {{[0-9]+}}(%rsp), %xmm10
455 ; SSE-NEXT: movaps {{[0-9]+}}(%rsp), %xmm9
456 ; SSE-NEXT: movaps {{[0-9]+}}(%rsp), %xmm11
457 ; SSE-NEXT: cmpltps %xmm3, %xmm7
458 ; SSE-NEXT: movdqa {{.*#+}} xmm3 = <u,u,u,u,0,4,8,12,u,u,u,u,u,u,u,u>
459 ; SSE-NEXT: pshufb %xmm3, %xmm7
460 ; SSE-NEXT: cmpltps %xmm2, %xmm6
461 ; SSE-NEXT: pshufb %xmm3, %xmm6
462 ; SSE-NEXT: punpckldq {{.*#+}} xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1]
463 ; SSE-NEXT: cmpltps %xmm1, %xmm5
464 ; SSE-NEXT: movdqa {{.*#+}} xmm1 = <0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u>
465 ; SSE-NEXT: pshufb %xmm1, %xmm5
466 ; SSE-NEXT: cmpltps %xmm0, %xmm4
467 ; SSE-NEXT: pshufb %xmm1, %xmm4
468 ; SSE-NEXT: punpckldq {{.*#+}} xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
469 ; SSE-NEXT: pblendw {{.*#+}} xmm4 = xmm4[0,1,2,3],xmm6[4,5,6,7]
470 ; SSE-NEXT: cmpltps {{[0-9]+}}(%rsp), %xmm11
471 ; SSE-NEXT: pshufb %xmm3, %xmm11
472 ; SSE-NEXT: cmpltps {{[0-9]+}}(%rsp), %xmm9
473 ; SSE-NEXT: pshufb %xmm3, %xmm9
474 ; SSE-NEXT: punpckldq {{.*#+}} xmm9 = xmm9[0],xmm11[0],xmm9[1],xmm11[1]
475 ; SSE-NEXT: cmpltps {{[0-9]+}}(%rsp), %xmm10
476 ; SSE-NEXT: pshufb %xmm1, %xmm10
477 ; SSE-NEXT: cmpltps {{[0-9]+}}(%rsp), %xmm8
478 ; SSE-NEXT: pshufb %xmm1, %xmm8
479 ; SSE-NEXT: punpckldq {{.*#+}} xmm8 = xmm8[0],xmm10[0],xmm8[1],xmm10[1]
480 ; SSE-NEXT: pblendw {{.*#+}} xmm8 = xmm8[0,1,2,3],xmm9[4,5,6,7]
481 ; SSE-NEXT: pand %xmm4, %xmm8
482 ; SSE-NEXT: pmovmskb %xmm8, %eax
483 ; SSE-NEXT: # kill: def $ax killed $ax killed $eax
486 ; AVX12-LABEL: v16f32:
488 ; AVX12-NEXT: vcmpltps %ymm1, %ymm3, %ymm1
489 ; AVX12-NEXT: vextractf128 $1, %ymm1, %xmm3
490 ; AVX12-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
491 ; AVX12-NEXT: vcmpltps %ymm0, %ymm2, %ymm0
492 ; AVX12-NEXT: vextractf128 $1, %ymm0, %xmm2
493 ; AVX12-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
494 ; AVX12-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
495 ; AVX12-NEXT: vcmpltps %ymm5, %ymm7, %ymm1
496 ; AVX12-NEXT: vextractf128 $1, %ymm1, %xmm2
497 ; AVX12-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
498 ; AVX12-NEXT: vcmpltps %ymm4, %ymm6, %ymm2
499 ; AVX12-NEXT: vextractf128 $1, %ymm2, %xmm3
500 ; AVX12-NEXT: vpackssdw %xmm3, %xmm2, %xmm2
501 ; AVX12-NEXT: vpacksswb %xmm1, %xmm2, %xmm1
502 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
503 ; AVX12-NEXT: vpmovmskb %xmm0, %eax
504 ; AVX12-NEXT: # kill: def $ax killed $ax killed $eax
505 ; AVX12-NEXT: vzeroupper
508 ; AVX512F-LABEL: v16f32:
510 ; AVX512F-NEXT: vcmpltps %zmm0, %zmm1, %k1
511 ; AVX512F-NEXT: vcmpltps %zmm2, %zmm3, %k0 {%k1}
512 ; AVX512F-NEXT: kmovw %k0, %eax
513 ; AVX512F-NEXT: # kill: def $ax killed $ax killed $eax
514 ; AVX512F-NEXT: vzeroupper
517 ; AVX512BW-LABEL: v16f32:
519 ; AVX512BW-NEXT: vcmpltps %zmm0, %zmm1, %k1
520 ; AVX512BW-NEXT: vcmpltps %zmm2, %zmm3, %k0 {%k1}
521 ; AVX512BW-NEXT: kmovd %k0, %eax
522 ; AVX512BW-NEXT: # kill: def $ax killed $ax killed $eax
523 ; AVX512BW-NEXT: vzeroupper
524 ; AVX512BW-NEXT: retq
525 %x0 = fcmp ogt <16 x float> %a, %b
526 %x1 = fcmp ogt <16 x float> %c, %d
527 %y = and <16 x i1> %x0, %x1
528 %res = bitcast <16 x i1> %y to i16
532 define i64 @v64i8(<64 x i8> %a, <64 x i8> %b, <64 x i8> %c, <64 x i8> %d) {
535 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm10
536 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm11
537 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm8
538 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
539 ; SSE-NEXT: pcmpgtb %xmm7, %xmm3
540 ; SSE-NEXT: pcmpgtb %xmm6, %xmm2
541 ; SSE-NEXT: pcmpgtb %xmm5, %xmm1
542 ; SSE-NEXT: pcmpgtb %xmm4, %xmm0
543 ; SSE-NEXT: pcmpgtb {{[0-9]+}}(%rsp), %xmm9
544 ; SSE-NEXT: pand %xmm3, %xmm9
545 ; SSE-NEXT: pcmpgtb {{[0-9]+}}(%rsp), %xmm8
546 ; SSE-NEXT: pand %xmm2, %xmm8
547 ; SSE-NEXT: pcmpgtb {{[0-9]+}}(%rsp), %xmm11
548 ; SSE-NEXT: pand %xmm1, %xmm11
549 ; SSE-NEXT: pcmpgtb {{[0-9]+}}(%rsp), %xmm10
550 ; SSE-NEXT: pand %xmm0, %xmm10
551 ; SSE-NEXT: pmovmskb %xmm10, %eax
552 ; SSE-NEXT: pmovmskb %xmm11, %ecx
553 ; SSE-NEXT: shll $16, %ecx
554 ; SSE-NEXT: orl %eax, %ecx
555 ; SSE-NEXT: pmovmskb %xmm8, %edx
556 ; SSE-NEXT: pmovmskb %xmm9, %eax
557 ; SSE-NEXT: shll $16, %eax
558 ; SSE-NEXT: orl %edx, %eax
559 ; SSE-NEXT: shlq $32, %rax
560 ; SSE-NEXT: orq %rcx, %rax
565 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm8
566 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm9
567 ; AVX1-NEXT: vpcmpgtb %xmm8, %xmm9, %xmm8
568 ; AVX1-NEXT: vpcmpgtb %xmm3, %xmm1, %xmm9
569 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
570 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
571 ; AVX1-NEXT: vpcmpgtb %xmm3, %xmm1, %xmm1
572 ; AVX1-NEXT: vpcmpgtb %xmm2, %xmm0, %xmm0
573 ; AVX1-NEXT: vextractf128 $1, %ymm7, %xmm2
574 ; AVX1-NEXT: vextractf128 $1, %ymm5, %xmm3
575 ; AVX1-NEXT: vpcmpgtb %xmm2, %xmm3, %xmm2
576 ; AVX1-NEXT: vpand %xmm2, %xmm8, %xmm2
577 ; AVX1-NEXT: vpcmpgtb %xmm7, %xmm5, %xmm3
578 ; AVX1-NEXT: vpand %xmm3, %xmm9, %xmm3
579 ; AVX1-NEXT: vextractf128 $1, %ymm6, %xmm5
580 ; AVX1-NEXT: vextractf128 $1, %ymm4, %xmm7
581 ; AVX1-NEXT: vpcmpgtb %xmm5, %xmm7, %xmm5
582 ; AVX1-NEXT: vpand %xmm5, %xmm1, %xmm1
583 ; AVX1-NEXT: vpcmpgtb %xmm6, %xmm4, %xmm4
584 ; AVX1-NEXT: vpand %xmm4, %xmm0, %xmm0
585 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
586 ; AVX1-NEXT: vpmovmskb %xmm1, %ecx
587 ; AVX1-NEXT: shll $16, %ecx
588 ; AVX1-NEXT: orl %eax, %ecx
589 ; AVX1-NEXT: vpmovmskb %xmm3, %edx
590 ; AVX1-NEXT: vpmovmskb %xmm2, %eax
591 ; AVX1-NEXT: shll $16, %eax
592 ; AVX1-NEXT: orl %edx, %eax
593 ; AVX1-NEXT: shlq $32, %rax
594 ; AVX1-NEXT: orq %rcx, %rax
595 ; AVX1-NEXT: vzeroupper
600 ; AVX2-NEXT: vpcmpgtb %ymm3, %ymm1, %ymm1
601 ; AVX2-NEXT: vpcmpgtb %ymm2, %ymm0, %ymm0
602 ; AVX2-NEXT: vpcmpgtb %ymm7, %ymm5, %ymm2
603 ; AVX2-NEXT: vpand %ymm2, %ymm1, %ymm1
604 ; AVX2-NEXT: vpcmpgtb %ymm6, %ymm4, %ymm2
605 ; AVX2-NEXT: vpand %ymm2, %ymm0, %ymm0
606 ; AVX2-NEXT: vpmovmskb %ymm0, %ecx
607 ; AVX2-NEXT: vpmovmskb %ymm1, %eax
608 ; AVX2-NEXT: shlq $32, %rax
609 ; AVX2-NEXT: orq %rcx, %rax
610 ; AVX2-NEXT: vzeroupper
613 ; AVX512F-LABEL: v64i8:
615 ; AVX512F-NEXT: vextracti64x4 $1, %zmm3, %ymm4
616 ; AVX512F-NEXT: vextracti64x4 $1, %zmm2, %ymm5
617 ; AVX512F-NEXT: vpcmpgtb %ymm4, %ymm5, %ymm4
618 ; AVX512F-NEXT: vextracti64x4 $1, %zmm1, %ymm5
619 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm6
620 ; AVX512F-NEXT: vpcmpgtb %ymm5, %ymm6, %ymm5
621 ; AVX512F-NEXT: vextracti128 $1, %ymm5, %xmm6
622 ; AVX512F-NEXT: vpcmpgtb %ymm1, %ymm0, %ymm0
623 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
624 ; AVX512F-NEXT: vextracti128 $1, %ymm4, %xmm7
625 ; AVX512F-NEXT: vpand %xmm7, %xmm6, %xmm6
626 ; AVX512F-NEXT: vpcmpgtb %ymm3, %ymm2, %ymm2
627 ; AVX512F-NEXT: vextracti128 $1, %ymm2, %xmm3
628 ; AVX512F-NEXT: vpand %xmm3, %xmm1, %xmm1
629 ; AVX512F-NEXT: vpand %xmm2, %xmm0, %xmm0
630 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
631 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
632 ; AVX512F-NEXT: kmovw %k0, %eax
633 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm0
634 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
635 ; AVX512F-NEXT: kmovw %k0, %ecx
636 ; AVX512F-NEXT: shll $16, %ecx
637 ; AVX512F-NEXT: orl %eax, %ecx
638 ; AVX512F-NEXT: vpand %xmm4, %xmm5, %xmm0
639 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
640 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
641 ; AVX512F-NEXT: kmovw %k0, %edx
642 ; AVX512F-NEXT: vpmovsxbd %xmm6, %zmm0
643 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
644 ; AVX512F-NEXT: kmovw %k0, %eax
645 ; AVX512F-NEXT: shll $16, %eax
646 ; AVX512F-NEXT: orl %edx, %eax
647 ; AVX512F-NEXT: shlq $32, %rax
648 ; AVX512F-NEXT: orq %rcx, %rax
649 ; AVX512F-NEXT: vzeroupper
652 ; AVX512BW-LABEL: v64i8:
654 ; AVX512BW-NEXT: vpcmpgtb %zmm1, %zmm0, %k1
655 ; AVX512BW-NEXT: vpcmpgtb %zmm3, %zmm2, %k0 {%k1}
656 ; AVX512BW-NEXT: kmovq %k0, %rax
657 ; AVX512BW-NEXT: vzeroupper
658 ; AVX512BW-NEXT: retq
659 %x0 = icmp sgt <64 x i8> %a, %b
660 %x1 = icmp sgt <64 x i8> %c, %d
661 %y = and <64 x i1> %x0, %x1
662 %res = bitcast <64 x i1> %y to i64