1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
|
/*
* Function wrappers for mathbench.
*
* Copyright (c) 2022-2024, Arm Limited.
* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
*/
#if WANT_EXPERIMENTAL_MATH
static double
atan2_wrap (double x)
{
return atan2 (5.0, x);
}
static float
atan2f_wrap (float x)
{
return atan2f (5.0f, x);
}
static double
powi_wrap (double x)
{
return __builtin_powi (x, (int) round (x));
}
#endif /* WANT_EXPERIMENTAL_MATH. */
#if __aarch64__ && __linux__
__vpcs static float32x4_t
_Z_sincospif_wrap (float32x4_t x)
{
float s[4], c[4];
_ZGVnN4vl4l4_sincospif (x, s, c);
return vld1q_f32 (s) + vld1q_f32 (c);
}
__vpcs static float64x2_t
_Z_sincospi_wrap (float64x2_t x)
{
double s[2], c[2];
_ZGVnN2vl8l8_sincospi (x, s, c);
return vld1q_f64 (s) + vld1q_f64 (c);
}
__vpcs static float64x2_t
_Z_atan2_wrap (float64x2_t x)
{
return _ZGVnN2vv_atan2 (vdupq_n_f64 (5.0), x);
}
__vpcs static float32x4_t
_Z_atan2f_wrap (float32x4_t x)
{
return _ZGVnN4vv_atan2f (vdupq_n_f32 (5.0f), x);
}
__vpcs static float32x4_t
_Z_hypotf_wrap (float32x4_t x)
{
return _ZGVnN4vv_hypotf (vdupq_n_f32 (5.0f), x);
}
__vpcs static float64x2_t
_Z_hypot_wrap (float64x2_t x)
{
return _ZGVnN2vv_hypot (vdupq_n_f64 (5.0), x);
}
__vpcs static float32x4_t
xy_Z_powf (float32x4_t x)
{
return _ZGVnN4vv_powf (x, x);
}
__vpcs static float32x4_t
x_Z_powf (float32x4_t x)
{
return _ZGVnN4vv_powf (x, vdupq_n_f32 (23.4));
}
__vpcs static float32x4_t
y_Z_powf (float32x4_t x)
{
return _ZGVnN4vv_powf (vdupq_n_f32 (2.34), x);
}
__vpcs static float64x2_t
xy_Z_pow (float64x2_t x)
{
return _ZGVnN2vv_pow (x, x);
}
__vpcs static float64x2_t
x_Z_pow (float64x2_t x)
{
return _ZGVnN2vv_pow (x, vdupq_n_f64 (23.4));
}
__vpcs static float64x2_t
y_Z_pow (float64x2_t x)
{
return _ZGVnN2vv_pow (vdupq_n_f64 (2.34), x);
}
__vpcs static float32x4_t
_Z_modff_wrap (float32x4_t x)
{
float y[4];
float32x4_t ret = _ZGVnN4vl4_modff (x, y);
return ret + vld1q_f32 (y);
}
__vpcs static float64x2_t
_Z_modf_wrap (float64x2_t x)
{
double y[2];
float64x2_t ret = _ZGVnN2vl8_modf (x, y);
return ret + vld1q_f64 (y);
}
__vpcs static float32x4_t
_Z_sincosf_wrap (float32x4_t x)
{
float s[4], c[4];
_ZGVnN4vl4l4_sincosf (x, s, c);
return vld1q_f32 (s) + vld1q_f32 (c);
}
__vpcs static float32x4_t
_Z_cexpif_wrap (float32x4_t x)
{
float32x4x2_t sc = _ZGVnN4v_cexpif (x);
return sc.val[0] + sc.val[1];
}
__vpcs static float64x2_t
_Z_sincos_wrap (float64x2_t x)
{
double s[2], c[2];
_ZGVnN2vl8l8_sincos (x, s, c);
return vld1q_f64 (s) + vld1q_f64 (c);
}
__vpcs static float64x2_t
_Z_cexpi_wrap (float64x2_t x)
{
float64x2x2_t sc = _ZGVnN2v_cexpi (x);
return sc.val[0] + sc.val[1];
}
#endif
#if WANT_SVE_TESTS
static svfloat32_t
_Z_sv_atan2f_wrap (svfloat32_t x, svbool_t pg)
{
return _ZGVsMxvv_atan2f (x, svdup_f32 (5.0f), pg);
}
static svfloat64_t
_Z_sv_atan2_wrap (svfloat64_t x, svbool_t pg)
{
return _ZGVsMxvv_atan2 (x, svdup_f64 (5.0), pg);
}
static svfloat32_t
_Z_sv_hypotf_wrap (svfloat32_t x, svbool_t pg)
{
return _ZGVsMxvv_hypotf (x, svdup_f32 (5.0), pg);
}
static svfloat64_t
_Z_sv_hypot_wrap (svfloat64_t x, svbool_t pg)
{
return _ZGVsMxvv_hypot (x, svdup_f64 (5.0), pg);
}
static svfloat32_t
xy_Z_sv_powf (svfloat32_t x, svbool_t pg)
{
return _ZGVsMxvv_powf (x, x, pg);
}
static svfloat32_t
x_Z_sv_powf (svfloat32_t x, svbool_t pg)
{
return _ZGVsMxvv_powf (x, svdup_f32 (23.4f), pg);
}
static svfloat32_t
y_Z_sv_powf (svfloat32_t x, svbool_t pg)
{
return _ZGVsMxvv_powf (svdup_f32 (2.34f), x, pg);
}
static svfloat64_t
xy_Z_sv_pow (svfloat64_t x, svbool_t pg)
{
return _ZGVsMxvv_pow (x, x, pg);
}
static svfloat64_t
x_Z_sv_pow (svfloat64_t x, svbool_t pg)
{
return _ZGVsMxvv_pow (x, svdup_f64 (23.4), pg);
}
static svfloat64_t
y_Z_sv_pow (svfloat64_t x, svbool_t pg)
{
return _ZGVsMxvv_pow (svdup_f64 (2.34), x, pg);
}
static svfloat32_t
_Z_sv_sincospif_wrap (svfloat32_t x, svbool_t pg)
{
float s[svcntw ()], c[svcntw ()];
_ZGVsMxvl4l4_sincospif (x, s, c, pg);
return svadd_x (pg, svld1 (pg, s), svld1 (pg, c));
}
static svfloat64_t
_Z_sv_sincospi_wrap (svfloat64_t x, svbool_t pg)
{
double s[svcntd ()], c[svcntd ()];
_ZGVsMxvl8l8_sincospi (x, s, c, pg);
return svadd_x (pg, svld1 (pg, s), svld1 (pg, c));
}
static svfloat32_t
_Z_sv_modff_wrap (svfloat32_t x, svbool_t pg)
{
float i[svcntw ()];
svfloat32_t r = _ZGVsMxvl4_modff (x, i, pg);
return svadd_x (pg, r, svld1 (pg, i));
}
static svfloat64_t
_Z_sv_modf_wrap (svfloat64_t x, svbool_t pg)
{
double i[svcntd ()];
svfloat64_t r = _ZGVsMxvl8_modf (x, i, pg);
return svadd_x (pg, r, svld1 (pg, i));
}
static svfloat32_t
_Z_sv_sincosf_wrap (svfloat32_t x, svbool_t pg)
{
float s[svcntw ()], c[svcntw ()];
_ZGVsMxvl4l4_sincosf (x, s, c, pg);
return svadd_x (pg, svld1 (pg, s), svld1 (pg, s));
}
static svfloat32_t
_Z_sv_cexpif_wrap (svfloat32_t x, svbool_t pg)
{
svfloat32x2_t sc = _ZGVsMxv_cexpif (x, pg);
return svadd_x (pg, svget2 (sc, 0), svget2 (sc, 1));
}
static svfloat64_t
_Z_sv_sincos_wrap (svfloat64_t x, svbool_t pg)
{
double s[svcntd ()], c[svcntd ()];
_ZGVsMxvl8l8_sincos (x, s, c, pg);
return svadd_x (pg, svld1 (pg, s), svld1 (pg, s));
}
static svfloat64_t
_Z_sv_cexpi_wrap (svfloat64_t x, svbool_t pg)
{
svfloat64x2_t sc = _ZGVsMxv_cexpi (x, pg);
return svadd_x (pg, svget2 (sc, 0), svget2 (sc, 1));
}
# if WANT_EXPERIMENTAL_MATH
static svfloat32_t
_Z_sv_powi_wrap (svfloat32_t x, svbool_t pg)
{
return _ZGVsMxvv_powi (x, svcvt_s32_f32_x (pg, x), pg);
}
static svfloat64_t
_Z_sv_powk_wrap (svfloat64_t x, svbool_t pg)
{
return _ZGVsMxvv_powk (x, svcvt_s64_f64_x (pg, x), pg);
}
# endif
#endif
#if __aarch64__
static float
sincospif_wrap (float x)
{
float s, c;
arm_math_sincospif (x, &s, &c);
return s + c;
}
static double
sincospi_wrap (double x)
{
double s, c;
arm_math_sincospi (x, &s, &c);
return s + c;
}
#endif
static double
xypow (double x)
{
return pow (x, x);
}
static float
xypowf (float x)
{
return powf (x, x);
}
static double
xpow (double x)
{
return pow (x, 23.4);
}
static float
xpowf (float x)
{
return powf (x, 23.4f);
}
static double
ypow (double x)
{
return pow (2.34, x);
}
static float
ypowf (float x)
{
return powf (2.34f, x);
}
static float
sincosf_wrap (float x)
{
float s, c;
sincosf (x, &s, &c);
return s + c;
}
|