1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -verify-machineinstrs -O0 | FileCheck %s --check-prefix=SSE
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -verify-machineinstrs -O0 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=SSE
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -verify-machineinstrs -mattr=avx | FileCheck %s --check-prefix=AVX
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -verify-machineinstrs -fast-isel -fast-isel-abort=1 -mattr=avx | FileCheck %s --check-prefix=AVX
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -verify-machineinstrs -mattr=avx512f | FileCheck %s --check-prefix=AVX512
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -verify-machineinstrs -fast-isel -fast-isel-abort=1 -mattr=avx512f | FileCheck %s --check-prefix=AVX512
9 ; Test all cmp predicates that can be used with SSE.
11 define float @select_fcmp_oeq_f32(float %a, float %b, float %c, float %d) {
12 ; SSE-LABEL: select_fcmp_oeq_f32:
14 ; SSE-NEXT: cmpeqss %xmm1, %xmm0
15 ; SSE-NEXT: movaps %xmm0, %xmm1
16 ; SSE-NEXT: andps %xmm2, %xmm1
17 ; SSE-NEXT: andnps %xmm3, %xmm0
18 ; SSE-NEXT: orps %xmm1, %xmm0
21 ; AVX-LABEL: select_fcmp_oeq_f32:
23 ; AVX-NEXT: vcmpeqss %xmm1, %xmm0, %xmm0
24 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
27 ; AVX512-LABEL: select_fcmp_oeq_f32:
29 ; AVX512-NEXT: vcmpeqss %xmm1, %xmm0, %k1
30 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
31 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
33 %1 = fcmp oeq float %a, %b
34 %2 = select i1 %1, float %c, float %d
38 define double @select_fcmp_oeq_f64(double %a, double %b, double %c, double %d) {
39 ; SSE-LABEL: select_fcmp_oeq_f64:
41 ; SSE-NEXT: cmpeqsd %xmm1, %xmm0
42 ; SSE-NEXT: movaps %xmm0, %xmm1
43 ; SSE-NEXT: andpd %xmm2, %xmm1
44 ; SSE-NEXT: andnpd %xmm3, %xmm0
45 ; SSE-NEXT: orpd %xmm1, %xmm0
48 ; AVX-LABEL: select_fcmp_oeq_f64:
50 ; AVX-NEXT: vcmpeqsd %xmm1, %xmm0, %xmm0
51 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
54 ; AVX512-LABEL: select_fcmp_oeq_f64:
56 ; AVX512-NEXT: vcmpeqsd %xmm1, %xmm0, %k1
57 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
58 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
60 %1 = fcmp oeq double %a, %b
61 %2 = select i1 %1, double %c, double %d
65 define float @select_fcmp_ogt_f32(float %a, float %b, float %c, float %d) {
66 ; SSE-LABEL: select_fcmp_ogt_f32:
68 ; SSE-NEXT: movss %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
69 ; SSE-NEXT: movaps %xmm0, %xmm1
70 ; SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
71 ; SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
72 ; SSE-NEXT: cmpltss %xmm1, %xmm0
73 ; SSE-NEXT: movaps %xmm0, %xmm1
74 ; SSE-NEXT: andps %xmm2, %xmm1
75 ; SSE-NEXT: andnps %xmm3, %xmm0
76 ; SSE-NEXT: orps %xmm1, %xmm0
79 ; AVX-LABEL: select_fcmp_ogt_f32:
81 ; AVX-NEXT: vcmpltss %xmm0, %xmm1, %xmm0
82 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
85 ; AVX512-LABEL: select_fcmp_ogt_f32:
87 ; AVX512-NEXT: vcmpltss %xmm0, %xmm1, %k1
88 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
89 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
91 %1 = fcmp ogt float %a, %b
92 %2 = select i1 %1, float %c, float %d
96 define double @select_fcmp_ogt_f64(double %a, double %b, double %c, double %d) {
97 ; SSE-LABEL: select_fcmp_ogt_f64:
99 ; SSE-NEXT: movsd %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
100 ; SSE-NEXT: movaps %xmm0, %xmm1
101 ; SSE-NEXT: movsd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 8-byte Reload
102 ; SSE-NEXT: # xmm0 = mem[0],zero
103 ; SSE-NEXT: cmpltsd %xmm1, %xmm0
104 ; SSE-NEXT: movaps %xmm0, %xmm1
105 ; SSE-NEXT: andpd %xmm2, %xmm1
106 ; SSE-NEXT: andnpd %xmm3, %xmm0
107 ; SSE-NEXT: orpd %xmm1, %xmm0
110 ; AVX-LABEL: select_fcmp_ogt_f64:
112 ; AVX-NEXT: vcmpltsd %xmm0, %xmm1, %xmm0
113 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
116 ; AVX512-LABEL: select_fcmp_ogt_f64:
118 ; AVX512-NEXT: vcmpltsd %xmm0, %xmm1, %k1
119 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
120 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
122 %1 = fcmp ogt double %a, %b
123 %2 = select i1 %1, double %c, double %d
127 define float @select_fcmp_oge_f32(float %a, float %b, float %c, float %d) {
128 ; SSE-LABEL: select_fcmp_oge_f32:
130 ; SSE-NEXT: movss %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
131 ; SSE-NEXT: movaps %xmm0, %xmm1
132 ; SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
133 ; SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
134 ; SSE-NEXT: cmpless %xmm1, %xmm0
135 ; SSE-NEXT: movaps %xmm0, %xmm1
136 ; SSE-NEXT: andps %xmm2, %xmm1
137 ; SSE-NEXT: andnps %xmm3, %xmm0
138 ; SSE-NEXT: orps %xmm1, %xmm0
141 ; AVX-LABEL: select_fcmp_oge_f32:
143 ; AVX-NEXT: vcmpless %xmm0, %xmm1, %xmm0
144 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
147 ; AVX512-LABEL: select_fcmp_oge_f32:
149 ; AVX512-NEXT: vcmpless %xmm0, %xmm1, %k1
150 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
151 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
153 %1 = fcmp oge float %a, %b
154 %2 = select i1 %1, float %c, float %d
158 define double @select_fcmp_oge_f64(double %a, double %b, double %c, double %d) {
159 ; SSE-LABEL: select_fcmp_oge_f64:
161 ; SSE-NEXT: movsd %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
162 ; SSE-NEXT: movaps %xmm0, %xmm1
163 ; SSE-NEXT: movsd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 8-byte Reload
164 ; SSE-NEXT: # xmm0 = mem[0],zero
165 ; SSE-NEXT: cmplesd %xmm1, %xmm0
166 ; SSE-NEXT: movaps %xmm0, %xmm1
167 ; SSE-NEXT: andpd %xmm2, %xmm1
168 ; SSE-NEXT: andnpd %xmm3, %xmm0
169 ; SSE-NEXT: orpd %xmm1, %xmm0
172 ; AVX-LABEL: select_fcmp_oge_f64:
174 ; AVX-NEXT: vcmplesd %xmm0, %xmm1, %xmm0
175 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
178 ; AVX512-LABEL: select_fcmp_oge_f64:
180 ; AVX512-NEXT: vcmplesd %xmm0, %xmm1, %k1
181 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
182 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
184 %1 = fcmp oge double %a, %b
185 %2 = select i1 %1, double %c, double %d
189 define float @select_fcmp_olt_f32(float %a, float %b, float %c, float %d) {
190 ; SSE-LABEL: select_fcmp_olt_f32:
192 ; SSE-NEXT: cmpltss %xmm1, %xmm0
193 ; SSE-NEXT: movaps %xmm0, %xmm1
194 ; SSE-NEXT: andps %xmm2, %xmm1
195 ; SSE-NEXT: andnps %xmm3, %xmm0
196 ; SSE-NEXT: orps %xmm1, %xmm0
199 ; AVX-LABEL: select_fcmp_olt_f32:
201 ; AVX-NEXT: vcmpltss %xmm1, %xmm0, %xmm0
202 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
205 ; AVX512-LABEL: select_fcmp_olt_f32:
207 ; AVX512-NEXT: vcmpltss %xmm1, %xmm0, %k1
208 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
209 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
211 %1 = fcmp olt float %a, %b
212 %2 = select i1 %1, float %c, float %d
216 define double @select_fcmp_olt_f64(double %a, double %b, double %c, double %d) {
217 ; SSE-LABEL: select_fcmp_olt_f64:
219 ; SSE-NEXT: cmpltsd %xmm1, %xmm0
220 ; SSE-NEXT: movaps %xmm0, %xmm1
221 ; SSE-NEXT: andpd %xmm2, %xmm1
222 ; SSE-NEXT: andnpd %xmm3, %xmm0
223 ; SSE-NEXT: orpd %xmm1, %xmm0
226 ; AVX-LABEL: select_fcmp_olt_f64:
228 ; AVX-NEXT: vcmpltsd %xmm1, %xmm0, %xmm0
229 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
232 ; AVX512-LABEL: select_fcmp_olt_f64:
234 ; AVX512-NEXT: vcmpltsd %xmm1, %xmm0, %k1
235 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
236 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
238 %1 = fcmp olt double %a, %b
239 %2 = select i1 %1, double %c, double %d
243 define float @select_fcmp_ole_f32(float %a, float %b, float %c, float %d) {
244 ; SSE-LABEL: select_fcmp_ole_f32:
246 ; SSE-NEXT: cmpless %xmm1, %xmm0
247 ; SSE-NEXT: movaps %xmm0, %xmm1
248 ; SSE-NEXT: andps %xmm2, %xmm1
249 ; SSE-NEXT: andnps %xmm3, %xmm0
250 ; SSE-NEXT: orps %xmm1, %xmm0
253 ; AVX-LABEL: select_fcmp_ole_f32:
255 ; AVX-NEXT: vcmpless %xmm1, %xmm0, %xmm0
256 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
259 ; AVX512-LABEL: select_fcmp_ole_f32:
261 ; AVX512-NEXT: vcmpless %xmm1, %xmm0, %k1
262 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
263 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
265 %1 = fcmp ole float %a, %b
266 %2 = select i1 %1, float %c, float %d
270 define double @select_fcmp_ole_f64(double %a, double %b, double %c, double %d) {
271 ; SSE-LABEL: select_fcmp_ole_f64:
273 ; SSE-NEXT: cmplesd %xmm1, %xmm0
274 ; SSE-NEXT: movaps %xmm0, %xmm1
275 ; SSE-NEXT: andpd %xmm2, %xmm1
276 ; SSE-NEXT: andnpd %xmm3, %xmm0
277 ; SSE-NEXT: orpd %xmm1, %xmm0
280 ; AVX-LABEL: select_fcmp_ole_f64:
282 ; AVX-NEXT: vcmplesd %xmm1, %xmm0, %xmm0
283 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
286 ; AVX512-LABEL: select_fcmp_ole_f64:
288 ; AVX512-NEXT: vcmplesd %xmm1, %xmm0, %k1
289 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
290 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
292 %1 = fcmp ole double %a, %b
293 %2 = select i1 %1, double %c, double %d
297 define float @select_fcmp_ord_f32(float %a, float %b, float %c, float %d) {
298 ; SSE-LABEL: select_fcmp_ord_f32:
300 ; SSE-NEXT: cmpordss %xmm1, %xmm0
301 ; SSE-NEXT: movaps %xmm0, %xmm1
302 ; SSE-NEXT: andps %xmm2, %xmm1
303 ; SSE-NEXT: andnps %xmm3, %xmm0
304 ; SSE-NEXT: orps %xmm1, %xmm0
307 ; AVX-LABEL: select_fcmp_ord_f32:
309 ; AVX-NEXT: vcmpordss %xmm1, %xmm0, %xmm0
310 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
313 ; AVX512-LABEL: select_fcmp_ord_f32:
315 ; AVX512-NEXT: vcmpordss %xmm1, %xmm0, %k1
316 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
317 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
319 %1 = fcmp ord float %a, %b
320 %2 = select i1 %1, float %c, float %d
324 define double @select_fcmp_ord_f64(double %a, double %b, double %c, double %d) {
325 ; SSE-LABEL: select_fcmp_ord_f64:
327 ; SSE-NEXT: cmpordsd %xmm1, %xmm0
328 ; SSE-NEXT: movaps %xmm0, %xmm1
329 ; SSE-NEXT: andpd %xmm2, %xmm1
330 ; SSE-NEXT: andnpd %xmm3, %xmm0
331 ; SSE-NEXT: orpd %xmm1, %xmm0
334 ; AVX-LABEL: select_fcmp_ord_f64:
336 ; AVX-NEXT: vcmpordsd %xmm1, %xmm0, %xmm0
337 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
340 ; AVX512-LABEL: select_fcmp_ord_f64:
342 ; AVX512-NEXT: vcmpordsd %xmm1, %xmm0, %k1
343 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
344 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
346 %1 = fcmp ord double %a, %b
347 %2 = select i1 %1, double %c, double %d
351 define float @select_fcmp_uno_f32(float %a, float %b, float %c, float %d) {
352 ; SSE-LABEL: select_fcmp_uno_f32:
354 ; SSE-NEXT: cmpunordss %xmm1, %xmm0
355 ; SSE-NEXT: movaps %xmm0, %xmm1
356 ; SSE-NEXT: andps %xmm2, %xmm1
357 ; SSE-NEXT: andnps %xmm3, %xmm0
358 ; SSE-NEXT: orps %xmm1, %xmm0
361 ; AVX-LABEL: select_fcmp_uno_f32:
363 ; AVX-NEXT: vcmpunordss %xmm1, %xmm0, %xmm0
364 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
367 ; AVX512-LABEL: select_fcmp_uno_f32:
369 ; AVX512-NEXT: vcmpunordss %xmm1, %xmm0, %k1
370 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
371 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
373 %1 = fcmp uno float %a, %b
374 %2 = select i1 %1, float %c, float %d
378 define double @select_fcmp_uno_f64(double %a, double %b, double %c, double %d) {
379 ; SSE-LABEL: select_fcmp_uno_f64:
381 ; SSE-NEXT: cmpunordsd %xmm1, %xmm0
382 ; SSE-NEXT: movaps %xmm0, %xmm1
383 ; SSE-NEXT: andpd %xmm2, %xmm1
384 ; SSE-NEXT: andnpd %xmm3, %xmm0
385 ; SSE-NEXT: orpd %xmm1, %xmm0
388 ; AVX-LABEL: select_fcmp_uno_f64:
390 ; AVX-NEXT: vcmpunordsd %xmm1, %xmm0, %xmm0
391 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
394 ; AVX512-LABEL: select_fcmp_uno_f64:
396 ; AVX512-NEXT: vcmpunordsd %xmm1, %xmm0, %k1
397 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
398 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
400 %1 = fcmp uno double %a, %b
401 %2 = select i1 %1, double %c, double %d
405 define float @select_fcmp_ugt_f32(float %a, float %b, float %c, float %d) {
406 ; SSE-LABEL: select_fcmp_ugt_f32:
408 ; SSE-NEXT: cmpnless %xmm1, %xmm0
409 ; SSE-NEXT: movaps %xmm0, %xmm1
410 ; SSE-NEXT: andps %xmm2, %xmm1
411 ; SSE-NEXT: andnps %xmm3, %xmm0
412 ; SSE-NEXT: orps %xmm1, %xmm0
415 ; AVX-LABEL: select_fcmp_ugt_f32:
417 ; AVX-NEXT: vcmpnless %xmm1, %xmm0, %xmm0
418 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
421 ; AVX512-LABEL: select_fcmp_ugt_f32:
423 ; AVX512-NEXT: vcmpnless %xmm1, %xmm0, %k1
424 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
425 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
427 %1 = fcmp ugt float %a, %b
428 %2 = select i1 %1, float %c, float %d
432 define double @select_fcmp_ugt_f64(double %a, double %b, double %c, double %d) {
433 ; SSE-LABEL: select_fcmp_ugt_f64:
435 ; SSE-NEXT: cmpnlesd %xmm1, %xmm0
436 ; SSE-NEXT: movaps %xmm0, %xmm1
437 ; SSE-NEXT: andpd %xmm2, %xmm1
438 ; SSE-NEXT: andnpd %xmm3, %xmm0
439 ; SSE-NEXT: orpd %xmm1, %xmm0
442 ; AVX-LABEL: select_fcmp_ugt_f64:
444 ; AVX-NEXT: vcmpnlesd %xmm1, %xmm0, %xmm0
445 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
448 ; AVX512-LABEL: select_fcmp_ugt_f64:
450 ; AVX512-NEXT: vcmpnlesd %xmm1, %xmm0, %k1
451 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
452 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
454 %1 = fcmp ugt double %a, %b
455 %2 = select i1 %1, double %c, double %d
459 define float @select_fcmp_uge_f32(float %a, float %b, float %c, float %d) {
460 ; SSE-LABEL: select_fcmp_uge_f32:
462 ; SSE-NEXT: cmpnltss %xmm1, %xmm0
463 ; SSE-NEXT: movaps %xmm0, %xmm1
464 ; SSE-NEXT: andps %xmm2, %xmm1
465 ; SSE-NEXT: andnps %xmm3, %xmm0
466 ; SSE-NEXT: orps %xmm1, %xmm0
469 ; AVX-LABEL: select_fcmp_uge_f32:
471 ; AVX-NEXT: vcmpnltss %xmm1, %xmm0, %xmm0
472 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
475 ; AVX512-LABEL: select_fcmp_uge_f32:
477 ; AVX512-NEXT: vcmpnltss %xmm1, %xmm0, %k1
478 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
479 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
481 %1 = fcmp uge float %a, %b
482 %2 = select i1 %1, float %c, float %d
486 define double @select_fcmp_uge_f64(double %a, double %b, double %c, double %d) {
487 ; SSE-LABEL: select_fcmp_uge_f64:
489 ; SSE-NEXT: cmpnltsd %xmm1, %xmm0
490 ; SSE-NEXT: movaps %xmm0, %xmm1
491 ; SSE-NEXT: andpd %xmm2, %xmm1
492 ; SSE-NEXT: andnpd %xmm3, %xmm0
493 ; SSE-NEXT: orpd %xmm1, %xmm0
496 ; AVX-LABEL: select_fcmp_uge_f64:
498 ; AVX-NEXT: vcmpnltsd %xmm1, %xmm0, %xmm0
499 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
502 ; AVX512-LABEL: select_fcmp_uge_f64:
504 ; AVX512-NEXT: vcmpnltsd %xmm1, %xmm0, %k1
505 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
506 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
508 %1 = fcmp uge double %a, %b
509 %2 = select i1 %1, double %c, double %d
513 define float @select_fcmp_ult_f32(float %a, float %b, float %c, float %d) {
514 ; SSE-LABEL: select_fcmp_ult_f32:
516 ; SSE-NEXT: movss %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
517 ; SSE-NEXT: movaps %xmm0, %xmm1
518 ; SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
519 ; SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
520 ; SSE-NEXT: cmpnless %xmm1, %xmm0
521 ; SSE-NEXT: movaps %xmm0, %xmm1
522 ; SSE-NEXT: andps %xmm2, %xmm1
523 ; SSE-NEXT: andnps %xmm3, %xmm0
524 ; SSE-NEXT: orps %xmm1, %xmm0
527 ; AVX-LABEL: select_fcmp_ult_f32:
529 ; AVX-NEXT: vcmpnless %xmm0, %xmm1, %xmm0
530 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
533 ; AVX512-LABEL: select_fcmp_ult_f32:
535 ; AVX512-NEXT: vcmpnless %xmm0, %xmm1, %k1
536 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
537 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
539 %1 = fcmp ult float %a, %b
540 %2 = select i1 %1, float %c, float %d
544 define double @select_fcmp_ult_f64(double %a, double %b, double %c, double %d) {
545 ; SSE-LABEL: select_fcmp_ult_f64:
547 ; SSE-NEXT: movsd %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
548 ; SSE-NEXT: movaps %xmm0, %xmm1
549 ; SSE-NEXT: movsd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 8-byte Reload
550 ; SSE-NEXT: # xmm0 = mem[0],zero
551 ; SSE-NEXT: cmpnlesd %xmm1, %xmm0
552 ; SSE-NEXT: movaps %xmm0, %xmm1
553 ; SSE-NEXT: andpd %xmm2, %xmm1
554 ; SSE-NEXT: andnpd %xmm3, %xmm0
555 ; SSE-NEXT: orpd %xmm1, %xmm0
558 ; AVX-LABEL: select_fcmp_ult_f64:
560 ; AVX-NEXT: vcmpnlesd %xmm0, %xmm1, %xmm0
561 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
564 ; AVX512-LABEL: select_fcmp_ult_f64:
566 ; AVX512-NEXT: vcmpnlesd %xmm0, %xmm1, %k1
567 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
568 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
570 %1 = fcmp ult double %a, %b
571 %2 = select i1 %1, double %c, double %d
575 define float @select_fcmp_ule_f32(float %a, float %b, float %c, float %d) {
576 ; SSE-LABEL: select_fcmp_ule_f32:
578 ; SSE-NEXT: movss %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
579 ; SSE-NEXT: movaps %xmm0, %xmm1
580 ; SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
581 ; SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
582 ; SSE-NEXT: cmpnltss %xmm1, %xmm0
583 ; SSE-NEXT: movaps %xmm0, %xmm1
584 ; SSE-NEXT: andps %xmm2, %xmm1
585 ; SSE-NEXT: andnps %xmm3, %xmm0
586 ; SSE-NEXT: orps %xmm1, %xmm0
589 ; AVX-LABEL: select_fcmp_ule_f32:
591 ; AVX-NEXT: vcmpnltss %xmm0, %xmm1, %xmm0
592 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
595 ; AVX512-LABEL: select_fcmp_ule_f32:
597 ; AVX512-NEXT: vcmpnltss %xmm0, %xmm1, %k1
598 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
599 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
601 %1 = fcmp ule float %a, %b
602 %2 = select i1 %1, float %c, float %d
606 define double @select_fcmp_ule_f64(double %a, double %b, double %c, double %d) {
607 ; SSE-LABEL: select_fcmp_ule_f64:
609 ; SSE-NEXT: movsd %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
610 ; SSE-NEXT: movaps %xmm0, %xmm1
611 ; SSE-NEXT: movsd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 8-byte Reload
612 ; SSE-NEXT: # xmm0 = mem[0],zero
613 ; SSE-NEXT: cmpnltsd %xmm1, %xmm0
614 ; SSE-NEXT: movaps %xmm0, %xmm1
615 ; SSE-NEXT: andpd %xmm2, %xmm1
616 ; SSE-NEXT: andnpd %xmm3, %xmm0
617 ; SSE-NEXT: orpd %xmm1, %xmm0
620 ; AVX-LABEL: select_fcmp_ule_f64:
622 ; AVX-NEXT: vcmpnltsd %xmm0, %xmm1, %xmm0
623 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
626 ; AVX512-LABEL: select_fcmp_ule_f64:
628 ; AVX512-NEXT: vcmpnltsd %xmm0, %xmm1, %k1
629 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
630 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
632 %1 = fcmp ule double %a, %b
633 %2 = select i1 %1, double %c, double %d
637 define float @select_fcmp_une_f32(float %a, float %b, float %c, float %d) {
638 ; SSE-LABEL: select_fcmp_une_f32:
640 ; SSE-NEXT: cmpneqss %xmm1, %xmm0
641 ; SSE-NEXT: movaps %xmm0, %xmm1
642 ; SSE-NEXT: andps %xmm2, %xmm1
643 ; SSE-NEXT: andnps %xmm3, %xmm0
644 ; SSE-NEXT: orps %xmm1, %xmm0
647 ; AVX-LABEL: select_fcmp_une_f32:
649 ; AVX-NEXT: vcmpneqss %xmm1, %xmm0, %xmm0
650 ; AVX-NEXT: vblendvps %xmm0, %xmm2, %xmm3, %xmm0
653 ; AVX512-LABEL: select_fcmp_une_f32:
655 ; AVX512-NEXT: vcmpneqss %xmm1, %xmm0, %k1
656 ; AVX512-NEXT: vmovss %xmm2, %xmm3, %xmm3 {%k1}
657 ; AVX512-NEXT: vmovaps %xmm3, %xmm0
659 %1 = fcmp une float %a, %b
660 %2 = select i1 %1, float %c, float %d
664 define double @select_fcmp_une_f64(double %a, double %b, double %c, double %d) {
665 ; SSE-LABEL: select_fcmp_une_f64:
667 ; SSE-NEXT: cmpneqsd %xmm1, %xmm0
668 ; SSE-NEXT: movaps %xmm0, %xmm1
669 ; SSE-NEXT: andpd %xmm2, %xmm1
670 ; SSE-NEXT: andnpd %xmm3, %xmm0
671 ; SSE-NEXT: orpd %xmm1, %xmm0
674 ; AVX-LABEL: select_fcmp_une_f64:
676 ; AVX-NEXT: vcmpneqsd %xmm1, %xmm0, %xmm0
677 ; AVX-NEXT: vblendvpd %xmm0, %xmm2, %xmm3, %xmm0
680 ; AVX512-LABEL: select_fcmp_une_f64:
682 ; AVX512-NEXT: vcmpneqsd %xmm1, %xmm0, %k1
683 ; AVX512-NEXT: vmovsd %xmm2, %xmm3, %xmm3 {%k1}
684 ; AVX512-NEXT: vmovapd %xmm3, %xmm0
686 %1 = fcmp une double %a, %b
687 %2 = select i1 %1, double %c, double %d