1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instcombine -S | FileCheck %s
3
4define float @powf_expf(float %x, float %y) {
5; CHECK-LABEL: @powf_expf(
6; CHECK-NEXT:    [[MUL:%.*]] = fmul fast float [[X:%.*]], [[Y:%.*]]
7; CHECK-NEXT:    [[EXP:%.*]] = call fast float @llvm.exp.f32(float [[MUL]])
8; CHECK-NEXT:    ret float [[EXP]]
9;
10  %call = call fast float @expf(float %x) nounwind readnone
11  %pow = call fast float @llvm.pow.f32(float %call, float %y)
12  ret float %pow
13}
14
15define float @powf_expf_libcall(float %x, float %y) {
16; CHECK-LABEL: @powf_expf_libcall(
17; CHECK-NEXT:    [[MUL:%.*]] = fmul fast float [[X:%.*]], [[Y:%.*]]
18; CHECK-NEXT:    [[EXPF:%.*]] = call fast float @expf(float [[MUL]])
19; CHECK-NEXT:    ret float [[EXPF]]
20;
21  %call = call fast float @expf(float %x)
22  %pow = call fast float @powf(float %call, float %y)
23  ret float %pow
24}
25
26define double @pow_exp(double %x, double %y) {
27; CHECK-LABEL: @pow_exp(
28; CHECK-NEXT:    [[MUL:%.*]] = fmul fast double [[X:%.*]], [[Y:%.*]]
29; CHECK-NEXT:    [[EXP:%.*]] = call fast double @llvm.exp.f64(double [[MUL]])
30; CHECK-NEXT:    ret double [[EXP]]
31;
32  %call = call fast double @exp(double %x) nounwind readnone
33  %pow = call fast double @llvm.pow.f64(double %call, double %y)
34  ret double %pow
35}
36
37define double @pow_exp_not_intrinsic(double %x, double %y) {
38; CHECK-LABEL: @pow_exp_not_intrinsic(
39; CHECK-NEXT:    [[MUL:%.*]] = fmul fast double [[X:%.*]], [[Y:%.*]]
40; CHECK-NEXT:    [[EXP:%.*]] = call fast double @llvm.exp.f64(double [[MUL]])
41; CHECK-NEXT:    ret double [[EXP]]
42;
43  %call = call fast double @exp(double %x) nounwind readnone
44  %pow = call fast double @pow(double %call, double %y) nounwind readnone
45  ret double %pow
46}
47
48define fp128 @powl_expl(fp128 %x, fp128 %y) {
49; CHECK-LABEL: @powl_expl(
50; CHECK-NEXT:    [[MUL:%.*]] = fmul fast fp128 [[X:%.*]], [[Y:%.*]]
51; CHECK-NEXT:    [[EXP:%.*]] = call fast fp128 @llvm.exp.f128(fp128 [[MUL]])
52; CHECK-NEXT:    ret fp128 [[EXP]]
53;
54  %call = call fast fp128 @expl(fp128 %x) nounwind readnone
55  %pow = call fast fp128 @llvm.pow.f128(fp128 %call, fp128 %y)
56  ret fp128 %pow
57}
58
59define fp128 @powl_expl_not_fast(fp128 %x, fp128 %y) {
60; CHECK-LABEL: @powl_expl_not_fast(
61; CHECK-NEXT:    [[CALL:%.*]] = call fp128 @expl(fp128 [[X:%.*]])
62; CHECK-NEXT:    [[POW:%.*]] = call fast fp128 @llvm.pow.f128(fp128 [[CALL]], fp128 [[Y:%.*]])
63; CHECK-NEXT:    ret fp128 [[POW]]
64;
65  %call = call fp128 @expl(fp128 %x)
66  %pow = call fast fp128 @llvm.pow.f128(fp128 %call, fp128 %y)
67  ret fp128 %pow
68}
69
70define float @powf_exp2f(float %x, float %y) {
71; CHECK-LABEL: @powf_exp2f(
72; CHECK-NEXT:    [[MUL:%.*]] = fmul fast float [[X:%.*]], [[Y:%.*]]
73; CHECK-NEXT:    [[EXP2:%.*]] = call fast float @llvm.exp2.f32(float [[MUL]])
74; CHECK-NEXT:    ret float [[EXP2]]
75;
76  %call = call fast float @exp2f(float %x) nounwind readnone
77  %pow = call fast float @llvm.pow.f32(float %call, float %y)
78  ret float %pow
79}
80
81define float @powf_exp2f_not_intrinsic(float %x, float %y) {
82; CHECK-LABEL: @powf_exp2f_not_intrinsic(
83; CHECK-NEXT:    [[MUL:%.*]] = fmul fast float [[X:%.*]], [[Y:%.*]]
84; CHECK-NEXT:    [[EXP2:%.*]] = call fast float @llvm.exp2.f32(float [[MUL]])
85; CHECK-NEXT:    ret float [[EXP2]]
86;
87  %call = call fast float @exp2f(float %x) nounwind readnone
88  %pow = call fast float @powf(float %call, float %y) nounwind readnone
89  ret float %pow
90}
91
92define double @pow_exp2(double %x, double %y) {
93; CHECK-LABEL: @pow_exp2(
94; CHECK-NEXT:    [[MUL:%.*]] = fmul fast double [[X:%.*]], [[Y:%.*]]
95; CHECK-NEXT:    [[EXP2:%.*]] = call fast double @llvm.exp2.f64(double [[MUL]])
96; CHECK-NEXT:    ret double [[EXP2]]
97;
98  %call = call fast double @exp2(double %x) nounwind readnone
99  %pow = call fast double @llvm.pow.f64(double %call, double %y)
100  ret double %pow
101}
102
103define double @pow_exp2_libcall(double %x, double %y) {
104; CHECK-LABEL: @pow_exp2_libcall(
105; CHECK-NEXT:    [[MUL:%.*]] = fmul fast double [[X:%.*]], [[Y:%.*]]
106; CHECK-NEXT:    [[EXP2:%.*]] = call fast double @exp2(double [[MUL]])
107; CHECK-NEXT:    ret double [[EXP2]]
108;
109  %call = call fast double @exp2(double %x)
110  %pow = call fast double @pow(double %call, double %y)
111  ret double %pow
112}
113
114define fp128 @powl_exp2l(fp128 %x, fp128 %y) {
115; CHECK-LABEL: @powl_exp2l(
116; CHECK-NEXT:    [[MUL:%.*]] = fmul fast fp128 [[X:%.*]], [[Y:%.*]]
117; CHECK-NEXT:    [[EXP2:%.*]] = call fast fp128 @llvm.exp2.f128(fp128 [[MUL]])
118; CHECK-NEXT:    ret fp128 [[EXP2]]
119;
120  %call = call fast fp128 @exp2l(fp128 %x) nounwind readnone
121  %pow = call fast fp128 @llvm.pow.f128(fp128 %call, fp128 %y)
122  ret fp128 %pow
123}
124
125define fp128 @powl_exp2l_not_fast(fp128 %x, fp128 %y) {
126; CHECK-LABEL: @powl_exp2l_not_fast(
127; CHECK-NEXT:    [[CALL:%.*]] = call fp128 @exp2l(fp128 [[X:%.*]])
128; CHECK-NEXT:    [[POW:%.*]] = call fast fp128 @llvm.pow.f128(fp128 [[CALL]], fp128 [[Y:%.*]])
129; CHECK-NEXT:    ret fp128 [[POW]]
130;
131  %call = call fp128 @exp2l(fp128 %x)
132  %pow = call fast fp128 @llvm.pow.f128(fp128 %call, fp128 %y)
133  ret fp128 %pow
134}
135
136; TODO: exp10() is not widely enabled by many targets yet.
137
138define float @powf_exp10f(float %x, float %y) {
139; CHECK-LABEL: @powf_exp10f(
140; CHECK-NEXT:    [[CALL:%.*]] = call fast float @exp10f(float [[X:%.*]]) #1
141; CHECK-NEXT:    [[POW:%.*]] = call fast float @llvm.pow.f32(float [[CALL]], float [[Y:%.*]])
142; CHECK-NEXT:    ret float [[POW]]
143;
144  %call = call fast float @exp10f(float %x) nounwind readnone
145  %pow = call fast float @llvm.pow.f32(float %call, float %y)
146  ret float %pow
147}
148
149define double @pow_exp10(double %x, double %y) {
150; CHECK-LABEL: @pow_exp10(
151; CHECK-NEXT:    [[CALL:%.*]] = call fast double @exp10(double [[X:%.*]]) #1
152; CHECK-NEXT:    [[POW:%.*]] = call fast double @llvm.pow.f64(double [[CALL]], double [[Y:%.*]])
153; CHECK-NEXT:    ret double [[POW]]
154;
155  %call = call fast double @exp10(double %x) nounwind readnone
156  %pow = call fast double @llvm.pow.f64(double %call, double %y)
157  ret double %pow
158}
159
160define fp128 @pow_exp10l(fp128 %x, fp128 %y) {
161; CHECK-LABEL: @pow_exp10l(
162; CHECK-NEXT:    [[CALL:%.*]] = call fast fp128 @exp10l(fp128 [[X:%.*]]) #1
163; CHECK-NEXT:    [[POW:%.*]] = call fast fp128 @llvm.pow.f128(fp128 [[CALL]], fp128 [[Y:%.*]])
164; CHECK-NEXT:    ret fp128 [[POW]]
165;
166  %call = call fast fp128 @exp10l(fp128 %x) nounwind readnone
167  %pow = call fast fp128 @llvm.pow.f128(fp128 %call, fp128 %y)
168  ret fp128 %pow
169}
170
171define float @reuse_fast(float %x, float %y, float * %p) {
172; CHECK-LABEL: @reuse_fast(
173; CHECK-NEXT:    [[EXP:%.*]] = call fast float @expf(float [[X:%.*]])
174; CHECK-NEXT:    [[POW:%.*]] = call fast float @powf(float [[EXP]], float [[Y:%.*]])
175; CHECK-NEXT:    store float [[EXP]], float* [[P:%.*]], align 4
176; CHECK-NEXT:    ret float [[POW]]
177;
178  %exp = call fast float @expf(float %x)
179  %pow = call fast float @powf(float %exp, float %y)
180  store float %exp, float *%p, align 4
181  ret float %pow
182}
183
184define fp128 @reuse_libcall(fp128 %x, fp128 %y, fp128 * %p) {
185; CHECK-LABEL: @reuse_libcall(
186; CHECK-NEXT:    [[EXP:%.*]] = call fp128 @expl(fp128 [[X:%.*]])
187; CHECK-NEXT:    [[POW:%.*]] = call fp128 @powl(fp128 [[EXP]], fp128 [[Y:%.*]])
188; CHECK-NEXT:    store fp128 [[EXP]], fp128* [[P:%.*]], align 16
189; CHECK-NEXT:    ret fp128 [[POW]]
190;
191  %exp = call fp128 @expl(fp128 %x)
192  %pow = call fp128 @powl(fp128 %exp, fp128 %y)
193  store fp128 %exp, fp128 *%p, align 16
194  ret fp128 %pow
195}
196
197define double @function_pointer(double ()* %fptr, double %p1) {
198; CHECK-LABEL: @function_pointer(
199; CHECK-NEXT:    [[CALL1:%.*]] = call fast double [[FPTR:%.*]]()
200; CHECK-NEXT:    [[POW:%.*]] = call fast double @llvm.pow.f64(double [[CALL1]], double [[P1:%.*]])
201; CHECK-NEXT:    ret double [[POW]]
202;
203  %call1 = call fast double %fptr()
204  %pow = call fast double @llvm.pow.f64(double %call1, double %p1)
205  ret double %pow
206}
207
208; pow(C,x) -> exp2(log2(C)*x)
209
210declare void @use_d(double)
211declare void @use_f(float)
212
213define double @pow_ok_base(double %e) {
214; CHECK-LABEL: @pow_ok_base(
215; Do not change 0xBFE0776{{.*}} to the exact constant, see PR42740
216; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn double [[E:%.*]], 0xBFE0776{{.*}}
217; CHECK-NEXT:    [[EXP2:%.*]] = call nnan ninf afn double @exp2(double [[MUL]])
218; CHECK-NEXT:    ret double [[EXP2]]
219;
220  %call = tail call afn nnan ninf double @pow(double 0x3FE6666666666666, double %e)
221  ret double %call
222}
223
224define double @pow_ok_base_fast(double %e) {
225; CHECK-LABEL: @pow_ok_base_fast(
226; CHECK-NEXT:    [[MUL:%.*]] = fmul fast double [[E:%.*]], 0xBFE0776{{.*}}
227; CHECK-NEXT:    [[EXP2:%.*]] = call fast double @exp2(double [[MUL]])
228; CHECK-NEXT:    ret double [[EXP2]]
229;
230  %call = tail call fast double @pow(double 0x3FE6666666666666, double %e)
231  ret double %call
232}
233
234define double @pow_ok_base2(double %e) {
235; CHECK-LABEL: @pow_ok_base2(
236; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn double [[E:%.*]], 0x4010952{{.*}}
237; CHECK-NEXT:    [[EXP2:%.*]] = call nnan ninf afn double @exp2(double [[MUL]])
238; CHECK-NEXT:    ret double [[EXP2]]
239;
240  %call = tail call afn nnan ninf double @pow(double 1.770000e+01, double %e)
241  ret double %call
242}
243
244define double @pow_ok_base3(double %e) {
245; CHECK-LABEL: @pow_ok_base3(
246; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn double [[E:%.*]], 0x400AB0B5{{.*}}
247; CHECK-NEXT:    [[EXP2:%.*]] = call nnan ninf afn double @exp2(double [[MUL]])
248; CHECK-NEXT:    ret double [[EXP2]]
249;
250  %call = tail call afn nnan ninf double @pow(double 1.010000e+01, double %e)
251  ret double %call
252}
253
254define double @pow_ok_ten_base(double %e) {
255; CHECK-LABEL: @pow_ok_ten_base(
256; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn double [[E:%.*]], 0x400A934F{{.*}}
257; CHECK-NEXT:    [[EXP2:%.*]] = call nnan ninf afn double @exp2(double [[MUL]])
258; CHECK-NEXT:    ret double [[EXP2]]
259;
260  %call = tail call afn nnan ninf double @pow(double 1.000000e+01, double %e)
261  ret double %call
262}
263
264define double @pow_ok_denorm_base(double %e) {
265; CHECK-LABEL: @pow_ok_denorm_base(
266; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn double [[E:%.*]], 0xC0904800000005C5
267; CHECK-NEXT:    [[EXP2:%.*]] = call nnan ninf afn double @exp2(double [[MUL]])
268; CHECK-NEXT:    ret double [[EXP2]]
269;
270  %call = tail call afn nnan ninf double @pow(double 0x00000000FFFFFFFF, double %e)
271  ret double %call
272}
273
274define float @powf_ok_base(float %e) {
275; CHECK-LABEL: @powf_ok_base(
276; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn float [[E:%.*]], 0xBFE07762{{.*}}
277; CHECK-NEXT:    [[EXP2F:%.*]] = call nnan ninf afn float @exp2f(float [[MUL]])
278; CHECK-NEXT:    ret float [[EXP2F]]
279;
280  %call = tail call afn nnan ninf float @powf(float 0x3FE6666660000000, float %e)
281  ret float %call
282}
283
284define float @powf_ok_base2(float %e) {
285; CHECK-LABEL: @powf_ok_base2(
286; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn float [[E:%.*]], 0x4010952{{.*}}
287; CHECK-NEXT:    [[EXP2F:%.*]] = call nnan ninf afn float @exp2f(float [[MUL]])
288; CHECK-NEXT:    ret float [[EXP2F]]
289;
290  %call = tail call afn nnan ninf float @powf(float 0x4031B33340000000, float %e)
291  ret float %call
292}
293
294define float @powf_ok_base3(float %e) {
295; CHECK-LABEL: @powf_ok_base3(
296; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn float [[E:%.*]], 0x400AB0B5{{.*}}
297; CHECK-NEXT:    [[EXP2F:%.*]] = call nnan ninf afn float @exp2f(float [[MUL]])
298; CHECK-NEXT:    ret float [[EXP2F]]
299;
300  %call = tail call afn nnan ninf float @powf(float 0x4024333340000000, float %e)
301  ret float %call
302}
303
304define float @powf_ok_ten_base(float %e) {
305; CHECK-LABEL: @powf_ok_ten_base(
306; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn float [[E:%.*]], 0x400A934{{.*}}
307; CHECK-NEXT:    [[EXP2F:%.*]] = call nnan ninf afn float @exp2f(float [[MUL]])
308; CHECK-NEXT:    ret float [[EXP2F]]
309;
310  %call = tail call afn nnan ninf float @powf(float 1.000000e+01, float %e)
311  ret float %call
312}
313
314define float @powf_ok_denorm_base(float %e) {
315; CHECK-LABEL: @powf_ok_denorm_base(
316; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn float [[E:%.*]], -1.350000e+02
317; CHECK-NEXT:    [[EXP2F:%.*]] = call nnan ninf afn float @exp2f(float [[MUL]])
318; CHECK-NEXT:    ret float [[EXP2F]]
319;
320  %call = tail call afn nnan ninf float @powf(float 0x3780000000000000, float %e)
321  ret float %call
322}
323
324; Negative tests
325
326define double @pow_zero_base(double %e) {
327; CHECK-LABEL: @pow_zero_base(
328; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @pow(double 0.000000e+00, double [[E:%.*]])
329; CHECK-NEXT:    ret double [[CALL]]
330;
331  %call = tail call afn nnan ninf double @pow(double 0.000000e+00, double %e)
332  ret double %call
333}
334
335define double @pow_zero_base2(double %e) {
336; CHECK-LABEL: @pow_zero_base2(
337; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @pow(double -0.000000e+00, double [[E:%.*]])
338; CHECK-NEXT:    ret double [[CALL]]
339;
340  %call = tail call afn nnan ninf double @pow(double -0.000000e+00, double %e)
341  ret double %call
342}
343
344define double @pow_inf_base(double %e) {
345; CHECK-LABEL: @pow_inf_base(
346; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @pow(double 0x7FF0000000000000, double [[E:%.*]])
347; CHECK-NEXT:    ret double [[CALL]]
348;
349  %call = tail call afn nnan ninf double @pow(double 0x7FF0000000000000, double %e)
350  ret double %call
351}
352
353define double @pow_nan_base(double %e) {
354; CHECK-LABEL: @pow_nan_base(
355; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @pow(double 0x7FF8000000000000, double [[E:%.*]])
356; CHECK-NEXT:    ret double [[CALL]]
357;
358  %call = tail call afn nnan ninf double @pow(double 0x7FF8000000000000, double %e)
359  ret double %call
360}
361
362define double @pow_negative_base(double %e) {
363; CHECK-LABEL: @pow_negative_base(
364; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @pow(double -4.000000e+00, double [[E:%.*]])
365; CHECK-NEXT:    ret double [[CALL]]
366;
367  %call = tail call afn nnan ninf double @pow(double -4.000000e+00, double %e)
368  ret double %call
369}
370
371define double @pow_multiuse(double %e) {
372; CHECK-LABEL: @pow_multiuse(
373; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn double [[E:%.*]], 0x4002934{{.*}}
374; CHECK-NEXT:    [[EXP2:%.*]] = call nnan ninf afn double @exp2(double [[MUL]])
375; CHECK-NEXT:    tail call void @use_d(double [[EXP2]])
376; CHECK-NEXT:    ret double [[EXP2]]
377;
378  %call = tail call afn nnan ninf double @pow(double 5.000000e+00, double %e)
379  tail call void @use_d(double %call)
380  ret double %call
381}
382
383define double @pow_ok_base_no_afn(double %e) {
384; CHECK-LABEL: @pow_ok_base_no_afn(
385; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf double @pow(double 0x3FE6666666666666, double [[E:%.*]])
386; CHECK-NEXT:    ret double [[CALL]]
387;
388  %call = tail call nnan ninf double @pow(double 0x3FE6666666666666, double %e)
389  ret double %call
390}
391
392define double @pow_ok_base_no_nnan(double %e) {
393; CHECK-LABEL: @pow_ok_base_no_nnan(
394; CHECK-NEXT:    [[CALL:%.*]] = tail call ninf afn double @pow(double 0x3FE6666666666666, double [[E:%.*]])
395; CHECK-NEXT:    ret double [[CALL]]
396;
397  %call = tail call afn ninf double @pow(double 0x3FE6666666666666, double %e)
398  ret double %call
399}
400
401define double @pow_ok_base_no_ninf(double %e) {
402; CHECK-LABEL: @pow_ok_base_no_ninf(
403; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan afn double [[E:%.*]], 0xBFE0776{{.*}}
404; CHECK-NEXT:    [[EXP2:%.*]] = call nnan afn double @exp2(double [[MUL]])
405; CHECK-NEXT:    ret double [[EXP2]]
406;
407  %call = tail call afn nnan double @pow(double 0x3FE6666666666666, double %e)
408  ret double %call
409}
410
411define float @powf_zero_base(float %e) {
412; CHECK-LABEL: @powf_zero_base(
413; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @powf(float 0.000000e+00, float [[E:%.*]])
414; CHECK-NEXT:    ret float [[CALL]]
415;
416  %call = tail call afn nnan ninf float @powf(float 0.000000e+00, float %e)
417  ret float %call
418}
419
420define float @powf_zero_base2(float %e) {
421; CHECK-LABEL: @powf_zero_base2(
422; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @powf(float -0.000000e+00, float [[E:%.*]])
423; CHECK-NEXT:    ret float [[CALL]]
424;
425  %call = tail call afn nnan ninf float @powf(float -0.000000e+00, float %e)
426  ret float %call
427}
428
429define float @powf_inf_base(float %e) {
430; CHECK-LABEL: @powf_inf_base(
431; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @powf(float 0x7FF0000000000000, float [[E:%.*]])
432; CHECK-NEXT:    ret float [[CALL]]
433;
434  %call = tail call afn nnan ninf float @powf(float 0x7FF0000000000000, float %e)
435  ret float %call
436}
437
438define float @powf_nan_base(float %e) {
439; CHECK-LABEL: @powf_nan_base(
440; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @powf(float 0x7FF8000000000000, float [[E:%.*]])
441; CHECK-NEXT:    ret float [[CALL]]
442;
443  %call = tail call afn nnan ninf float @powf(float 0x7FF8000000000000, float %e)
444  ret float %call
445}
446
447define float @powf_negative_base(float %e) {
448; CHECK-LABEL: @powf_negative_base(
449; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @powf(float -4.000000e+00, float [[E:%.*]])
450; CHECK-NEXT:    ret float [[CALL]]
451;
452  %call = tail call afn nnan ninf float @powf(float -4.000000e+00, float %e)
453  ret float %call
454}
455
456define float @powf_multiuse(float %e) {
457; CHECK-LABEL: @powf_multiuse(
458; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan ninf afn float [[E:%.*]], 0x4002934{{.*}}
459; CHECK-NEXT:    [[EXP2F:%.*]] = call nnan ninf afn float @exp2f(float [[MUL]])
460; CHECK-NEXT:    tail call void @use_f(float [[EXP2F]])
461; CHECK-NEXT:    ret float [[EXP2F]]
462;
463  %call = tail call afn nnan ninf float @powf(float 5.000000e+00, float %e)
464  tail call void @use_f(float %call)
465  ret float %call
466}
467
468define float @powf_ok_base_no_afn(float %e) {
469; CHECK-LABEL: @powf_ok_base_no_afn(
470; CHECK-NEXT:    [[CALL:%.*]] = tail call float @powf(float 0x3FE6666660000000, float [[E:%.*]])
471; CHECK-NEXT:    ret float [[CALL]]
472;
473  %call = tail call float @powf(float 0x3FE6666660000000, float %e)
474  ret float %call
475}
476
477define fp128 @powl_long_dbl_no_fold(fp128 %e) {
478; CHECK-LABEL: @powl_long_dbl_no_fold(
479; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn fp128 @powl(fp128 0xL00000000000000005001000000000000, fp128 [[E:%.*]])
480; CHECK-NEXT:    ret fp128 [[CALL]]
481;
482  %call = tail call afn nnan ninf fp128 @powl(fp128 0xL00000000000000005001000000000000, fp128 %e)
483  ret fp128 %call
484}
485
486declare float @expf(float)
487declare double @exp(double)
488declare fp128 @expl(fp128)
489declare float @exp2f(float)
490declare double @exp2(double)
491declare fp128 @exp2l(fp128)
492declare float @exp10f(float)
493declare double @exp10(double)
494declare fp128 @exp10l(fp128)
495declare float @powf(float, float)
496declare double @pow(double, double)
497declare fp128 @powl(fp128, fp128)
498declare float @llvm.pow.f32(float, float)
499declare double @llvm.pow.f64(double, double)
500declare fp128 @llvm.pow.f128(fp128, fp128)
501