1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=sse4.2 | FileCheck %s
4 define double @test1(double %a, double %b, double %eps) {
7 ; CHECK-NEXT: cmpltsd %xmm2, %xmm0
8 ; CHECK-NEXT: andpd %xmm1, %xmm0
10 %cmp = fcmp olt double %a, %eps
11 %cond = select i1 %cmp, double %b, double 0.000000e+00
15 define double @test2(double %a, double %b, double %eps) {
18 ; CHECK-NEXT: cmplesd %xmm2, %xmm0
19 ; CHECK-NEXT: andpd %xmm1, %xmm0
21 %cmp = fcmp ole double %a, %eps
22 %cond = select i1 %cmp, double %b, double 0.000000e+00
26 define double @test3(double %a, double %b, double %eps) {
29 ; CHECK-NEXT: cmpltsd %xmm0, %xmm2
30 ; CHECK-NEXT: andpd %xmm1, %xmm2
31 ; CHECK-NEXT: movapd %xmm2, %xmm0
33 %cmp = fcmp ogt double %a, %eps
34 %cond = select i1 %cmp, double %b, double 0.000000e+00
38 define double @test4(double %a, double %b, double %eps) {
41 ; CHECK-NEXT: cmplesd %xmm0, %xmm2
42 ; CHECK-NEXT: andpd %xmm1, %xmm2
43 ; CHECK-NEXT: movapd %xmm2, %xmm0
45 %cmp = fcmp oge double %a, %eps
46 %cond = select i1 %cmp, double %b, double 0.000000e+00
50 define double @test5(double %a, double %b, double %eps) {
53 ; CHECK-NEXT: cmpltsd %xmm2, %xmm0
54 ; CHECK-NEXT: andnpd %xmm1, %xmm0
56 %cmp = fcmp olt double %a, %eps
57 %cond = select i1 %cmp, double 0.000000e+00, double %b
61 define double @test6(double %a, double %b, double %eps) {
64 ; CHECK-NEXT: cmplesd %xmm2, %xmm0
65 ; CHECK-NEXT: andnpd %xmm1, %xmm0
67 %cmp = fcmp ole double %a, %eps
68 %cond = select i1 %cmp, double 0.000000e+00, double %b
72 define double @test7(double %a, double %b, double %eps) {
75 ; CHECK-NEXT: cmpltsd %xmm0, %xmm2
76 ; CHECK-NEXT: andnpd %xmm1, %xmm2
77 ; CHECK-NEXT: movapd %xmm2, %xmm0
79 %cmp = fcmp ogt double %a, %eps
80 %cond = select i1 %cmp, double 0.000000e+00, double %b
84 define double @test8(double %a, double %b, double %eps) {
87 ; CHECK-NEXT: cmplesd %xmm0, %xmm2
88 ; CHECK-NEXT: andnpd %xmm1, %xmm2
89 ; CHECK-NEXT: movapd %xmm2, %xmm0
91 %cmp = fcmp oge double %a, %eps
92 %cond = select i1 %cmp, double 0.000000e+00, double %b
96 define float @test9(float %a, float %b, float %eps) {
99 ; CHECK-NEXT: cmpltss %xmm2, %xmm0
100 ; CHECK-NEXT: andps %xmm1, %xmm0
102 %cmp = fcmp olt float %a, %eps
103 %cond = select i1 %cmp, float %b, float 0.000000e+00
107 define float @test10(float %a, float %b, float %eps) {
108 ; CHECK-LABEL: test10:
110 ; CHECK-NEXT: cmpless %xmm2, %xmm0
111 ; CHECK-NEXT: andps %xmm1, %xmm0
113 %cmp = fcmp ole float %a, %eps
114 %cond = select i1 %cmp, float %b, float 0.000000e+00
118 define float @test11(float %a, float %b, float %eps) {
119 ; CHECK-LABEL: test11:
121 ; CHECK-NEXT: cmpltss %xmm0, %xmm2
122 ; CHECK-NEXT: andps %xmm1, %xmm2
123 ; CHECK-NEXT: movaps %xmm2, %xmm0
125 %cmp = fcmp ogt float %a, %eps
126 %cond = select i1 %cmp, float %b, float 0.000000e+00
130 define float @test12(float %a, float %b, float %eps) {
131 ; CHECK-LABEL: test12:
133 ; CHECK-NEXT: cmpless %xmm0, %xmm2
134 ; CHECK-NEXT: andps %xmm1, %xmm2
135 ; CHECK-NEXT: movaps %xmm2, %xmm0
137 %cmp = fcmp oge float %a, %eps
138 %cond = select i1 %cmp, float %b, float 0.000000e+00
142 define float @test13(float %a, float %b, float %eps) {
143 ; CHECK-LABEL: test13:
145 ; CHECK-NEXT: cmpltss %xmm2, %xmm0
146 ; CHECK-NEXT: andnps %xmm1, %xmm0
148 %cmp = fcmp olt float %a, %eps
149 %cond = select i1 %cmp, float 0.000000e+00, float %b
153 define float @test14(float %a, float %b, float %eps) {
154 ; CHECK-LABEL: test14:
156 ; CHECK-NEXT: cmpless %xmm2, %xmm0
157 ; CHECK-NEXT: andnps %xmm1, %xmm0
159 %cmp = fcmp ole float %a, %eps
160 %cond = select i1 %cmp, float 0.000000e+00, float %b
164 define float @test15(float %a, float %b, float %eps) {
165 ; CHECK-LABEL: test15:
167 ; CHECK-NEXT: cmpltss %xmm0, %xmm2
168 ; CHECK-NEXT: andnps %xmm1, %xmm2
169 ; CHECK-NEXT: movaps %xmm2, %xmm0
171 %cmp = fcmp ogt float %a, %eps
172 %cond = select i1 %cmp, float 0.000000e+00, float %b
176 define float @test16(float %a, float %b, float %eps) {
177 ; CHECK-LABEL: test16:
179 ; CHECK-NEXT: cmpless %xmm0, %xmm2
180 ; CHECK-NEXT: andnps %xmm1, %xmm2
181 ; CHECK-NEXT: movaps %xmm2, %xmm0
183 %cmp = fcmp oge float %a, %eps
184 %cond = select i1 %cmp, float 0.000000e+00, float %b
188 define float @test17(float %a, float %b, float %c, float %eps) {
189 ; CHECK-LABEL: test17:
191 ; CHECK-NEXT: cmpless %xmm0, %xmm3
192 ; CHECK-NEXT: andps %xmm3, %xmm2
193 ; CHECK-NEXT: andnps %xmm1, %xmm3
194 ; CHECK-NEXT: orps %xmm2, %xmm3
195 ; CHECK-NEXT: movaps %xmm3, %xmm0
197 %cmp = fcmp oge float %a, %eps
198 %cond = select i1 %cmp, float %c, float %b
202 define double @test18(double %a, double %b, double %c, double %eps) {
203 ; CHECK-LABEL: test18:
205 ; CHECK-NEXT: cmplesd %xmm0, %xmm3
206 ; CHECK-NEXT: andpd %xmm3, %xmm2
207 ; CHECK-NEXT: andnpd %xmm1, %xmm3
208 ; CHECK-NEXT: orpd %xmm2, %xmm3
209 ; CHECK-NEXT: movapd %xmm3, %xmm0
211 %cmp = fcmp oge double %a, %eps
212 %cond = select i1 %cmp, double %c, double %b