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-prefix=ALL --check-prefix=SSE --check-prefix=SSE2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSE41
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.2 | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSE42
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=ALL --check-prefix=AVX --check-prefix=AVX1
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=ALL --check-prefix=AVX --check-prefix=AVX2
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=ALL --check-prefix=AVX --check-prefix=AVX512 --check-prefix=AVX512F
8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw | FileCheck %s --check-prefix=ALL --check-prefix=AVX --check-prefix=AVX512 --check-prefix=AVX512BW
11 ; Unsigned Maximum (GT)
14 define <2 x i64> @max_gt_v2i64(<2 x i64> %a, <2 x i64> %b) {
15 ; SSE2-LABEL: max_gt_v2i64:
17 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [9223372039002259456,9223372039002259456]
18 ; SSE2-NEXT: movdqa %xmm1, %xmm3
19 ; SSE2-NEXT: pxor %xmm2, %xmm3
20 ; SSE2-NEXT: pxor %xmm0, %xmm2
21 ; SSE2-NEXT: movdqa %xmm2, %xmm4
22 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm4
23 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
24 ; SSE2-NEXT: pcmpeqd %xmm3, %xmm2
25 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
26 ; SSE2-NEXT: pand %xmm5, %xmm2
27 ; SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
28 ; SSE2-NEXT: por %xmm2, %xmm3
29 ; SSE2-NEXT: pand %xmm3, %xmm0
30 ; SSE2-NEXT: pandn %xmm1, %xmm3
31 ; SSE2-NEXT: por %xmm3, %xmm0
34 ; SSE41-LABEL: max_gt_v2i64:
36 ; SSE41-NEXT: movdqa %xmm0, %xmm2
37 ; SSE41-NEXT: movdqa {{.*#+}} xmm0 = [9223372039002259456,9223372039002259456]
38 ; SSE41-NEXT: movdqa %xmm1, %xmm3
39 ; SSE41-NEXT: pxor %xmm0, %xmm3
40 ; SSE41-NEXT: pxor %xmm2, %xmm0
41 ; SSE41-NEXT: movdqa %xmm0, %xmm4
42 ; SSE41-NEXT: pcmpgtd %xmm3, %xmm4
43 ; SSE41-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
44 ; SSE41-NEXT: pcmpeqd %xmm3, %xmm0
45 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
46 ; SSE41-NEXT: pand %xmm5, %xmm0
47 ; SSE41-NEXT: por %xmm4, %xmm0
48 ; SSE41-NEXT: blendvpd %xmm0, %xmm2, %xmm1
49 ; SSE41-NEXT: movapd %xmm1, %xmm0
52 ; SSE42-LABEL: max_gt_v2i64:
54 ; SSE42-NEXT: movdqa %xmm0, %xmm2
55 ; SSE42-NEXT: movdqa {{.*#+}} xmm0 = [9223372036854775808,9223372036854775808]
56 ; SSE42-NEXT: movdqa %xmm1, %xmm3
57 ; SSE42-NEXT: pxor %xmm0, %xmm3
58 ; SSE42-NEXT: pxor %xmm2, %xmm0
59 ; SSE42-NEXT: pcmpgtq %xmm3, %xmm0
60 ; SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
61 ; SSE42-NEXT: movapd %xmm1, %xmm0
64 ; AVX1-LABEL: max_gt_v2i64:
66 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
67 ; AVX1-NEXT: vpxor %xmm2, %xmm1, %xmm3
68 ; AVX1-NEXT: vpxor %xmm2, %xmm0, %xmm2
69 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
70 ; AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
73 ; AVX2-LABEL: max_gt_v2i64:
75 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
76 ; AVX2-NEXT: vpxor %xmm2, %xmm1, %xmm3
77 ; AVX2-NEXT: vpxor %xmm2, %xmm0, %xmm2
78 ; AVX2-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
79 ; AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
82 ; AVX512-LABEL: max_gt_v2i64:
84 ; AVX512-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
85 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
86 ; AVX512-NEXT: vpmaxuq %zmm1, %zmm0, %zmm0
87 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
88 ; AVX512-NEXT: vzeroupper
90 %1 = icmp ugt <2 x i64> %a, %b
91 %2 = select <2 x i1> %1, <2 x i64> %a, <2 x i64> %b
95 define <4 x i64> @max_gt_v4i64(<4 x i64> %a, <4 x i64> %b) {
96 ; SSE2-LABEL: max_gt_v4i64:
98 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [9223372039002259456,9223372039002259456]
99 ; SSE2-NEXT: movdqa %xmm2, %xmm5
100 ; SSE2-NEXT: pxor %xmm4, %xmm5
101 ; SSE2-NEXT: movdqa %xmm0, %xmm6
102 ; SSE2-NEXT: pxor %xmm4, %xmm6
103 ; SSE2-NEXT: movdqa %xmm6, %xmm7
104 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm7
105 ; SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
106 ; SSE2-NEXT: pcmpeqd %xmm5, %xmm6
107 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm6[1,1,3,3]
108 ; SSE2-NEXT: pand %xmm8, %xmm5
109 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
110 ; SSE2-NEXT: por %xmm5, %xmm6
111 ; SSE2-NEXT: pand %xmm6, %xmm0
112 ; SSE2-NEXT: pandn %xmm2, %xmm6
113 ; SSE2-NEXT: por %xmm6, %xmm0
114 ; SSE2-NEXT: movdqa %xmm3, %xmm2
115 ; SSE2-NEXT: pxor %xmm4, %xmm2
116 ; SSE2-NEXT: pxor %xmm1, %xmm4
117 ; SSE2-NEXT: movdqa %xmm4, %xmm5
118 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm5
119 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
120 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm4
121 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
122 ; SSE2-NEXT: pand %xmm6, %xmm2
123 ; SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm5[1,1,3,3]
124 ; SSE2-NEXT: por %xmm2, %xmm4
125 ; SSE2-NEXT: pand %xmm4, %xmm1
126 ; SSE2-NEXT: pandn %xmm3, %xmm4
127 ; SSE2-NEXT: por %xmm4, %xmm1
130 ; SSE41-LABEL: max_gt_v4i64:
132 ; SSE41-NEXT: movdqa %xmm0, %xmm4
133 ; SSE41-NEXT: movdqa {{.*#+}} xmm5 = [9223372039002259456,9223372039002259456]
134 ; SSE41-NEXT: movdqa %xmm2, %xmm6
135 ; SSE41-NEXT: pxor %xmm5, %xmm6
136 ; SSE41-NEXT: movdqa %xmm0, %xmm7
137 ; SSE41-NEXT: pxor %xmm5, %xmm7
138 ; SSE41-NEXT: movdqa %xmm7, %xmm0
139 ; SSE41-NEXT: pcmpgtd %xmm6, %xmm0
140 ; SSE41-NEXT: pshufd {{.*#+}} xmm8 = xmm0[0,0,2,2]
141 ; SSE41-NEXT: pcmpeqd %xmm6, %xmm7
142 ; SSE41-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
143 ; SSE41-NEXT: pand %xmm8, %xmm6
144 ; SSE41-NEXT: por %xmm6, %xmm0
145 ; SSE41-NEXT: blendvpd %xmm0, %xmm4, %xmm2
146 ; SSE41-NEXT: movdqa %xmm3, %xmm0
147 ; SSE41-NEXT: pxor %xmm5, %xmm0
148 ; SSE41-NEXT: pxor %xmm1, %xmm5
149 ; SSE41-NEXT: movdqa %xmm5, %xmm4
150 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm4
151 ; SSE41-NEXT: pshufd {{.*#+}} xmm6 = xmm4[0,0,2,2]
152 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm5
153 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm5[1,1,3,3]
154 ; SSE41-NEXT: pand %xmm6, %xmm0
155 ; SSE41-NEXT: por %xmm4, %xmm0
156 ; SSE41-NEXT: blendvpd %xmm0, %xmm1, %xmm3
157 ; SSE41-NEXT: movapd %xmm2, %xmm0
158 ; SSE41-NEXT: movapd %xmm3, %xmm1
161 ; SSE42-LABEL: max_gt_v4i64:
163 ; SSE42-NEXT: movdqa %xmm0, %xmm4
164 ; SSE42-NEXT: movdqa {{.*#+}} xmm5 = [9223372036854775808,9223372036854775808]
165 ; SSE42-NEXT: movdqa %xmm2, %xmm6
166 ; SSE42-NEXT: pxor %xmm5, %xmm6
167 ; SSE42-NEXT: pxor %xmm5, %xmm0
168 ; SSE42-NEXT: pcmpgtq %xmm6, %xmm0
169 ; SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
170 ; SSE42-NEXT: movdqa %xmm3, %xmm0
171 ; SSE42-NEXT: pxor %xmm5, %xmm0
172 ; SSE42-NEXT: pxor %xmm1, %xmm5
173 ; SSE42-NEXT: pcmpgtq %xmm0, %xmm5
174 ; SSE42-NEXT: movdqa %xmm5, %xmm0
175 ; SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
176 ; SSE42-NEXT: movapd %xmm2, %xmm0
177 ; SSE42-NEXT: movapd %xmm3, %xmm1
180 ; AVX1-LABEL: max_gt_v4i64:
182 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
183 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [9223372036854775808,9223372036854775808]
184 ; AVX1-NEXT: vpxor %xmm3, %xmm2, %xmm2
185 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm4
186 ; AVX1-NEXT: vpxor %xmm3, %xmm4, %xmm4
187 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm4, %xmm2
188 ; AVX1-NEXT: vpxor %xmm3, %xmm1, %xmm4
189 ; AVX1-NEXT: vpxor %xmm3, %xmm0, %xmm3
190 ; AVX1-NEXT: vpcmpgtq %xmm4, %xmm3, %xmm3
191 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm3, %ymm2
192 ; AVX1-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
195 ; AVX2-LABEL: max_gt_v4i64:
197 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [9223372036854775808,9223372036854775808,9223372036854775808,9223372036854775808]
198 ; AVX2-NEXT: vpxor %ymm2, %ymm1, %ymm3
199 ; AVX2-NEXT: vpxor %ymm2, %ymm0, %ymm2
200 ; AVX2-NEXT: vpcmpgtq %ymm3, %ymm2, %ymm2
201 ; AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
204 ; AVX512-LABEL: max_gt_v4i64:
206 ; AVX512-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
207 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
208 ; AVX512-NEXT: vpmaxuq %zmm1, %zmm0, %zmm0
209 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
211 %1 = icmp ugt <4 x i64> %a, %b
212 %2 = select <4 x i1> %1, <4 x i64> %a, <4 x i64> %b
216 define <4 x i32> @max_gt_v4i32(<4 x i32> %a, <4 x i32> %b) {
217 ; SSE2-LABEL: max_gt_v4i32:
219 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
220 ; SSE2-NEXT: movdqa %xmm1, %xmm3
221 ; SSE2-NEXT: pxor %xmm2, %xmm3
222 ; SSE2-NEXT: pxor %xmm0, %xmm2
223 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm2
224 ; SSE2-NEXT: pand %xmm2, %xmm0
225 ; SSE2-NEXT: pandn %xmm1, %xmm2
226 ; SSE2-NEXT: por %xmm2, %xmm0
229 ; SSE41-LABEL: max_gt_v4i32:
231 ; SSE41-NEXT: pmaxud %xmm1, %xmm0
234 ; SSE42-LABEL: max_gt_v4i32:
236 ; SSE42-NEXT: pmaxud %xmm1, %xmm0
239 ; AVX-LABEL: max_gt_v4i32:
241 ; AVX-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
243 %1 = icmp ugt <4 x i32> %a, %b
244 %2 = select <4 x i1> %1, <4 x i32> %a, <4 x i32> %b
248 define <8 x i32> @max_gt_v8i32(<8 x i32> %a, <8 x i32> %b) {
249 ; SSE2-LABEL: max_gt_v8i32:
251 ; SSE2-NEXT: movdqa {{.*#+}} xmm5 = [2147483648,2147483648,2147483648,2147483648]
252 ; SSE2-NEXT: movdqa %xmm2, %xmm6
253 ; SSE2-NEXT: pxor %xmm5, %xmm6
254 ; SSE2-NEXT: movdqa %xmm0, %xmm4
255 ; SSE2-NEXT: pxor %xmm5, %xmm4
256 ; SSE2-NEXT: pcmpgtd %xmm6, %xmm4
257 ; SSE2-NEXT: pand %xmm4, %xmm0
258 ; SSE2-NEXT: pandn %xmm2, %xmm4
259 ; SSE2-NEXT: por %xmm0, %xmm4
260 ; SSE2-NEXT: movdqa %xmm3, %xmm0
261 ; SSE2-NEXT: pxor %xmm5, %xmm0
262 ; SSE2-NEXT: pxor %xmm1, %xmm5
263 ; SSE2-NEXT: pcmpgtd %xmm0, %xmm5
264 ; SSE2-NEXT: pand %xmm5, %xmm1
265 ; SSE2-NEXT: pandn %xmm3, %xmm5
266 ; SSE2-NEXT: por %xmm5, %xmm1
267 ; SSE2-NEXT: movdqa %xmm4, %xmm0
270 ; SSE41-LABEL: max_gt_v8i32:
272 ; SSE41-NEXT: pmaxud %xmm2, %xmm0
273 ; SSE41-NEXT: pmaxud %xmm3, %xmm1
276 ; SSE42-LABEL: max_gt_v8i32:
278 ; SSE42-NEXT: pmaxud %xmm2, %xmm0
279 ; SSE42-NEXT: pmaxud %xmm3, %xmm1
282 ; AVX1-LABEL: max_gt_v8i32:
284 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
285 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
286 ; AVX1-NEXT: vpmaxud %xmm2, %xmm3, %xmm2
287 ; AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
288 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
291 ; AVX2-LABEL: max_gt_v8i32:
293 ; AVX2-NEXT: vpmaxud %ymm1, %ymm0, %ymm0
296 ; AVX512-LABEL: max_gt_v8i32:
298 ; AVX512-NEXT: vpmaxud %ymm1, %ymm0, %ymm0
300 %1 = icmp ugt <8 x i32> %a, %b
301 %2 = select <8 x i1> %1, <8 x i32> %a, <8 x i32> %b
305 define <8 x i16> @max_gt_v8i16(<8 x i16> %a, <8 x i16> %b) {
306 ; SSE2-LABEL: max_gt_v8i16:
308 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [32768,32768,32768,32768,32768,32768,32768,32768]
309 ; SSE2-NEXT: pxor %xmm2, %xmm1
310 ; SSE2-NEXT: pxor %xmm2, %xmm0
311 ; SSE2-NEXT: pmaxsw %xmm1, %xmm0
312 ; SSE2-NEXT: pxor %xmm2, %xmm0
315 ; SSE41-LABEL: max_gt_v8i16:
317 ; SSE41-NEXT: pmaxuw %xmm1, %xmm0
320 ; SSE42-LABEL: max_gt_v8i16:
322 ; SSE42-NEXT: pmaxuw %xmm1, %xmm0
325 ; AVX-LABEL: max_gt_v8i16:
327 ; AVX-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
329 %1 = icmp ugt <8 x i16> %a, %b
330 %2 = select <8 x i1> %1, <8 x i16> %a, <8 x i16> %b
334 define <16 x i16> @max_gt_v16i16(<16 x i16> %a, <16 x i16> %b) {
335 ; SSE2-LABEL: max_gt_v16i16:
337 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [32768,32768,32768,32768,32768,32768,32768,32768]
338 ; SSE2-NEXT: pxor %xmm4, %xmm2
339 ; SSE2-NEXT: pxor %xmm4, %xmm0
340 ; SSE2-NEXT: pmaxsw %xmm2, %xmm0
341 ; SSE2-NEXT: pxor %xmm4, %xmm0
342 ; SSE2-NEXT: pxor %xmm4, %xmm3
343 ; SSE2-NEXT: pxor %xmm4, %xmm1
344 ; SSE2-NEXT: pmaxsw %xmm3, %xmm1
345 ; SSE2-NEXT: pxor %xmm4, %xmm1
348 ; SSE41-LABEL: max_gt_v16i16:
350 ; SSE41-NEXT: pmaxuw %xmm2, %xmm0
351 ; SSE41-NEXT: pmaxuw %xmm3, %xmm1
354 ; SSE42-LABEL: max_gt_v16i16:
356 ; SSE42-NEXT: pmaxuw %xmm2, %xmm0
357 ; SSE42-NEXT: pmaxuw %xmm3, %xmm1
360 ; AVX1-LABEL: max_gt_v16i16:
362 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
363 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
364 ; AVX1-NEXT: vpmaxuw %xmm2, %xmm3, %xmm2
365 ; AVX1-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
366 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
369 ; AVX2-LABEL: max_gt_v16i16:
371 ; AVX2-NEXT: vpmaxuw %ymm1, %ymm0, %ymm0
374 ; AVX512-LABEL: max_gt_v16i16:
376 ; AVX512-NEXT: vpmaxuw %ymm1, %ymm0, %ymm0
378 %1 = icmp ugt <16 x i16> %a, %b
379 %2 = select <16 x i1> %1, <16 x i16> %a, <16 x i16> %b
383 define <16 x i8> @max_gt_v16i8(<16 x i8> %a, <16 x i8> %b) {
384 ; SSE-LABEL: max_gt_v16i8:
386 ; SSE-NEXT: pmaxub %xmm1, %xmm0
389 ; AVX-LABEL: max_gt_v16i8:
391 ; AVX-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
393 %1 = icmp ugt <16 x i8> %a, %b
394 %2 = select <16 x i1> %1, <16 x i8> %a, <16 x i8> %b
398 define <32 x i8> @max_gt_v32i8(<32 x i8> %a, <32 x i8> %b) {
399 ; SSE-LABEL: max_gt_v32i8:
401 ; SSE-NEXT: pmaxub %xmm2, %xmm0
402 ; SSE-NEXT: pmaxub %xmm3, %xmm1
405 ; AVX1-LABEL: max_gt_v32i8:
407 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
408 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
409 ; AVX1-NEXT: vpmaxub %xmm2, %xmm3, %xmm2
410 ; AVX1-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
411 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
414 ; AVX2-LABEL: max_gt_v32i8:
416 ; AVX2-NEXT: vpmaxub %ymm1, %ymm0, %ymm0
419 ; AVX512-LABEL: max_gt_v32i8:
421 ; AVX512-NEXT: vpmaxub %ymm1, %ymm0, %ymm0
423 %1 = icmp ugt <32 x i8> %a, %b
424 %2 = select <32 x i1> %1, <32 x i8> %a, <32 x i8> %b
429 ; Unsigned Maximum (GE)
432 define <2 x i64> @max_ge_v2i64(<2 x i64> %a, <2 x i64> %b) {
433 ; SSE2-LABEL: max_ge_v2i64:
435 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [9223372039002259456,9223372039002259456]
436 ; SSE2-NEXT: movdqa %xmm1, %xmm3
437 ; SSE2-NEXT: pxor %xmm2, %xmm3
438 ; SSE2-NEXT: pxor %xmm0, %xmm2
439 ; SSE2-NEXT: movdqa %xmm2, %xmm4
440 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm4
441 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
442 ; SSE2-NEXT: pcmpeqd %xmm3, %xmm2
443 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
444 ; SSE2-NEXT: pand %xmm5, %xmm2
445 ; SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
446 ; SSE2-NEXT: por %xmm2, %xmm3
447 ; SSE2-NEXT: pand %xmm3, %xmm0
448 ; SSE2-NEXT: pandn %xmm1, %xmm3
449 ; SSE2-NEXT: por %xmm3, %xmm0
452 ; SSE41-LABEL: max_ge_v2i64:
454 ; SSE41-NEXT: movdqa %xmm0, %xmm2
455 ; SSE41-NEXT: movdqa {{.*#+}} xmm0 = [9223372039002259456,9223372039002259456]
456 ; SSE41-NEXT: movdqa %xmm1, %xmm3
457 ; SSE41-NEXT: pxor %xmm0, %xmm3
458 ; SSE41-NEXT: pxor %xmm2, %xmm0
459 ; SSE41-NEXT: movdqa %xmm0, %xmm4
460 ; SSE41-NEXT: pcmpgtd %xmm3, %xmm4
461 ; SSE41-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
462 ; SSE41-NEXT: pcmpeqd %xmm3, %xmm0
463 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
464 ; SSE41-NEXT: pand %xmm5, %xmm0
465 ; SSE41-NEXT: por %xmm4, %xmm0
466 ; SSE41-NEXT: blendvpd %xmm0, %xmm2, %xmm1
467 ; SSE41-NEXT: movapd %xmm1, %xmm0
470 ; SSE42-LABEL: max_ge_v2i64:
472 ; SSE42-NEXT: movdqa %xmm0, %xmm2
473 ; SSE42-NEXT: movdqa {{.*#+}} xmm0 = [9223372036854775808,9223372036854775808]
474 ; SSE42-NEXT: movdqa %xmm1, %xmm3
475 ; SSE42-NEXT: pxor %xmm0, %xmm3
476 ; SSE42-NEXT: pxor %xmm2, %xmm0
477 ; SSE42-NEXT: pcmpgtq %xmm3, %xmm0
478 ; SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
479 ; SSE42-NEXT: movapd %xmm1, %xmm0
482 ; AVX1-LABEL: max_ge_v2i64:
484 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
485 ; AVX1-NEXT: vpxor %xmm2, %xmm1, %xmm3
486 ; AVX1-NEXT: vpxor %xmm2, %xmm0, %xmm2
487 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
488 ; AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
491 ; AVX2-LABEL: max_ge_v2i64:
493 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
494 ; AVX2-NEXT: vpxor %xmm2, %xmm1, %xmm3
495 ; AVX2-NEXT: vpxor %xmm2, %xmm0, %xmm2
496 ; AVX2-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
497 ; AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
500 ; AVX512-LABEL: max_ge_v2i64:
502 ; AVX512-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
503 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
504 ; AVX512-NEXT: vpmaxuq %zmm1, %zmm0, %zmm0
505 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
506 ; AVX512-NEXT: vzeroupper
508 %1 = icmp uge <2 x i64> %a, %b
509 %2 = select <2 x i1> %1, <2 x i64> %a, <2 x i64> %b
513 define <4 x i64> @max_ge_v4i64(<4 x i64> %a, <4 x i64> %b) {
514 ; SSE2-LABEL: max_ge_v4i64:
516 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [9223372039002259456,9223372039002259456]
517 ; SSE2-NEXT: movdqa %xmm2, %xmm5
518 ; SSE2-NEXT: pxor %xmm4, %xmm5
519 ; SSE2-NEXT: movdqa %xmm0, %xmm6
520 ; SSE2-NEXT: pxor %xmm4, %xmm6
521 ; SSE2-NEXT: movdqa %xmm6, %xmm7
522 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm7
523 ; SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
524 ; SSE2-NEXT: pcmpeqd %xmm5, %xmm6
525 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm6[1,1,3,3]
526 ; SSE2-NEXT: pand %xmm8, %xmm5
527 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
528 ; SSE2-NEXT: por %xmm5, %xmm6
529 ; SSE2-NEXT: pand %xmm6, %xmm0
530 ; SSE2-NEXT: pandn %xmm2, %xmm6
531 ; SSE2-NEXT: por %xmm6, %xmm0
532 ; SSE2-NEXT: movdqa %xmm3, %xmm2
533 ; SSE2-NEXT: pxor %xmm4, %xmm2
534 ; SSE2-NEXT: pxor %xmm1, %xmm4
535 ; SSE2-NEXT: movdqa %xmm4, %xmm5
536 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm5
537 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
538 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm4
539 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
540 ; SSE2-NEXT: pand %xmm6, %xmm2
541 ; SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm5[1,1,3,3]
542 ; SSE2-NEXT: por %xmm2, %xmm4
543 ; SSE2-NEXT: pand %xmm4, %xmm1
544 ; SSE2-NEXT: pandn %xmm3, %xmm4
545 ; SSE2-NEXT: por %xmm4, %xmm1
548 ; SSE41-LABEL: max_ge_v4i64:
550 ; SSE41-NEXT: movdqa %xmm0, %xmm4
551 ; SSE41-NEXT: movdqa {{.*#+}} xmm5 = [9223372039002259456,9223372039002259456]
552 ; SSE41-NEXT: movdqa %xmm2, %xmm6
553 ; SSE41-NEXT: pxor %xmm5, %xmm6
554 ; SSE41-NEXT: movdqa %xmm0, %xmm7
555 ; SSE41-NEXT: pxor %xmm5, %xmm7
556 ; SSE41-NEXT: movdqa %xmm7, %xmm0
557 ; SSE41-NEXT: pcmpgtd %xmm6, %xmm0
558 ; SSE41-NEXT: pshufd {{.*#+}} xmm8 = xmm0[0,0,2,2]
559 ; SSE41-NEXT: pcmpeqd %xmm6, %xmm7
560 ; SSE41-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
561 ; SSE41-NEXT: pand %xmm8, %xmm6
562 ; SSE41-NEXT: por %xmm6, %xmm0
563 ; SSE41-NEXT: blendvpd %xmm0, %xmm4, %xmm2
564 ; SSE41-NEXT: movdqa %xmm3, %xmm0
565 ; SSE41-NEXT: pxor %xmm5, %xmm0
566 ; SSE41-NEXT: pxor %xmm1, %xmm5
567 ; SSE41-NEXT: movdqa %xmm5, %xmm4
568 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm4
569 ; SSE41-NEXT: pshufd {{.*#+}} xmm6 = xmm4[0,0,2,2]
570 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm5
571 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm5[1,1,3,3]
572 ; SSE41-NEXT: pand %xmm6, %xmm0
573 ; SSE41-NEXT: por %xmm4, %xmm0
574 ; SSE41-NEXT: blendvpd %xmm0, %xmm1, %xmm3
575 ; SSE41-NEXT: movapd %xmm2, %xmm0
576 ; SSE41-NEXT: movapd %xmm3, %xmm1
579 ; SSE42-LABEL: max_ge_v4i64:
581 ; SSE42-NEXT: movdqa %xmm0, %xmm4
582 ; SSE42-NEXT: movdqa {{.*#+}} xmm5 = [9223372036854775808,9223372036854775808]
583 ; SSE42-NEXT: movdqa %xmm2, %xmm6
584 ; SSE42-NEXT: pxor %xmm5, %xmm6
585 ; SSE42-NEXT: pxor %xmm5, %xmm0
586 ; SSE42-NEXT: pcmpgtq %xmm6, %xmm0
587 ; SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
588 ; SSE42-NEXT: movdqa %xmm3, %xmm0
589 ; SSE42-NEXT: pxor %xmm5, %xmm0
590 ; SSE42-NEXT: pxor %xmm1, %xmm5
591 ; SSE42-NEXT: pcmpgtq %xmm0, %xmm5
592 ; SSE42-NEXT: movdqa %xmm5, %xmm0
593 ; SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
594 ; SSE42-NEXT: movapd %xmm2, %xmm0
595 ; SSE42-NEXT: movapd %xmm3, %xmm1
598 ; AVX1-LABEL: max_ge_v4i64:
600 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
601 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [9223372036854775808,9223372036854775808]
602 ; AVX1-NEXT: vpxor %xmm3, %xmm2, %xmm2
603 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm4
604 ; AVX1-NEXT: vpxor %xmm3, %xmm4, %xmm4
605 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm4, %xmm2
606 ; AVX1-NEXT: vpxor %xmm3, %xmm1, %xmm4
607 ; AVX1-NEXT: vpxor %xmm3, %xmm0, %xmm3
608 ; AVX1-NEXT: vpcmpgtq %xmm4, %xmm3, %xmm3
609 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm3, %ymm2
610 ; AVX1-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
613 ; AVX2-LABEL: max_ge_v4i64:
615 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [9223372036854775808,9223372036854775808,9223372036854775808,9223372036854775808]
616 ; AVX2-NEXT: vpxor %ymm2, %ymm1, %ymm3
617 ; AVX2-NEXT: vpxor %ymm2, %ymm0, %ymm2
618 ; AVX2-NEXT: vpcmpgtq %ymm3, %ymm2, %ymm2
619 ; AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
622 ; AVX512-LABEL: max_ge_v4i64:
624 ; AVX512-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
625 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
626 ; AVX512-NEXT: vpmaxuq %zmm1, %zmm0, %zmm0
627 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
629 %1 = icmp uge <4 x i64> %a, %b
630 %2 = select <4 x i1> %1, <4 x i64> %a, <4 x i64> %b
634 define <4 x i32> @max_ge_v4i32(<4 x i32> %a, <4 x i32> %b) {
635 ; SSE2-LABEL: max_ge_v4i32:
637 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
638 ; SSE2-NEXT: movdqa %xmm1, %xmm3
639 ; SSE2-NEXT: pxor %xmm2, %xmm3
640 ; SSE2-NEXT: pxor %xmm0, %xmm2
641 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm2
642 ; SSE2-NEXT: pand %xmm2, %xmm0
643 ; SSE2-NEXT: pandn %xmm1, %xmm2
644 ; SSE2-NEXT: por %xmm2, %xmm0
647 ; SSE41-LABEL: max_ge_v4i32:
649 ; SSE41-NEXT: pmaxud %xmm1, %xmm0
652 ; SSE42-LABEL: max_ge_v4i32:
654 ; SSE42-NEXT: pmaxud %xmm1, %xmm0
657 ; AVX-LABEL: max_ge_v4i32:
659 ; AVX-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
661 %1 = icmp uge <4 x i32> %a, %b
662 %2 = select <4 x i1> %1, <4 x i32> %a, <4 x i32> %b
666 define <8 x i32> @max_ge_v8i32(<8 x i32> %a, <8 x i32> %b) {
667 ; SSE2-LABEL: max_ge_v8i32:
669 ; SSE2-NEXT: movdqa {{.*#+}} xmm5 = [2147483648,2147483648,2147483648,2147483648]
670 ; SSE2-NEXT: movdqa %xmm2, %xmm6
671 ; SSE2-NEXT: pxor %xmm5, %xmm6
672 ; SSE2-NEXT: movdqa %xmm0, %xmm4
673 ; SSE2-NEXT: pxor %xmm5, %xmm4
674 ; SSE2-NEXT: pcmpgtd %xmm6, %xmm4
675 ; SSE2-NEXT: pand %xmm4, %xmm0
676 ; SSE2-NEXT: pandn %xmm2, %xmm4
677 ; SSE2-NEXT: por %xmm0, %xmm4
678 ; SSE2-NEXT: movdqa %xmm3, %xmm0
679 ; SSE2-NEXT: pxor %xmm5, %xmm0
680 ; SSE2-NEXT: pxor %xmm1, %xmm5
681 ; SSE2-NEXT: pcmpgtd %xmm0, %xmm5
682 ; SSE2-NEXT: pand %xmm5, %xmm1
683 ; SSE2-NEXT: pandn %xmm3, %xmm5
684 ; SSE2-NEXT: por %xmm5, %xmm1
685 ; SSE2-NEXT: movdqa %xmm4, %xmm0
688 ; SSE41-LABEL: max_ge_v8i32:
690 ; SSE41-NEXT: pmaxud %xmm2, %xmm0
691 ; SSE41-NEXT: pmaxud %xmm3, %xmm1
694 ; SSE42-LABEL: max_ge_v8i32:
696 ; SSE42-NEXT: pmaxud %xmm2, %xmm0
697 ; SSE42-NEXT: pmaxud %xmm3, %xmm1
700 ; AVX1-LABEL: max_ge_v8i32:
702 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
703 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
704 ; AVX1-NEXT: vpmaxud %xmm2, %xmm3, %xmm2
705 ; AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
706 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
709 ; AVX2-LABEL: max_ge_v8i32:
711 ; AVX2-NEXT: vpmaxud %ymm1, %ymm0, %ymm0
714 ; AVX512-LABEL: max_ge_v8i32:
716 ; AVX512-NEXT: vpmaxud %ymm1, %ymm0, %ymm0
718 %1 = icmp uge <8 x i32> %a, %b
719 %2 = select <8 x i1> %1, <8 x i32> %a, <8 x i32> %b
723 define <8 x i16> @max_ge_v8i16(<8 x i16> %a, <8 x i16> %b) {
724 ; SSE2-LABEL: max_ge_v8i16:
726 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [32768,32768,32768,32768,32768,32768,32768,32768]
727 ; SSE2-NEXT: pxor %xmm2, %xmm1
728 ; SSE2-NEXT: pxor %xmm2, %xmm0
729 ; SSE2-NEXT: pmaxsw %xmm1, %xmm0
730 ; SSE2-NEXT: pxor %xmm2, %xmm0
733 ; SSE41-LABEL: max_ge_v8i16:
735 ; SSE41-NEXT: pmaxuw %xmm1, %xmm0
738 ; SSE42-LABEL: max_ge_v8i16:
740 ; SSE42-NEXT: pmaxuw %xmm1, %xmm0
743 ; AVX-LABEL: max_ge_v8i16:
745 ; AVX-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
747 %1 = icmp uge <8 x i16> %a, %b
748 %2 = select <8 x i1> %1, <8 x i16> %a, <8 x i16> %b
752 define <16 x i16> @max_ge_v16i16(<16 x i16> %a, <16 x i16> %b) {
753 ; SSE2-LABEL: max_ge_v16i16:
755 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [32768,32768,32768,32768,32768,32768,32768,32768]
756 ; SSE2-NEXT: pxor %xmm4, %xmm2
757 ; SSE2-NEXT: pxor %xmm4, %xmm0
758 ; SSE2-NEXT: pmaxsw %xmm2, %xmm0
759 ; SSE2-NEXT: pxor %xmm4, %xmm0
760 ; SSE2-NEXT: pxor %xmm4, %xmm3
761 ; SSE2-NEXT: pxor %xmm4, %xmm1
762 ; SSE2-NEXT: pmaxsw %xmm3, %xmm1
763 ; SSE2-NEXT: pxor %xmm4, %xmm1
766 ; SSE41-LABEL: max_ge_v16i16:
768 ; SSE41-NEXT: pmaxuw %xmm2, %xmm0
769 ; SSE41-NEXT: pmaxuw %xmm3, %xmm1
772 ; SSE42-LABEL: max_ge_v16i16:
774 ; SSE42-NEXT: pmaxuw %xmm2, %xmm0
775 ; SSE42-NEXT: pmaxuw %xmm3, %xmm1
778 ; AVX1-LABEL: max_ge_v16i16:
780 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
781 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
782 ; AVX1-NEXT: vpmaxuw %xmm2, %xmm3, %xmm2
783 ; AVX1-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
784 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
787 ; AVX2-LABEL: max_ge_v16i16:
789 ; AVX2-NEXT: vpmaxuw %ymm1, %ymm0, %ymm0
792 ; AVX512-LABEL: max_ge_v16i16:
794 ; AVX512-NEXT: vpmaxuw %ymm1, %ymm0, %ymm0
796 %1 = icmp uge <16 x i16> %a, %b
797 %2 = select <16 x i1> %1, <16 x i16> %a, <16 x i16> %b
801 define <16 x i8> @max_ge_v16i8(<16 x i8> %a, <16 x i8> %b) {
802 ; SSE-LABEL: max_ge_v16i8:
804 ; SSE-NEXT: pmaxub %xmm1, %xmm0
807 ; AVX-LABEL: max_ge_v16i8:
809 ; AVX-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
811 %1 = icmp uge <16 x i8> %a, %b
812 %2 = select <16 x i1> %1, <16 x i8> %a, <16 x i8> %b
816 define <32 x i8> @max_ge_v32i8(<32 x i8> %a, <32 x i8> %b) {
817 ; SSE-LABEL: max_ge_v32i8:
819 ; SSE-NEXT: pmaxub %xmm2, %xmm0
820 ; SSE-NEXT: pmaxub %xmm3, %xmm1
823 ; AVX1-LABEL: max_ge_v32i8:
825 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
826 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
827 ; AVX1-NEXT: vpmaxub %xmm2, %xmm3, %xmm2
828 ; AVX1-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
829 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
832 ; AVX2-LABEL: max_ge_v32i8:
834 ; AVX2-NEXT: vpmaxub %ymm1, %ymm0, %ymm0
837 ; AVX512-LABEL: max_ge_v32i8:
839 ; AVX512-NEXT: vpmaxub %ymm1, %ymm0, %ymm0
841 %1 = icmp uge <32 x i8> %a, %b
842 %2 = select <32 x i1> %1, <32 x i8> %a, <32 x i8> %b
847 ; Unsigned Minimum (LT)
850 define <2 x i64> @min_lt_v2i64(<2 x i64> %a, <2 x i64> %b) {
851 ; SSE2-LABEL: min_lt_v2i64:
853 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [9223372039002259456,9223372039002259456]
854 ; SSE2-NEXT: movdqa %xmm0, %xmm3
855 ; SSE2-NEXT: pxor %xmm2, %xmm3
856 ; SSE2-NEXT: pxor %xmm1, %xmm2
857 ; SSE2-NEXT: movdqa %xmm2, %xmm4
858 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm4
859 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
860 ; SSE2-NEXT: pcmpeqd %xmm3, %xmm2
861 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
862 ; SSE2-NEXT: pand %xmm5, %xmm2
863 ; SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
864 ; SSE2-NEXT: por %xmm2, %xmm3
865 ; SSE2-NEXT: pand %xmm3, %xmm0
866 ; SSE2-NEXT: pandn %xmm1, %xmm3
867 ; SSE2-NEXT: por %xmm3, %xmm0
870 ; SSE41-LABEL: min_lt_v2i64:
872 ; SSE41-NEXT: movdqa %xmm0, %xmm2
873 ; SSE41-NEXT: movdqa {{.*#+}} xmm0 = [9223372039002259456,9223372039002259456]
874 ; SSE41-NEXT: movdqa %xmm2, %xmm3
875 ; SSE41-NEXT: pxor %xmm0, %xmm3
876 ; SSE41-NEXT: pxor %xmm1, %xmm0
877 ; SSE41-NEXT: movdqa %xmm0, %xmm4
878 ; SSE41-NEXT: pcmpgtd %xmm3, %xmm4
879 ; SSE41-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
880 ; SSE41-NEXT: pcmpeqd %xmm3, %xmm0
881 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
882 ; SSE41-NEXT: pand %xmm5, %xmm0
883 ; SSE41-NEXT: por %xmm4, %xmm0
884 ; SSE41-NEXT: blendvpd %xmm0, %xmm2, %xmm1
885 ; SSE41-NEXT: movapd %xmm1, %xmm0
888 ; SSE42-LABEL: min_lt_v2i64:
890 ; SSE42-NEXT: movdqa %xmm0, %xmm2
891 ; SSE42-NEXT: movdqa {{.*#+}} xmm0 = [9223372036854775808,9223372036854775808]
892 ; SSE42-NEXT: movdqa %xmm2, %xmm3
893 ; SSE42-NEXT: pxor %xmm0, %xmm3
894 ; SSE42-NEXT: pxor %xmm1, %xmm0
895 ; SSE42-NEXT: pcmpgtq %xmm3, %xmm0
896 ; SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
897 ; SSE42-NEXT: movapd %xmm1, %xmm0
900 ; AVX1-LABEL: min_lt_v2i64:
902 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
903 ; AVX1-NEXT: vpxor %xmm2, %xmm0, %xmm3
904 ; AVX1-NEXT: vpxor %xmm2, %xmm1, %xmm2
905 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
906 ; AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
909 ; AVX2-LABEL: min_lt_v2i64:
911 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
912 ; AVX2-NEXT: vpxor %xmm2, %xmm0, %xmm3
913 ; AVX2-NEXT: vpxor %xmm2, %xmm1, %xmm2
914 ; AVX2-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
915 ; AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
918 ; AVX512-LABEL: min_lt_v2i64:
920 ; AVX512-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
921 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
922 ; AVX512-NEXT: vpminuq %zmm1, %zmm0, %zmm0
923 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
924 ; AVX512-NEXT: vzeroupper
926 %1 = icmp ult <2 x i64> %a, %b
927 %2 = select <2 x i1> %1, <2 x i64> %a, <2 x i64> %b
931 define <4 x i64> @min_lt_v4i64(<4 x i64> %a, <4 x i64> %b) {
932 ; SSE2-LABEL: min_lt_v4i64:
934 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [9223372039002259456,9223372039002259456]
935 ; SSE2-NEXT: movdqa %xmm0, %xmm5
936 ; SSE2-NEXT: pxor %xmm4, %xmm5
937 ; SSE2-NEXT: movdqa %xmm2, %xmm6
938 ; SSE2-NEXT: pxor %xmm4, %xmm6
939 ; SSE2-NEXT: movdqa %xmm6, %xmm7
940 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm7
941 ; SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
942 ; SSE2-NEXT: pcmpeqd %xmm5, %xmm6
943 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm6[1,1,3,3]
944 ; SSE2-NEXT: pand %xmm8, %xmm5
945 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
946 ; SSE2-NEXT: por %xmm5, %xmm6
947 ; SSE2-NEXT: pand %xmm6, %xmm0
948 ; SSE2-NEXT: pandn %xmm2, %xmm6
949 ; SSE2-NEXT: por %xmm6, %xmm0
950 ; SSE2-NEXT: movdqa %xmm1, %xmm2
951 ; SSE2-NEXT: pxor %xmm4, %xmm2
952 ; SSE2-NEXT: pxor %xmm3, %xmm4
953 ; SSE2-NEXT: movdqa %xmm4, %xmm5
954 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm5
955 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
956 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm4
957 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
958 ; SSE2-NEXT: pand %xmm6, %xmm2
959 ; SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm5[1,1,3,3]
960 ; SSE2-NEXT: por %xmm2, %xmm4
961 ; SSE2-NEXT: pand %xmm4, %xmm1
962 ; SSE2-NEXT: pandn %xmm3, %xmm4
963 ; SSE2-NEXT: por %xmm4, %xmm1
966 ; SSE41-LABEL: min_lt_v4i64:
968 ; SSE41-NEXT: movdqa %xmm0, %xmm4
969 ; SSE41-NEXT: movdqa {{.*#+}} xmm5 = [9223372039002259456,9223372039002259456]
970 ; SSE41-NEXT: pxor %xmm5, %xmm0
971 ; SSE41-NEXT: movdqa %xmm2, %xmm6
972 ; SSE41-NEXT: pxor %xmm5, %xmm6
973 ; SSE41-NEXT: movdqa %xmm6, %xmm7
974 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm7
975 ; SSE41-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
976 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm6
977 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm6[1,1,3,3]
978 ; SSE41-NEXT: pand %xmm8, %xmm0
979 ; SSE41-NEXT: por %xmm7, %xmm0
980 ; SSE41-NEXT: blendvpd %xmm0, %xmm4, %xmm2
981 ; SSE41-NEXT: movdqa %xmm1, %xmm0
982 ; SSE41-NEXT: pxor %xmm5, %xmm0
983 ; SSE41-NEXT: pxor %xmm3, %xmm5
984 ; SSE41-NEXT: movdqa %xmm5, %xmm4
985 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm4
986 ; SSE41-NEXT: pshufd {{.*#+}} xmm6 = xmm4[0,0,2,2]
987 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm5
988 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm5[1,1,3,3]
989 ; SSE41-NEXT: pand %xmm6, %xmm0
990 ; SSE41-NEXT: por %xmm4, %xmm0
991 ; SSE41-NEXT: blendvpd %xmm0, %xmm1, %xmm3
992 ; SSE41-NEXT: movapd %xmm2, %xmm0
993 ; SSE41-NEXT: movapd %xmm3, %xmm1
996 ; SSE42-LABEL: min_lt_v4i64:
998 ; SSE42-NEXT: movdqa %xmm0, %xmm4
999 ; SSE42-NEXT: movdqa {{.*#+}} xmm5 = [9223372036854775808,9223372036854775808]
1000 ; SSE42-NEXT: movdqa %xmm0, %xmm6
1001 ; SSE42-NEXT: pxor %xmm5, %xmm6
1002 ; SSE42-NEXT: movdqa %xmm2, %xmm0
1003 ; SSE42-NEXT: pxor %xmm5, %xmm0
1004 ; SSE42-NEXT: pcmpgtq %xmm6, %xmm0
1005 ; SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
1006 ; SSE42-NEXT: movdqa %xmm1, %xmm0
1007 ; SSE42-NEXT: pxor %xmm5, %xmm0
1008 ; SSE42-NEXT: pxor %xmm3, %xmm5
1009 ; SSE42-NEXT: pcmpgtq %xmm0, %xmm5
1010 ; SSE42-NEXT: movdqa %xmm5, %xmm0
1011 ; SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
1012 ; SSE42-NEXT: movapd %xmm2, %xmm0
1013 ; SSE42-NEXT: movapd %xmm3, %xmm1
1016 ; AVX1-LABEL: min_lt_v4i64:
1018 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
1019 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [9223372036854775808,9223372036854775808]
1020 ; AVX1-NEXT: vpxor %xmm3, %xmm2, %xmm2
1021 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm4
1022 ; AVX1-NEXT: vpxor %xmm3, %xmm4, %xmm4
1023 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm4, %xmm2
1024 ; AVX1-NEXT: vpxor %xmm3, %xmm0, %xmm4
1025 ; AVX1-NEXT: vpxor %xmm3, %xmm1, %xmm3
1026 ; AVX1-NEXT: vpcmpgtq %xmm4, %xmm3, %xmm3
1027 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm3, %ymm2
1028 ; AVX1-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
1031 ; AVX2-LABEL: min_lt_v4i64:
1033 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [9223372036854775808,9223372036854775808,9223372036854775808,9223372036854775808]
1034 ; AVX2-NEXT: vpxor %ymm2, %ymm0, %ymm3
1035 ; AVX2-NEXT: vpxor %ymm2, %ymm1, %ymm2
1036 ; AVX2-NEXT: vpcmpgtq %ymm3, %ymm2, %ymm2
1037 ; AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
1040 ; AVX512-LABEL: min_lt_v4i64:
1042 ; AVX512-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1043 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1044 ; AVX512-NEXT: vpminuq %zmm1, %zmm0, %zmm0
1045 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
1047 %1 = icmp ult <4 x i64> %a, %b
1048 %2 = select <4 x i1> %1, <4 x i64> %a, <4 x i64> %b
1052 define <4 x i32> @min_lt_v4i32(<4 x i32> %a, <4 x i32> %b) {
1053 ; SSE2-LABEL: min_lt_v4i32:
1055 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
1056 ; SSE2-NEXT: movdqa %xmm0, %xmm3
1057 ; SSE2-NEXT: pxor %xmm2, %xmm3
1058 ; SSE2-NEXT: pxor %xmm1, %xmm2
1059 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm2
1060 ; SSE2-NEXT: pand %xmm2, %xmm0
1061 ; SSE2-NEXT: pandn %xmm1, %xmm2
1062 ; SSE2-NEXT: por %xmm2, %xmm0
1065 ; SSE41-LABEL: min_lt_v4i32:
1067 ; SSE41-NEXT: pminud %xmm1, %xmm0
1070 ; SSE42-LABEL: min_lt_v4i32:
1072 ; SSE42-NEXT: pminud %xmm1, %xmm0
1075 ; AVX-LABEL: min_lt_v4i32:
1077 ; AVX-NEXT: vpminud %xmm1, %xmm0, %xmm0
1079 %1 = icmp ult <4 x i32> %a, %b
1080 %2 = select <4 x i1> %1, <4 x i32> %a, <4 x i32> %b
1084 define <8 x i32> @min_lt_v8i32(<8 x i32> %a, <8 x i32> %b) {
1085 ; SSE2-LABEL: min_lt_v8i32:
1087 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648,2147483648,2147483648]
1088 ; SSE2-NEXT: movdqa %xmm0, %xmm5
1089 ; SSE2-NEXT: pxor %xmm4, %xmm5
1090 ; SSE2-NEXT: movdqa %xmm2, %xmm6
1091 ; SSE2-NEXT: pxor %xmm4, %xmm6
1092 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm6
1093 ; SSE2-NEXT: pand %xmm6, %xmm0
1094 ; SSE2-NEXT: pandn %xmm2, %xmm6
1095 ; SSE2-NEXT: por %xmm6, %xmm0
1096 ; SSE2-NEXT: movdqa %xmm1, %xmm2
1097 ; SSE2-NEXT: pxor %xmm4, %xmm2
1098 ; SSE2-NEXT: pxor %xmm3, %xmm4
1099 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm4
1100 ; SSE2-NEXT: pand %xmm4, %xmm1
1101 ; SSE2-NEXT: pandn %xmm3, %xmm4
1102 ; SSE2-NEXT: por %xmm4, %xmm1
1105 ; SSE41-LABEL: min_lt_v8i32:
1107 ; SSE41-NEXT: pminud %xmm2, %xmm0
1108 ; SSE41-NEXT: pminud %xmm3, %xmm1
1111 ; SSE42-LABEL: min_lt_v8i32:
1113 ; SSE42-NEXT: pminud %xmm2, %xmm0
1114 ; SSE42-NEXT: pminud %xmm3, %xmm1
1117 ; AVX1-LABEL: min_lt_v8i32:
1119 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1120 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1121 ; AVX1-NEXT: vpminud %xmm2, %xmm3, %xmm2
1122 ; AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
1123 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1126 ; AVX2-LABEL: min_lt_v8i32:
1128 ; AVX2-NEXT: vpminud %ymm1, %ymm0, %ymm0
1131 ; AVX512-LABEL: min_lt_v8i32:
1133 ; AVX512-NEXT: vpminud %ymm1, %ymm0, %ymm0
1135 %1 = icmp ult <8 x i32> %a, %b
1136 %2 = select <8 x i1> %1, <8 x i32> %a, <8 x i32> %b
1140 define <8 x i16> @min_lt_v8i16(<8 x i16> %a, <8 x i16> %b) {
1141 ; SSE2-LABEL: min_lt_v8i16:
1143 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [32768,32768,32768,32768,32768,32768,32768,32768]
1144 ; SSE2-NEXT: pxor %xmm2, %xmm1
1145 ; SSE2-NEXT: pxor %xmm2, %xmm0
1146 ; SSE2-NEXT: pminsw %xmm1, %xmm0
1147 ; SSE2-NEXT: pxor %xmm2, %xmm0
1150 ; SSE41-LABEL: min_lt_v8i16:
1152 ; SSE41-NEXT: pminuw %xmm1, %xmm0
1155 ; SSE42-LABEL: min_lt_v8i16:
1157 ; SSE42-NEXT: pminuw %xmm1, %xmm0
1160 ; AVX-LABEL: min_lt_v8i16:
1162 ; AVX-NEXT: vpminuw %xmm1, %xmm0, %xmm0
1164 %1 = icmp ult <8 x i16> %a, %b
1165 %2 = select <8 x i1> %1, <8 x i16> %a, <8 x i16> %b
1169 define <16 x i16> @min_lt_v16i16(<16 x i16> %a, <16 x i16> %b) {
1170 ; SSE2-LABEL: min_lt_v16i16:
1172 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [32768,32768,32768,32768,32768,32768,32768,32768]
1173 ; SSE2-NEXT: pxor %xmm4, %xmm2
1174 ; SSE2-NEXT: pxor %xmm4, %xmm0
1175 ; SSE2-NEXT: pminsw %xmm2, %xmm0
1176 ; SSE2-NEXT: pxor %xmm4, %xmm0
1177 ; SSE2-NEXT: pxor %xmm4, %xmm3
1178 ; SSE2-NEXT: pxor %xmm4, %xmm1
1179 ; SSE2-NEXT: pminsw %xmm3, %xmm1
1180 ; SSE2-NEXT: pxor %xmm4, %xmm1
1183 ; SSE41-LABEL: min_lt_v16i16:
1185 ; SSE41-NEXT: pminuw %xmm2, %xmm0
1186 ; SSE41-NEXT: pminuw %xmm3, %xmm1
1189 ; SSE42-LABEL: min_lt_v16i16:
1191 ; SSE42-NEXT: pminuw %xmm2, %xmm0
1192 ; SSE42-NEXT: pminuw %xmm3, %xmm1
1195 ; AVX1-LABEL: min_lt_v16i16:
1197 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1198 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1199 ; AVX1-NEXT: vpminuw %xmm2, %xmm3, %xmm2
1200 ; AVX1-NEXT: vpminuw %xmm1, %xmm0, %xmm0
1201 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1204 ; AVX2-LABEL: min_lt_v16i16:
1206 ; AVX2-NEXT: vpminuw %ymm1, %ymm0, %ymm0
1209 ; AVX512-LABEL: min_lt_v16i16:
1211 ; AVX512-NEXT: vpminuw %ymm1, %ymm0, %ymm0
1213 %1 = icmp ult <16 x i16> %a, %b
1214 %2 = select <16 x i1> %1, <16 x i16> %a, <16 x i16> %b
1218 define <16 x i8> @min_lt_v16i8(<16 x i8> %a, <16 x i8> %b) {
1219 ; SSE-LABEL: min_lt_v16i8:
1221 ; SSE-NEXT: pminub %xmm1, %xmm0
1224 ; AVX-LABEL: min_lt_v16i8:
1226 ; AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
1228 %1 = icmp ult <16 x i8> %a, %b
1229 %2 = select <16 x i1> %1, <16 x i8> %a, <16 x i8> %b
1233 define <32 x i8> @min_lt_v32i8(<32 x i8> %a, <32 x i8> %b) {
1234 ; SSE-LABEL: min_lt_v32i8:
1236 ; SSE-NEXT: pminub %xmm2, %xmm0
1237 ; SSE-NEXT: pminub %xmm3, %xmm1
1240 ; AVX1-LABEL: min_lt_v32i8:
1242 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1243 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1244 ; AVX1-NEXT: vpminub %xmm2, %xmm3, %xmm2
1245 ; AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
1246 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1249 ; AVX2-LABEL: min_lt_v32i8:
1251 ; AVX2-NEXT: vpminub %ymm1, %ymm0, %ymm0
1254 ; AVX512-LABEL: min_lt_v32i8:
1256 ; AVX512-NEXT: vpminub %ymm1, %ymm0, %ymm0
1258 %1 = icmp ult <32 x i8> %a, %b
1259 %2 = select <32 x i1> %1, <32 x i8> %a, <32 x i8> %b
1264 ; Unsigned Minimum (LE)
1267 define <2 x i64> @min_le_v2i64(<2 x i64> %a, <2 x i64> %b) {
1268 ; SSE2-LABEL: min_le_v2i64:
1270 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [9223372039002259456,9223372039002259456]
1271 ; SSE2-NEXT: movdqa %xmm0, %xmm3
1272 ; SSE2-NEXT: pxor %xmm2, %xmm3
1273 ; SSE2-NEXT: pxor %xmm1, %xmm2
1274 ; SSE2-NEXT: movdqa %xmm2, %xmm4
1275 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm4
1276 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
1277 ; SSE2-NEXT: pcmpeqd %xmm3, %xmm2
1278 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
1279 ; SSE2-NEXT: pand %xmm5, %xmm2
1280 ; SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
1281 ; SSE2-NEXT: por %xmm2, %xmm3
1282 ; SSE2-NEXT: pand %xmm3, %xmm0
1283 ; SSE2-NEXT: pandn %xmm1, %xmm3
1284 ; SSE2-NEXT: por %xmm3, %xmm0
1287 ; SSE41-LABEL: min_le_v2i64:
1289 ; SSE41-NEXT: movdqa %xmm0, %xmm2
1290 ; SSE41-NEXT: movdqa {{.*#+}} xmm0 = [9223372039002259456,9223372039002259456]
1291 ; SSE41-NEXT: movdqa %xmm2, %xmm3
1292 ; SSE41-NEXT: pxor %xmm0, %xmm3
1293 ; SSE41-NEXT: pxor %xmm1, %xmm0
1294 ; SSE41-NEXT: movdqa %xmm0, %xmm4
1295 ; SSE41-NEXT: pcmpgtd %xmm3, %xmm4
1296 ; SSE41-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
1297 ; SSE41-NEXT: pcmpeqd %xmm3, %xmm0
1298 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
1299 ; SSE41-NEXT: pand %xmm5, %xmm0
1300 ; SSE41-NEXT: por %xmm4, %xmm0
1301 ; SSE41-NEXT: blendvpd %xmm0, %xmm2, %xmm1
1302 ; SSE41-NEXT: movapd %xmm1, %xmm0
1305 ; SSE42-LABEL: min_le_v2i64:
1307 ; SSE42-NEXT: movdqa %xmm0, %xmm2
1308 ; SSE42-NEXT: movdqa {{.*#+}} xmm0 = [9223372036854775808,9223372036854775808]
1309 ; SSE42-NEXT: movdqa %xmm2, %xmm3
1310 ; SSE42-NEXT: pxor %xmm0, %xmm3
1311 ; SSE42-NEXT: pxor %xmm1, %xmm0
1312 ; SSE42-NEXT: pcmpgtq %xmm3, %xmm0
1313 ; SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
1314 ; SSE42-NEXT: movapd %xmm1, %xmm0
1317 ; AVX1-LABEL: min_le_v2i64:
1319 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
1320 ; AVX1-NEXT: vpxor %xmm2, %xmm0, %xmm3
1321 ; AVX1-NEXT: vpxor %xmm2, %xmm1, %xmm2
1322 ; AVX1-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
1323 ; AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
1326 ; AVX2-LABEL: min_le_v2i64:
1328 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
1329 ; AVX2-NEXT: vpxor %xmm2, %xmm0, %xmm3
1330 ; AVX2-NEXT: vpxor %xmm2, %xmm1, %xmm2
1331 ; AVX2-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
1332 ; AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
1335 ; AVX512-LABEL: min_le_v2i64:
1337 ; AVX512-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1338 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1339 ; AVX512-NEXT: vpminuq %zmm1, %zmm0, %zmm0
1340 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
1341 ; AVX512-NEXT: vzeroupper
1343 %1 = icmp ule <2 x i64> %a, %b
1344 %2 = select <2 x i1> %1, <2 x i64> %a, <2 x i64> %b
1348 define <4 x i64> @min_le_v4i64(<4 x i64> %a, <4 x i64> %b) {
1349 ; SSE2-LABEL: min_le_v4i64:
1351 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [9223372039002259456,9223372039002259456]
1352 ; SSE2-NEXT: movdqa %xmm0, %xmm5
1353 ; SSE2-NEXT: pxor %xmm4, %xmm5
1354 ; SSE2-NEXT: movdqa %xmm2, %xmm6
1355 ; SSE2-NEXT: pxor %xmm4, %xmm6
1356 ; SSE2-NEXT: movdqa %xmm6, %xmm7
1357 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm7
1358 ; SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
1359 ; SSE2-NEXT: pcmpeqd %xmm5, %xmm6
1360 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm6[1,1,3,3]
1361 ; SSE2-NEXT: pand %xmm8, %xmm5
1362 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
1363 ; SSE2-NEXT: por %xmm5, %xmm6
1364 ; SSE2-NEXT: pand %xmm6, %xmm0
1365 ; SSE2-NEXT: pandn %xmm2, %xmm6
1366 ; SSE2-NEXT: por %xmm6, %xmm0
1367 ; SSE2-NEXT: movdqa %xmm1, %xmm2
1368 ; SSE2-NEXT: pxor %xmm4, %xmm2
1369 ; SSE2-NEXT: pxor %xmm3, %xmm4
1370 ; SSE2-NEXT: movdqa %xmm4, %xmm5
1371 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm5
1372 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
1373 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm4
1374 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
1375 ; SSE2-NEXT: pand %xmm6, %xmm2
1376 ; SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm5[1,1,3,3]
1377 ; SSE2-NEXT: por %xmm2, %xmm4
1378 ; SSE2-NEXT: pand %xmm4, %xmm1
1379 ; SSE2-NEXT: pandn %xmm3, %xmm4
1380 ; SSE2-NEXT: por %xmm4, %xmm1
1383 ; SSE41-LABEL: min_le_v4i64:
1385 ; SSE41-NEXT: movdqa %xmm0, %xmm4
1386 ; SSE41-NEXT: movdqa {{.*#+}} xmm5 = [9223372039002259456,9223372039002259456]
1387 ; SSE41-NEXT: pxor %xmm5, %xmm0
1388 ; SSE41-NEXT: movdqa %xmm2, %xmm6
1389 ; SSE41-NEXT: pxor %xmm5, %xmm6
1390 ; SSE41-NEXT: movdqa %xmm6, %xmm7
1391 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm7
1392 ; SSE41-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
1393 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm6
1394 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm6[1,1,3,3]
1395 ; SSE41-NEXT: pand %xmm8, %xmm0
1396 ; SSE41-NEXT: por %xmm7, %xmm0
1397 ; SSE41-NEXT: blendvpd %xmm0, %xmm4, %xmm2
1398 ; SSE41-NEXT: movdqa %xmm1, %xmm0
1399 ; SSE41-NEXT: pxor %xmm5, %xmm0
1400 ; SSE41-NEXT: pxor %xmm3, %xmm5
1401 ; SSE41-NEXT: movdqa %xmm5, %xmm4
1402 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm4
1403 ; SSE41-NEXT: pshufd {{.*#+}} xmm6 = xmm4[0,0,2,2]
1404 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm5
1405 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm5[1,1,3,3]
1406 ; SSE41-NEXT: pand %xmm6, %xmm0
1407 ; SSE41-NEXT: por %xmm4, %xmm0
1408 ; SSE41-NEXT: blendvpd %xmm0, %xmm1, %xmm3
1409 ; SSE41-NEXT: movapd %xmm2, %xmm0
1410 ; SSE41-NEXT: movapd %xmm3, %xmm1
1413 ; SSE42-LABEL: min_le_v4i64:
1415 ; SSE42-NEXT: movdqa %xmm0, %xmm4
1416 ; SSE42-NEXT: movdqa {{.*#+}} xmm5 = [9223372036854775808,9223372036854775808]
1417 ; SSE42-NEXT: movdqa %xmm0, %xmm6
1418 ; SSE42-NEXT: pxor %xmm5, %xmm6
1419 ; SSE42-NEXT: movdqa %xmm2, %xmm0
1420 ; SSE42-NEXT: pxor %xmm5, %xmm0
1421 ; SSE42-NEXT: pcmpgtq %xmm6, %xmm0
1422 ; SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
1423 ; SSE42-NEXT: movdqa %xmm1, %xmm0
1424 ; SSE42-NEXT: pxor %xmm5, %xmm0
1425 ; SSE42-NEXT: pxor %xmm3, %xmm5
1426 ; SSE42-NEXT: pcmpgtq %xmm0, %xmm5
1427 ; SSE42-NEXT: movdqa %xmm5, %xmm0
1428 ; SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
1429 ; SSE42-NEXT: movapd %xmm2, %xmm0
1430 ; SSE42-NEXT: movapd %xmm3, %xmm1
1433 ; AVX1-LABEL: min_le_v4i64:
1435 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
1436 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [9223372036854775808,9223372036854775808]
1437 ; AVX1-NEXT: vpxor %xmm3, %xmm2, %xmm2
1438 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm4
1439 ; AVX1-NEXT: vpxor %xmm3, %xmm4, %xmm4
1440 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm4, %xmm2
1441 ; AVX1-NEXT: vpxor %xmm3, %xmm0, %xmm4
1442 ; AVX1-NEXT: vpxor %xmm3, %xmm1, %xmm3
1443 ; AVX1-NEXT: vpcmpgtq %xmm4, %xmm3, %xmm3
1444 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm3, %ymm2
1445 ; AVX1-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
1448 ; AVX2-LABEL: min_le_v4i64:
1450 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [9223372036854775808,9223372036854775808,9223372036854775808,9223372036854775808]
1451 ; AVX2-NEXT: vpxor %ymm2, %ymm0, %ymm3
1452 ; AVX2-NEXT: vpxor %ymm2, %ymm1, %ymm2
1453 ; AVX2-NEXT: vpcmpgtq %ymm3, %ymm2, %ymm2
1454 ; AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
1457 ; AVX512-LABEL: min_le_v4i64:
1459 ; AVX512-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1460 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1461 ; AVX512-NEXT: vpminuq %zmm1, %zmm0, %zmm0
1462 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
1464 %1 = icmp ule <4 x i64> %a, %b
1465 %2 = select <4 x i1> %1, <4 x i64> %a, <4 x i64> %b
1469 define <4 x i32> @min_le_v4i32(<4 x i32> %a, <4 x i32> %b) {
1470 ; SSE2-LABEL: min_le_v4i32:
1472 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
1473 ; SSE2-NEXT: movdqa %xmm0, %xmm3
1474 ; SSE2-NEXT: pxor %xmm2, %xmm3
1475 ; SSE2-NEXT: pxor %xmm1, %xmm2
1476 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm2
1477 ; SSE2-NEXT: pand %xmm2, %xmm0
1478 ; SSE2-NEXT: pandn %xmm1, %xmm2
1479 ; SSE2-NEXT: por %xmm2, %xmm0
1482 ; SSE41-LABEL: min_le_v4i32:
1484 ; SSE41-NEXT: pminud %xmm1, %xmm0
1487 ; SSE42-LABEL: min_le_v4i32:
1489 ; SSE42-NEXT: pminud %xmm1, %xmm0
1492 ; AVX-LABEL: min_le_v4i32:
1494 ; AVX-NEXT: vpminud %xmm1, %xmm0, %xmm0
1496 %1 = icmp ule <4 x i32> %a, %b
1497 %2 = select <4 x i1> %1, <4 x i32> %a, <4 x i32> %b
1501 define <8 x i32> @min_le_v8i32(<8 x i32> %a, <8 x i32> %b) {
1502 ; SSE2-LABEL: min_le_v8i32:
1504 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648,2147483648,2147483648]
1505 ; SSE2-NEXT: movdqa %xmm0, %xmm5
1506 ; SSE2-NEXT: pxor %xmm4, %xmm5
1507 ; SSE2-NEXT: movdqa %xmm2, %xmm6
1508 ; SSE2-NEXT: pxor %xmm4, %xmm6
1509 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm6
1510 ; SSE2-NEXT: pand %xmm6, %xmm0
1511 ; SSE2-NEXT: pandn %xmm2, %xmm6
1512 ; SSE2-NEXT: por %xmm6, %xmm0
1513 ; SSE2-NEXT: movdqa %xmm1, %xmm2
1514 ; SSE2-NEXT: pxor %xmm4, %xmm2
1515 ; SSE2-NEXT: pxor %xmm3, %xmm4
1516 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm4
1517 ; SSE2-NEXT: pand %xmm4, %xmm1
1518 ; SSE2-NEXT: pandn %xmm3, %xmm4
1519 ; SSE2-NEXT: por %xmm4, %xmm1
1522 ; SSE41-LABEL: min_le_v8i32:
1524 ; SSE41-NEXT: pminud %xmm2, %xmm0
1525 ; SSE41-NEXT: pminud %xmm3, %xmm1
1528 ; SSE42-LABEL: min_le_v8i32:
1530 ; SSE42-NEXT: pminud %xmm2, %xmm0
1531 ; SSE42-NEXT: pminud %xmm3, %xmm1
1534 ; AVX1-LABEL: min_le_v8i32:
1536 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1537 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1538 ; AVX1-NEXT: vpminud %xmm2, %xmm3, %xmm2
1539 ; AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
1540 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1543 ; AVX2-LABEL: min_le_v8i32:
1545 ; AVX2-NEXT: vpminud %ymm1, %ymm0, %ymm0
1548 ; AVX512-LABEL: min_le_v8i32:
1550 ; AVX512-NEXT: vpminud %ymm1, %ymm0, %ymm0
1552 %1 = icmp ule <8 x i32> %a, %b
1553 %2 = select <8 x i1> %1, <8 x i32> %a, <8 x i32> %b
1557 define <8 x i16> @min_le_v8i16(<8 x i16> %a, <8 x i16> %b) {
1558 ; SSE2-LABEL: min_le_v8i16:
1560 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [32768,32768,32768,32768,32768,32768,32768,32768]
1561 ; SSE2-NEXT: pxor %xmm2, %xmm1
1562 ; SSE2-NEXT: pxor %xmm2, %xmm0
1563 ; SSE2-NEXT: pminsw %xmm1, %xmm0
1564 ; SSE2-NEXT: pxor %xmm2, %xmm0
1567 ; SSE41-LABEL: min_le_v8i16:
1569 ; SSE41-NEXT: pminuw %xmm1, %xmm0
1572 ; SSE42-LABEL: min_le_v8i16:
1574 ; SSE42-NEXT: pminuw %xmm1, %xmm0
1577 ; AVX-LABEL: min_le_v8i16:
1579 ; AVX-NEXT: vpminuw %xmm1, %xmm0, %xmm0
1581 %1 = icmp ule <8 x i16> %a, %b
1582 %2 = select <8 x i1> %1, <8 x i16> %a, <8 x i16> %b
1586 define <16 x i16> @min_le_v16i16(<16 x i16> %a, <16 x i16> %b) {
1587 ; SSE2-LABEL: min_le_v16i16:
1589 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [32768,32768,32768,32768,32768,32768,32768,32768]
1590 ; SSE2-NEXT: pxor %xmm4, %xmm2
1591 ; SSE2-NEXT: pxor %xmm4, %xmm0
1592 ; SSE2-NEXT: pminsw %xmm2, %xmm0
1593 ; SSE2-NEXT: pxor %xmm4, %xmm0
1594 ; SSE2-NEXT: pxor %xmm4, %xmm3
1595 ; SSE2-NEXT: pxor %xmm4, %xmm1
1596 ; SSE2-NEXT: pminsw %xmm3, %xmm1
1597 ; SSE2-NEXT: pxor %xmm4, %xmm1
1600 ; SSE41-LABEL: min_le_v16i16:
1602 ; SSE41-NEXT: pminuw %xmm2, %xmm0
1603 ; SSE41-NEXT: pminuw %xmm3, %xmm1
1606 ; SSE42-LABEL: min_le_v16i16:
1608 ; SSE42-NEXT: pminuw %xmm2, %xmm0
1609 ; SSE42-NEXT: pminuw %xmm3, %xmm1
1612 ; AVX1-LABEL: min_le_v16i16:
1614 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1615 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1616 ; AVX1-NEXT: vpminuw %xmm2, %xmm3, %xmm2
1617 ; AVX1-NEXT: vpminuw %xmm1, %xmm0, %xmm0
1618 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1621 ; AVX2-LABEL: min_le_v16i16:
1623 ; AVX2-NEXT: vpminuw %ymm1, %ymm0, %ymm0
1626 ; AVX512-LABEL: min_le_v16i16:
1628 ; AVX512-NEXT: vpminuw %ymm1, %ymm0, %ymm0
1630 %1 = icmp ule <16 x i16> %a, %b
1631 %2 = select <16 x i1> %1, <16 x i16> %a, <16 x i16> %b
1635 define <16 x i8> @min_le_v16i8(<16 x i8> %a, <16 x i8> %b) {
1636 ; SSE-LABEL: min_le_v16i8:
1638 ; SSE-NEXT: pminub %xmm1, %xmm0
1641 ; AVX-LABEL: min_le_v16i8:
1643 ; AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
1645 %1 = icmp ule <16 x i8> %a, %b
1646 %2 = select <16 x i1> %1, <16 x i8> %a, <16 x i8> %b
1650 define <32 x i8> @min_le_v32i8(<32 x i8> %a, <32 x i8> %b) {
1651 ; SSE-LABEL: min_le_v32i8:
1653 ; SSE-NEXT: pminub %xmm2, %xmm0
1654 ; SSE-NEXT: pminub %xmm3, %xmm1
1657 ; AVX1-LABEL: min_le_v32i8:
1659 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1660 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1661 ; AVX1-NEXT: vpminub %xmm2, %xmm3, %xmm2
1662 ; AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
1663 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1666 ; AVX2-LABEL: min_le_v32i8:
1668 ; AVX2-NEXT: vpminub %ymm1, %ymm0, %ymm0
1671 ; AVX512-LABEL: min_le_v32i8:
1673 ; AVX512-NEXT: vpminub %ymm1, %ymm0, %ymm0
1675 %1 = icmp ule <32 x i8> %a, %b
1676 %2 = select <32 x i1> %1, <32 x i8> %a, <32 x i8> %b
1684 define <2 x i64> @max_gt_v2i64c() {
1685 ; SSE-LABEL: max_gt_v2i64c:
1687 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551615,7]
1690 ; AVX-LABEL: max_gt_v2i64c:
1692 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [18446744073709551615,7]
1694 %1 = insertelement <2 x i64> <i64 -7, i64 7>, i64 -7, i32 0
1695 %2 = insertelement <2 x i64> <i64 -1, i64 1>, i64 -1, i32 0
1696 %3 = icmp ugt <2 x i64> %1, %2
1697 %4 = select <2 x i1> %3, <2 x i64> %1, <2 x i64> %2
1701 define <4 x i64> @max_gt_v4i64c() {
1702 ; SSE-LABEL: max_gt_v4i64c:
1704 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,7]
1705 ; SSE-NEXT: pcmpeqd %xmm0, %xmm0
1708 ; AVX-LABEL: max_gt_v4i64c:
1710 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [18446744073709551615,18446744073709551615,7,7]
1712 %1 = insertelement <4 x i64> <i64 -7, i64 -1, i64 1, i64 7>, i64 -7, i32 0
1713 %2 = insertelement <4 x i64> <i64 -1, i64 -7, i64 7, i64 1>, i64 -1, i32 0
1714 %3 = icmp ugt <4 x i64> %1, %2
1715 %4 = select <4 x i1> %3, <4 x i64> %1, <4 x i64> %2
1719 define <4 x i32> @max_gt_v4i32c() {
1720 ; SSE-LABEL: max_gt_v4i32c:
1722 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967295,4294967295,7,7]
1725 ; AVX-LABEL: max_gt_v4i32c:
1727 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [4294967295,4294967295,7,7]
1729 %1 = insertelement <4 x i32> <i32 -7, i32 -1, i32 1, i32 7>, i32 -7, i32 0
1730 %2 = insertelement <4 x i32> <i32 -1, i32 -7, i32 7, i32 1>, i32 -1, i32 0
1731 %3 = icmp ugt <4 x i32> %1, %2
1732 %4 = select <4 x i1> %3, <4 x i32> %1, <4 x i32> %2
1736 define <8 x i32> @max_gt_v8i32c() {
1737 ; SSE-LABEL: max_gt_v8i32c:
1739 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967295,4294967293,4294967293,4294967295]
1740 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,5,5,7]
1743 ; AVX-LABEL: max_gt_v8i32c:
1745 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [4294967295,4294967293,4294967293,4294967295,7,5,5,7]
1747 %1 = insertelement <8 x i32> <i32 -7, i32 -5, i32 -3, i32 -1, i32 1, i32 3, i32 5, i32 7>, i32 -7, i32 0
1748 %2 = insertelement <8 x i32> <i32 -1, i32 -3, i32 -5, i32 -7, i32 7, i32 5, i32 3, i32 1>, i32 -1, i32 0
1749 %3 = icmp ugt <8 x i32> %1, %2
1750 %4 = select <8 x i1> %3, <8 x i32> %1, <8 x i32> %2
1754 define <8 x i16> @max_gt_v8i16c() {
1755 ; SSE-LABEL: max_gt_v8i16c:
1757 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65535,65533,65533,65535,7,5,5,7]
1760 ; AVX-LABEL: max_gt_v8i16c:
1762 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [65535,65533,65533,65535,7,5,5,7]
1764 %1 = insertelement <8 x i16> <i16 -7, i16 -5, i16 -3, i16 -1, i16 1, i16 3, i16 5, i16 7>, i16 -7, i32 0
1765 %2 = insertelement <8 x i16> <i16 -1, i16 -3, i16 -5, i16 -7, i16 7, i16 5, i16 3, i16 1>, i16 -1, i32 0
1766 %3 = icmp ugt <8 x i16> %1, %2
1767 %4 = select <8 x i1> %3, <8 x i16> %1, <8 x i16> %2
1771 define <16 x i16> @max_gt_v16i16c() {
1772 ; SSE-LABEL: max_gt_v16i16c:
1774 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65535,65534,65533,65532,65533,65534,65535,0]
1775 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,6,5,4,5,6,7,8]
1778 ; AVX-LABEL: max_gt_v16i16c:
1780 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [65535,65534,65533,65532,65533,65534,65535,0,7,6,5,4,5,6,7,8]
1782 %1 = insertelement <16 x i16> <i16 -7, i16 -6, i16 -5, i16 -4, i16 -3, i16 -2, i16 -1, i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>, i16 -7, i32 0
1783 %2 = insertelement <16 x i16> <i16 -1, i16 -2, i16 -3, i16 -4, i16 -5, i16 -6, i16 -7, i16 0, i16 7, i16 6, i16 5, i16 4, i16 3, i16 2, i16 1, i16 0>, i16 -1, i32 0
1784 %3 = icmp ugt <16 x i16> %1, %2
1785 %4 = select <16 x i1> %3, <16 x i16> %1, <16 x i16> %2
1789 define <16 x i8> @max_gt_v16i8c() {
1790 ; SSE-LABEL: max_gt_v16i8c:
1792 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [255,254,253,252,253,254,255,0,7,6,5,4,5,6,7,8]
1795 ; AVX-LABEL: max_gt_v16i8c:
1797 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [255,254,253,252,253,254,255,0,7,6,5,4,5,6,7,8]
1799 %1 = insertelement <16 x i8> <i8 -7, i8 -6, i8 -5, i8 -4, i8 -3, i8 -2, i8 -1, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8>, i8 -7, i32 0
1800 %2 = insertelement <16 x i8> <i8 -1, i8 -2, i8 -3, i8 -4, i8 -5, i8 -6, i8 -7, i8 0, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>, i8 -1, i32 0
1801 %3 = icmp ugt <16 x i8> %1, %2
1802 %4 = select <16 x i1> %3, <16 x i8> %1, <16 x i8> %2
1806 define <2 x i64> @max_ge_v2i64c() {
1807 ; SSE-LABEL: max_ge_v2i64c:
1809 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551615,7]
1812 ; AVX-LABEL: max_ge_v2i64c:
1814 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [18446744073709551615,7]
1816 %1 = insertelement <2 x i64> <i64 -7, i64 7>, i64 -7, i32 0
1817 %2 = insertelement <2 x i64> <i64 -1, i64 1>, i64 -1, i32 0
1818 %3 = icmp uge <2 x i64> %1, %2
1819 %4 = select <2 x i1> %3, <2 x i64> %1, <2 x i64> %2
1823 define <4 x i64> @max_ge_v4i64c() {
1824 ; SSE-LABEL: max_ge_v4i64c:
1826 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,7]
1827 ; SSE-NEXT: pcmpeqd %xmm0, %xmm0
1830 ; AVX-LABEL: max_ge_v4i64c:
1832 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [18446744073709551615,18446744073709551615,7,7]
1834 %1 = insertelement <4 x i64> <i64 -7, i64 -1, i64 1, i64 7>, i64 -7, i32 0
1835 %2 = insertelement <4 x i64> <i64 -1, i64 -7, i64 7, i64 1>, i64 -1, i32 0
1836 %3 = icmp uge <4 x i64> %1, %2
1837 %4 = select <4 x i1> %3, <4 x i64> %1, <4 x i64> %2
1841 define <4 x i32> @max_ge_v4i32c() {
1842 ; SSE-LABEL: max_ge_v4i32c:
1844 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967295,4294967295,7,7]
1847 ; AVX-LABEL: max_ge_v4i32c:
1849 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [4294967295,4294967295,7,7]
1851 %1 = insertelement <4 x i32> <i32 -7, i32 -1, i32 1, i32 7>, i32 -7, i32 0
1852 %2 = insertelement <4 x i32> <i32 -1, i32 -7, i32 7, i32 1>, i32 -1, i32 0
1853 %3 = icmp uge <4 x i32> %1, %2
1854 %4 = select <4 x i1> %3, <4 x i32> %1, <4 x i32> %2
1858 define <8 x i32> @max_ge_v8i32c() {
1859 ; SSE-LABEL: max_ge_v8i32c:
1861 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967295,4294967293,4294967293,4294967295]
1862 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,5,5,7]
1865 ; AVX-LABEL: max_ge_v8i32c:
1867 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [4294967295,4294967293,4294967293,4294967295,7,5,5,7]
1869 %1 = insertelement <8 x i32> <i32 -7, i32 -5, i32 -3, i32 -1, i32 1, i32 3, i32 5, i32 7>, i32 -7, i32 0
1870 %2 = insertelement <8 x i32> <i32 -1, i32 -3, i32 -5, i32 -7, i32 7, i32 5, i32 3, i32 1>, i32 -1, i32 0
1871 %3 = icmp uge <8 x i32> %1, %2
1872 %4 = select <8 x i1> %3, <8 x i32> %1, <8 x i32> %2
1876 define <8 x i16> @max_ge_v8i16c() {
1877 ; SSE-LABEL: max_ge_v8i16c:
1879 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65535,65533,65533,65535,7,5,5,7]
1882 ; AVX-LABEL: max_ge_v8i16c:
1884 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [65535,65533,65533,65535,7,5,5,7]
1886 %1 = insertelement <8 x i16> <i16 -7, i16 -5, i16 -3, i16 -1, i16 1, i16 3, i16 5, i16 7>, i16 -7, i32 0
1887 %2 = insertelement <8 x i16> <i16 -1, i16 -3, i16 -5, i16 -7, i16 7, i16 5, i16 3, i16 1>, i16 -1, i32 0
1888 %3 = icmp uge <8 x i16> %1, %2
1889 %4 = select <8 x i1> %3, <8 x i16> %1, <8 x i16> %2
1893 define <16 x i16> @max_ge_v16i16c() {
1894 ; SSE-LABEL: max_ge_v16i16c:
1896 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65535,65534,65533,65532,65533,65534,65535,0]
1897 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,6,5,4,5,6,7,8]
1900 ; AVX-LABEL: max_ge_v16i16c:
1902 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [65535,65534,65533,65532,65533,65534,65535,0,7,6,5,4,5,6,7,8]
1904 %1 = insertelement <16 x i16> <i16 -7, i16 -6, i16 -5, i16 -4, i16 -3, i16 -2, i16 -1, i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>, i16 -7, i32 0
1905 %2 = insertelement <16 x i16> <i16 -1, i16 -2, i16 -3, i16 -4, i16 -5, i16 -6, i16 -7, i16 0, i16 7, i16 6, i16 5, i16 4, i16 3, i16 2, i16 1, i16 0>, i16 -1, i32 0
1906 %3 = icmp uge <16 x i16> %1, %2
1907 %4 = select <16 x i1> %3, <16 x i16> %1, <16 x i16> %2
1911 define <16 x i8> @max_ge_v16i8c() {
1912 ; SSE-LABEL: max_ge_v16i8c:
1914 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [255,254,253,252,253,254,255,0,7,6,5,4,5,6,7,8]
1917 ; AVX-LABEL: max_ge_v16i8c:
1919 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [255,254,253,252,253,254,255,0,7,6,5,4,5,6,7,8]
1921 %1 = insertelement <16 x i8> <i8 -7, i8 -6, i8 -5, i8 -4, i8 -3, i8 -2, i8 -1, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8>, i8 -7, i32 0
1922 %2 = insertelement <16 x i8> <i8 -1, i8 -2, i8 -3, i8 -4, i8 -5, i8 -6, i8 -7, i8 0, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>, i8 -1, i32 0
1923 %3 = icmp uge <16 x i8> %1, %2
1924 %4 = select <16 x i1> %3, <16 x i8> %1, <16 x i8> %2
1928 define <2 x i64> @min_lt_v2i64c() {
1929 ; SSE-LABEL: min_lt_v2i64c:
1931 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551609,1]
1934 ; AVX-LABEL: min_lt_v2i64c:
1936 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [18446744073709551609,1]
1938 %1 = insertelement <2 x i64> <i64 -7, i64 7>, i64 -7, i32 0
1939 %2 = insertelement <2 x i64> <i64 -1, i64 1>, i64 -1, i32 0
1940 %3 = icmp ult <2 x i64> %1, %2
1941 %4 = select <2 x i1> %3, <2 x i64> %1, <2 x i64> %2
1945 define <4 x i64> @min_lt_v4i64c() {
1946 ; SSE-LABEL: min_lt_v4i64c:
1948 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551609,18446744073709551609]
1949 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,1]
1952 ; AVX-LABEL: min_lt_v4i64c:
1954 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [18446744073709551609,18446744073709551609,1,1]
1956 %1 = insertelement <4 x i64> <i64 -7, i64 -1, i64 1, i64 7>, i64 -7, i32 0
1957 %2 = insertelement <4 x i64> <i64 -1, i64 -7, i64 7, i64 1>, i64 -1, i32 0
1958 %3 = icmp ult <4 x i64> %1, %2
1959 %4 = select <4 x i1> %3, <4 x i64> %1, <4 x i64> %2
1963 define <4 x i32> @min_lt_v4i32c() {
1964 ; SSE-LABEL: min_lt_v4i32c:
1966 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967289,4294967289,1,1]
1969 ; AVX-LABEL: min_lt_v4i32c:
1971 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [4294967289,4294967289,1,1]
1973 %1 = insertelement <4 x i32> <i32 -7, i32 -1, i32 1, i32 7>, i32 -7, i32 0
1974 %2 = insertelement <4 x i32> <i32 -1, i32 -7, i32 7, i32 1>, i32 -1, i32 0
1975 %3 = icmp ult <4 x i32> %1, %2
1976 %4 = select <4 x i1> %3, <4 x i32> %1, <4 x i32> %2
1980 define <8 x i32> @min_lt_v8i32c() {
1981 ; SSE-LABEL: min_lt_v8i32c:
1983 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967289,4294967291,4294967291,4294967289]
1984 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,3,3,1]
1987 ; AVX-LABEL: min_lt_v8i32c:
1989 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [4294967289,4294967291,4294967291,4294967289,1,3,3,1]
1991 %1 = insertelement <8 x i32> <i32 -7, i32 -5, i32 -3, i32 -1, i32 1, i32 3, i32 5, i32 7>, i32 -7, i32 0
1992 %2 = insertelement <8 x i32> <i32 -1, i32 -3, i32 -5, i32 -7, i32 7, i32 5, i32 3, i32 1>, i32 -1, i32 0
1993 %3 = icmp ult <8 x i32> %1, %2
1994 %4 = select <8 x i1> %3, <8 x i32> %1, <8 x i32> %2
1998 define <8 x i16> @min_lt_v8i16c() {
1999 ; SSE-LABEL: min_lt_v8i16c:
2001 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [1,65531,65531,65529,1,3,3,1]
2004 ; AVX-LABEL: min_lt_v8i16c:
2006 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [1,65531,65531,65529,1,3,3,1]
2008 %1 = insertelement <8 x i16> <i16 -7, i16 -5, i16 -3, i16 -1, i16 1, i16 3, i16 5, i16 7>, i16 -7, i32 0
2009 %2 = insertelement <8 x i16> <i16 -1, i16 -3, i16 -5, i16 -7, i16 7, i16 5, i16 3, i16 1>, i16 1, i32 0
2010 %3 = icmp ult <8 x i16> %1, %2
2011 %4 = select <8 x i1> %3, <8 x i16> %1, <8 x i16> %2
2015 define <16 x i16> @min_lt_v16i16c() {
2016 ; SSE-LABEL: min_lt_v16i16c:
2018 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [1,65530,65531,65532,65531,65530,65529,0]
2019 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,2,3,4,3,2,1,0]
2022 ; AVX-LABEL: min_lt_v16i16c:
2024 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [1,65530,65531,65532,65531,65530,65529,0,1,2,3,4,3,2,1,0]
2026 %1 = insertelement <16 x i16> <i16 -7, i16 -6, i16 -5, i16 -4, i16 -3, i16 -2, i16 -1, i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>, i16 -7, i32 0
2027 %2 = insertelement <16 x i16> <i16 -1, i16 -2, i16 -3, i16 -4, i16 -5, i16 -6, i16 -7, i16 0, i16 7, i16 6, i16 5, i16 4, i16 3, i16 2, i16 1, i16 0>, i16 1, i32 0
2028 %3 = icmp ult <16 x i16> %1, %2
2029 %4 = select <16 x i1> %3, <16 x i16> %1, <16 x i16> %2
2033 define <16 x i8> @min_lt_v16i8c() {
2034 ; SSE-LABEL: min_lt_v16i8c:
2036 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [1,250,251,252,251,250,249,0,1,2,3,4,3,2,1,0]
2039 ; AVX-LABEL: min_lt_v16i8c:
2041 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [1,250,251,252,251,250,249,0,1,2,3,4,3,2,1,0]
2043 %1 = insertelement <16 x i8> <i8 -7, i8 -6, i8 -5, i8 -4, i8 -3, i8 -2, i8 -1, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8>, i8 -7, i32 0
2044 %2 = insertelement <16 x i8> <i8 -1, i8 -2, i8 -3, i8 -4, i8 -5, i8 -6, i8 -7, i8 0, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>, i8 1, i32 0
2045 %3 = icmp ult <16 x i8> %1, %2
2046 %4 = select <16 x i1> %3, <16 x i8> %1, <16 x i8> %2
2050 define <2 x i64> @min_le_v2i64c() {
2051 ; SSE-LABEL: min_le_v2i64c:
2053 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551609,1]
2056 ; AVX-LABEL: min_le_v2i64c:
2058 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [18446744073709551609,1]
2060 %1 = insertelement <2 x i64> <i64 -7, i64 7>, i64 -7, i32 0
2061 %2 = insertelement <2 x i64> <i64 -1, i64 1>, i64 -1, i32 0
2062 %3 = icmp ule <2 x i64> %1, %2
2063 %4 = select <2 x i1> %3, <2 x i64> %1, <2 x i64> %2
2067 define <4 x i64> @min_le_v4i64c() {
2068 ; SSE-LABEL: min_le_v4i64c:
2070 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551609,18446744073709551609]
2071 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,1]
2074 ; AVX-LABEL: min_le_v4i64c:
2076 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [18446744073709551609,18446744073709551609,1,1]
2078 %1 = insertelement <4 x i64> <i64 -7, i64 -1, i64 1, i64 7>, i64 -7, i32 0
2079 %2 = insertelement <4 x i64> <i64 -1, i64 -7, i64 7, i64 1>, i64 -1, i32 0
2080 %3 = icmp ule <4 x i64> %1, %2
2081 %4 = select <4 x i1> %3, <4 x i64> %1, <4 x i64> %2
2085 define <4 x i32> @min_le_v4i32c() {
2086 ; SSE-LABEL: min_le_v4i32c:
2088 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967289,4294967289,1,1]
2091 ; AVX-LABEL: min_le_v4i32c:
2093 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [4294967289,4294967289,1,1]
2095 %1 = insertelement <4 x i32> <i32 -7, i32 -1, i32 1, i32 7>, i32 -7, i32 0
2096 %2 = insertelement <4 x i32> <i32 -1, i32 -7, i32 7, i32 1>, i32 -1, i32 0
2097 %3 = icmp ule <4 x i32> %1, %2
2098 %4 = select <4 x i1> %3, <4 x i32> %1, <4 x i32> %2
2102 define <8 x i32> @min_le_v8i32c() {
2103 ; SSE-LABEL: min_le_v8i32c:
2105 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967289,4294967291,4294967291,4294967289]
2106 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,3,3,1]
2109 ; AVX-LABEL: min_le_v8i32c:
2111 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [4294967289,4294967291,4294967291,4294967289,1,3,3,1]
2113 %1 = insertelement <8 x i32> <i32 -7, i32 -5, i32 -3, i32 -1, i32 1, i32 3, i32 5, i32 7>, i32 -7, i32 0
2114 %2 = insertelement <8 x i32> <i32 -1, i32 -3, i32 -5, i32 -7, i32 7, i32 5, i32 3, i32 1>, i32 -1, i32 0
2115 %3 = icmp ule <8 x i32> %1, %2
2116 %4 = select <8 x i1> %3, <8 x i32> %1, <8 x i32> %2
2120 define <8 x i16> @min_le_v8i16c() {
2121 ; SSE-LABEL: min_le_v8i16c:
2123 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65529,65531,65531,65529,1,3,3,1]
2126 ; AVX-LABEL: min_le_v8i16c:
2128 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [65529,65531,65531,65529,1,3,3,1]
2130 %1 = insertelement <8 x i16> <i16 -7, i16 -5, i16 -3, i16 -1, i16 1, i16 3, i16 5, i16 7>, i16 -7, i32 0
2131 %2 = insertelement <8 x i16> <i16 -1, i16 -3, i16 -5, i16 -7, i16 7, i16 5, i16 3, i16 1>, i16 -1, i32 0
2132 %3 = icmp ule <8 x i16> %1, %2
2133 %4 = select <8 x i1> %3, <8 x i16> %1, <8 x i16> %2
2137 define <16 x i16> @min_le_v16i16c() {
2138 ; SSE-LABEL: min_le_v16i16c:
2140 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65529,65530,65531,65532,65531,65530,65529,0]
2141 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,2,3,4,3,2,1,0]
2144 ; AVX-LABEL: min_le_v16i16c:
2146 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [65529,65530,65531,65532,65531,65530,65529,0,1,2,3,4,3,2,1,0]
2148 %1 = insertelement <16 x i16> <i16 -7, i16 -6, i16 -5, i16 -4, i16 -3, i16 -2, i16 -1, i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>, i16 -7, i32 0
2149 %2 = insertelement <16 x i16> <i16 -1, i16 -2, i16 -3, i16 -4, i16 -5, i16 -6, i16 -7, i16 0, i16 7, i16 6, i16 5, i16 4, i16 3, i16 2, i16 1, i16 0>, i16 -1, i32 0
2150 %3 = icmp ule <16 x i16> %1, %2
2151 %4 = select <16 x i1> %3, <16 x i16> %1, <16 x i16> %2
2155 define <16 x i8> @min_le_v16i8c() {
2156 ; SSE-LABEL: min_le_v16i8c:
2158 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [249,250,251,252,251,250,249,0,1,2,3,4,3,2,1,0]
2161 ; AVX-LABEL: min_le_v16i8c:
2163 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [249,250,251,252,251,250,249,0,1,2,3,4,3,2,1,0]
2165 %1 = insertelement <16 x i8> <i8 -7, i8 -6, i8 -5, i8 -4, i8 -3, i8 -2, i8 -1, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8>, i8 -7, i32 0
2166 %2 = insertelement <16 x i8> <i8 -1, i8 -2, i8 -3, i8 -4, i8 -5, i8 -6, i8 -7, i8 0, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>, i8 -1, i32 0
2167 %3 = icmp ule <16 x i8> %1, %2
2168 %4 = select <16 x i1> %3, <16 x i8> %1, <16 x i8> %2