• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3
4define double @test1(double %a, double %b, double %eps) {
5; CHECK-LABEL: test1:
6; CHECK:       # %bb.0:
7; CHECK-NEXT:    cmpltsd %xmm2, %xmm0
8; CHECK-NEXT:    andpd %xmm1, %xmm0
9; CHECK-NEXT:    retq
10  %cmp = fcmp olt double %a, %eps
11  %cond = select i1 %cmp, double %b, double 0.000000e+00
12  ret double %cond
13}
14
15define double @test2(double %a, double %b, double %eps) {
16; CHECK-LABEL: test2:
17; CHECK:       # %bb.0:
18; CHECK-NEXT:    cmplesd %xmm2, %xmm0
19; CHECK-NEXT:    andpd %xmm1, %xmm0
20; CHECK-NEXT:    retq
21  %cmp = fcmp ole double %a, %eps
22  %cond = select i1 %cmp, double %b, double 0.000000e+00
23  ret double %cond
24}
25
26define double @test3(double %a, double %b, double %eps) {
27; CHECK-LABEL: test3:
28; CHECK:       # %bb.0:
29; CHECK-NEXT:    cmpltsd %xmm0, %xmm2
30; CHECK-NEXT:    andpd %xmm1, %xmm2
31; CHECK-NEXT:    movapd %xmm2, %xmm0
32; CHECK-NEXT:    retq
33  %cmp = fcmp ogt double %a, %eps
34  %cond = select i1 %cmp, double %b, double 0.000000e+00
35  ret double %cond
36}
37
38define double @test4(double %a, double %b, double %eps) {
39; CHECK-LABEL: test4:
40; CHECK:       # %bb.0:
41; CHECK-NEXT:    cmplesd %xmm0, %xmm2
42; CHECK-NEXT:    andpd %xmm1, %xmm2
43; CHECK-NEXT:    movapd %xmm2, %xmm0
44; CHECK-NEXT:    retq
45  %cmp = fcmp oge double %a, %eps
46  %cond = select i1 %cmp, double %b, double 0.000000e+00
47  ret double %cond
48}
49
50define double @test5(double %a, double %b, double %eps) {
51; CHECK-LABEL: test5:
52; CHECK:       # %bb.0:
53; CHECK-NEXT:    cmpltsd %xmm2, %xmm0
54; CHECK-NEXT:    andnpd %xmm1, %xmm0
55; CHECK-NEXT:    retq
56  %cmp = fcmp olt double %a, %eps
57  %cond = select i1 %cmp, double 0.000000e+00, double %b
58  ret double %cond
59}
60
61define double @test6(double %a, double %b, double %eps) {
62; CHECK-LABEL: test6:
63; CHECK:       # %bb.0:
64; CHECK-NEXT:    cmplesd %xmm2, %xmm0
65; CHECK-NEXT:    andnpd %xmm1, %xmm0
66; CHECK-NEXT:    retq
67  %cmp = fcmp ole double %a, %eps
68  %cond = select i1 %cmp, double 0.000000e+00, double %b
69  ret double %cond
70}
71
72define double @test7(double %a, double %b, double %eps) {
73; CHECK-LABEL: test7:
74; CHECK:       # %bb.0:
75; CHECK-NEXT:    cmpltsd %xmm0, %xmm2
76; CHECK-NEXT:    andnpd %xmm1, %xmm2
77; CHECK-NEXT:    movapd %xmm2, %xmm0
78; CHECK-NEXT:    retq
79  %cmp = fcmp ogt double %a, %eps
80  %cond = select i1 %cmp, double 0.000000e+00, double %b
81  ret double %cond
82}
83
84define double @test8(double %a, double %b, double %eps) {
85; CHECK-LABEL: test8:
86; CHECK:       # %bb.0:
87; CHECK-NEXT:    cmplesd %xmm0, %xmm2
88; CHECK-NEXT:    andnpd %xmm1, %xmm2
89; CHECK-NEXT:    movapd %xmm2, %xmm0
90; CHECK-NEXT:    retq
91  %cmp = fcmp oge double %a, %eps
92  %cond = select i1 %cmp, double 0.000000e+00, double %b
93  ret double %cond
94}
95
96define float @test9(float %a, float %b, float %eps) {
97; CHECK-LABEL: test9:
98; CHECK:       # %bb.0:
99; CHECK-NEXT:    cmpltss %xmm2, %xmm0
100; CHECK-NEXT:    andps %xmm1, %xmm0
101; CHECK-NEXT:    retq
102  %cmp = fcmp olt float %a, %eps
103  %cond = select i1 %cmp, float %b, float 0.000000e+00
104  ret float %cond
105}
106
107define float @test10(float %a, float %b, float %eps) {
108; CHECK-LABEL: test10:
109; CHECK:       # %bb.0:
110; CHECK-NEXT:    cmpless %xmm2, %xmm0
111; CHECK-NEXT:    andps %xmm1, %xmm0
112; CHECK-NEXT:    retq
113  %cmp = fcmp ole float %a, %eps
114  %cond = select i1 %cmp, float %b, float 0.000000e+00
115  ret float %cond
116}
117
118define float @test11(float %a, float %b, float %eps) {
119; CHECK-LABEL: test11:
120; CHECK:       # %bb.0:
121; CHECK-NEXT:    cmpltss %xmm0, %xmm2
122; CHECK-NEXT:    andps %xmm1, %xmm2
123; CHECK-NEXT:    movaps %xmm2, %xmm0
124; CHECK-NEXT:    retq
125  %cmp = fcmp ogt float %a, %eps
126  %cond = select i1 %cmp, float %b, float 0.000000e+00
127  ret float %cond
128}
129
130define float @test12(float %a, float %b, float %eps) {
131; CHECK-LABEL: test12:
132; CHECK:       # %bb.0:
133; CHECK-NEXT:    cmpless %xmm0, %xmm2
134; CHECK-NEXT:    andps %xmm1, %xmm2
135; CHECK-NEXT:    movaps %xmm2, %xmm0
136; CHECK-NEXT:    retq
137  %cmp = fcmp oge float %a, %eps
138  %cond = select i1 %cmp, float %b, float 0.000000e+00
139  ret float %cond
140}
141
142define float @test13(float %a, float %b, float %eps) {
143; CHECK-LABEL: test13:
144; CHECK:       # %bb.0:
145; CHECK-NEXT:    cmpltss %xmm2, %xmm0
146; CHECK-NEXT:    andnps %xmm1, %xmm0
147; CHECK-NEXT:    retq
148  %cmp = fcmp olt float %a, %eps
149  %cond = select i1 %cmp, float 0.000000e+00, float %b
150  ret float %cond
151}
152
153define float @test14(float %a, float %b, float %eps) {
154; CHECK-LABEL: test14:
155; CHECK:       # %bb.0:
156; CHECK-NEXT:    cmpless %xmm2, %xmm0
157; CHECK-NEXT:    andnps %xmm1, %xmm0
158; CHECK-NEXT:    retq
159  %cmp = fcmp ole float %a, %eps
160  %cond = select i1 %cmp, float 0.000000e+00, float %b
161  ret float %cond
162}
163
164define float @test15(float %a, float %b, float %eps) {
165; CHECK-LABEL: test15:
166; CHECK:       # %bb.0:
167; CHECK-NEXT:    cmpltss %xmm0, %xmm2
168; CHECK-NEXT:    andnps %xmm1, %xmm2
169; CHECK-NEXT:    movaps %xmm2, %xmm0
170; CHECK-NEXT:    retq
171  %cmp = fcmp ogt float %a, %eps
172  %cond = select i1 %cmp, float 0.000000e+00, float %b
173  ret float %cond
174}
175
176define float @test16(float %a, float %b, float %eps) {
177; CHECK-LABEL: test16:
178; CHECK:       # %bb.0:
179; CHECK-NEXT:    cmpless %xmm0, %xmm2
180; CHECK-NEXT:    andnps %xmm1, %xmm2
181; CHECK-NEXT:    movaps %xmm2, %xmm0
182; CHECK-NEXT:    retq
183  %cmp = fcmp oge float %a, %eps
184  %cond = select i1 %cmp, float 0.000000e+00, float %b
185  ret float %cond
186}
187
188define float @test17(float %a, float %b, float %c, float %eps) {
189; CHECK-LABEL: test17:
190; CHECK:       # %bb.0:
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
196; CHECK-NEXT:    retq
197  %cmp = fcmp oge float %a, %eps
198  %cond = select i1 %cmp, float %c, float %b
199  ret float %cond
200}
201
202define double @test18(double %a, double %b, double %c, double %eps) {
203; CHECK-LABEL: test18:
204; CHECK:       # %bb.0:
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
210; CHECK-NEXT:    retq
211  %cmp = fcmp oge double %a, %eps
212  %cond = select i1 %cmp, double %c, double %b
213  ret double %cond
214}
215
216