15
15
16
16
declare float @powf (float , float ) nounwind readonly
17
17
declare double @pow (double , double ) nounwind readonly
18
+ declare <2 x float > @llvm.pow.v2f32 (<2 x float >, <2 x float >) nounwind readonly
19
+ declare <2 x double > @llvm.pow.v2f64 (<2 x double >, <2 x double >) nounwind readonly
18
20
19
21
; Check pow(1.0, x) -> 1.0.
20
22
@@ -25,13 +27,27 @@ define float @test_simplify1(float %x) {
25
27
; CHECK-NEXT: ret float 1.000000e+00
26
28
}
27
29
30
+ define <2 x float > @test_simplify1v (<2 x float > %x ) {
31
+ ; CHECK-LABEL: @test_simplify1v(
32
+ %retval = call <2 x float > @llvm.pow.v2f32 (<2 x float > <float 1 .0 , float 1 .0 >, <2 x float > %x )
33
+ ret <2 x float > %retval
34
+ ; CHECK-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
35
+ }
36
+
28
37
define double @test_simplify2 (double %x ) {
29
38
; CHECK-LABEL: @test_simplify2(
30
39
%retval = call double @pow (double 1 .0 , double %x )
31
40
ret double %retval
32
41
; CHECK-NEXT: ret double 1.000000e+00
33
42
}
34
43
44
+ define <2 x double > @test_simplify2v (<2 x double > %x ) {
45
+ ; CHECK-LABEL: @test_simplify2v(
46
+ %retval = call <2 x double > @llvm.pow.v2f64 (<2 x double > <double 1 .0 , double 1 .0 >, <2 x double > %x )
47
+ ret <2 x double > %retval
48
+ ; CHECK-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
49
+ }
50
+
35
51
; Check pow(2.0, x) -> exp2(x).
36
52
37
53
define float @test_simplify3 (float %x ) {
@@ -42,6 +58,14 @@ define float @test_simplify3(float %x) {
42
58
; CHECK-NEXT: ret float [[EXP2F]]
43
59
}
44
60
61
+ define <2 x float > @test_simplify3v (<2 x float > %x ) {
62
+ ; CHECK-LABEL: @test_simplify3v(
63
+ %retval = call <2 x float > @llvm.pow.v2f32 (<2 x float > <float 2 .0 , float 2 .0 >, <2 x float > %x )
64
+ ; CHECK-NEXT: [[EXP2F:%[a-z0-9]+]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> %x)
65
+ ret <2 x float > %retval
66
+ ; CHECK-NEXT: ret <2 x float> [[EXP2F]]
67
+ }
68
+
45
69
define double @test_simplify4 (double %x ) {
46
70
; CHECK-LABEL: @test_simplify4(
47
71
%retval = call double @pow (double 2 .0 , double %x )
@@ -50,6 +74,14 @@ define double @test_simplify4(double %x) {
50
74
; CHECK-NEXT: ret double [[EXP2]]
51
75
}
52
76
77
+ define <2 x double > @test_simplify4v (<2 x double > %x ) {
78
+ ; CHECK-LABEL: @test_simplify4v(
79
+ %retval = call <2 x double > @llvm.pow.v2f64 (<2 x double > <double 2 .0 , double 2 .0 >, <2 x double > %x )
80
+ ; CHECK-NEXT: [[EXP2:%[a-z0-9]+]] = call <2 x double> @llvm.exp2.v2f64(<2 x double> %x)
81
+ ret <2 x double > %retval
82
+ ; CHECK-NEXT: ret <2 x double> [[EXP2]]
83
+ }
84
+
53
85
; Check pow(x, 0.0) -> 1.0.
54
86
55
87
define float @test_simplify5 (float %x ) {
@@ -59,13 +91,27 @@ define float @test_simplify5(float %x) {
59
91
; CHECK-NEXT: ret float 1.000000e+00
60
92
}
61
93
94
+ define <2 x float > @test_simplify5v (<2 x float > %x ) {
95
+ ; CHECK-LABEL: @test_simplify5v(
96
+ %retval = call <2 x float > @llvm.pow.v2f32 (<2 x float > %x , <2 x float > <float 0 .0 , float 0 .0 >)
97
+ ret <2 x float > %retval
98
+ ; CHECK-NEXT: %retval = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> zeroinitializer)
99
+ }
100
+
62
101
define double @test_simplify6 (double %x ) {
63
102
; CHECK-LABEL: @test_simplify6(
64
103
%retval = call double @pow (double %x , double 0 .0 )
65
104
ret double %retval
66
105
; CHECK-NEXT: ret double 1.000000e+00
67
106
}
68
107
108
+ define <2 x double > @test_simplify6v (<2 x double > %x ) {
109
+ ; CHECK-LABEL: @test_simplify6v(
110
+ %retval = call <2 x double > @llvm.pow.v2f64 (<2 x double > %x , <2 x double > <double 0 .0 , double 0 .0 >)
111
+ ret <2 x double > %retval
112
+ ; CHECK-NEXT: %retval = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> zeroinitializer)
113
+ }
114
+
69
115
; Check pow(x, 0.5) -> fabs(sqrt(x)), where x != -infinity.
70
116
71
117
define float @test_simplify7 (float %x ) {
@@ -115,13 +161,27 @@ define float @test_simplify11(float %x) {
115
161
; CHECK-NEXT: ret float %x
116
162
}
117
163
164
+ define <2 x float > @test_simplify11v (<2 x float > %x ) {
165
+ ; CHECK-LABEL: @test_simplify11v(
166
+ %retval = call <2 x float > @llvm.pow.v2f32 (<2 x float > %x , <2 x float > <float 1 .0 , float 1 .0 >)
167
+ ret <2 x float > %retval
168
+ ; CHECK-NEXT: %retval = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float 1.000000e+00, float 1.000000e+00>)
169
+ }
170
+
118
171
define double @test_simplify12 (double %x ) {
119
172
; CHECK-LABEL: @test_simplify12(
120
173
%retval = call double @pow (double %x , double 1 .0 )
121
174
ret double %retval
122
175
; CHECK-NEXT: ret double %x
123
176
}
124
177
178
+ define <2 x double > @test_simplify12v (<2 x double > %x ) {
179
+ ; CHECK-LABEL: @test_simplify12v(
180
+ %retval = call <2 x double > @llvm.pow.v2f64 (<2 x double > %x , <2 x double > <double 1 .0 , double 1 .0 >)
181
+ ret <2 x double > %retval
182
+ ; CHECK-NEXT: %retval = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
183
+ }
184
+
125
185
; Check pow(x, 2.0) -> x*x.
126
186
127
187
define float @pow2_strict (float %x ) {
@@ -133,6 +193,15 @@ define float @pow2_strict(float %x) {
133
193
ret float %r
134
194
}
135
195
196
+ define <2 x float > @pow2_strictv (<2 x float > %x ) {
197
+ ; CHECK-LABEL: @pow2_strictv(
198
+ ; CHECK-NEXT: [[POW2:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float 2.000000e+00, float 2.000000e+00>)
199
+ ; CHECK-NEXT: ret <2 x float> [[POW2]]
200
+ ;
201
+ %r = call <2 x float > @llvm.pow.v2f32 (<2 x float > %x , <2 x float > <float 2 .0 , float 2 .0 >)
202
+ ret <2 x float > %r
203
+ }
204
+
136
205
define double @pow2_double_strict (double %x ) {
137
206
; CHECK-LABEL: @pow2_double_strict(
138
207
; CHECK-NEXT: [[POW2:%.*]] = fmul double %x, %x
@@ -141,6 +210,14 @@ define double @pow2_double_strict(double %x) {
141
210
%r = call double @pow (double %x , double 2 .0 )
142
211
ret double %r
143
212
}
213
+ define <2 x double > @pow2_double_strictv (<2 x double > %x ) {
214
+ ; CHECK-LABEL: @pow2_double_strictv(
215
+ ; CHECK-NEXT: [[POW2:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 2.000000e+00, double 2.000000e+00>)
216
+ ; CHECK-NEXT: ret <2 x double> [[POW2]]
217
+ ;
218
+ %r = call <2 x double > @llvm.pow.v2f64 (<2 x double > %x , <2 x double > <double 2 .0 , double 2 .0 >)
219
+ ret <2 x double > %r
220
+ }
144
221
145
222
; Don't drop the FMF - PR35601 ( https://bugs.llvm.org/show_bug.cgi?id=35601 )
146
223
@@ -164,6 +241,15 @@ define float @pow_neg1_strict(float %x) {
164
241
ret float %r
165
242
}
166
243
244
+ define <2 x float > @pow_neg1_strictv (<2 x float > %x ) {
245
+ ; CHECK-LABEL: @pow_neg1_strictv(
246
+ ; CHECK-NEXT: [[POWRECIP:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float -1.000000e+00, float -1.000000e+00>)
247
+ ; CHECK-NEXT: ret <2 x float> [[POWRECIP]]
248
+ ;
249
+ %r = call <2 x float > @llvm.pow.v2f32 (<2 x float > %x , <2 x float > <float -1 .0 , float -1 .0 >)
250
+ ret <2 x float > %r
251
+ }
252
+
167
253
define double @pow_neg1_double_fast (double %x ) {
168
254
; CHECK-LABEL: @pow_neg1_double_fast(
169
255
; CHECK-NEXT: [[POWRECIP:%.*]] = fdiv fast double 1.000000e+00, %x
@@ -173,6 +259,15 @@ define double @pow_neg1_double_fast(double %x) {
173
259
ret double %r
174
260
}
175
261
262
+ define <2 x double > @pow_neg1_double_fastv (<2 x double > %x ) {
263
+ ; CHECK-LABEL: @pow_neg1_double_fastv(
264
+ ; CHECK-NEXT: [[POWRECIP:%.*]] = call fast <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double -1.000000e+00, double -1.000000e+00>)
265
+ ; CHECK-NEXT: ret <2 x double> [[POWRECIP]]
266
+ ;
267
+ %r = call fast <2 x double > @llvm.pow.v2f64 (<2 x double > %x , <2 x double > <double -1 .0 , double -1 .0 >)
268
+ ret <2 x double > %r
269
+ }
270
+
176
271
declare double @llvm.pow.f64 (double %Val , double %Power )
177
272
define double @test_simplify17 (double %x ) {
178
273
; CHECK-LABEL: @test_simplify17(
0 commit comments