1
1
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2
2
; RUN: opt < %s -instcombine -S | FileCheck %s
3
3
4
+ ; TODO: Should result in expf(x * y).
5
+ define float @powf_expf (float %x , float %y ) {
6
+ ; CHECK-LABEL: @powf_expf(
7
+ ; CHECK-NEXT: [[CALL:%.*]] = call fast float @expf(float [[X:%.*]]) #1
8
+ ; CHECK-NEXT: [[POW:%.*]] = call fast float @llvm.pow.f32(float [[CALL]], float [[Y:%.*]])
9
+ ; CHECK-NEXT: ret float [[POW]]
10
+ ;
11
+ %call = call fast float @expf (float %x ) nounwind readnone
12
+ %pow = call fast float @llvm.pow.f32 (float %call , float %y )
13
+ ret float %pow
14
+ }
15
+
16
+ ; TODO: Should result in intrinsic call to exp().
4
17
define double @pow_exp (double %x , double %y ) {
5
18
; CHECK-LABEL: @pow_exp(
6
19
; CHECK-NEXT: [[MUL:%.*]] = fmul fast double [[X:%.*]], [[Y:%.*]]
@@ -12,6 +25,19 @@ define double @pow_exp(double %x, double %y) {
12
25
ret double %pow
13
26
}
14
27
28
+ ; TODO: Should result in exp2f(x * y).
29
+ define float @powf_exp2f (float %x , float %y ) {
30
+ ; CHECK-LABEL: @powf_exp2f(
31
+ ; CHECK-NEXT: [[CALL:%.*]] = call fast float @exp2f(float [[X:%.*]]) #1
32
+ ; CHECK-NEXT: [[POW:%.*]] = call fast float @llvm.pow.f32(float [[CALL]], float [[Y:%.*]])
33
+ ; CHECK-NEXT: ret float [[POW]]
34
+ ;
35
+ %call = call fast float @exp2f (float %x ) nounwind readnone
36
+ %pow = call fast float @llvm.pow.f32 (float %call , float %y )
37
+ ret float %pow
38
+ }
39
+
40
+ ; TODO: Should result in intrinsic call to exp2().
15
41
define double @pow_exp2 (double %x , double %y ) {
16
42
; CHECK-LABEL: @pow_exp2(
17
43
; CHECK-NEXT: [[MUL:%.*]] = fmul fast double [[X:%.*]], [[Y:%.*]]
@@ -23,6 +49,30 @@ define double @pow_exp2(double %x, double %y) {
23
49
ret double %pow
24
50
}
25
51
52
+ ; TODO: exp10() is not widely enabled by many targets yet.
53
+
54
+ define float @powf_exp10f (float %x , float %y ) {
55
+ ; CHECK-LABEL: @powf_exp10f(
56
+ ; CHECK-NEXT: [[CALL:%.*]] = call fast float @exp10f(float [[X:%.*]]) #1
57
+ ; CHECK-NEXT: [[POW:%.*]] = call fast float @llvm.pow.f32(float [[CALL]], float [[Y:%.*]])
58
+ ; CHECK-NEXT: ret float [[POW]]
59
+ ;
60
+ %call = call fast float @exp10f (float %x ) nounwind readnone
61
+ %pow = call fast float @llvm.pow.f32 (float %call , float %y )
62
+ ret float %pow
63
+ }
64
+
65
+ define double @pow_exp10 (double %x , double %y ) {
66
+ ; CHECK-LABEL: @pow_exp10(
67
+ ; CHECK-NEXT: [[CALL:%.*]] = call fast double @exp10(double [[X:%.*]]) #1
68
+ ; CHECK-NEXT: [[POW:%.*]] = call fast double @llvm.pow.f64(double [[CALL]], double [[Y:%.*]])
69
+ ; CHECK-NEXT: ret double [[POW]]
70
+ ;
71
+ %call = call fast double @exp10 (double %x ) nounwind readnone
72
+ %pow = call fast double @llvm.pow.f64 (double %call , double %y )
73
+ ret double %pow
74
+ }
75
+
26
76
define double @pow_exp_not_fast (double %x , double %y ) {
27
77
; CHECK-LABEL: @pow_exp_not_fast(
28
78
; CHECK-NEXT: [[CALL:%.*]] = call double @exp(double [[X:%.*]])
@@ -46,6 +96,10 @@ define double @function_pointer(double ()* %fptr, double %p1) {
46
96
}
47
97
48
98
declare double @exp (double )
99
+ declare float @expf (float )
49
100
declare double @exp2 (double )
101
+ declare float @exp2f (float )
102
+ declare double @exp10 (double )
103
+ declare float @exp10f (float )
50
104
declare double @llvm.pow.f64 (double , double )
51
-
105
+ declare float @llvm.pow.f32 ( float , float )
0 commit comments