1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s
4 define <4 x i32> @test1(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
7 ; CHECK-NEXT: vcmpnleps %xmm0, %xmm1, %xmm0
8 ; CHECK-NEXT: vandps %xmm2, %xmm0, %xmm0
10 %f = fcmp ult <4 x float> %a, %b
11 %r = select <4 x i1> %f, <4 x i32> %c, <4 x i32> zeroinitializer
15 define <4 x i32> @test2(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
18 ; CHECK-NEXT: vcmpnleps %xmm0, %xmm1, %xmm0
19 ; CHECK-NEXT: vorps %xmm2, %xmm0, %xmm0
21 %f = fcmp ult <4 x float> %a, %b
22 %r = select <4 x i1> %f, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, <4 x i32> %c
26 define <4 x i32> @test3(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
29 ; CHECK-NEXT: vcmpleps %xmm0, %xmm1, %xmm0
30 ; CHECK-NEXT: vandps %xmm2, %xmm0, %xmm0
32 %f = fcmp ult <4 x float> %a, %b
33 %r = select <4 x i1> %f, <4 x i32> zeroinitializer, <4 x i32> %c
37 define <4 x i32> @test4(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
40 ; CHECK-NEXT: vcmpleps %xmm0, %xmm1, %xmm0
41 ; CHECK-NEXT: vorps %xmm2, %xmm0, %xmm0
43 %f = fcmp ult <4 x float> %a, %b
44 %r = select <4 x i1> %f, <4 x i32> %c, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
48 define <4 x i32> @test5(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
51 ; CHECK-NEXT: vcmpnleps %xmm0, %xmm1, %xmm0
53 %f = fcmp ult <4 x float> %a, %b
54 %r = sext <4 x i1> %f to <4 x i32>
58 define <4 x i32> @test6(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
61 ; CHECK-NEXT: vcmpleps %xmm0, %xmm1, %xmm0
63 %not.f = fcmp oge <4 x float> %a, %b
64 %r = sext <4 x i1> %not.f to <4 x i32>
68 define <4 x i32> @test7(<4 x float> %a, <4 x float> %b, <4 x i32>* %p) {
71 ; CHECK-NEXT: vcmpnleps %xmm0, %xmm1, %xmm0
72 ; CHECK-NEXT: vandps (%rdi), %xmm0, %xmm0
74 %f = fcmp ult <4 x float> %a, %b
75 %l = load <4 x i32>, <4 x i32>* %p, align 16
76 %r = select <4 x i1> %f, <4 x i32> %l, <4 x i32> zeroinitializer
80 ; Repeat all with FP types for the select operands. Also, use different comparison predicates for better test coverage.
82 define <2 x double> @test1f(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
83 ; CHECK-LABEL: test1f:
85 ; CHECK-NEXT: vcmpltpd %xmm0, %xmm1, %xmm0
86 ; CHECK-NEXT: vandpd %xmm2, %xmm0, %xmm0
88 %f = fcmp ogt <2 x double> %a, %b
89 %r = select <2 x i1> %f, <2 x double> %c, <2 x double> zeroinitializer
93 define <2 x double> @test2f(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
94 ; CHECK-LABEL: test2f:
96 ; CHECK-NEXT: vcmplepd %xmm0, %xmm1, %xmm0
97 ; CHECK-NEXT: vorpd %xmm2, %xmm0, %xmm0
99 %f = fcmp oge <2 x double> %a, %b
100 %r = select <2 x i1> %f, <2 x double> <double 0xffffffffffffffff, double 0xffffffffffffffff>, <2 x double> %c
104 define <2 x double> @test3f(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
105 ; CHECK-LABEL: test3f:
107 ; CHECK-NEXT: vcmpnltpd %xmm1, %xmm0, %xmm0
108 ; CHECK-NEXT: vandpd %xmm2, %xmm0, %xmm0
110 %f = fcmp olt <2 x double> %a, %b
111 %r = select <2 x i1> %f, <2 x double> zeroinitializer, <2 x double> %c
115 define <2 x double> @test4f(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
116 ; CHECK-LABEL: test4f:
118 ; CHECK-NEXT: vcmpnlepd %xmm1, %xmm0, %xmm0
119 ; CHECK-NEXT: vorpd %xmm2, %xmm0, %xmm0
121 %f = fcmp ole <2 x double> %a, %b
122 %r = select <2 x i1> %f, <2 x double> %c, <2 x double> <double 0xffffffffffffffff, double 0xffffffffffffffff>
126 define <2 x double> @test5f(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
127 ; CHECK-LABEL: test5f:
129 ; CHECK-NEXT: vcmpnlepd %xmm1, %xmm0, %xmm0
131 %f = fcmp ugt <2 x double> %a, %b
132 %r = select <2 x i1> %f, <2 x double> <double 0xffffffffffffffff, double 0xffffffffffffffff>, <2 x double> zeroinitializer
136 define <2 x double> @test6f(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
137 ; CHECK-LABEL: test6f:
139 ; CHECK-NEXT: vcmpltpd %xmm0, %xmm1, %xmm0
141 %f = fcmp ule <2 x double> %a, %b
142 %r = select <2 x i1> %f, <2 x double> zeroinitializer, <2 x double> <double 0xffffffffffffffff, double 0xffffffffffffffff>
146 define <2 x double> @test7f(<2 x double> %a, <2 x double> %b, <2 x double>* %p) {
147 ; CHECK-LABEL: test7f:
149 ; CHECK-NEXT: vcmpeqpd %xmm1, %xmm0, %xmm0
150 ; CHECK-NEXT: vandpd (%rdi), %xmm0, %xmm0
152 %f = fcmp oeq <2 x double> %a, %b
153 %l = load <2 x double>, <2 x double>* %p, align 16
154 %r = select <2 x i1> %f, <2 x double> %l, <2 x double> zeroinitializer