16
16
17
17
declare float @powf (float , float ) nounwind readonly
18
18
declare double @pow (double , double ) nounwind readonly
19
- declare double @llvm.pow.f64 (double , double )
20
19
declare <2 x float > @llvm.pow.v2f32 (<2 x float >, <2 x float >) nounwind readonly
21
20
declare <2 x double > @llvm.pow.v2f64 (<2 x double >, <2 x double >) nounwind readonly
22
21
@@ -58,18 +57,18 @@ define <2 x double> @test_simplify2v(<2 x double> %x) {
58
57
59
58
define float @test_simplify3 (float %x ) {
60
59
; ANY-LABEL: @test_simplify3(
61
- ; ANY-NEXT: [[EXP2F :%.*]] = call float @exp2f (float [[X:%.*]]) [[NUW_RO:#[0-9]+]]
62
- ; ANY-NEXT: ret float [[EXP2F ]]
60
+ ; ANY-NEXT: [[EXP2 :%.*]] = call float @llvm.exp2.f32 (float [[X:%.*]])
61
+ ; ANY-NEXT: ret float [[EXP2 ]]
63
62
;
64
63
%retval = call float @powf (float 2 .0 , float %x )
65
64
ret float %retval
66
65
}
67
66
67
+ ; TODO: Should result in exp2(-2.0 * x).
68
68
define double @test_simplify3n (double %x ) {
69
69
; ANY-LABEL: @test_simplify3n(
70
- ; ANY-NEXT: [[MUL:%.*]] = fmul double [[X:%.*]], -2.000000e+00
71
- ; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]]) [[NUW_RO]]
72
- ; ANY-NEXT: ret double [[EXP2]]
70
+ ; ANY-NEXT: [[RETVAL:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]])
71
+ ; ANY-NEXT: ret double [[RETVAL]]
73
72
;
74
73
%retval = call double @pow (double 0 .25 , double %x )
75
74
ret double %retval
@@ -84,30 +83,30 @@ define <2 x float> @test_simplify3v(<2 x float> %x) {
84
83
ret <2 x float > %retval
85
84
}
86
85
86
+ ; TODO: Should result in exp2(2.0 * x).
87
87
define <2 x double > @test_simplify3vn (<2 x double > %x ) {
88
88
; ANY-LABEL: @test_simplify3vn(
89
- ; ANY-NEXT: [[MUL:%.*]] = fmul <2 x double> [[X:%.*]], <double 2.000000e+00, double 2.000000e+00>
90
- ; ANY-NEXT: [[EXP2:%.*]] = call <2 x double> @llvm.exp2.v2f64(<2 x double> [[MUL]])
91
- ; ANY-NEXT: ret <2 x double> [[EXP2]]
89
+ ; ANY-NEXT: [[RETVAL:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.000000e+00, double 4.000000e+00>, <2 x double> [[X:%.*]])
90
+ ; ANY-NEXT: ret <2 x double> [[RETVAL]]
92
91
;
93
92
%retval = call <2 x double > @llvm.pow.v2f64 (<2 x double > <double 4 .0 , double 4 .0 >, <2 x double > %x )
94
93
ret <2 x double > %retval
95
94
}
96
95
97
96
define double @test_simplify4 (double %x ) {
98
97
; ANY-LABEL: @test_simplify4(
99
- ; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]]) [[NUW_RO]]
98
+ ; ANY-NEXT: [[EXP2:%.*]] = call double @llvm. exp2.f64 (double [[X:%.*]])
100
99
; ANY-NEXT: ret double [[EXP2]]
101
100
;
102
101
%retval = call double @pow (double 2 .0 , double %x )
103
102
ret double %retval
104
103
}
105
104
105
+ ; TODO: Should result in exp2f(3.0 * x).
106
106
define float @test_simplify4n (float %x ) {
107
107
; ANY-LABEL: @test_simplify4n(
108
- ; ANY-NEXT: [[MUL:%.*]] = fmul float [[X:%.*]], 3.000000e+00
109
- ; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]]) [[NUW_RO]]
110
- ; ANY-NEXT: ret float [[EXP2F]]
108
+ ; ANY-NEXT: [[RETVAL:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]])
109
+ ; ANY-NEXT: ret float [[RETVAL]]
111
110
;
112
111
%retval = call float @powf (float 8 .0 , float %x )
113
112
ret float %retval
@@ -122,11 +121,11 @@ define <2 x double> @test_simplify4v(<2 x double> %x) {
122
121
ret <2 x double > %retval
123
122
}
124
123
124
+ ; TODO: Should result in exp2f(-x).
125
125
define <2 x float > @test_simplify4vn (<2 x float > %x ) {
126
126
; ANY-LABEL: @test_simplify4vn(
127
- ; ANY-NEXT: [[MUL:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
128
- ; ANY-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[MUL]])
129
- ; ANY-NEXT: ret <2 x float> [[EXP2]]
127
+ ; ANY-NEXT: [[RETVAL:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X:%.*]])
128
+ ; ANY-NEXT: ret <2 x float> [[RETVAL]]
130
129
;
131
130
%retval = call <2 x float > @llvm.pow.v2f32 (<2 x float > <float 0 .5 , float 0 .5 >, <2 x float > %x )
132
131
ret <2 x float > %retval
@@ -170,7 +169,7 @@ define <2 x double> @test_simplify6v(<2 x double> %x) {
170
169
171
170
define float @test_simplify7 (float %x ) {
172
171
; ANY-LABEL: @test_simplify7(
173
- ; ANY-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO]]
172
+ ; ANY-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO:#[0-9]+ ]]
174
173
; ANY-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
175
174
; ANY-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000
176
175
; ANY-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]]
@@ -331,6 +330,7 @@ define <2 x double> @pow_neg1_double_fastv(<2 x double> %x) {
331
330
ret <2 x double > %r
332
331
}
333
332
333
+ declare double @llvm.pow.f64 (double %Val , double %Power )
334
334
define double @test_simplify17 (double %x ) {
335
335
; ANY-LABEL: @test_simplify17(
336
336
; ANY-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
0 commit comments