1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=SSE,SSE2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,SSE41
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.2 | FileCheck %s --check-prefixes=SSE,SSE42
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX,AVX1
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX2
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefixes=AVX,AVX512
8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw | FileCheck %s --check-prefixes=AVX,AVX512
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 = [2147483648,2147483648]
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: pmovzxdq {{.*#+}} xmm3 = [2147483648,2147483648]
38 ; SSE41-NEXT: movdqa %xmm1, %xmm0
39 ; SSE41-NEXT: pxor %xmm3, %xmm0
40 ; SSE41-NEXT: pxor %xmm2, %xmm3
41 ; SSE41-NEXT: movdqa %xmm3, %xmm4
42 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm4
43 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm3
44 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm3[0,0,2,2]
45 ; SSE41-NEXT: pand %xmm4, %xmm0
46 ; SSE41-NEXT: por %xmm3, %xmm0
47 ; SSE41-NEXT: blendvpd %xmm0, %xmm2, %xmm1
48 ; SSE41-NEXT: movapd %xmm1, %xmm0
51 ; SSE42-LABEL: max_gt_v2i64:
53 ; SSE42-NEXT: movdqa %xmm0, %xmm2
54 ; SSE42-NEXT: pcmpgtq %xmm1, %xmm0
55 ; SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
56 ; SSE42-NEXT: movapd %xmm1, %xmm0
59 ; AVX1-LABEL: max_gt_v2i64:
61 ; AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
62 ; AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
65 ; AVX2-LABEL: max_gt_v2i64:
67 ; AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
68 ; AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
71 ; AVX512-LABEL: max_gt_v2i64:
73 ; AVX512-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
74 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
75 ; AVX512-NEXT: vpmaxsq %zmm1, %zmm0, %zmm0
76 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
77 ; AVX512-NEXT: vzeroupper
79 %1 = icmp sgt <2 x i64> %a, %b
80 %2 = select <2 x i1> %1, <2 x i64> %a, <2 x i64> %b
84 define <4 x i64> @max_gt_v4i64(<4 x i64> %a, <4 x i64> %b) {
85 ; SSE2-LABEL: max_gt_v4i64:
87 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
88 ; SSE2-NEXT: movdqa %xmm2, %xmm5
89 ; SSE2-NEXT: pxor %xmm4, %xmm5
90 ; SSE2-NEXT: movdqa %xmm0, %xmm6
91 ; SSE2-NEXT: pxor %xmm4, %xmm6
92 ; SSE2-NEXT: movdqa %xmm6, %xmm7
93 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm7
94 ; SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
95 ; SSE2-NEXT: pcmpeqd %xmm5, %xmm6
96 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm6[1,1,3,3]
97 ; SSE2-NEXT: pand %xmm8, %xmm5
98 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
99 ; SSE2-NEXT: por %xmm5, %xmm6
100 ; SSE2-NEXT: pand %xmm6, %xmm0
101 ; SSE2-NEXT: pandn %xmm2, %xmm6
102 ; SSE2-NEXT: por %xmm6, %xmm0
103 ; SSE2-NEXT: movdqa %xmm3, %xmm2
104 ; SSE2-NEXT: pxor %xmm4, %xmm2
105 ; SSE2-NEXT: pxor %xmm1, %xmm4
106 ; SSE2-NEXT: movdqa %xmm4, %xmm5
107 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm5
108 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
109 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm4
110 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
111 ; SSE2-NEXT: pand %xmm6, %xmm2
112 ; SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm5[1,1,3,3]
113 ; SSE2-NEXT: por %xmm2, %xmm4
114 ; SSE2-NEXT: pand %xmm4, %xmm1
115 ; SSE2-NEXT: pandn %xmm3, %xmm4
116 ; SSE2-NEXT: por %xmm4, %xmm1
119 ; SSE41-LABEL: max_gt_v4i64:
121 ; SSE41-NEXT: movdqa %xmm0, %xmm4
122 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm5 = [2147483648,2147483648]
123 ; SSE41-NEXT: movdqa %xmm2, %xmm0
124 ; SSE41-NEXT: pxor %xmm5, %xmm0
125 ; SSE41-NEXT: movdqa %xmm4, %xmm6
126 ; SSE41-NEXT: pxor %xmm5, %xmm6
127 ; SSE41-NEXT: movdqa %xmm6, %xmm7
128 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm7
129 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm6
130 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm6[0,0,2,2]
131 ; SSE41-NEXT: pand %xmm7, %xmm0
132 ; SSE41-NEXT: por %xmm6, %xmm0
133 ; SSE41-NEXT: blendvpd %xmm0, %xmm4, %xmm2
134 ; SSE41-NEXT: movdqa %xmm3, %xmm0
135 ; SSE41-NEXT: pxor %xmm5, %xmm0
136 ; SSE41-NEXT: pxor %xmm1, %xmm5
137 ; SSE41-NEXT: movdqa %xmm5, %xmm4
138 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm4
139 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm5
140 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm5[0,0,2,2]
141 ; SSE41-NEXT: pand %xmm4, %xmm0
142 ; SSE41-NEXT: por %xmm5, %xmm0
143 ; SSE41-NEXT: blendvpd %xmm0, %xmm1, %xmm3
144 ; SSE41-NEXT: movapd %xmm2, %xmm0
145 ; SSE41-NEXT: movapd %xmm3, %xmm1
148 ; SSE42-LABEL: max_gt_v4i64:
150 ; SSE42-NEXT: movdqa %xmm0, %xmm4
151 ; SSE42-NEXT: pcmpgtq %xmm2, %xmm0
152 ; SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
153 ; SSE42-NEXT: movdqa %xmm1, %xmm0
154 ; SSE42-NEXT: pcmpgtq %xmm3, %xmm0
155 ; SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
156 ; SSE42-NEXT: movapd %xmm2, %xmm0
157 ; SSE42-NEXT: movapd %xmm3, %xmm1
160 ; AVX1-LABEL: max_gt_v4i64:
162 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
163 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
164 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm2
165 ; AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm3
166 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm3, %ymm2
167 ; AVX1-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
170 ; AVX2-LABEL: max_gt_v4i64:
172 ; AVX2-NEXT: vpcmpgtq %ymm1, %ymm0, %ymm2
173 ; AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
176 ; AVX512-LABEL: max_gt_v4i64:
178 ; AVX512-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
179 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
180 ; AVX512-NEXT: vpmaxsq %zmm1, %zmm0, %zmm0
181 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
183 %1 = icmp sgt <4 x i64> %a, %b
184 %2 = select <4 x i1> %1, <4 x i64> %a, <4 x i64> %b
188 define <4 x i32> @max_gt_v4i32(<4 x i32> %a, <4 x i32> %b) {
189 ; SSE2-LABEL: max_gt_v4i32:
191 ; SSE2-NEXT: movdqa %xmm0, %xmm2
192 ; SSE2-NEXT: pcmpgtd %xmm1, %xmm2
193 ; SSE2-NEXT: pand %xmm2, %xmm0
194 ; SSE2-NEXT: pandn %xmm1, %xmm2
195 ; SSE2-NEXT: por %xmm2, %xmm0
198 ; SSE41-LABEL: max_gt_v4i32:
200 ; SSE41-NEXT: pmaxsd %xmm1, %xmm0
203 ; SSE42-LABEL: max_gt_v4i32:
205 ; SSE42-NEXT: pmaxsd %xmm1, %xmm0
208 ; AVX-LABEL: max_gt_v4i32:
210 ; AVX-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
212 %1 = icmp sgt <4 x i32> %a, %b
213 %2 = select <4 x i1> %1, <4 x i32> %a, <4 x i32> %b
217 define <8 x i32> @max_gt_v8i32(<8 x i32> %a, <8 x i32> %b) {
218 ; SSE2-LABEL: max_gt_v8i32:
220 ; SSE2-NEXT: movdqa %xmm0, %xmm4
221 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm4
222 ; SSE2-NEXT: pand %xmm4, %xmm0
223 ; SSE2-NEXT: pandn %xmm2, %xmm4
224 ; SSE2-NEXT: por %xmm4, %xmm0
225 ; SSE2-NEXT: movdqa %xmm1, %xmm2
226 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm2
227 ; SSE2-NEXT: pand %xmm2, %xmm1
228 ; SSE2-NEXT: pandn %xmm3, %xmm2
229 ; SSE2-NEXT: por %xmm2, %xmm1
232 ; SSE41-LABEL: max_gt_v8i32:
234 ; SSE41-NEXT: pmaxsd %xmm2, %xmm0
235 ; SSE41-NEXT: pmaxsd %xmm3, %xmm1
238 ; SSE42-LABEL: max_gt_v8i32:
240 ; SSE42-NEXT: pmaxsd %xmm2, %xmm0
241 ; SSE42-NEXT: pmaxsd %xmm3, %xmm1
244 ; AVX1-LABEL: max_gt_v8i32:
246 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
247 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
248 ; AVX1-NEXT: vpmaxsd %xmm2, %xmm3, %xmm2
249 ; AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
250 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
253 ; AVX2-LABEL: max_gt_v8i32:
255 ; AVX2-NEXT: vpmaxsd %ymm1, %ymm0, %ymm0
258 ; AVX512-LABEL: max_gt_v8i32:
260 ; AVX512-NEXT: vpmaxsd %ymm1, %ymm0, %ymm0
262 %1 = icmp sgt <8 x i32> %a, %b
263 %2 = select <8 x i1> %1, <8 x i32> %a, <8 x i32> %b
267 define <8 x i16> @max_gt_v8i16(<8 x i16> %a, <8 x i16> %b) {
268 ; SSE-LABEL: max_gt_v8i16:
270 ; SSE-NEXT: pmaxsw %xmm1, %xmm0
273 ; AVX-LABEL: max_gt_v8i16:
275 ; AVX-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
277 %1 = icmp sgt <8 x i16> %a, %b
278 %2 = select <8 x i1> %1, <8 x i16> %a, <8 x i16> %b
282 define <16 x i16> @max_gt_v16i16(<16 x i16> %a, <16 x i16> %b) {
283 ; SSE-LABEL: max_gt_v16i16:
285 ; SSE-NEXT: pmaxsw %xmm2, %xmm0
286 ; SSE-NEXT: pmaxsw %xmm3, %xmm1
289 ; AVX1-LABEL: max_gt_v16i16:
291 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
292 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
293 ; AVX1-NEXT: vpmaxsw %xmm2, %xmm3, %xmm2
294 ; AVX1-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
295 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
298 ; AVX2-LABEL: max_gt_v16i16:
300 ; AVX2-NEXT: vpmaxsw %ymm1, %ymm0, %ymm0
303 ; AVX512-LABEL: max_gt_v16i16:
305 ; AVX512-NEXT: vpmaxsw %ymm1, %ymm0, %ymm0
307 %1 = icmp sgt <16 x i16> %a, %b
308 %2 = select <16 x i1> %1, <16 x i16> %a, <16 x i16> %b
312 define <16 x i8> @max_gt_v16i8(<16 x i8> %a, <16 x i8> %b) {
313 ; SSE2-LABEL: max_gt_v16i8:
315 ; SSE2-NEXT: movdqa %xmm0, %xmm2
316 ; SSE2-NEXT: pcmpgtb %xmm1, %xmm2
317 ; SSE2-NEXT: pand %xmm2, %xmm0
318 ; SSE2-NEXT: pandn %xmm1, %xmm2
319 ; SSE2-NEXT: por %xmm2, %xmm0
322 ; SSE41-LABEL: max_gt_v16i8:
324 ; SSE41-NEXT: pmaxsb %xmm1, %xmm0
327 ; SSE42-LABEL: max_gt_v16i8:
329 ; SSE42-NEXT: pmaxsb %xmm1, %xmm0
332 ; AVX-LABEL: max_gt_v16i8:
334 ; AVX-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
336 %1 = icmp sgt <16 x i8> %a, %b
337 %2 = select <16 x i1> %1, <16 x i8> %a, <16 x i8> %b
341 define <32 x i8> @max_gt_v32i8(<32 x i8> %a, <32 x i8> %b) {
342 ; SSE2-LABEL: max_gt_v32i8:
344 ; SSE2-NEXT: movdqa %xmm0, %xmm4
345 ; SSE2-NEXT: pcmpgtb %xmm2, %xmm4
346 ; SSE2-NEXT: pand %xmm4, %xmm0
347 ; SSE2-NEXT: pandn %xmm2, %xmm4
348 ; SSE2-NEXT: por %xmm4, %xmm0
349 ; SSE2-NEXT: movdqa %xmm1, %xmm2
350 ; SSE2-NEXT: pcmpgtb %xmm3, %xmm2
351 ; SSE2-NEXT: pand %xmm2, %xmm1
352 ; SSE2-NEXT: pandn %xmm3, %xmm2
353 ; SSE2-NEXT: por %xmm2, %xmm1
356 ; SSE41-LABEL: max_gt_v32i8:
358 ; SSE41-NEXT: pmaxsb %xmm2, %xmm0
359 ; SSE41-NEXT: pmaxsb %xmm3, %xmm1
362 ; SSE42-LABEL: max_gt_v32i8:
364 ; SSE42-NEXT: pmaxsb %xmm2, %xmm0
365 ; SSE42-NEXT: pmaxsb %xmm3, %xmm1
368 ; AVX1-LABEL: max_gt_v32i8:
370 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
371 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
372 ; AVX1-NEXT: vpmaxsb %xmm2, %xmm3, %xmm2
373 ; AVX1-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
374 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
377 ; AVX2-LABEL: max_gt_v32i8:
379 ; AVX2-NEXT: vpmaxsb %ymm1, %ymm0, %ymm0
382 ; AVX512-LABEL: max_gt_v32i8:
384 ; AVX512-NEXT: vpmaxsb %ymm1, %ymm0, %ymm0
386 %1 = icmp sgt <32 x i8> %a, %b
387 %2 = select <32 x i1> %1, <32 x i8> %a, <32 x i8> %b
392 ; Signed Maximum (GE)
395 define <2 x i64> @max_ge_v2i64(<2 x i64> %a, <2 x i64> %b) {
396 ; SSE2-LABEL: max_ge_v2i64:
398 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648]
399 ; SSE2-NEXT: movdqa %xmm1, %xmm3
400 ; SSE2-NEXT: pxor %xmm2, %xmm3
401 ; SSE2-NEXT: pxor %xmm0, %xmm2
402 ; SSE2-NEXT: movdqa %xmm2, %xmm4
403 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm4
404 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
405 ; SSE2-NEXT: pcmpeqd %xmm3, %xmm2
406 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
407 ; SSE2-NEXT: pand %xmm5, %xmm2
408 ; SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
409 ; SSE2-NEXT: por %xmm2, %xmm3
410 ; SSE2-NEXT: pand %xmm3, %xmm0
411 ; SSE2-NEXT: pandn %xmm1, %xmm3
412 ; SSE2-NEXT: por %xmm3, %xmm0
415 ; SSE41-LABEL: max_ge_v2i64:
417 ; SSE41-NEXT: movdqa %xmm0, %xmm2
418 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm3 = [2147483648,2147483648]
419 ; SSE41-NEXT: movdqa %xmm1, %xmm0
420 ; SSE41-NEXT: pxor %xmm3, %xmm0
421 ; SSE41-NEXT: pxor %xmm2, %xmm3
422 ; SSE41-NEXT: movdqa %xmm3, %xmm4
423 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm4
424 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm3
425 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm3[0,0,2,2]
426 ; SSE41-NEXT: pand %xmm4, %xmm0
427 ; SSE41-NEXT: por %xmm3, %xmm0
428 ; SSE41-NEXT: blendvpd %xmm0, %xmm2, %xmm1
429 ; SSE41-NEXT: movapd %xmm1, %xmm0
432 ; SSE42-LABEL: max_ge_v2i64:
434 ; SSE42-NEXT: movdqa %xmm0, %xmm2
435 ; SSE42-NEXT: pcmpgtq %xmm1, %xmm0
436 ; SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
437 ; SSE42-NEXT: movapd %xmm1, %xmm0
440 ; AVX1-LABEL: max_ge_v2i64:
442 ; AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
443 ; AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
446 ; AVX2-LABEL: max_ge_v2i64:
448 ; AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
449 ; AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
452 ; AVX512-LABEL: max_ge_v2i64:
454 ; AVX512-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
455 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
456 ; AVX512-NEXT: vpmaxsq %zmm1, %zmm0, %zmm0
457 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
458 ; AVX512-NEXT: vzeroupper
460 %1 = icmp sge <2 x i64> %a, %b
461 %2 = select <2 x i1> %1, <2 x i64> %a, <2 x i64> %b
465 define <4 x i64> @max_ge_v4i64(<4 x i64> %a, <4 x i64> %b) {
466 ; SSE2-LABEL: max_ge_v4i64:
468 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
469 ; SSE2-NEXT: movdqa %xmm2, %xmm5
470 ; SSE2-NEXT: pxor %xmm4, %xmm5
471 ; SSE2-NEXT: movdqa %xmm0, %xmm6
472 ; SSE2-NEXT: pxor %xmm4, %xmm6
473 ; SSE2-NEXT: movdqa %xmm6, %xmm7
474 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm7
475 ; SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
476 ; SSE2-NEXT: pcmpeqd %xmm5, %xmm6
477 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm6[1,1,3,3]
478 ; SSE2-NEXT: pand %xmm8, %xmm5
479 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
480 ; SSE2-NEXT: por %xmm5, %xmm6
481 ; SSE2-NEXT: pand %xmm6, %xmm0
482 ; SSE2-NEXT: pandn %xmm2, %xmm6
483 ; SSE2-NEXT: por %xmm6, %xmm0
484 ; SSE2-NEXT: movdqa %xmm3, %xmm2
485 ; SSE2-NEXT: pxor %xmm4, %xmm2
486 ; SSE2-NEXT: pxor %xmm1, %xmm4
487 ; SSE2-NEXT: movdqa %xmm4, %xmm5
488 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm5
489 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
490 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm4
491 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
492 ; SSE2-NEXT: pand %xmm6, %xmm2
493 ; SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm5[1,1,3,3]
494 ; SSE2-NEXT: por %xmm2, %xmm4
495 ; SSE2-NEXT: pand %xmm4, %xmm1
496 ; SSE2-NEXT: pandn %xmm3, %xmm4
497 ; SSE2-NEXT: por %xmm4, %xmm1
500 ; SSE41-LABEL: max_ge_v4i64:
502 ; SSE41-NEXT: movdqa %xmm0, %xmm4
503 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm5 = [2147483648,2147483648]
504 ; SSE41-NEXT: movdqa %xmm2, %xmm0
505 ; SSE41-NEXT: pxor %xmm5, %xmm0
506 ; SSE41-NEXT: movdqa %xmm4, %xmm6
507 ; SSE41-NEXT: pxor %xmm5, %xmm6
508 ; SSE41-NEXT: movdqa %xmm6, %xmm7
509 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm7
510 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm6
511 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm6[0,0,2,2]
512 ; SSE41-NEXT: pand %xmm7, %xmm0
513 ; SSE41-NEXT: por %xmm6, %xmm0
514 ; SSE41-NEXT: blendvpd %xmm0, %xmm4, %xmm2
515 ; SSE41-NEXT: movdqa %xmm3, %xmm0
516 ; SSE41-NEXT: pxor %xmm5, %xmm0
517 ; SSE41-NEXT: pxor %xmm1, %xmm5
518 ; SSE41-NEXT: movdqa %xmm5, %xmm4
519 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm4
520 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm5
521 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm5[0,0,2,2]
522 ; SSE41-NEXT: pand %xmm4, %xmm0
523 ; SSE41-NEXT: por %xmm5, %xmm0
524 ; SSE41-NEXT: blendvpd %xmm0, %xmm1, %xmm3
525 ; SSE41-NEXT: movapd %xmm2, %xmm0
526 ; SSE41-NEXT: movapd %xmm3, %xmm1
529 ; SSE42-LABEL: max_ge_v4i64:
531 ; SSE42-NEXT: movdqa %xmm0, %xmm4
532 ; SSE42-NEXT: pcmpgtq %xmm2, %xmm0
533 ; SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
534 ; SSE42-NEXT: movdqa %xmm1, %xmm0
535 ; SSE42-NEXT: pcmpgtq %xmm3, %xmm0
536 ; SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
537 ; SSE42-NEXT: movapd %xmm2, %xmm0
538 ; SSE42-NEXT: movapd %xmm3, %xmm1
541 ; AVX1-LABEL: max_ge_v4i64:
543 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
544 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
545 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm2
546 ; AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm3
547 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm3, %ymm2
548 ; AVX1-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
551 ; AVX2-LABEL: max_ge_v4i64:
553 ; AVX2-NEXT: vpcmpgtq %ymm1, %ymm0, %ymm2
554 ; AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
557 ; AVX512-LABEL: max_ge_v4i64:
559 ; AVX512-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
560 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
561 ; AVX512-NEXT: vpmaxsq %zmm1, %zmm0, %zmm0
562 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
564 %1 = icmp sge <4 x i64> %a, %b
565 %2 = select <4 x i1> %1, <4 x i64> %a, <4 x i64> %b
569 define <4 x i32> @max_ge_v4i32(<4 x i32> %a, <4 x i32> %b) {
570 ; SSE2-LABEL: max_ge_v4i32:
572 ; SSE2-NEXT: movdqa %xmm0, %xmm2
573 ; SSE2-NEXT: pcmpgtd %xmm1, %xmm2
574 ; SSE2-NEXT: pand %xmm2, %xmm0
575 ; SSE2-NEXT: pandn %xmm1, %xmm2
576 ; SSE2-NEXT: por %xmm2, %xmm0
579 ; SSE41-LABEL: max_ge_v4i32:
581 ; SSE41-NEXT: pmaxsd %xmm1, %xmm0
584 ; SSE42-LABEL: max_ge_v4i32:
586 ; SSE42-NEXT: pmaxsd %xmm1, %xmm0
589 ; AVX-LABEL: max_ge_v4i32:
591 ; AVX-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
593 %1 = icmp sge <4 x i32> %a, %b
594 %2 = select <4 x i1> %1, <4 x i32> %a, <4 x i32> %b
598 define <8 x i32> @max_ge_v8i32(<8 x i32> %a, <8 x i32> %b) {
599 ; SSE2-LABEL: max_ge_v8i32:
601 ; SSE2-NEXT: movdqa %xmm0, %xmm4
602 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm4
603 ; SSE2-NEXT: pand %xmm4, %xmm0
604 ; SSE2-NEXT: pandn %xmm2, %xmm4
605 ; SSE2-NEXT: por %xmm4, %xmm0
606 ; SSE2-NEXT: movdqa %xmm1, %xmm2
607 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm2
608 ; SSE2-NEXT: pand %xmm2, %xmm1
609 ; SSE2-NEXT: pandn %xmm3, %xmm2
610 ; SSE2-NEXT: por %xmm2, %xmm1
613 ; SSE41-LABEL: max_ge_v8i32:
615 ; SSE41-NEXT: pmaxsd %xmm2, %xmm0
616 ; SSE41-NEXT: pmaxsd %xmm3, %xmm1
619 ; SSE42-LABEL: max_ge_v8i32:
621 ; SSE42-NEXT: pmaxsd %xmm2, %xmm0
622 ; SSE42-NEXT: pmaxsd %xmm3, %xmm1
625 ; AVX1-LABEL: max_ge_v8i32:
627 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
628 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
629 ; AVX1-NEXT: vpmaxsd %xmm2, %xmm3, %xmm2
630 ; AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
631 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
634 ; AVX2-LABEL: max_ge_v8i32:
636 ; AVX2-NEXT: vpmaxsd %ymm1, %ymm0, %ymm0
639 ; AVX512-LABEL: max_ge_v8i32:
641 ; AVX512-NEXT: vpmaxsd %ymm1, %ymm0, %ymm0
643 %1 = icmp sge <8 x i32> %a, %b
644 %2 = select <8 x i1> %1, <8 x i32> %a, <8 x i32> %b
648 define <8 x i16> @max_ge_v8i16(<8 x i16> %a, <8 x i16> %b) {
649 ; SSE-LABEL: max_ge_v8i16:
651 ; SSE-NEXT: pmaxsw %xmm1, %xmm0
654 ; AVX-LABEL: max_ge_v8i16:
656 ; AVX-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
658 %1 = icmp sge <8 x i16> %a, %b
659 %2 = select <8 x i1> %1, <8 x i16> %a, <8 x i16> %b
663 define <16 x i16> @max_ge_v16i16(<16 x i16> %a, <16 x i16> %b) {
664 ; SSE-LABEL: max_ge_v16i16:
666 ; SSE-NEXT: pmaxsw %xmm2, %xmm0
667 ; SSE-NEXT: pmaxsw %xmm3, %xmm1
670 ; AVX1-LABEL: max_ge_v16i16:
672 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
673 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
674 ; AVX1-NEXT: vpmaxsw %xmm2, %xmm3, %xmm2
675 ; AVX1-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
676 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
679 ; AVX2-LABEL: max_ge_v16i16:
681 ; AVX2-NEXT: vpmaxsw %ymm1, %ymm0, %ymm0
684 ; AVX512-LABEL: max_ge_v16i16:
686 ; AVX512-NEXT: vpmaxsw %ymm1, %ymm0, %ymm0
688 %1 = icmp sge <16 x i16> %a, %b
689 %2 = select <16 x i1> %1, <16 x i16> %a, <16 x i16> %b
693 define <16 x i8> @max_ge_v16i8(<16 x i8> %a, <16 x i8> %b) {
694 ; SSE2-LABEL: max_ge_v16i8:
696 ; SSE2-NEXT: movdqa %xmm0, %xmm2
697 ; SSE2-NEXT: pcmpgtb %xmm1, %xmm2
698 ; SSE2-NEXT: pand %xmm2, %xmm0
699 ; SSE2-NEXT: pandn %xmm1, %xmm2
700 ; SSE2-NEXT: por %xmm2, %xmm0
703 ; SSE41-LABEL: max_ge_v16i8:
705 ; SSE41-NEXT: pmaxsb %xmm1, %xmm0
708 ; SSE42-LABEL: max_ge_v16i8:
710 ; SSE42-NEXT: pmaxsb %xmm1, %xmm0
713 ; AVX-LABEL: max_ge_v16i8:
715 ; AVX-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
717 %1 = icmp sge <16 x i8> %a, %b
718 %2 = select <16 x i1> %1, <16 x i8> %a, <16 x i8> %b
722 define <32 x i8> @max_ge_v32i8(<32 x i8> %a, <32 x i8> %b) {
723 ; SSE2-LABEL: max_ge_v32i8:
725 ; SSE2-NEXT: movdqa %xmm0, %xmm4
726 ; SSE2-NEXT: pcmpgtb %xmm2, %xmm4
727 ; SSE2-NEXT: pand %xmm4, %xmm0
728 ; SSE2-NEXT: pandn %xmm2, %xmm4
729 ; SSE2-NEXT: por %xmm4, %xmm0
730 ; SSE2-NEXT: movdqa %xmm1, %xmm2
731 ; SSE2-NEXT: pcmpgtb %xmm3, %xmm2
732 ; SSE2-NEXT: pand %xmm2, %xmm1
733 ; SSE2-NEXT: pandn %xmm3, %xmm2
734 ; SSE2-NEXT: por %xmm2, %xmm1
737 ; SSE41-LABEL: max_ge_v32i8:
739 ; SSE41-NEXT: pmaxsb %xmm2, %xmm0
740 ; SSE41-NEXT: pmaxsb %xmm3, %xmm1
743 ; SSE42-LABEL: max_ge_v32i8:
745 ; SSE42-NEXT: pmaxsb %xmm2, %xmm0
746 ; SSE42-NEXT: pmaxsb %xmm3, %xmm1
749 ; AVX1-LABEL: max_ge_v32i8:
751 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
752 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
753 ; AVX1-NEXT: vpmaxsb %xmm2, %xmm3, %xmm2
754 ; AVX1-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
755 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
758 ; AVX2-LABEL: max_ge_v32i8:
760 ; AVX2-NEXT: vpmaxsb %ymm1, %ymm0, %ymm0
763 ; AVX512-LABEL: max_ge_v32i8:
765 ; AVX512-NEXT: vpmaxsb %ymm1, %ymm0, %ymm0
767 %1 = icmp sge <32 x i8> %a, %b
768 %2 = select <32 x i1> %1, <32 x i8> %a, <32 x i8> %b
773 ; Signed Minimum (LT)
776 define <2 x i64> @min_lt_v2i64(<2 x i64> %a, <2 x i64> %b) {
777 ; SSE2-LABEL: min_lt_v2i64:
779 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648]
780 ; SSE2-NEXT: movdqa %xmm0, %xmm3
781 ; SSE2-NEXT: pxor %xmm2, %xmm3
782 ; SSE2-NEXT: pxor %xmm1, %xmm2
783 ; SSE2-NEXT: movdqa %xmm2, %xmm4
784 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm4
785 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
786 ; SSE2-NEXT: pcmpeqd %xmm3, %xmm2
787 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
788 ; SSE2-NEXT: pand %xmm5, %xmm2
789 ; SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
790 ; SSE2-NEXT: por %xmm2, %xmm3
791 ; SSE2-NEXT: pand %xmm3, %xmm0
792 ; SSE2-NEXT: pandn %xmm1, %xmm3
793 ; SSE2-NEXT: por %xmm3, %xmm0
796 ; SSE41-LABEL: min_lt_v2i64:
798 ; SSE41-NEXT: movdqa %xmm0, %xmm2
799 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm3 = [2147483648,2147483648]
800 ; SSE41-NEXT: pxor %xmm3, %xmm0
801 ; SSE41-NEXT: pxor %xmm1, %xmm3
802 ; SSE41-NEXT: movdqa %xmm3, %xmm4
803 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm4
804 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm3
805 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm3[0,0,2,2]
806 ; SSE41-NEXT: pand %xmm4, %xmm0
807 ; SSE41-NEXT: por %xmm3, %xmm0
808 ; SSE41-NEXT: blendvpd %xmm0, %xmm2, %xmm1
809 ; SSE41-NEXT: movapd %xmm1, %xmm0
812 ; SSE42-LABEL: min_lt_v2i64:
814 ; SSE42-NEXT: movdqa %xmm0, %xmm2
815 ; SSE42-NEXT: movdqa %xmm1, %xmm0
816 ; SSE42-NEXT: pcmpgtq %xmm2, %xmm0
817 ; SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
818 ; SSE42-NEXT: movapd %xmm1, %xmm0
821 ; AVX1-LABEL: min_lt_v2i64:
823 ; AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
824 ; AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
827 ; AVX2-LABEL: min_lt_v2i64:
829 ; AVX2-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
830 ; AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
833 ; AVX512-LABEL: min_lt_v2i64:
835 ; AVX512-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
836 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
837 ; AVX512-NEXT: vpminsq %zmm1, %zmm0, %zmm0
838 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
839 ; AVX512-NEXT: vzeroupper
841 %1 = icmp slt <2 x i64> %a, %b
842 %2 = select <2 x i1> %1, <2 x i64> %a, <2 x i64> %b
846 define <4 x i64> @min_lt_v4i64(<4 x i64> %a, <4 x i64> %b) {
847 ; SSE2-LABEL: min_lt_v4i64:
849 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
850 ; SSE2-NEXT: movdqa %xmm0, %xmm5
851 ; SSE2-NEXT: pxor %xmm4, %xmm5
852 ; SSE2-NEXT: movdqa %xmm2, %xmm6
853 ; SSE2-NEXT: pxor %xmm4, %xmm6
854 ; SSE2-NEXT: movdqa %xmm6, %xmm7
855 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm7
856 ; SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
857 ; SSE2-NEXT: pcmpeqd %xmm5, %xmm6
858 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm6[1,1,3,3]
859 ; SSE2-NEXT: pand %xmm8, %xmm5
860 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
861 ; SSE2-NEXT: por %xmm5, %xmm6
862 ; SSE2-NEXT: pand %xmm6, %xmm0
863 ; SSE2-NEXT: pandn %xmm2, %xmm6
864 ; SSE2-NEXT: por %xmm6, %xmm0
865 ; SSE2-NEXT: movdqa %xmm1, %xmm2
866 ; SSE2-NEXT: pxor %xmm4, %xmm2
867 ; SSE2-NEXT: pxor %xmm3, %xmm4
868 ; SSE2-NEXT: movdqa %xmm4, %xmm5
869 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm5
870 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
871 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm4
872 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
873 ; SSE2-NEXT: pand %xmm6, %xmm2
874 ; SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm5[1,1,3,3]
875 ; SSE2-NEXT: por %xmm2, %xmm4
876 ; SSE2-NEXT: pand %xmm4, %xmm1
877 ; SSE2-NEXT: pandn %xmm3, %xmm4
878 ; SSE2-NEXT: por %xmm4, %xmm1
881 ; SSE41-LABEL: min_lt_v4i64:
883 ; SSE41-NEXT: movdqa %xmm0, %xmm4
884 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm5 = [2147483648,2147483648]
885 ; SSE41-NEXT: pxor %xmm5, %xmm0
886 ; SSE41-NEXT: movdqa %xmm2, %xmm6
887 ; SSE41-NEXT: pxor %xmm5, %xmm6
888 ; SSE41-NEXT: movdqa %xmm6, %xmm7
889 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm7
890 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm6
891 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm6[0,0,2,2]
892 ; SSE41-NEXT: pand %xmm7, %xmm0
893 ; SSE41-NEXT: por %xmm6, %xmm0
894 ; SSE41-NEXT: blendvpd %xmm0, %xmm4, %xmm2
895 ; SSE41-NEXT: movdqa %xmm1, %xmm0
896 ; SSE41-NEXT: pxor %xmm5, %xmm0
897 ; SSE41-NEXT: pxor %xmm3, %xmm5
898 ; SSE41-NEXT: movdqa %xmm5, %xmm4
899 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm4
900 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm5
901 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm5[0,0,2,2]
902 ; SSE41-NEXT: pand %xmm4, %xmm0
903 ; SSE41-NEXT: por %xmm5, %xmm0
904 ; SSE41-NEXT: blendvpd %xmm0, %xmm1, %xmm3
905 ; SSE41-NEXT: movapd %xmm2, %xmm0
906 ; SSE41-NEXT: movapd %xmm3, %xmm1
909 ; SSE42-LABEL: min_lt_v4i64:
911 ; SSE42-NEXT: movdqa %xmm0, %xmm4
912 ; SSE42-NEXT: movdqa %xmm2, %xmm0
913 ; SSE42-NEXT: pcmpgtq %xmm4, %xmm0
914 ; SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
915 ; SSE42-NEXT: movdqa %xmm3, %xmm0
916 ; SSE42-NEXT: pcmpgtq %xmm1, %xmm0
917 ; SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
918 ; SSE42-NEXT: movapd %xmm2, %xmm0
919 ; SSE42-NEXT: movapd %xmm3, %xmm1
922 ; AVX1-LABEL: min_lt_v4i64:
924 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
925 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
926 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm2
927 ; AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm3
928 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm3, %ymm2
929 ; AVX1-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
932 ; AVX2-LABEL: min_lt_v4i64:
934 ; AVX2-NEXT: vpcmpgtq %ymm0, %ymm1, %ymm2
935 ; AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
938 ; AVX512-LABEL: min_lt_v4i64:
940 ; AVX512-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
941 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
942 ; AVX512-NEXT: vpminsq %zmm1, %zmm0, %zmm0
943 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
945 %1 = icmp slt <4 x i64> %a, %b
946 %2 = select <4 x i1> %1, <4 x i64> %a, <4 x i64> %b
950 define <4 x i32> @min_lt_v4i32(<4 x i32> %a, <4 x i32> %b) {
951 ; SSE2-LABEL: min_lt_v4i32:
953 ; SSE2-NEXT: movdqa %xmm1, %xmm2
954 ; SSE2-NEXT: pcmpgtd %xmm0, %xmm2
955 ; SSE2-NEXT: pand %xmm2, %xmm0
956 ; SSE2-NEXT: pandn %xmm1, %xmm2
957 ; SSE2-NEXT: por %xmm2, %xmm0
960 ; SSE41-LABEL: min_lt_v4i32:
962 ; SSE41-NEXT: pminsd %xmm1, %xmm0
965 ; SSE42-LABEL: min_lt_v4i32:
967 ; SSE42-NEXT: pminsd %xmm1, %xmm0
970 ; AVX-LABEL: min_lt_v4i32:
972 ; AVX-NEXT: vpminsd %xmm1, %xmm0, %xmm0
974 %1 = icmp slt <4 x i32> %a, %b
975 %2 = select <4 x i1> %1, <4 x i32> %a, <4 x i32> %b
979 define <8 x i32> @min_lt_v8i32(<8 x i32> %a, <8 x i32> %b) {
980 ; SSE2-LABEL: min_lt_v8i32:
982 ; SSE2-NEXT: movdqa %xmm2, %xmm4
983 ; SSE2-NEXT: pcmpgtd %xmm0, %xmm4
984 ; SSE2-NEXT: pand %xmm4, %xmm0
985 ; SSE2-NEXT: pandn %xmm2, %xmm4
986 ; SSE2-NEXT: por %xmm4, %xmm0
987 ; SSE2-NEXT: movdqa %xmm3, %xmm2
988 ; SSE2-NEXT: pcmpgtd %xmm1, %xmm2
989 ; SSE2-NEXT: pand %xmm2, %xmm1
990 ; SSE2-NEXT: pandn %xmm3, %xmm2
991 ; SSE2-NEXT: por %xmm2, %xmm1
994 ; SSE41-LABEL: min_lt_v8i32:
996 ; SSE41-NEXT: pminsd %xmm2, %xmm0
997 ; SSE41-NEXT: pminsd %xmm3, %xmm1
1000 ; SSE42-LABEL: min_lt_v8i32:
1002 ; SSE42-NEXT: pminsd %xmm2, %xmm0
1003 ; SSE42-NEXT: pminsd %xmm3, %xmm1
1006 ; AVX1-LABEL: min_lt_v8i32:
1008 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1009 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1010 ; AVX1-NEXT: vpminsd %xmm2, %xmm3, %xmm2
1011 ; AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
1012 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1015 ; AVX2-LABEL: min_lt_v8i32:
1017 ; AVX2-NEXT: vpminsd %ymm1, %ymm0, %ymm0
1020 ; AVX512-LABEL: min_lt_v8i32:
1022 ; AVX512-NEXT: vpminsd %ymm1, %ymm0, %ymm0
1024 %1 = icmp slt <8 x i32> %a, %b
1025 %2 = select <8 x i1> %1, <8 x i32> %a, <8 x i32> %b
1029 define <8 x i16> @min_lt_v8i16(<8 x i16> %a, <8 x i16> %b) {
1030 ; SSE-LABEL: min_lt_v8i16:
1032 ; SSE-NEXT: pminsw %xmm1, %xmm0
1035 ; AVX-LABEL: min_lt_v8i16:
1037 ; AVX-NEXT: vpminsw %xmm1, %xmm0, %xmm0
1039 %1 = icmp slt <8 x i16> %a, %b
1040 %2 = select <8 x i1> %1, <8 x i16> %a, <8 x i16> %b
1044 define <16 x i16> @min_lt_v16i16(<16 x i16> %a, <16 x i16> %b) {
1045 ; SSE-LABEL: min_lt_v16i16:
1047 ; SSE-NEXT: pminsw %xmm2, %xmm0
1048 ; SSE-NEXT: pminsw %xmm3, %xmm1
1051 ; AVX1-LABEL: min_lt_v16i16:
1053 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1054 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1055 ; AVX1-NEXT: vpminsw %xmm2, %xmm3, %xmm2
1056 ; AVX1-NEXT: vpminsw %xmm1, %xmm0, %xmm0
1057 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1060 ; AVX2-LABEL: min_lt_v16i16:
1062 ; AVX2-NEXT: vpminsw %ymm1, %ymm0, %ymm0
1065 ; AVX512-LABEL: min_lt_v16i16:
1067 ; AVX512-NEXT: vpminsw %ymm1, %ymm0, %ymm0
1069 %1 = icmp slt <16 x i16> %a, %b
1070 %2 = select <16 x i1> %1, <16 x i16> %a, <16 x i16> %b
1074 define <16 x i8> @min_lt_v16i8(<16 x i8> %a, <16 x i8> %b) {
1075 ; SSE2-LABEL: min_lt_v16i8:
1077 ; SSE2-NEXT: movdqa %xmm1, %xmm2
1078 ; SSE2-NEXT: pcmpgtb %xmm0, %xmm2
1079 ; SSE2-NEXT: pand %xmm2, %xmm0
1080 ; SSE2-NEXT: pandn %xmm1, %xmm2
1081 ; SSE2-NEXT: por %xmm2, %xmm0
1084 ; SSE41-LABEL: min_lt_v16i8:
1086 ; SSE41-NEXT: pminsb %xmm1, %xmm0
1089 ; SSE42-LABEL: min_lt_v16i8:
1091 ; SSE42-NEXT: pminsb %xmm1, %xmm0
1094 ; AVX-LABEL: min_lt_v16i8:
1096 ; AVX-NEXT: vpminsb %xmm1, %xmm0, %xmm0
1098 %1 = icmp slt <16 x i8> %a, %b
1099 %2 = select <16 x i1> %1, <16 x i8> %a, <16 x i8> %b
1103 define <32 x i8> @min_lt_v32i8(<32 x i8> %a, <32 x i8> %b) {
1104 ; SSE2-LABEL: min_lt_v32i8:
1106 ; SSE2-NEXT: movdqa %xmm2, %xmm4
1107 ; SSE2-NEXT: pcmpgtb %xmm0, %xmm4
1108 ; SSE2-NEXT: pand %xmm4, %xmm0
1109 ; SSE2-NEXT: pandn %xmm2, %xmm4
1110 ; SSE2-NEXT: por %xmm4, %xmm0
1111 ; SSE2-NEXT: movdqa %xmm3, %xmm2
1112 ; SSE2-NEXT: pcmpgtb %xmm1, %xmm2
1113 ; SSE2-NEXT: pand %xmm2, %xmm1
1114 ; SSE2-NEXT: pandn %xmm3, %xmm2
1115 ; SSE2-NEXT: por %xmm2, %xmm1
1118 ; SSE41-LABEL: min_lt_v32i8:
1120 ; SSE41-NEXT: pminsb %xmm2, %xmm0
1121 ; SSE41-NEXT: pminsb %xmm3, %xmm1
1124 ; SSE42-LABEL: min_lt_v32i8:
1126 ; SSE42-NEXT: pminsb %xmm2, %xmm0
1127 ; SSE42-NEXT: pminsb %xmm3, %xmm1
1130 ; AVX1-LABEL: min_lt_v32i8:
1132 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1133 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1134 ; AVX1-NEXT: vpminsb %xmm2, %xmm3, %xmm2
1135 ; AVX1-NEXT: vpminsb %xmm1, %xmm0, %xmm0
1136 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1139 ; AVX2-LABEL: min_lt_v32i8:
1141 ; AVX2-NEXT: vpminsb %ymm1, %ymm0, %ymm0
1144 ; AVX512-LABEL: min_lt_v32i8:
1146 ; AVX512-NEXT: vpminsb %ymm1, %ymm0, %ymm0
1148 %1 = icmp slt <32 x i8> %a, %b
1149 %2 = select <32 x i1> %1, <32 x i8> %a, <32 x i8> %b
1154 ; Signed Minimum (LE)
1157 define <2 x i64> @min_le_v2i64(<2 x i64> %a, <2 x i64> %b) {
1158 ; SSE2-LABEL: min_le_v2i64:
1160 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648]
1161 ; SSE2-NEXT: movdqa %xmm0, %xmm3
1162 ; SSE2-NEXT: pxor %xmm2, %xmm3
1163 ; SSE2-NEXT: pxor %xmm1, %xmm2
1164 ; SSE2-NEXT: movdqa %xmm2, %xmm4
1165 ; SSE2-NEXT: pcmpgtd %xmm3, %xmm4
1166 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
1167 ; SSE2-NEXT: pcmpeqd %xmm3, %xmm2
1168 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
1169 ; SSE2-NEXT: pand %xmm5, %xmm2
1170 ; SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
1171 ; SSE2-NEXT: por %xmm2, %xmm3
1172 ; SSE2-NEXT: pand %xmm3, %xmm0
1173 ; SSE2-NEXT: pandn %xmm1, %xmm3
1174 ; SSE2-NEXT: por %xmm3, %xmm0
1177 ; SSE41-LABEL: min_le_v2i64:
1179 ; SSE41-NEXT: movdqa %xmm0, %xmm2
1180 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm3 = [2147483648,2147483648]
1181 ; SSE41-NEXT: pxor %xmm3, %xmm0
1182 ; SSE41-NEXT: pxor %xmm1, %xmm3
1183 ; SSE41-NEXT: movdqa %xmm3, %xmm4
1184 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm4
1185 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm3
1186 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm3[0,0,2,2]
1187 ; SSE41-NEXT: pand %xmm4, %xmm0
1188 ; SSE41-NEXT: por %xmm3, %xmm0
1189 ; SSE41-NEXT: blendvpd %xmm0, %xmm2, %xmm1
1190 ; SSE41-NEXT: movapd %xmm1, %xmm0
1193 ; SSE42-LABEL: min_le_v2i64:
1195 ; SSE42-NEXT: movdqa %xmm0, %xmm2
1196 ; SSE42-NEXT: movdqa %xmm1, %xmm0
1197 ; SSE42-NEXT: pcmpgtq %xmm2, %xmm0
1198 ; SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
1199 ; SSE42-NEXT: movapd %xmm1, %xmm0
1202 ; AVX1-LABEL: min_le_v2i64:
1204 ; AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
1205 ; AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
1208 ; AVX2-LABEL: min_le_v2i64:
1210 ; AVX2-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
1211 ; AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
1214 ; AVX512-LABEL: min_le_v2i64:
1216 ; AVX512-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1217 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1218 ; AVX512-NEXT: vpminsq %zmm1, %zmm0, %zmm0
1219 ; AVX512-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
1220 ; AVX512-NEXT: vzeroupper
1222 %1 = icmp sle <2 x i64> %a, %b
1223 %2 = select <2 x i1> %1, <2 x i64> %a, <2 x i64> %b
1227 define <4 x i64> @min_le_v4i64(<4 x i64> %a, <4 x i64> %b) {
1228 ; SSE2-LABEL: min_le_v4i64:
1230 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
1231 ; SSE2-NEXT: movdqa %xmm0, %xmm5
1232 ; SSE2-NEXT: pxor %xmm4, %xmm5
1233 ; SSE2-NEXT: movdqa %xmm2, %xmm6
1234 ; SSE2-NEXT: pxor %xmm4, %xmm6
1235 ; SSE2-NEXT: movdqa %xmm6, %xmm7
1236 ; SSE2-NEXT: pcmpgtd %xmm5, %xmm7
1237 ; SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
1238 ; SSE2-NEXT: pcmpeqd %xmm5, %xmm6
1239 ; SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm6[1,1,3,3]
1240 ; SSE2-NEXT: pand %xmm8, %xmm5
1241 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
1242 ; SSE2-NEXT: por %xmm5, %xmm6
1243 ; SSE2-NEXT: pand %xmm6, %xmm0
1244 ; SSE2-NEXT: pandn %xmm2, %xmm6
1245 ; SSE2-NEXT: por %xmm6, %xmm0
1246 ; SSE2-NEXT: movdqa %xmm1, %xmm2
1247 ; SSE2-NEXT: pxor %xmm4, %xmm2
1248 ; SSE2-NEXT: pxor %xmm3, %xmm4
1249 ; SSE2-NEXT: movdqa %xmm4, %xmm5
1250 ; SSE2-NEXT: pcmpgtd %xmm2, %xmm5
1251 ; SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
1252 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm4
1253 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
1254 ; SSE2-NEXT: pand %xmm6, %xmm2
1255 ; SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm5[1,1,3,3]
1256 ; SSE2-NEXT: por %xmm2, %xmm4
1257 ; SSE2-NEXT: pand %xmm4, %xmm1
1258 ; SSE2-NEXT: pandn %xmm3, %xmm4
1259 ; SSE2-NEXT: por %xmm4, %xmm1
1262 ; SSE41-LABEL: min_le_v4i64:
1264 ; SSE41-NEXT: movdqa %xmm0, %xmm4
1265 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm5 = [2147483648,2147483648]
1266 ; SSE41-NEXT: pxor %xmm5, %xmm0
1267 ; SSE41-NEXT: movdqa %xmm2, %xmm6
1268 ; SSE41-NEXT: pxor %xmm5, %xmm6
1269 ; SSE41-NEXT: movdqa %xmm6, %xmm7
1270 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm7
1271 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm6
1272 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm6[0,0,2,2]
1273 ; SSE41-NEXT: pand %xmm7, %xmm0
1274 ; SSE41-NEXT: por %xmm6, %xmm0
1275 ; SSE41-NEXT: blendvpd %xmm0, %xmm4, %xmm2
1276 ; SSE41-NEXT: movdqa %xmm1, %xmm0
1277 ; SSE41-NEXT: pxor %xmm5, %xmm0
1278 ; SSE41-NEXT: pxor %xmm3, %xmm5
1279 ; SSE41-NEXT: movdqa %xmm5, %xmm4
1280 ; SSE41-NEXT: pcmpeqd %xmm0, %xmm4
1281 ; SSE41-NEXT: pcmpgtd %xmm0, %xmm5
1282 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm5[0,0,2,2]
1283 ; SSE41-NEXT: pand %xmm4, %xmm0
1284 ; SSE41-NEXT: por %xmm5, %xmm0
1285 ; SSE41-NEXT: blendvpd %xmm0, %xmm1, %xmm3
1286 ; SSE41-NEXT: movapd %xmm2, %xmm0
1287 ; SSE41-NEXT: movapd %xmm3, %xmm1
1290 ; SSE42-LABEL: min_le_v4i64:
1292 ; SSE42-NEXT: movdqa %xmm0, %xmm4
1293 ; SSE42-NEXT: movdqa %xmm2, %xmm0
1294 ; SSE42-NEXT: pcmpgtq %xmm4, %xmm0
1295 ; SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
1296 ; SSE42-NEXT: movdqa %xmm3, %xmm0
1297 ; SSE42-NEXT: pcmpgtq %xmm1, %xmm0
1298 ; SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
1299 ; SSE42-NEXT: movapd %xmm2, %xmm0
1300 ; SSE42-NEXT: movapd %xmm3, %xmm1
1303 ; AVX1-LABEL: min_le_v4i64:
1305 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
1306 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
1307 ; AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm2
1308 ; AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm3
1309 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm3, %ymm2
1310 ; AVX1-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
1313 ; AVX2-LABEL: min_le_v4i64:
1315 ; AVX2-NEXT: vpcmpgtq %ymm0, %ymm1, %ymm2
1316 ; AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
1319 ; AVX512-LABEL: min_le_v4i64:
1321 ; AVX512-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1322 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1323 ; AVX512-NEXT: vpminsq %zmm1, %zmm0, %zmm0
1324 ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
1326 %1 = icmp sle <4 x i64> %a, %b
1327 %2 = select <4 x i1> %1, <4 x i64> %a, <4 x i64> %b
1331 define <4 x i32> @min_le_v4i32(<4 x i32> %a, <4 x i32> %b) {
1332 ; SSE2-LABEL: min_le_v4i32:
1334 ; SSE2-NEXT: movdqa %xmm1, %xmm2
1335 ; SSE2-NEXT: pcmpgtd %xmm0, %xmm2
1336 ; SSE2-NEXT: pand %xmm2, %xmm0
1337 ; SSE2-NEXT: pandn %xmm1, %xmm2
1338 ; SSE2-NEXT: por %xmm2, %xmm0
1341 ; SSE41-LABEL: min_le_v4i32:
1343 ; SSE41-NEXT: pminsd %xmm1, %xmm0
1346 ; SSE42-LABEL: min_le_v4i32:
1348 ; SSE42-NEXT: pminsd %xmm1, %xmm0
1351 ; AVX-LABEL: min_le_v4i32:
1353 ; AVX-NEXT: vpminsd %xmm1, %xmm0, %xmm0
1355 %1 = icmp sle <4 x i32> %a, %b
1356 %2 = select <4 x i1> %1, <4 x i32> %a, <4 x i32> %b
1360 define <8 x i32> @min_le_v8i32(<8 x i32> %a, <8 x i32> %b) {
1361 ; SSE2-LABEL: min_le_v8i32:
1363 ; SSE2-NEXT: movdqa %xmm2, %xmm4
1364 ; SSE2-NEXT: pcmpgtd %xmm0, %xmm4
1365 ; SSE2-NEXT: pand %xmm4, %xmm0
1366 ; SSE2-NEXT: pandn %xmm2, %xmm4
1367 ; SSE2-NEXT: por %xmm4, %xmm0
1368 ; SSE2-NEXT: movdqa %xmm3, %xmm2
1369 ; SSE2-NEXT: pcmpgtd %xmm1, %xmm2
1370 ; SSE2-NEXT: pand %xmm2, %xmm1
1371 ; SSE2-NEXT: pandn %xmm3, %xmm2
1372 ; SSE2-NEXT: por %xmm2, %xmm1
1375 ; SSE41-LABEL: min_le_v8i32:
1377 ; SSE41-NEXT: pminsd %xmm2, %xmm0
1378 ; SSE41-NEXT: pminsd %xmm3, %xmm1
1381 ; SSE42-LABEL: min_le_v8i32:
1383 ; SSE42-NEXT: pminsd %xmm2, %xmm0
1384 ; SSE42-NEXT: pminsd %xmm3, %xmm1
1387 ; AVX1-LABEL: min_le_v8i32:
1389 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1390 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1391 ; AVX1-NEXT: vpminsd %xmm2, %xmm3, %xmm2
1392 ; AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
1393 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1396 ; AVX2-LABEL: min_le_v8i32:
1398 ; AVX2-NEXT: vpminsd %ymm1, %ymm0, %ymm0
1401 ; AVX512-LABEL: min_le_v8i32:
1403 ; AVX512-NEXT: vpminsd %ymm1, %ymm0, %ymm0
1405 %1 = icmp sle <8 x i32> %a, %b
1406 %2 = select <8 x i1> %1, <8 x i32> %a, <8 x i32> %b
1410 define <8 x i16> @min_le_v8i16(<8 x i16> %a, <8 x i16> %b) {
1411 ; SSE-LABEL: min_le_v8i16:
1413 ; SSE-NEXT: pminsw %xmm1, %xmm0
1416 ; AVX-LABEL: min_le_v8i16:
1418 ; AVX-NEXT: vpminsw %xmm1, %xmm0, %xmm0
1420 %1 = icmp sle <8 x i16> %a, %b
1421 %2 = select <8 x i1> %1, <8 x i16> %a, <8 x i16> %b
1425 define <16 x i16> @min_le_v16i16(<16 x i16> %a, <16 x i16> %b) {
1426 ; SSE-LABEL: min_le_v16i16:
1428 ; SSE-NEXT: pminsw %xmm2, %xmm0
1429 ; SSE-NEXT: pminsw %xmm3, %xmm1
1432 ; AVX1-LABEL: min_le_v16i16:
1434 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1435 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1436 ; AVX1-NEXT: vpminsw %xmm2, %xmm3, %xmm2
1437 ; AVX1-NEXT: vpminsw %xmm1, %xmm0, %xmm0
1438 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1441 ; AVX2-LABEL: min_le_v16i16:
1443 ; AVX2-NEXT: vpminsw %ymm1, %ymm0, %ymm0
1446 ; AVX512-LABEL: min_le_v16i16:
1448 ; AVX512-NEXT: vpminsw %ymm1, %ymm0, %ymm0
1450 %1 = icmp sle <16 x i16> %a, %b
1451 %2 = select <16 x i1> %1, <16 x i16> %a, <16 x i16> %b
1455 define <16 x i8> @min_le_v16i8(<16 x i8> %a, <16 x i8> %b) {
1456 ; SSE2-LABEL: min_le_v16i8:
1458 ; SSE2-NEXT: movdqa %xmm1, %xmm2
1459 ; SSE2-NEXT: pcmpgtb %xmm0, %xmm2
1460 ; SSE2-NEXT: pand %xmm2, %xmm0
1461 ; SSE2-NEXT: pandn %xmm1, %xmm2
1462 ; SSE2-NEXT: por %xmm2, %xmm0
1465 ; SSE41-LABEL: min_le_v16i8:
1467 ; SSE41-NEXT: pminsb %xmm1, %xmm0
1470 ; SSE42-LABEL: min_le_v16i8:
1472 ; SSE42-NEXT: pminsb %xmm1, %xmm0
1475 ; AVX-LABEL: min_le_v16i8:
1477 ; AVX-NEXT: vpminsb %xmm1, %xmm0, %xmm0
1479 %1 = icmp sle <16 x i8> %a, %b
1480 %2 = select <16 x i1> %1, <16 x i8> %a, <16 x i8> %b
1484 define <32 x i8> @min_le_v32i8(<32 x i8> %a, <32 x i8> %b) {
1485 ; SSE2-LABEL: min_le_v32i8:
1487 ; SSE2-NEXT: movdqa %xmm2, %xmm4
1488 ; SSE2-NEXT: pcmpgtb %xmm0, %xmm4
1489 ; SSE2-NEXT: pand %xmm4, %xmm0
1490 ; SSE2-NEXT: pandn %xmm2, %xmm4
1491 ; SSE2-NEXT: por %xmm4, %xmm0
1492 ; SSE2-NEXT: movdqa %xmm3, %xmm2
1493 ; SSE2-NEXT: pcmpgtb %xmm1, %xmm2
1494 ; SSE2-NEXT: pand %xmm2, %xmm1
1495 ; SSE2-NEXT: pandn %xmm3, %xmm2
1496 ; SSE2-NEXT: por %xmm2, %xmm1
1499 ; SSE41-LABEL: min_le_v32i8:
1501 ; SSE41-NEXT: pminsb %xmm2, %xmm0
1502 ; SSE41-NEXT: pminsb %xmm3, %xmm1
1505 ; SSE42-LABEL: min_le_v32i8:
1507 ; SSE42-NEXT: pminsb %xmm2, %xmm0
1508 ; SSE42-NEXT: pminsb %xmm3, %xmm1
1511 ; AVX1-LABEL: min_le_v32i8:
1513 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1514 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1515 ; AVX1-NEXT: vpminsb %xmm2, %xmm3, %xmm2
1516 ; AVX1-NEXT: vpminsb %xmm1, %xmm0, %xmm0
1517 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1520 ; AVX2-LABEL: min_le_v32i8:
1522 ; AVX2-NEXT: vpminsb %ymm1, %ymm0, %ymm0
1525 ; AVX512-LABEL: min_le_v32i8:
1527 ; AVX512-NEXT: vpminsb %ymm1, %ymm0, %ymm0
1529 %1 = icmp sle <32 x i8> %a, %b
1530 %2 = select <32 x i1> %1, <32 x i8> %a, <32 x i8> %b
1538 define <2 x i64> @max_gt_v2i64c() {
1539 ; SSE-LABEL: max_gt_v2i64c:
1541 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551615,7]
1544 ; AVX-LABEL: max_gt_v2i64c:
1546 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [18446744073709551615,7]
1548 %1 = insertelement <2 x i64> <i64 -7, i64 7>, i64 -7, i32 0
1549 %2 = insertelement <2 x i64> <i64 -1, i64 1>, i64 -1, i32 0
1550 %3 = icmp sgt <2 x i64> %1, %2
1551 %4 = select <2 x i1> %3, <2 x i64> %1, <2 x i64> %2
1555 define <4 x i64> @max_gt_v4i64c() {
1556 ; SSE-LABEL: max_gt_v4i64c:
1558 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,7]
1559 ; SSE-NEXT: pcmpeqd %xmm0, %xmm0
1562 ; AVX-LABEL: max_gt_v4i64c:
1564 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [18446744073709551615,18446744073709551615,7,7]
1566 %1 = insertelement <4 x i64> <i64 -7, i64 -1, i64 1, i64 7>, i64 -7, i32 0
1567 %2 = insertelement <4 x i64> <i64 -1, i64 -7, i64 7, i64 1>, i64 -1, i32 0
1568 %3 = icmp sgt <4 x i64> %1, %2
1569 %4 = select <4 x i1> %3, <4 x i64> %1, <4 x i64> %2
1573 define <4 x i32> @max_gt_v4i32c() {
1574 ; SSE-LABEL: max_gt_v4i32c:
1576 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967295,4294967295,7,7]
1579 ; AVX-LABEL: max_gt_v4i32c:
1581 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [4294967295,4294967295,7,7]
1583 %1 = insertelement <4 x i32> <i32 -7, i32 -1, i32 1, i32 7>, i32 -7, i32 0
1584 %2 = insertelement <4 x i32> <i32 -1, i32 -7, i32 7, i32 1>, i32 -1, i32 0
1585 %3 = icmp sgt <4 x i32> %1, %2
1586 %4 = select <4 x i1> %3, <4 x i32> %1, <4 x i32> %2
1590 define <8 x i32> @max_gt_v8i32c() {
1591 ; SSE-LABEL: max_gt_v8i32c:
1593 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967295,4294967293,4294967293,4294967295]
1594 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,5,5,7]
1597 ; AVX-LABEL: max_gt_v8i32c:
1599 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [4294967295,4294967293,4294967293,4294967295,7,5,5,7]
1601 %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
1602 %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
1603 %3 = icmp sgt <8 x i32> %1, %2
1604 %4 = select <8 x i1> %3, <8 x i32> %1, <8 x i32> %2
1608 define <8 x i16> @max_gt_v8i16c() {
1609 ; SSE-LABEL: max_gt_v8i16c:
1611 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65535,65533,65533,65535,7,5,5,7]
1614 ; AVX-LABEL: max_gt_v8i16c:
1616 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [65535,65533,65533,65535,7,5,5,7]
1618 %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
1619 %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
1620 %3 = icmp sgt <8 x i16> %1, %2
1621 %4 = select <8 x i1> %3, <8 x i16> %1, <8 x i16> %2
1625 define <16 x i16> @max_gt_v16i16c() {
1626 ; SSE-LABEL: max_gt_v16i16c:
1628 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65535,65534,65533,65532,65533,65534,65535,0]
1629 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,6,5,4,5,6,7,8]
1632 ; AVX-LABEL: max_gt_v16i16c:
1634 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [65535,65534,65533,65532,65533,65534,65535,0,7,6,5,4,5,6,7,8]
1636 %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
1637 %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
1638 %3 = icmp sgt <16 x i16> %1, %2
1639 %4 = select <16 x i1> %3, <16 x i16> %1, <16 x i16> %2
1643 define <16 x i8> @max_gt_v16i8c() {
1644 ; SSE-LABEL: max_gt_v16i8c:
1646 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [255,254,253,252,253,254,255,0,7,6,5,4,5,6,7,8]
1649 ; AVX-LABEL: max_gt_v16i8c:
1651 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [255,254,253,252,253,254,255,0,7,6,5,4,5,6,7,8]
1653 %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
1654 %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
1655 %3 = icmp sgt <16 x i8> %1, %2
1656 %4 = select <16 x i1> %3, <16 x i8> %1, <16 x i8> %2
1660 define <2 x i64> @max_ge_v2i64c() {
1661 ; SSE-LABEL: max_ge_v2i64c:
1663 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551615,7]
1666 ; AVX-LABEL: max_ge_v2i64c:
1668 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [18446744073709551615,7]
1670 %1 = insertelement <2 x i64> <i64 -7, i64 7>, i64 -7, i32 0
1671 %2 = insertelement <2 x i64> <i64 -1, i64 1>, i64 -1, i32 0
1672 %3 = icmp sge <2 x i64> %1, %2
1673 %4 = select <2 x i1> %3, <2 x i64> %1, <2 x i64> %2
1677 define <4 x i64> @max_ge_v4i64c() {
1678 ; SSE-LABEL: max_ge_v4i64c:
1680 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,7]
1681 ; SSE-NEXT: pcmpeqd %xmm0, %xmm0
1684 ; AVX-LABEL: max_ge_v4i64c:
1686 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [18446744073709551615,18446744073709551615,7,7]
1688 %1 = insertelement <4 x i64> <i64 -7, i64 -1, i64 1, i64 7>, i64 -7, i32 0
1689 %2 = insertelement <4 x i64> <i64 -1, i64 -7, i64 7, i64 1>, i64 -1, i32 0
1690 %3 = icmp sge <4 x i64> %1, %2
1691 %4 = select <4 x i1> %3, <4 x i64> %1, <4 x i64> %2
1695 define <4 x i32> @max_ge_v4i32c() {
1696 ; SSE-LABEL: max_ge_v4i32c:
1698 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967295,4294967295,7,7]
1701 ; AVX-LABEL: max_ge_v4i32c:
1703 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [4294967295,4294967295,7,7]
1705 %1 = insertelement <4 x i32> <i32 -7, i32 -1, i32 1, i32 7>, i32 -7, i32 0
1706 %2 = insertelement <4 x i32> <i32 -1, i32 -7, i32 7, i32 1>, i32 -1, i32 0
1707 %3 = icmp sge <4 x i32> %1, %2
1708 %4 = select <4 x i1> %3, <4 x i32> %1, <4 x i32> %2
1712 define <8 x i32> @max_ge_v8i32c() {
1713 ; SSE-LABEL: max_ge_v8i32c:
1715 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967295,4294967293,4294967293,4294967295]
1716 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,5,5,7]
1719 ; AVX-LABEL: max_ge_v8i32c:
1721 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [4294967295,4294967293,4294967293,4294967295,7,5,5,7]
1723 %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
1724 %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
1725 %3 = icmp sge <8 x i32> %1, %2
1726 %4 = select <8 x i1> %3, <8 x i32> %1, <8 x i32> %2
1730 define <8 x i16> @max_ge_v8i16c() {
1731 ; SSE-LABEL: max_ge_v8i16c:
1733 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65535,65533,65533,65535,7,5,5,7]
1736 ; AVX-LABEL: max_ge_v8i16c:
1738 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [65535,65533,65533,65535,7,5,5,7]
1740 %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
1741 %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
1742 %3 = icmp sge <8 x i16> %1, %2
1743 %4 = select <8 x i1> %3, <8 x i16> %1, <8 x i16> %2
1747 define <16 x i16> @max_ge_v16i16c() {
1748 ; SSE-LABEL: max_ge_v16i16c:
1750 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65535,65534,65533,65532,65533,65534,65535,0]
1751 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [7,6,5,4,5,6,7,8]
1754 ; AVX-LABEL: max_ge_v16i16c:
1756 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [65535,65534,65533,65532,65533,65534,65535,0,7,6,5,4,5,6,7,8]
1758 %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
1759 %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
1760 %3 = icmp sge <16 x i16> %1, %2
1761 %4 = select <16 x i1> %3, <16 x i16> %1, <16 x i16> %2
1765 define <16 x i8> @max_ge_v16i8c() {
1766 ; SSE-LABEL: max_ge_v16i8c:
1768 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [255,254,253,252,253,254,255,0,7,6,5,4,5,6,7,8]
1771 ; AVX-LABEL: max_ge_v16i8c:
1773 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [255,254,253,252,253,254,255,0,7,6,5,4,5,6,7,8]
1775 %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
1776 %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
1777 %3 = icmp sge <16 x i8> %1, %2
1778 %4 = select <16 x i1> %3, <16 x i8> %1, <16 x i8> %2
1782 define <2 x i64> @min_lt_v2i64c() {
1783 ; SSE-LABEL: min_lt_v2i64c:
1785 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551609,1]
1788 ; AVX-LABEL: min_lt_v2i64c:
1790 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [18446744073709551609,1]
1792 %1 = insertelement <2 x i64> <i64 -7, i64 7>, i64 -7, i32 0
1793 %2 = insertelement <2 x i64> <i64 -1, i64 1>, i64 -1, i32 0
1794 %3 = icmp slt <2 x i64> %1, %2
1795 %4 = select <2 x i1> %3, <2 x i64> %1, <2 x i64> %2
1799 define <4 x i64> @min_lt_v4i64c() {
1800 ; SSE-LABEL: min_lt_v4i64c:
1802 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551609,18446744073709551609]
1803 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,1]
1806 ; AVX-LABEL: min_lt_v4i64c:
1808 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [18446744073709551609,18446744073709551609,1,1]
1810 %1 = insertelement <4 x i64> <i64 -7, i64 -1, i64 1, i64 7>, i64 -7, i32 0
1811 %2 = insertelement <4 x i64> <i64 -1, i64 -7, i64 7, i64 1>, i64 -1, i32 0
1812 %3 = icmp slt <4 x i64> %1, %2
1813 %4 = select <4 x i1> %3, <4 x i64> %1, <4 x i64> %2
1817 define <4 x i32> @min_lt_v4i32c() {
1818 ; SSE-LABEL: min_lt_v4i32c:
1820 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967289,4294967289,1,1]
1823 ; AVX-LABEL: min_lt_v4i32c:
1825 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [4294967289,4294967289,1,1]
1827 %1 = insertelement <4 x i32> <i32 -7, i32 -1, i32 1, i32 7>, i32 -7, i32 0
1828 %2 = insertelement <4 x i32> <i32 -1, i32 -7, i32 7, i32 1>, i32 -1, i32 0
1829 %3 = icmp slt <4 x i32> %1, %2
1830 %4 = select <4 x i1> %3, <4 x i32> %1, <4 x i32> %2
1834 define <8 x i32> @min_lt_v8i32c() {
1835 ; SSE-LABEL: min_lt_v8i32c:
1837 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967289,4294967291,4294967291,4294967289]
1838 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,3,3,1]
1841 ; AVX-LABEL: min_lt_v8i32c:
1843 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [4294967289,4294967291,4294967291,4294967289,1,3,3,1]
1845 %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
1846 %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
1847 %3 = icmp slt <8 x i32> %1, %2
1848 %4 = select <8 x i1> %3, <8 x i32> %1, <8 x i32> %2
1852 define <8 x i16> @min_lt_v8i16c() {
1853 ; SSE-LABEL: min_lt_v8i16c:
1855 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65529,65531,65531,65529,1,3,3,1]
1858 ; AVX-LABEL: min_lt_v8i16c:
1860 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [65529,65531,65531,65529,1,3,3,1]
1862 %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
1863 %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
1864 %3 = icmp slt <8 x i16> %1, %2
1865 %4 = select <8 x i1> %3, <8 x i16> %1, <8 x i16> %2
1869 define <16 x i16> @min_lt_v16i16c() {
1870 ; SSE-LABEL: min_lt_v16i16c:
1872 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65529,65530,65531,65532,65531,65530,65529,0]
1873 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,2,3,4,3,2,1,0]
1876 ; AVX-LABEL: min_lt_v16i16c:
1878 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [65529,65530,65531,65532,65531,65530,65529,0,1,2,3,4,3,2,1,0]
1880 %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
1881 %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
1882 %3 = icmp slt <16 x i16> %1, %2
1883 %4 = select <16 x i1> %3, <16 x i16> %1, <16 x i16> %2
1887 define <16 x i8> @min_lt_v16i8c() {
1888 ; SSE-LABEL: min_lt_v16i8c:
1890 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [249,250,251,252,251,250,249,0,1,2,3,4,3,2,1,0]
1893 ; AVX-LABEL: min_lt_v16i8c:
1895 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [249,250,251,252,251,250,249,0,1,2,3,4,3,2,1,0]
1897 %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
1898 %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
1899 %3 = icmp slt <16 x i8> %1, %2
1900 %4 = select <16 x i1> %3, <16 x i8> %1, <16 x i8> %2
1904 define <2 x i64> @min_le_v2i64c() {
1905 ; SSE-LABEL: min_le_v2i64c:
1907 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551609,1]
1910 ; AVX-LABEL: min_le_v2i64c:
1912 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [18446744073709551609,1]
1914 %1 = insertelement <2 x i64> <i64 -7, i64 7>, i64 -7, i32 0
1915 %2 = insertelement <2 x i64> <i64 -1, i64 1>, i64 -1, i32 0
1916 %3 = icmp sle <2 x i64> %1, %2
1917 %4 = select <2 x i1> %3, <2 x i64> %1, <2 x i64> %2
1921 define <4 x i64> @min_le_v4i64c() {
1922 ; SSE-LABEL: min_le_v4i64c:
1924 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [18446744073709551609,18446744073709551609]
1925 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,1]
1928 ; AVX-LABEL: min_le_v4i64c:
1930 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [18446744073709551609,18446744073709551609,1,1]
1932 %1 = insertelement <4 x i64> <i64 -7, i64 -1, i64 1, i64 7>, i64 -7, i32 0
1933 %2 = insertelement <4 x i64> <i64 -1, i64 -7, i64 7, i64 1>, i64 -1, i32 0
1934 %3 = icmp sle <4 x i64> %1, %2
1935 %4 = select <4 x i1> %3, <4 x i64> %1, <4 x i64> %2
1939 define <4 x i32> @min_le_v4i32c() {
1940 ; SSE-LABEL: min_le_v4i32c:
1942 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967289,4294967289,1,1]
1945 ; AVX-LABEL: min_le_v4i32c:
1947 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [4294967289,4294967289,1,1]
1949 %1 = insertelement <4 x i32> <i32 -7, i32 -1, i32 1, i32 7>, i32 -7, i32 0
1950 %2 = insertelement <4 x i32> <i32 -1, i32 -7, i32 7, i32 1>, i32 -1, i32 0
1951 %3 = icmp sle <4 x i32> %1, %2
1952 %4 = select <4 x i1> %3, <4 x i32> %1, <4 x i32> %2
1956 define <8 x i32> @min_le_v8i32c() {
1957 ; SSE-LABEL: min_le_v8i32c:
1959 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [4294967289,4294967291,4294967291,4294967289]
1960 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,3,3,1]
1963 ; AVX-LABEL: min_le_v8i32c:
1965 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [4294967289,4294967291,4294967291,4294967289,1,3,3,1]
1967 %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
1968 %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
1969 %3 = icmp sle <8 x i32> %1, %2
1970 %4 = select <8 x i1> %3, <8 x i32> %1, <8 x i32> %2
1974 define <8 x i16> @min_le_v8i16c() {
1975 ; SSE-LABEL: min_le_v8i16c:
1977 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65529,65531,65531,65529,1,3,3,1]
1980 ; AVX-LABEL: min_le_v8i16c:
1982 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [65529,65531,65531,65529,1,3,3,1]
1984 %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
1985 %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
1986 %3 = icmp sle <8 x i16> %1, %2
1987 %4 = select <8 x i1> %3, <8 x i16> %1, <8 x i16> %2
1991 define <16 x i16> @min_le_v16i16c() {
1992 ; SSE-LABEL: min_le_v16i16c:
1994 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [65529,65530,65531,65532,65531,65530,65529,0]
1995 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [1,2,3,4,3,2,1,0]
1998 ; AVX-LABEL: min_le_v16i16c:
2000 ; AVX-NEXT: vmovaps {{.*#+}} ymm0 = [65529,65530,65531,65532,65531,65530,65529,0,1,2,3,4,3,2,1,0]
2002 %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
2003 %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
2004 %3 = icmp sle <16 x i16> %1, %2
2005 %4 = select <16 x i1> %3, <16 x i16> %1, <16 x i16> %2
2009 define <16 x i8> @min_le_v16i8c() {
2010 ; SSE-LABEL: min_le_v16i8c:
2012 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [249,250,251,252,251,250,249,0,1,2,3,4,3,2,1,0]
2015 ; AVX-LABEL: min_le_v16i8c:
2017 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [249,250,251,252,251,250,249,0,1,2,3,4,3,2,1,0]
2019 %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
2020 %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
2021 %3 = icmp sle <16 x i8> %1, %2
2022 %4 = select <16 x i1> %3, <16 x i8> %1, <16 x i8> %2