1 ; RUN: opt < %s -passes=libcalls-shrinkwrap -S | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
6 define void @test_range_error(double %value) {
8 %call_0 = call double @cosh(double %value)
9 ; CHECK: [[COND1:%[0-9]+]] = fcmp olt double %value, -7.100000e+02
10 ; CHECK: [[COND2:%[0-9]+]] = fcmp ogt double %value, 7.100000e+02
11 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
12 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT:[0-9]+]]
13 ; CHECK: [[CALL_LABEL]]:
14 ; CHECK-NEXT: %call_0 = call double @cosh(double %value)
15 ; CHECK-NEXT: br label %[[END_LABEL]]
16 ; CHECK: [[END_LABEL]]:
18 %call_1 = call double @exp(double %value)
19 ; CHECK: [[COND1:%[0-9]+]] = fcmp olt double %value, -7.450000e+02
20 ; CHECK: [[COND2:%[0-9]+]] = fcmp ogt double %value, 7.090000e+02
21 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
22 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
23 ; CHECK: [[CALL_LABEL]]:
24 ; CHECK-NEXT: %call_1 = call double @exp(double %value)
25 ; CHECK-NEXT: br label %[[END_LABEL]]
26 ; CHECK: [[END_LABEL]]:
28 %call_3 = call double @exp2(double %value)
29 ; CHECK: [[COND1:%[0-9]+]] = fcmp olt double %value, -1.074000e+03
30 ; CHECK: [[COND2:%[0-9]+]] = fcmp ogt double %value, 1.023000e+03
31 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
32 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
33 ; CHECK: [[CALL_LABEL]]:
34 ; CHECK-NEXT: %call_3 = call double @exp2(double %value)
35 ; CHECK-NEXT: br label %[[END_LABEL]]
36 ; CHECK: [[END_LABEL]]:
38 %call_4 = call double @sinh(double %value)
39 ; CHECK: [[COND1:%[0-9]+]] = fcmp olt double %value, -7.100000e+02
40 ; CHECK: [[COND2:%[0-9]+]] = fcmp ogt double %value, 7.100000e+02
41 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
42 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
43 ; CHECK: [[CALL_LABEL]]:
44 ; CHECK-NEXT: %call_4 = call double @sinh(double %value)
45 ; CHECK-NEXT: br label %[[END_LABEL]]
46 ; CHECK: [[END_LABEL]]:
48 %call_5 = call double @expm1(double %value)
49 ; CHECK: [[COND:%[0-9]+]] = fcmp ogt double %value, 7.090000e+02
50 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
51 ; CHECK: [[CALL_LABEL]]:
52 ; CHECK-NEXT: %call_5 = call double @expm1(double %value)
53 ; CHECK-NEXT: br label %[[END_LABEL]]
54 ; CHECK: [[END_LABEL]]:
59 define void @test_range_error_strictfp(double %value) strictfp {
61 %call_0 = call double @cosh(double %value) strictfp
62 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double -7.100000e+02, metadata !"olt", metadata !"fpexcept.strict")
63 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 7.100000e+02, metadata !"ogt", metadata !"fpexcept.strict")
64 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
65 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT:[0-9]+]]
66 ; CHECK: [[CALL_LABEL]]:
67 ; CHECK-NEXT: %call_0 = call double @cosh(double %value)
68 ; CHECK-NEXT: br label %[[END_LABEL]]
69 ; CHECK: [[END_LABEL]]:
71 %call_1 = call double @exp(double %value) strictfp
72 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double -7.450000e+02, metadata !"olt", metadata !"fpexcept.strict")
73 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 7.090000e+02, metadata !"ogt", metadata !"fpexcept.strict")
74 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
75 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
76 ; CHECK: [[CALL_LABEL]]:
77 ; CHECK-NEXT: %call_1 = call double @exp(double %value)
78 ; CHECK-NEXT: br label %[[END_LABEL]]
79 ; CHECK: [[END_LABEL]]:
81 %call_3 = call double @exp2(double %value) strictfp
82 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double -1.074000e+03, metadata !"olt", metadata !"fpexcept.strict")
83 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 1.023000e+03, metadata !"ogt", metadata !"fpexcept.strict")
84 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
85 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
86 ; CHECK: [[CALL_LABEL]]:
87 ; CHECK-NEXT: %call_3 = call double @exp2(double %value)
88 ; CHECK-NEXT: br label %[[END_LABEL]]
89 ; CHECK: [[END_LABEL]]:
91 %call_4 = call double @sinh(double %value) strictfp
92 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double -7.100000e+02, metadata !"olt", metadata !"fpexcept.strict")
93 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 7.100000e+02, metadata !"ogt", metadata !"fpexcept.strict")
94 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
95 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
96 ; CHECK: [[CALL_LABEL]]:
97 ; CHECK-NEXT: %call_4 = call double @sinh(double %value)
98 ; CHECK-NEXT: br label %[[END_LABEL]]
99 ; CHECK: [[END_LABEL]]:
101 %call_5 = call double @expm1(double %value) strictfp
102 ; CHECK: [[COND:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 7.090000e+02, metadata !"ogt", metadata !"fpexcept.strict")
103 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
104 ; CHECK: [[CALL_LABEL]]:
105 ; CHECK-NEXT: %call_5 = call double @expm1(double %value)
106 ; CHECK-NEXT: br label %[[END_LABEL]]
107 ; CHECK: [[END_LABEL]]:
112 declare double @cosh(double)
113 declare double @exp(double)
114 declare double @exp2(double)
115 declare double @sinh(double)
116 declare double @expm1(double)
118 define void @test_domain_error(double %value) {
120 %call_00 = call double @acos(double %value)
121 ; CHECK: [[COND1:%[0-9]+]] = fcmp ogt double %value, 1.000000e+00
122 ; CHECK: [[COND2:%[0-9]+]] = fcmp olt double %value, -1.000000e+00
123 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
124 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
125 ; CHECK: [[CALL_LABEL]]:
126 ; CHECK-NEXT: %call_00 = call double @acos(double %value)
127 ; CHECK-NEXT: br label %[[END_LABEL]]
128 ; CHECK: [[END_LABEL]]:
130 %call_01 = call double @asin(double %value)
131 ; CHECK: [[COND1:%[0-9]+]] = fcmp ogt double %value, 1.000000e+00
132 ; CHECK: [[COND2:%[0-9]+]] = fcmp olt double %value, -1.000000e+00
133 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
134 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
135 ; CHECK: [[CALL_LABEL]]:
136 ; CHECK-NEXT: %call_01 = call double @asin(double %value)
137 ; CHECK-NEXT: br label %[[END_LABEL]]
138 ; CHECK: [[END_LABEL]]:
140 %call_02 = call double @cos(double %value)
141 ; CHECK: [[COND1:%[0-9]+]] = fcmp oeq double %value, 0xFFF0000000000000
142 ; CHECK: [[COND2:%[0-9]+]] = fcmp oeq double %value, 0x7FF0000000000000
143 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
144 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
145 ; CHECK: [[CALL_LABEL]]:
146 ; CHECK-NEXT: %call_02 = call double @cos(double %value)
147 ; CHECK-NEXT: br label %[[END_LABEL]]
148 ; CHECK: [[END_LABEL]]:
150 %call_03 = call double @sin(double %value)
151 ; CHECK: [[COND1:%[0-9]+]] = fcmp oeq double %value, 0xFFF0000000000000
152 ; CHECK: [[COND2:%[0-9]+]] = fcmp oeq double %value, 0x7FF0000000000000
153 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
154 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
155 ; CHECK: [[CALL_LABEL]]:
156 ; CHECK-NEXT: %call_03 = call double @sin(double %value)
157 ; CHECK-NEXT: br label %[[END_LABEL]]
158 ; CHECK: [[END_LABEL]]:
160 %call_04 = call double @acosh(double %value)
161 ; CHECK: [[COND:%[0-9]+]] = fcmp olt double %value, 1.000000e+00
162 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
163 ; CHECK: [[CALL_LABEL]]:
164 ; CHECK-NEXT: %call_04 = call double @acosh(double %value)
165 ; CHECK-NEXT: br label %[[END_LABEL]]
166 ; CHECK: [[END_LABEL]]:
168 %call_05 = call double @sqrt(double %value)
169 ; CHECK: [[COND:%[0-9]+]] = fcmp olt double %value, 0.000000e+00
170 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
171 ; CHECK: [[CALL_LABEL]]:
172 ; CHECK-NEXT: %call_05 = call double @sqrt(double %value)
173 ; CHECK-NEXT: br label %[[END_LABEL]]
174 ; CHECK: [[END_LABEL]]:
176 %call_06 = call double @atanh(double %value)
177 ; CHECK: [[COND1:%[0-9]+]] = fcmp oge double %value, 1.000000e+00
178 ; CHECK: [[COND2:%[0-9]+]] = fcmp ole double %value, -1.000000e+00
179 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
180 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
181 ; CHECK: [[CALL_LABEL]]:
182 ; CHECK-NEXT: %call_06 = call double @atanh(double %value)
183 ; CHECK-NEXT: br label %[[END_LABEL]]
184 ; CHECK: [[END_LABEL]]:
186 %call_07 = call double @log(double %value)
187 ; CHECK: [[COND:%[0-9]+]] = fcmp ole double %value, 0.000000e+00
188 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
189 ; CHECK: [[CALL_LABEL]]:
190 ; CHECK-NEXT: %call_07 = call double @log(double %value)
191 ; CHECK-NEXT: br label %[[END_LABEL]]
192 ; CHECK: [[END_LABEL]]:
194 %call_08 = call double @log10(double %value)
195 ; CHECK: [[COND:%[0-9]+]] = fcmp ole double %value, 0.000000e+00
196 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
197 ; CHECK: [[CALL_LABEL]]:
198 ; CHECK-NEXT: %call_08 = call double @log10(double %value)
199 ; CHECK-NEXT: br label %[[END_LABEL]]
200 ; CHECK: [[END_LABEL]]:
202 %call_09 = call double @log2(double %value)
203 ; CHECK: [[COND:%[0-9]+]] = fcmp ole double %value, 0.000000e+00
204 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
205 ; CHECK: [[CALL_LABEL]]:
206 ; CHECK-NEXT: %call_09 = call double @log2(double %value)
207 ; CHECK-NEXT: br label %[[END_LABEL]]
208 ; CHECK: [[END_LABEL]]:
210 %call_10 = call double @logb(double %value)
211 ; CHECK: [[COND:%[0-9]+]] = fcmp ole double %value, 0.000000e+00
212 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
213 ; CHECK: [[CALL_LABEL]]:
214 ; CHECK-NEXT: %call_10 = call double @logb(double %value)
215 ; CHECK-NEXT: br label %[[END_LABEL]]
216 ; CHECK: [[END_LABEL]]:
218 %call_11 = call double @log1p(double %value)
219 ; CHECK: [[COND:%[0-9]+]] = fcmp ole double %value, -1.000000e+00
220 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
221 ; CHECK: [[CALL_LABEL]]:
222 ; CHECK-NEXT: %call_11 = call double @log1p(double %value)
223 ; CHECK-NEXT: br label %[[END_LABEL]]
224 ; CHECK: [[END_LABEL]]:
229 define void @test_domain_error_strictfp(double %value) strictfp {
231 %call_00 = call double @acos(double %value) strictfp
232 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 1.000000e+00, metadata !"ogt", metadata !"fpexcept.strict")
233 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double -1.000000e+00, metadata !"olt", metadata !"fpexcept.strict")
234 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
235 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
236 ; CHECK: [[CALL_LABEL]]:
237 ; CHECK-NEXT: %call_00 = call double @acos(double %value)
238 ; CHECK-NEXT: br label %[[END_LABEL]]
239 ; CHECK: [[END_LABEL]]:
241 %call_01 = call double @asin(double %value) strictfp
242 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 1.000000e+00, metadata !"ogt", metadata !"fpexcept.strict")
243 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double -1.000000e+00, metadata !"olt", metadata !"fpexcept.strict")
244 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
245 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
246 ; CHECK: [[CALL_LABEL]]:
247 ; CHECK-NEXT: %call_01 = call double @asin(double %value)
248 ; CHECK-NEXT: br label %[[END_LABEL]]
249 ; CHECK: [[END_LABEL]]:
251 %call_02 = call double @cos(double %value) strictfp
252 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0xFFF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
253 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0x7FF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
254 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
255 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
256 ; CHECK: [[CALL_LABEL]]:
257 ; CHECK-NEXT: %call_02 = call double @cos(double %value)
258 ; CHECK-NEXT: br label %[[END_LABEL]]
259 ; CHECK: [[END_LABEL]]:
261 %call_03 = call double @sin(double %value) strictfp
262 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0xFFF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
263 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0x7FF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
264 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
265 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
266 ; CHECK: [[CALL_LABEL]]:
267 ; CHECK-NEXT: %call_03 = call double @sin(double %value)
268 ; CHECK-NEXT: br label %[[END_LABEL]]
269 ; CHECK: [[END_LABEL]]:
271 %call_04 = call double @acosh(double %value) strictfp
272 ; CHECK: [[COND:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 1.000000e+00, metadata !"olt", metadata !"fpexcept.strict")
273 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
274 ; CHECK: [[CALL_LABEL]]:
275 ; CHECK-NEXT: %call_04 = call double @acosh(double %value)
276 ; CHECK-NEXT: br label %[[END_LABEL]]
277 ; CHECK: [[END_LABEL]]:
279 %call_05 = call double @sqrt(double %value) strictfp
280 ; CHECK: [[COND:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0.000000e+00, metadata !"olt", metadata !"fpexcept.strict")
281 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
282 ; CHECK: [[CALL_LABEL]]:
283 ; CHECK-NEXT: %call_05 = call double @sqrt(double %value)
284 ; CHECK-NEXT: br label %[[END_LABEL]]
285 ; CHECK: [[END_LABEL]]:
287 %call_06 = call double @atanh(double %value) strictfp
288 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 1.000000e+00, metadata !"oge", metadata !"fpexcept.strict")
289 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double -1.000000e+00, metadata !"ole", metadata !"fpexcept.strict")
290 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
291 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
292 ; CHECK: [[CALL_LABEL]]:
293 ; CHECK-NEXT: %call_06 = call double @atanh(double %value)
294 ; CHECK-NEXT: br label %[[END_LABEL]]
295 ; CHECK: [[END_LABEL]]:
297 %call_07 = call double @log(double %value) strictfp
298 ; CHECK: [[COND:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0.000000e+00, metadata !"ole", metadata !"fpexcept.strict")
299 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
300 ; CHECK: [[CALL_LABEL]]:
301 ; CHECK-NEXT: %call_07 = call double @log(double %value)
302 ; CHECK-NEXT: br label %[[END_LABEL]]
303 ; CHECK: [[END_LABEL]]:
305 %call_08 = call double @log10(double %value) strictfp
306 ; CHECK: [[COND:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0.000000e+00, metadata !"ole", metadata !"fpexcept.strict")
307 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
308 ; CHECK: [[CALL_LABEL]]:
309 ; CHECK-NEXT: %call_08 = call double @log10(double %value)
310 ; CHECK-NEXT: br label %[[END_LABEL]]
311 ; CHECK: [[END_LABEL]]:
313 %call_09 = call double @log2(double %value) strictfp
314 ; CHECK: [[COND:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0.000000e+00, metadata !"ole", metadata !"fpexcept.strict")
315 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
316 ; CHECK: [[CALL_LABEL]]:
317 ; CHECK-NEXT: %call_09 = call double @log2(double %value)
318 ; CHECK-NEXT: br label %[[END_LABEL]]
319 ; CHECK: [[END_LABEL]]:
321 %call_10 = call double @logb(double %value) strictfp
322 ; CHECK: [[COND:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0.000000e+00, metadata !"ole", metadata !"fpexcept.strict")
323 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
324 ; CHECK: [[CALL_LABEL]]:
325 ; CHECK-NEXT: %call_10 = call double @logb(double %value)
326 ; CHECK-NEXT: br label %[[END_LABEL]]
327 ; CHECK: [[END_LABEL]]:
329 %call_11 = call double @log1p(double %value) strictfp
330 ; CHECK: [[COND:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double -1.000000e+00, metadata !"ole", metadata !"fpexcept.strict")
331 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
332 ; CHECK: [[CALL_LABEL]]:
333 ; CHECK-NEXT: %call_11 = call double @log1p(double %value)
334 ; CHECK-NEXT: br label %[[END_LABEL]]
335 ; CHECK: [[END_LABEL]]:
340 declare double @acos(double)
341 declare double @asin(double)
342 declare double @cos(double)
343 declare double @sin(double)
344 declare double @acosh(double)
345 declare double @sqrt(double)
346 declare double @atanh(double)
347 declare double @log(double)
348 declare double @log10(double)
349 declare double @log2(double)
350 declare double @logb(double)
351 declare double @log1p(double)
353 define void @test_pow(i32 %int_val, double %exp) {
354 %call = call double @pow(double 2.500000e+00, double %exp)
355 ; CHECK: [[COND:%[0-9]+]] = fcmp ogt double %exp, 1.270000e+02
356 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
357 ; CHECK: [[CALL_LABEL]]:
358 ; CHECK-NEXT: %call = call double @pow(double 2.500000e+00, double %exp)
359 ; CHECK-NEXT: br label %[[END_LABEL]]
360 ; CHECK: [[END_LABEL]]:
362 %conv = sitofp i32 %int_val to double
363 %call1 = call double @pow(double %conv, double %exp)
364 ; CHECK: [[COND1:%[0-9]+]] = fcmp ogt double %exp, 3.200000e+01
365 ; CHECK: [[COND2:%[0-9]+]] = fcmp ole double %conv, 0.000000e+00
366 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
367 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
368 ; CHECK: [[CALL_LABEL]]:
369 ; CHECK-NEXT: %call1 = call double @pow(double %conv, double %exp)
370 ; CHECK-NEXT: br label %[[END_LABEL]]
371 ; CHECK: [[END_LABEL]]:
373 %conv2 = trunc i32 %int_val to i8
374 %conv3 = uitofp i8 %conv2 to double
375 %call4 = call double @pow(double %conv3, double %exp)
376 ; CHECK: [[COND1:%[0-9]+]] = fcmp ogt double %exp, 1.280000e+02
377 ; CHECK: [[COND2:%[0-9]+]] = fcmp ole double %conv3, 0.000000e+00
378 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
379 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
380 ; CHECK: [[CALL_LABEL]]:
381 ; CHECK-NEXT: %call4 = call double @pow(double %conv3, double %exp)
382 ; CHECK-NEXT: br label %[[END_LABEL]]
383 ; CHECK: [[END_LABEL]]:
386 %conv5 = trunc i32 %int_val to i16
387 %conv6 = uitofp i16 %conv5 to double
388 %call7 = call double @pow(double %conv6, double %exp)
389 ; CHECK: [[COND1:%[0-9]+]] = fcmp ogt double %exp, 6.400000e+01
390 ; CHECK: [[COND2:%[0-9]+]] = fcmp ole double %conv6, 0.000000e+00
391 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
392 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
393 ; CHECK: [[CALL_LABEL]]:
394 ; CHECK-NEXT: %call7 = call double @pow(double %conv6, double %exp)
395 ; CHECK-NEXT: br label %[[END_LABEL]]
396 ; CHECK: [[END_LABEL]]:
401 define void @test_pow_strictfp(i32 %int_val, double %exp) strictfp {
402 %call = call double @pow(double 2.500000e+00, double %exp) strictfp
403 ; CHECK: [[COND:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %exp, double 1.270000e+02, metadata !"ogt", metadata !"fpexcept.strict")
404 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
405 ; CHECK: [[CALL_LABEL]]:
406 ; CHECK-NEXT: %call = call double @pow(double 2.500000e+00, double %exp)
407 ; CHECK-NEXT: br label %[[END_LABEL]]
408 ; CHECK: [[END_LABEL]]:
410 %conv = sitofp i32 %int_val to double
411 %call1 = call double @pow(double %conv, double %exp) strictfp
412 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %exp, double 3.200000e+01, metadata !"ogt", metadata !"fpexcept.strict")
413 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %conv, double 0.000000e+00, metadata !"ole", metadata !"fpexcept.strict")
414 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
415 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
416 ; CHECK: [[CALL_LABEL]]:
417 ; CHECK-NEXT: %call1 = call double @pow(double %conv, double %exp)
418 ; CHECK-NEXT: br label %[[END_LABEL]]
419 ; CHECK: [[END_LABEL]]:
421 %conv2 = trunc i32 %int_val to i8
422 %conv3 = uitofp i8 %conv2 to double
423 %call4 = call double @pow(double %conv3, double %exp) strictfp
424 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %exp, double 1.280000e+02, metadata !"ogt", metadata !"fpexcept.strict")
425 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %conv3, double 0.000000e+00, metadata !"ole", metadata !"fpexcept.strict")
426 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
427 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
428 ; CHECK: [[CALL_LABEL]]:
429 ; CHECK-NEXT: %call4 = call double @pow(double %conv3, double %exp)
430 ; CHECK-NEXT: br label %[[END_LABEL]]
431 ; CHECK: [[END_LABEL]]:
434 %conv5 = trunc i32 %int_val to i16
435 %conv6 = uitofp i16 %conv5 to double
436 %call7 = call double @pow(double %conv6, double %exp) strictfp
437 ; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %exp, double 6.400000e+01, metadata !"ogt", metadata !"fpexcept.strict")
438 ; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %conv6, double 0.000000e+00, metadata !"ole", metadata !"fpexcept.strict")
439 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
440 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
441 ; CHECK: [[CALL_LABEL]]:
442 ; CHECK-NEXT: %call7 = call double @pow(double %conv6, double %exp)
443 ; CHECK-NEXT: br label %[[END_LABEL]]
444 ; CHECK: [[END_LABEL]]:
449 declare double @pow(double, double)
451 ; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 1048575}