xref: /freebsd/contrib/arm-optimized-routines/math/test/ulp_wrappers.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1 /*
2  * Function wrappers for ulp.
3  *
4  * Copyright (c) 2022-2023, Arm Limited.
5  * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
6  */
7 
8 /* clang-format off */
9 
10 /* Wrappers for sincos.  */
11 static float sincosf_sinf(float x) {(void)cosf(x); return sinf(x);}
12 static float sincosf_cosf(float x) {(void)sinf(x); return cosf(x);}
13 static double sincos_sin(double x) {(void)cos(x); return sin(x);}
14 static double sincos_cos(double x) {(void)sin(x); return cos(x);}
15 #if USE_MPFR
16 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); }
17 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); }
18 #endif
19 
20 /* Wrappers for vector functions.  */
21 #ifdef __vpcs
22 static float Z_sinf(float x) { return _ZGVnN4v_sinf(argf(x))[0]; }
23 static float Z_cosf(float x) { return _ZGVnN4v_cosf(argf(x))[0]; }
24 static float Z_expf_1u(float x) { return _ZGVnN4v_expf_1u(argf(x))[0]; }
25 static float Z_expf(float x) { return _ZGVnN4v_expf(argf(x))[0]; }
26 static float Z_exp2f_1u(float x) { return _ZGVnN4v_exp2f_1u(argf(x))[0]; }
27 static float Z_exp2f(float x) { return _ZGVnN4v_exp2f(argf(x))[0]; }
28 static float Z_logf(float x) { return _ZGVnN4v_logf(argf(x))[0]; }
29 static float Z_powf(float x, float y) { return _ZGVnN4vv_powf(argf(x),argf(y))[0]; }
30 static double Z_sin(double x) { return _ZGVnN2v_sin(argd(x))[0]; }
31 static double Z_cos(double x) { return _ZGVnN2v_cos(argd(x))[0]; }
32 static double Z_exp(double x) { return _ZGVnN2v_exp(argd(x))[0]; }
33 static double Z_log(double x) { return _ZGVnN2v_log(argd(x))[0]; }
34 static double Z_pow(double x, double y) { return _ZGVnN2vv_pow(argd(x),argd(y))[0]; }
35 #endif
36 
37 /* clang-format on */
38