xref: /freebsd/contrib/arm-optimized-routines/math/test/ulp_wrappers.h (revision 9247238cc4b8835892a47701136b0fd073f8d67c)
1 /*
2  * Function wrappers for ulp.
3  *
4  * Copyright (c) 2022, Arm Limited.
5  * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
6  */
7 
8 /* Wrappers for sincos.  */
9 static float sincosf_sinf(float x) {(void)cosf(x); return sinf(x);}
10 static float sincosf_cosf(float x) {(void)sinf(x); return cosf(x);}
11 static double sincos_sin(double x) {(void)cos(x); return sin(x);}
12 static double sincos_cos(double x) {(void)sin(x); return cos(x);}
13 #if USE_MPFR
14 static int sincos_mpfr_sin(mpfr_t y, const mpfr_t x, mpfr_rnd_t r) { mpfr_cos(y,x,r); return mpfr_sin(y,x,r); }
15 static int sincos_mpfr_cos(mpfr_t y, const mpfr_t x, mpfr_rnd_t r) { mpfr_sin(y,x,r); return mpfr_cos(y,x,r); }
16 #endif
17 
18 /* Wrappers for vector functions.  */
19 #if __aarch64__ && WANT_VMATH
20 static float v_sinf(float x) { return __v_sinf(argf(x))[0]; }
21 static float v_cosf(float x) { return __v_cosf(argf(x))[0]; }
22 static float v_expf_1u(float x) { return __v_expf_1u(argf(x))[0]; }
23 static float v_expf(float x) { return __v_expf(argf(x))[0]; }
24 static float v_exp2f_1u(float x) { return __v_exp2f_1u(argf(x))[0]; }
25 static float v_exp2f(float x) { return __v_exp2f(argf(x))[0]; }
26 static float v_logf(float x) { return __v_logf(argf(x))[0]; }
27 static float v_powf(float x, float y) { return __v_powf(argf(x),argf(y))[0]; }
28 static double v_sin(double x) { return __v_sin(argd(x))[0]; }
29 static double v_cos(double x) { return __v_cos(argd(x))[0]; }
30 static double v_exp(double x) { return __v_exp(argd(x))[0]; }
31 static double v_log(double x) { return __v_log(argd(x))[0]; }
32 static double v_pow(double x, double y) { return __v_pow(argd(x),argd(y))[0]; }
33 #ifdef __vpcs
34 static float vn_sinf(float x) { return __vn_sinf(argf(x))[0]; }
35 static float vn_cosf(float x) { return __vn_cosf(argf(x))[0]; }
36 static float vn_expf_1u(float x) { return __vn_expf_1u(argf(x))[0]; }
37 static float vn_expf(float x) { return __vn_expf(argf(x))[0]; }
38 static float vn_exp2f_1u(float x) { return __vn_exp2f_1u(argf(x))[0]; }
39 static float vn_exp2f(float x) { return __vn_exp2f(argf(x))[0]; }
40 static float vn_logf(float x) { return __vn_logf(argf(x))[0]; }
41 static float vn_powf(float x, float y) { return __vn_powf(argf(x),argf(y))[0]; }
42 static double vn_sin(double x) { return __vn_sin(argd(x))[0]; }
43 static double vn_cos(double x) { return __vn_cos(argd(x))[0]; }
44 static double vn_exp(double x) { return __vn_exp(argd(x))[0]; }
45 static double vn_log(double x) { return __vn_log(argd(x))[0]; }
46 static double vn_pow(double x, double y) { return __vn_pow(argd(x),argd(y))[0]; }
47 static float Z_sinf(float x) { return _ZGVnN4v_sinf(argf(x))[0]; }
48 static float Z_cosf(float x) { return _ZGVnN4v_cosf(argf(x))[0]; }
49 static float Z_expf(float x) { return _ZGVnN4v_expf(argf(x))[0]; }
50 static float Z_exp2f(float x) { return _ZGVnN4v_exp2f(argf(x))[0]; }
51 static float Z_logf(float x) { return _ZGVnN4v_logf(argf(x))[0]; }
52 static float Z_powf(float x, float y) { return _ZGVnN4vv_powf(argf(x),argf(y))[0]; }
53 static double Z_sin(double x) { return _ZGVnN2v_sin(argd(x))[0]; }
54 static double Z_cos(double x) { return _ZGVnN2v_cos(argd(x))[0]; }
55 static double Z_exp(double x) { return _ZGVnN2v_exp(argd(x))[0]; }
56 static double Z_log(double x) { return _ZGVnN2v_log(argd(x))[0]; }
57 static double Z_pow(double x, double y) { return _ZGVnN2vv_pow(argd(x),argd(y))[0]; }
58 #endif
59 #endif
60