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: vpsraw $15, %xmm0, %xmm0
78 ; AVX1-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
79 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
80 ; AVX1-NEXT: # kill: def $al killed $al killed $eax
81 ; AVX1-NEXT: vzeroupper
86 ; AVX2-NEXT: vpcmpgtq %ymm3, %ymm1, %ymm1
87 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm3
88 ; AVX2-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
89 ; AVX2-NEXT: vpcmpgtq %ymm2, %ymm0, %ymm0
90 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm2
91 ; AVX2-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
92 ; AVX2-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
93 ; AVX2-NEXT: vpcmpgtq %ymm7, %ymm5, %ymm1
94 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm2
95 ; AVX2-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
96 ; AVX2-NEXT: vpcmpgtq %ymm6, %ymm4, %ymm2
97 ; AVX2-NEXT: vextracti128 $1, %ymm2, %xmm3
98 ; AVX2-NEXT: vpackssdw %xmm3, %xmm2, %xmm2
99 ; AVX2-NEXT: vpackssdw %xmm1, %xmm2, %xmm1
100 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
101 ; AVX2-NEXT: vpsllw $15, %xmm0, %xmm0
102 ; AVX2-NEXT: vpsraw $15, %xmm0, %xmm0
103 ; AVX2-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
104 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
105 ; AVX2-NEXT: # kill: def $al killed $al killed $eax
106 ; AVX2-NEXT: vzeroupper
109 ; AVX512F-LABEL: v8i64:
111 ; AVX512F-NEXT: vpcmpgtq %zmm1, %zmm0, %k1
112 ; AVX512F-NEXT: vpcmpgtq %zmm3, %zmm2, %k0 {%k1}
113 ; AVX512F-NEXT: kmovw %k0, %eax
114 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
115 ; AVX512F-NEXT: vzeroupper
118 ; AVX512BW-LABEL: v8i64:
120 ; AVX512BW-NEXT: vpcmpgtq %zmm1, %zmm0, %k1
121 ; AVX512BW-NEXT: vpcmpgtq %zmm3, %zmm2, %k0 {%k1}
122 ; AVX512BW-NEXT: kmovd %k0, %eax
123 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
124 ; AVX512BW-NEXT: vzeroupper
125 ; AVX512BW-NEXT: retq
126 %x0 = icmp sgt <8 x i64> %a, %b
127 %x1 = icmp sgt <8 x i64> %c, %d
128 %y = and <8 x i1> %x0, %x1
129 %res = bitcast <8 x i1> %y to i8
133 define i8 @v8f64(<8 x double> %a, <8 x double> %b, <8 x double> %c, <8 x double> %d) {
136 ; SSE-NEXT: movapd {{[0-9]+}}(%rsp), %xmm8
137 ; SSE-NEXT: movapd {{[0-9]+}}(%rsp), %xmm9
138 ; SSE-NEXT: movapd {{[0-9]+}}(%rsp), %xmm10
139 ; SSE-NEXT: movapd {{[0-9]+}}(%rsp), %xmm11
140 ; SSE-NEXT: cmpltpd %xmm3, %xmm7
141 ; SSE-NEXT: shufps {{.*#+}} xmm7 = xmm7[0,2,2,3]
142 ; SSE-NEXT: pshuflw {{.*#+}} xmm3 = xmm7[0,1,0,2,4,5,6,7]
143 ; SSE-NEXT: cmpltpd %xmm2, %xmm6
144 ; SSE-NEXT: shufps {{.*#+}} xmm6 = xmm6[0,2,2,3]
145 ; SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm6[0,1,0,2,4,5,6,7]
146 ; SSE-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
147 ; SSE-NEXT: cmpltpd %xmm1, %xmm5
148 ; SSE-NEXT: shufps {{.*#+}} xmm5 = xmm5[0,2,2,3]
149 ; SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm5[0,2,2,3,4,5,6,7]
150 ; SSE-NEXT: cmpltpd %xmm0, %xmm4
151 ; SSE-NEXT: shufps {{.*#+}} xmm4 = xmm4[0,2,2,3]
152 ; SSE-NEXT: pshuflw {{.*#+}} xmm0 = xmm4[0,2,2,3,4,5,6,7]
153 ; SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
154 ; SSE-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm2[4,5,6,7]
155 ; SSE-NEXT: cmpltpd {{[0-9]+}}(%rsp), %xmm11
156 ; SSE-NEXT: shufps {{.*#+}} xmm11 = xmm11[0,2,2,3]
157 ; SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm11[0,1,0,2,4,5,6,7]
158 ; SSE-NEXT: cmpltpd {{[0-9]+}}(%rsp), %xmm10
159 ; SSE-NEXT: shufps {{.*#+}} xmm10 = xmm10[0,2,2,3]
160 ; SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm10[0,1,0,2,4,5,6,7]
161 ; SSE-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
162 ; SSE-NEXT: cmpltpd {{[0-9]+}}(%rsp), %xmm9
163 ; SSE-NEXT: shufps {{.*#+}} xmm9 = xmm9[0,2,2,3]
164 ; SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm9[0,2,2,3,4,5,6,7]
165 ; SSE-NEXT: cmpltpd {{[0-9]+}}(%rsp), %xmm8
166 ; SSE-NEXT: shufps {{.*#+}} xmm8 = xmm8[0,2,2,3]
167 ; SSE-NEXT: pshuflw {{.*#+}} xmm3 = xmm8[0,2,2,3,4,5,6,7]
168 ; SSE-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
169 ; SSE-NEXT: pblendw {{.*#+}} xmm3 = xmm3[0,1,2,3],xmm2[4,5,6,7]
170 ; SSE-NEXT: pand %xmm0, %xmm3
171 ; SSE-NEXT: packsswb %xmm0, %xmm3
172 ; SSE-NEXT: pmovmskb %xmm3, %eax
173 ; SSE-NEXT: # kill: def $al killed $al killed $eax
176 ; AVX12-LABEL: v8f64:
178 ; AVX12-NEXT: vcmpltpd %ymm1, %ymm3, %ymm1
179 ; AVX12-NEXT: vextractf128 $1, %ymm1, %xmm3
180 ; AVX12-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
181 ; AVX12-NEXT: vcmpltpd %ymm0, %ymm2, %ymm0
182 ; AVX12-NEXT: vextractf128 $1, %ymm0, %xmm2
183 ; AVX12-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
184 ; AVX12-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
185 ; AVX12-NEXT: vcmpltpd %ymm5, %ymm7, %ymm1
186 ; AVX12-NEXT: vextractf128 $1, %ymm1, %xmm2
187 ; AVX12-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
188 ; AVX12-NEXT: vcmpltpd %ymm4, %ymm6, %ymm2
189 ; AVX12-NEXT: vextractf128 $1, %ymm2, %xmm3
190 ; AVX12-NEXT: vpackssdw %xmm3, %xmm2, %xmm2
191 ; AVX12-NEXT: vpackssdw %xmm1, %xmm2, %xmm1
192 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
193 ; AVX12-NEXT: vpsllw $15, %xmm0, %xmm0
194 ; AVX12-NEXT: vpsraw $15, %xmm0, %xmm0
195 ; AVX12-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
196 ; AVX12-NEXT: vpmovmskb %xmm0, %eax
197 ; AVX12-NEXT: # kill: def $al killed $al killed $eax
198 ; AVX12-NEXT: vzeroupper
201 ; AVX512F-LABEL: v8f64:
203 ; AVX512F-NEXT: vcmpltpd %zmm0, %zmm1, %k1
204 ; AVX512F-NEXT: vcmpltpd %zmm2, %zmm3, %k0 {%k1}
205 ; AVX512F-NEXT: kmovw %k0, %eax
206 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
207 ; AVX512F-NEXT: vzeroupper
210 ; AVX512BW-LABEL: v8f64:
212 ; AVX512BW-NEXT: vcmpltpd %zmm0, %zmm1, %k1
213 ; AVX512BW-NEXT: vcmpltpd %zmm2, %zmm3, %k0 {%k1}
214 ; AVX512BW-NEXT: kmovd %k0, %eax
215 ; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
216 ; AVX512BW-NEXT: vzeroupper
217 ; AVX512BW-NEXT: retq
218 %x0 = fcmp ogt <8 x double> %a, %b
219 %x1 = fcmp ogt <8 x double> %c, %d
220 %y = and <8 x i1> %x0, %x1
221 %res = bitcast <8 x i1> %y to i8
225 define i32 @v32i16(<32 x i16> %a, <32 x i16> %b, <32 x i16> %c, <32 x i16> %d) {
228 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm8
229 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
230 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm10
231 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm11
232 ; SSE-NEXT: pcmpgtw %xmm5, %xmm1
233 ; SSE-NEXT: pcmpgtw %xmm4, %xmm0
234 ; SSE-NEXT: packsswb %xmm1, %xmm0
235 ; SSE-NEXT: pcmpgtw %xmm7, %xmm3
236 ; SSE-NEXT: pcmpgtw %xmm6, %xmm2
237 ; SSE-NEXT: packsswb %xmm3, %xmm2
238 ; SSE-NEXT: pcmpgtw {{[0-9]+}}(%rsp), %xmm11
239 ; SSE-NEXT: pcmpgtw {{[0-9]+}}(%rsp), %xmm10
240 ; SSE-NEXT: packsswb %xmm11, %xmm10
241 ; SSE-NEXT: pand %xmm0, %xmm10
242 ; SSE-NEXT: pcmpgtw {{[0-9]+}}(%rsp), %xmm9
243 ; SSE-NEXT: pcmpgtw {{[0-9]+}}(%rsp), %xmm8
244 ; SSE-NEXT: packsswb %xmm9, %xmm8
245 ; SSE-NEXT: pand %xmm2, %xmm8
246 ; SSE-NEXT: pmovmskb %xmm10, %ecx
247 ; SSE-NEXT: pmovmskb %xmm8, %eax
248 ; SSE-NEXT: shll $16, %eax
249 ; SSE-NEXT: orl %ecx, %eax
252 ; AVX1-LABEL: v32i16:
254 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm8
255 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm9
256 ; AVX1-NEXT: vpcmpgtw %xmm8, %xmm9, %xmm8
257 ; AVX1-NEXT: vpcmpgtw %xmm3, %xmm1, %xmm1
258 ; AVX1-NEXT: vpacksswb %xmm8, %xmm1, %xmm8
259 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
260 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
261 ; AVX1-NEXT: vpcmpgtw %xmm3, %xmm1, %xmm1
262 ; AVX1-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
263 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
264 ; AVX1-NEXT: vextractf128 $1, %ymm7, %xmm1
265 ; AVX1-NEXT: vextractf128 $1, %ymm5, %xmm2
266 ; AVX1-NEXT: vpcmpgtw %xmm1, %xmm2, %xmm1
267 ; AVX1-NEXT: vpcmpgtw %xmm7, %xmm5, %xmm2
268 ; AVX1-NEXT: vpacksswb %xmm1, %xmm2, %xmm1
269 ; AVX1-NEXT: vpand %xmm1, %xmm8, %xmm1
270 ; AVX1-NEXT: vextractf128 $1, %ymm6, %xmm2
271 ; AVX1-NEXT: vextractf128 $1, %ymm4, %xmm3
272 ; AVX1-NEXT: vpcmpgtw %xmm2, %xmm3, %xmm2
273 ; AVX1-NEXT: vpcmpgtw %xmm6, %xmm4, %xmm3
274 ; AVX1-NEXT: vpacksswb %xmm2, %xmm3, %xmm2
275 ; AVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
276 ; AVX1-NEXT: vpmovmskb %xmm0, %ecx
277 ; AVX1-NEXT: vpmovmskb %xmm1, %eax
278 ; AVX1-NEXT: shll $16, %eax
279 ; AVX1-NEXT: orl %ecx, %eax
280 ; AVX1-NEXT: vzeroupper
283 ; AVX2-LABEL: v32i16:
285 ; AVX2-NEXT: vpcmpgtw %ymm3, %ymm1, %ymm1
286 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm3
287 ; AVX2-NEXT: vpacksswb %xmm3, %xmm1, %xmm1
288 ; AVX2-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
289 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm2
290 ; AVX2-NEXT: vpacksswb %xmm2, %xmm0, %xmm0
291 ; AVX2-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
292 ; AVX2-NEXT: vpcmpgtw %ymm7, %ymm5, %ymm1
293 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm2
294 ; AVX2-NEXT: vpacksswb %xmm2, %xmm1, %xmm1
295 ; AVX2-NEXT: vpcmpgtw %ymm6, %ymm4, %ymm2
296 ; AVX2-NEXT: vextracti128 $1, %ymm2, %xmm3
297 ; AVX2-NEXT: vpacksswb %xmm3, %xmm2, %xmm2
298 ; AVX2-NEXT: vinserti128 $1, %xmm1, %ymm2, %ymm1
299 ; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
300 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
301 ; AVX2-NEXT: vzeroupper
304 ; AVX512F-LABEL: v32i16:
306 ; AVX512F-NEXT: vpcmpgtw %ymm3, %ymm1, %ymm1
307 ; AVX512F-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
308 ; AVX512F-NEXT: vpcmpgtw %ymm7, %ymm5, %ymm2
309 ; AVX512F-NEXT: vpand %ymm2, %ymm1, %ymm1
310 ; AVX512F-NEXT: vpcmpgtw %ymm6, %ymm4, %ymm2
311 ; AVX512F-NEXT: vpand %ymm2, %ymm0, %ymm0
312 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
313 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
314 ; AVX512F-NEXT: kmovw %k0, %ecx
315 ; AVX512F-NEXT: vpmovsxwd %ymm1, %zmm0
316 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
317 ; AVX512F-NEXT: kmovw %k0, %eax
318 ; AVX512F-NEXT: shll $16, %eax
319 ; AVX512F-NEXT: orl %ecx, %eax
320 ; AVX512F-NEXT: vzeroupper
323 ; AVX512BW-LABEL: v32i16:
325 ; AVX512BW-NEXT: vpcmpgtw %zmm1, %zmm0, %k1
326 ; AVX512BW-NEXT: vpcmpgtw %zmm3, %zmm2, %k0 {%k1}
327 ; AVX512BW-NEXT: kmovd %k0, %eax
328 ; AVX512BW-NEXT: vzeroupper
329 ; AVX512BW-NEXT: retq
330 %x0 = icmp sgt <32 x i16> %a, %b
331 %x1 = icmp sgt <32 x i16> %c, %d
332 %y = and <32 x i1> %x0, %x1
333 %res = bitcast <32 x i1> %y to i32
337 define i16 @v16i32(<16 x i32> %a, <16 x i32> %b, <16 x i32> %c, <16 x i32> %d) {
340 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm8
341 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm10
342 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
343 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm11
344 ; SSE-NEXT: pcmpgtd %xmm7, %xmm3
345 ; SSE-NEXT: movdqa {{.*#+}} xmm7 = <u,u,u,u,0,4,8,12,u,u,u,u,u,u,u,u>
346 ; SSE-NEXT: pshufb %xmm7, %xmm3
347 ; SSE-NEXT: pcmpgtd %xmm6, %xmm2
348 ; SSE-NEXT: pshufb %xmm7, %xmm2
349 ; SSE-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
350 ; SSE-NEXT: pcmpgtd %xmm5, %xmm1
351 ; SSE-NEXT: movdqa {{.*#+}} xmm3 = <0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u>
352 ; SSE-NEXT: pshufb %xmm3, %xmm1
353 ; SSE-NEXT: pcmpgtd %xmm4, %xmm0
354 ; SSE-NEXT: pshufb %xmm3, %xmm0
355 ; SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
356 ; SSE-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm2[4,5,6,7]
357 ; SSE-NEXT: pcmpgtd {{[0-9]+}}(%rsp), %xmm11
358 ; SSE-NEXT: pshufb %xmm7, %xmm11
359 ; SSE-NEXT: pcmpgtd {{[0-9]+}}(%rsp), %xmm9
360 ; SSE-NEXT: pshufb %xmm7, %xmm9
361 ; SSE-NEXT: punpckldq {{.*#+}} xmm9 = xmm9[0],xmm11[0],xmm9[1],xmm11[1]
362 ; SSE-NEXT: pcmpgtd {{[0-9]+}}(%rsp), %xmm10
363 ; SSE-NEXT: pshufb %xmm3, %xmm10
364 ; SSE-NEXT: pcmpgtd {{[0-9]+}}(%rsp), %xmm8
365 ; SSE-NEXT: pshufb %xmm3, %xmm8
366 ; SSE-NEXT: punpckldq {{.*#+}} xmm8 = xmm8[0],xmm10[0],xmm8[1],xmm10[1]
367 ; SSE-NEXT: pblendw {{.*#+}} xmm8 = xmm8[0,1,2,3],xmm9[4,5,6,7]
368 ; SSE-NEXT: pand %xmm0, %xmm8
369 ; SSE-NEXT: pmovmskb %xmm8, %eax
370 ; SSE-NEXT: # kill: def $ax killed $ax killed $eax
373 ; AVX1-LABEL: v16i32:
375 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm8
376 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm9
377 ; AVX1-NEXT: vpcmpgtd %xmm8, %xmm9, %xmm8
378 ; AVX1-NEXT: vpcmpgtd %xmm3, %xmm1, %xmm1
379 ; AVX1-NEXT: vpackssdw %xmm8, %xmm1, %xmm8
380 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
381 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
382 ; AVX1-NEXT: vpcmpgtd %xmm3, %xmm1, %xmm1
383 ; AVX1-NEXT: vpcmpgtd %xmm2, %xmm0, %xmm0
384 ; AVX1-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
385 ; AVX1-NEXT: vpacksswb %xmm8, %xmm0, %xmm0
386 ; AVX1-NEXT: vextractf128 $1, %ymm7, %xmm1
387 ; AVX1-NEXT: vextractf128 $1, %ymm5, %xmm2
388 ; AVX1-NEXT: vpcmpgtd %xmm1, %xmm2, %xmm1
389 ; AVX1-NEXT: vpcmpgtd %xmm7, %xmm5, %xmm2
390 ; AVX1-NEXT: vpackssdw %xmm1, %xmm2, %xmm1
391 ; AVX1-NEXT: vextractf128 $1, %ymm6, %xmm2
392 ; AVX1-NEXT: vextractf128 $1, %ymm4, %xmm3
393 ; AVX1-NEXT: vpcmpgtd %xmm2, %xmm3, %xmm2
394 ; AVX1-NEXT: vpcmpgtd %xmm6, %xmm4, %xmm3
395 ; AVX1-NEXT: vpackssdw %xmm2, %xmm3, %xmm2
396 ; AVX1-NEXT: vpacksswb %xmm1, %xmm2, %xmm1
397 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
398 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
399 ; AVX1-NEXT: # kill: def $ax killed $ax killed $eax
400 ; AVX1-NEXT: vzeroupper
403 ; AVX2-LABEL: v16i32:
405 ; AVX2-NEXT: vpcmpgtd %ymm3, %ymm1, %ymm1
406 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm3
407 ; AVX2-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
408 ; AVX2-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
409 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm2
410 ; AVX2-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
411 ; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
412 ; AVX2-NEXT: vpcmpgtd %ymm7, %ymm5, %ymm1
413 ; AVX2-NEXT: vextracti128 $1, %ymm1, %xmm2
414 ; AVX2-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
415 ; AVX2-NEXT: vpcmpgtd %ymm6, %ymm4, %ymm2
416 ; AVX2-NEXT: vextracti128 $1, %ymm2, %xmm3
417 ; AVX2-NEXT: vpackssdw %xmm3, %xmm2, %xmm2
418 ; AVX2-NEXT: vpacksswb %xmm1, %xmm2, %xmm1
419 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
420 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
421 ; AVX2-NEXT: # kill: def $ax killed $ax killed $eax
422 ; AVX2-NEXT: vzeroupper
425 ; AVX512F-LABEL: v16i32:
427 ; AVX512F-NEXT: vpcmpgtd %zmm1, %zmm0, %k1
428 ; AVX512F-NEXT: vpcmpgtd %zmm3, %zmm2, %k0 {%k1}
429 ; AVX512F-NEXT: kmovw %k0, %eax
430 ; AVX512F-NEXT: # kill: def $ax killed $ax killed $eax
431 ; AVX512F-NEXT: vzeroupper
434 ; AVX512BW-LABEL: v16i32:
436 ; AVX512BW-NEXT: vpcmpgtd %zmm1, %zmm0, %k1
437 ; AVX512BW-NEXT: vpcmpgtd %zmm3, %zmm2, %k0 {%k1}
438 ; AVX512BW-NEXT: kmovd %k0, %eax
439 ; AVX512BW-NEXT: # kill: def $ax killed $ax killed $eax
440 ; AVX512BW-NEXT: vzeroupper
441 ; AVX512BW-NEXT: retq
442 %x0 = icmp sgt <16 x i32> %a, %b
443 %x1 = icmp sgt <16 x i32> %c, %d
444 %y = and <16 x i1> %x0, %x1
445 %res = bitcast <16 x i1> %y to i16
449 define i16 @v16f32(<16 x float> %a, <16 x float> %b, <16 x float> %c, <16 x float> %d) {
452 ; SSE-NEXT: movaps {{[0-9]+}}(%rsp), %xmm8
453 ; SSE-NEXT: movaps {{[0-9]+}}(%rsp), %xmm10
454 ; SSE-NEXT: movaps {{[0-9]+}}(%rsp), %xmm9
455 ; SSE-NEXT: movaps {{[0-9]+}}(%rsp), %xmm11
456 ; SSE-NEXT: cmpltps %xmm3, %xmm7
457 ; SSE-NEXT: movdqa {{.*#+}} xmm3 = <u,u,u,u,0,4,8,12,u,u,u,u,u,u,u,u>
458 ; SSE-NEXT: pshufb %xmm3, %xmm7
459 ; SSE-NEXT: cmpltps %xmm2, %xmm6
460 ; SSE-NEXT: pshufb %xmm3, %xmm6
461 ; SSE-NEXT: punpckldq {{.*#+}} xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1]
462 ; SSE-NEXT: cmpltps %xmm1, %xmm5
463 ; SSE-NEXT: movdqa {{.*#+}} xmm1 = <0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u>
464 ; SSE-NEXT: pshufb %xmm1, %xmm5
465 ; SSE-NEXT: cmpltps %xmm0, %xmm4
466 ; SSE-NEXT: pshufb %xmm1, %xmm4
467 ; SSE-NEXT: punpckldq {{.*#+}} xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
468 ; SSE-NEXT: pblendw {{.*#+}} xmm4 = xmm4[0,1,2,3],xmm6[4,5,6,7]
469 ; SSE-NEXT: cmpltps {{[0-9]+}}(%rsp), %xmm11
470 ; SSE-NEXT: pshufb %xmm3, %xmm11
471 ; SSE-NEXT: cmpltps {{[0-9]+}}(%rsp), %xmm9
472 ; SSE-NEXT: pshufb %xmm3, %xmm9
473 ; SSE-NEXT: punpckldq {{.*#+}} xmm9 = xmm9[0],xmm11[0],xmm9[1],xmm11[1]
474 ; SSE-NEXT: cmpltps {{[0-9]+}}(%rsp), %xmm10
475 ; SSE-NEXT: pshufb %xmm1, %xmm10
476 ; SSE-NEXT: cmpltps {{[0-9]+}}(%rsp), %xmm8
477 ; SSE-NEXT: pshufb %xmm1, %xmm8
478 ; SSE-NEXT: punpckldq {{.*#+}} xmm8 = xmm8[0],xmm10[0],xmm8[1],xmm10[1]
479 ; SSE-NEXT: pblendw {{.*#+}} xmm8 = xmm8[0,1,2,3],xmm9[4,5,6,7]
480 ; SSE-NEXT: pand %xmm4, %xmm8
481 ; SSE-NEXT: pmovmskb %xmm8, %eax
482 ; SSE-NEXT: # kill: def $ax killed $ax killed $eax
485 ; AVX12-LABEL: v16f32:
487 ; AVX12-NEXT: vcmpltps %ymm1, %ymm3, %ymm1
488 ; AVX12-NEXT: vextractf128 $1, %ymm1, %xmm3
489 ; AVX12-NEXT: vpackssdw %xmm3, %xmm1, %xmm1
490 ; AVX12-NEXT: vcmpltps %ymm0, %ymm2, %ymm0
491 ; AVX12-NEXT: vextractf128 $1, %ymm0, %xmm2
492 ; AVX12-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
493 ; AVX12-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
494 ; AVX12-NEXT: vcmpltps %ymm5, %ymm7, %ymm1
495 ; AVX12-NEXT: vextractf128 $1, %ymm1, %xmm2
496 ; AVX12-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
497 ; AVX12-NEXT: vcmpltps %ymm4, %ymm6, %ymm2
498 ; AVX12-NEXT: vextractf128 $1, %ymm2, %xmm3
499 ; AVX12-NEXT: vpackssdw %xmm3, %xmm2, %xmm2
500 ; AVX12-NEXT: vpacksswb %xmm1, %xmm2, %xmm1
501 ; AVX12-NEXT: vpand %xmm1, %xmm0, %xmm0
502 ; AVX12-NEXT: vpmovmskb %xmm0, %eax
503 ; AVX12-NEXT: # kill: def $ax killed $ax killed $eax
504 ; AVX12-NEXT: vzeroupper
507 ; AVX512F-LABEL: v16f32:
509 ; AVX512F-NEXT: vcmpltps %zmm0, %zmm1, %k1
510 ; AVX512F-NEXT: vcmpltps %zmm2, %zmm3, %k0 {%k1}
511 ; AVX512F-NEXT: kmovw %k0, %eax
512 ; AVX512F-NEXT: # kill: def $ax killed $ax killed $eax
513 ; AVX512F-NEXT: vzeroupper
516 ; AVX512BW-LABEL: v16f32:
518 ; AVX512BW-NEXT: vcmpltps %zmm0, %zmm1, %k1
519 ; AVX512BW-NEXT: vcmpltps %zmm2, %zmm3, %k0 {%k1}
520 ; AVX512BW-NEXT: kmovd %k0, %eax
521 ; AVX512BW-NEXT: # kill: def $ax killed $ax killed $eax
522 ; AVX512BW-NEXT: vzeroupper
523 ; AVX512BW-NEXT: retq
524 %x0 = fcmp ogt <16 x float> %a, %b
525 %x1 = fcmp ogt <16 x float> %c, %d
526 %y = and <16 x i1> %x0, %x1
527 %res = bitcast <16 x i1> %y to i16
531 define i64 @v64i8(<64 x i8> %a, <64 x i8> %b, <64 x i8> %c, <64 x i8> %d) {
534 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm10
535 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm11
536 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm8
537 ; SSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
538 ; SSE-NEXT: pcmpgtb %xmm7, %xmm3
539 ; SSE-NEXT: pcmpgtb %xmm6, %xmm2
540 ; SSE-NEXT: pcmpgtb %xmm5, %xmm1
541 ; SSE-NEXT: pcmpgtb %xmm4, %xmm0
542 ; SSE-NEXT: pcmpgtb {{[0-9]+}}(%rsp), %xmm9
543 ; SSE-NEXT: pand %xmm3, %xmm9
544 ; SSE-NEXT: pcmpgtb {{[0-9]+}}(%rsp), %xmm8
545 ; SSE-NEXT: pand %xmm2, %xmm8
546 ; SSE-NEXT: pcmpgtb {{[0-9]+}}(%rsp), %xmm11
547 ; SSE-NEXT: pand %xmm1, %xmm11
548 ; SSE-NEXT: pcmpgtb {{[0-9]+}}(%rsp), %xmm10
549 ; SSE-NEXT: pand %xmm0, %xmm10
550 ; SSE-NEXT: pmovmskb %xmm10, %eax
551 ; SSE-NEXT: pmovmskb %xmm11, %ecx
552 ; SSE-NEXT: shll $16, %ecx
553 ; SSE-NEXT: orl %eax, %ecx
554 ; SSE-NEXT: pmovmskb %xmm8, %edx
555 ; SSE-NEXT: pmovmskb %xmm9, %eax
556 ; SSE-NEXT: shll $16, %eax
557 ; SSE-NEXT: orl %edx, %eax
558 ; SSE-NEXT: shlq $32, %rax
559 ; SSE-NEXT: orq %rcx, %rax
564 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm8
565 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm9
566 ; AVX1-NEXT: vpcmpgtb %xmm8, %xmm9, %xmm8
567 ; AVX1-NEXT: vpcmpgtb %xmm3, %xmm1, %xmm9
568 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
569 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
570 ; AVX1-NEXT: vpcmpgtb %xmm3, %xmm1, %xmm1
571 ; AVX1-NEXT: vpcmpgtb %xmm2, %xmm0, %xmm0
572 ; AVX1-NEXT: vextractf128 $1, %ymm7, %xmm2
573 ; AVX1-NEXT: vextractf128 $1, %ymm5, %xmm3
574 ; AVX1-NEXT: vpcmpgtb %xmm2, %xmm3, %xmm2
575 ; AVX1-NEXT: vpand %xmm2, %xmm8, %xmm2
576 ; AVX1-NEXT: vpcmpgtb %xmm7, %xmm5, %xmm3
577 ; AVX1-NEXT: vpand %xmm3, %xmm9, %xmm3
578 ; AVX1-NEXT: vextractf128 $1, %ymm6, %xmm5
579 ; AVX1-NEXT: vextractf128 $1, %ymm4, %xmm7
580 ; AVX1-NEXT: vpcmpgtb %xmm5, %xmm7, %xmm5
581 ; AVX1-NEXT: vpand %xmm5, %xmm1, %xmm1
582 ; AVX1-NEXT: vpcmpgtb %xmm6, %xmm4, %xmm4
583 ; AVX1-NEXT: vpand %xmm4, %xmm0, %xmm0
584 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
585 ; AVX1-NEXT: vpmovmskb %xmm1, %ecx
586 ; AVX1-NEXT: shll $16, %ecx
587 ; AVX1-NEXT: orl %eax, %ecx
588 ; AVX1-NEXT: vpmovmskb %xmm3, %edx
589 ; AVX1-NEXT: vpmovmskb %xmm2, %eax
590 ; AVX1-NEXT: shll $16, %eax
591 ; AVX1-NEXT: orl %edx, %eax
592 ; AVX1-NEXT: shlq $32, %rax
593 ; AVX1-NEXT: orq %rcx, %rax
594 ; AVX1-NEXT: vzeroupper
599 ; AVX2-NEXT: vpcmpgtb %ymm3, %ymm1, %ymm1
600 ; AVX2-NEXT: vpcmpgtb %ymm2, %ymm0, %ymm0
601 ; AVX2-NEXT: vpcmpgtb %ymm7, %ymm5, %ymm2
602 ; AVX2-NEXT: vpand %ymm2, %ymm1, %ymm1
603 ; AVX2-NEXT: vpcmpgtb %ymm6, %ymm4, %ymm2
604 ; AVX2-NEXT: vpand %ymm2, %ymm0, %ymm0
605 ; AVX2-NEXT: vpmovmskb %ymm0, %ecx
606 ; AVX2-NEXT: vpmovmskb %ymm1, %eax
607 ; AVX2-NEXT: shlq $32, %rax
608 ; AVX2-NEXT: orq %rcx, %rax
609 ; AVX2-NEXT: vzeroupper
612 ; AVX512F-LABEL: v64i8:
614 ; AVX512F-NEXT: vpcmpgtb %ymm3, %ymm1, %ymm1
615 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm3
616 ; AVX512F-NEXT: vpcmpgtb %ymm2, %ymm0, %ymm0
617 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm2
618 ; AVX512F-NEXT: vpcmpgtb %ymm7, %ymm5, %ymm5
619 ; AVX512F-NEXT: vextracti128 $1, %ymm5, %xmm7
620 ; AVX512F-NEXT: vpand %xmm7, %xmm3, %xmm3
621 ; AVX512F-NEXT: vpcmpgtb %ymm6, %ymm4, %ymm4
622 ; AVX512F-NEXT: vextracti128 $1, %ymm4, %xmm6
623 ; AVX512F-NEXT: vpand %xmm6, %xmm2, %xmm2
624 ; AVX512F-NEXT: vpand %xmm4, %xmm0, %xmm0
625 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
626 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
627 ; AVX512F-NEXT: kmovw %k0, %eax
628 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm0
629 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
630 ; AVX512F-NEXT: kmovw %k0, %ecx
631 ; AVX512F-NEXT: shll $16, %ecx
632 ; AVX512F-NEXT: orl %eax, %ecx
633 ; AVX512F-NEXT: vpand %xmm5, %xmm1, %xmm0
634 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
635 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
636 ; AVX512F-NEXT: kmovw %k0, %edx
637 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm0
638 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
639 ; AVX512F-NEXT: kmovw %k0, %eax
640 ; AVX512F-NEXT: shll $16, %eax
641 ; AVX512F-NEXT: orl %edx, %eax
642 ; AVX512F-NEXT: shlq $32, %rax
643 ; AVX512F-NEXT: orq %rcx, %rax
644 ; AVX512F-NEXT: vzeroupper
647 ; AVX512BW-LABEL: v64i8:
649 ; AVX512BW-NEXT: vpcmpgtb %zmm1, %zmm0, %k1
650 ; AVX512BW-NEXT: vpcmpgtb %zmm3, %zmm2, %k0 {%k1}
651 ; AVX512BW-NEXT: kmovq %k0, %rax
652 ; AVX512BW-NEXT: vzeroupper
653 ; AVX512BW-NEXT: retq
654 %x0 = icmp sgt <64 x i8> %a, %b
655 %x1 = icmp sgt <64 x i8> %c, %d
656 %y = and <64 x i1> %x0, %x1
657 %res = bitcast <64 x i1> %y to i64