xref: /freebsd/contrib/arm-optimized-routines/pl/math/pl_sig.h (revision fe75646a0234a261c0013bf1840fdac4acaf0cec)
1 /*
2  * PL macros for emitting various ulp/bench entries based on function signature
3  *
4  * Copyright (c) 2022-2023, Arm Limited.
5  * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception.
6  */
7 #define PL_DECL_SF1(fun) float fun##f (float);
8 #define PL_DECL_SF2(fun) float fun##f (float, float);
9 #define PL_DECL_SD1(fun) double fun (double);
10 #define PL_DECL_SD2(fun) double fun (double, double);
11 
12 #if V_SUPPORTED
13 #define PL_DECL_VF1(fun) VPCS_ATTR v_f32_t V_NAME (fun##f) (v_f32_t);
14 #define PL_DECL_VF2(fun) VPCS_ATTR v_f32_t V_NAME (fun##f) (v_f32_t, v_f32_t);
15 #define PL_DECL_VD1(fun) VPCS_ATTR v_f64_t V_NAME (fun) (v_f64_t);
16 #define PL_DECL_VD2(fun) VPCS_ATTR v_f64_t V_NAME (fun) (v_f64_t, v_f64_t);
17 #else
18 #define PL_DECL_VF1(fun)
19 #define PL_DECL_VF2(fun)
20 #define PL_DECL_VD1(fun)
21 #define PL_DECL_VD2(fun)
22 #endif
23 
24 #if SV_SUPPORTED
25 #define PL_DECL_SVF1(fun) sv_f32_t __sv_##fun##f_x (sv_f32_t, svbool_t);
26 #define PL_DECL_SVF2(fun)                                                      \
27   sv_f32_t __sv_##fun##f_x (sv_f32_t, sv_f32_t, svbool_t);
28 #define PL_DECL_SVD1(fun) sv_f64_t __sv_##fun##_x (sv_f64_t, svbool_t);
29 #define PL_DECL_SVD2(fun)                                                      \
30   sv_f64_t __sv_##fun##_x (sv_f64_t, sv_f64_t, svbool_t);
31 #else
32 #define PL_DECL_SVF1(fun)
33 #define PL_DECL_SVF2(fun)
34 #define PL_DECL_SVD1(fun)
35 #define PL_DECL_SVD2(fun)
36 #endif
37 
38 /* For building the routines, emit function prototype from PL_SIG. This
39    ensures that the correct signature has been chosen (wrong one will be a
40    compile error). PL_SIG is defined differently by various components of the
41    build system to emit entries in the wrappers and entries for mathbench and
42    ulp.  */
43 #define PL_SIG(v, t, a, f, ...) PL_DECL_##v##t##a (f)
44