xref: /freebsd/contrib/arm-optimized-routines/pl/math/pl_sig.h (revision 397e83df75e0fcd0d3fcb95ae4d794cb7600fc89)
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 
8 #define V_NAME_F1(fun) _ZGVnN4v_##fun##f
9 #define V_NAME_D1(fun) _ZGVnN2v_##fun
10 #define V_NAME_F2(fun) _ZGVnN4vv_##fun##f
11 #define V_NAME_D2(fun) _ZGVnN2vv_##fun
12 
13 #define SV_NAME_F1(fun) _ZGVsMxv_##fun##f
14 #define SV_NAME_D1(fun) _ZGVsMxv_##fun
15 #define SV_NAME_F2(fun) _ZGVsMxvv_##fun##f
16 #define SV_NAME_D2(fun) _ZGVsMxvv_##fun
17 
18 #define PL_DECL_SF1(fun) float fun##f (float);
19 #define PL_DECL_SF2(fun) float fun##f (float, float);
20 #define PL_DECL_SD1(fun) double fun (double);
21 #define PL_DECL_SD2(fun) double fun (double, double);
22 
23 #if WANT_VMATH
24 # define PL_DECL_VF1(fun)                                                    \
25     VPCS_ATTR float32x4_t V_NAME_F1 (fun##f) (float32x4_t);
26 # define PL_DECL_VF2(fun)                                                    \
27     VPCS_ATTR float32x4_t V_NAME_F2 (fun##f) (float32x4_t, float32x4_t);
28 # define PL_DECL_VD1(fun) VPCS_ATTR float64x2_t V_NAME_D1 (fun) (float64x2_t);
29 # define PL_DECL_VD2(fun)                                                    \
30     VPCS_ATTR float64x2_t V_NAME_D2 (fun) (float64x2_t, float64x2_t);
31 #else
32 # define PL_DECL_VF1(fun)
33 # define PL_DECL_VF2(fun)
34 # define PL_DECL_VD1(fun)
35 # define PL_DECL_VD2(fun)
36 #endif
37 
38 #if WANT_SVE_MATH
39 # define PL_DECL_SVF1(fun)                                                   \
40     svfloat32_t SV_NAME_F1 (fun) (svfloat32_t, svbool_t);
41 # define PL_DECL_SVF2(fun)                                                   \
42     svfloat32_t SV_NAME_F2 (fun) (svfloat32_t, svfloat32_t, svbool_t);
43 # define PL_DECL_SVD1(fun)                                                   \
44     svfloat64_t SV_NAME_D1 (fun) (svfloat64_t, svbool_t);
45 # define PL_DECL_SVD2(fun)                                                   \
46     svfloat64_t SV_NAME_D2 (fun) (svfloat64_t, svfloat64_t, svbool_t);
47 #else
48 # define PL_DECL_SVF1(fun)
49 # define PL_DECL_SVF2(fun)
50 # define PL_DECL_SVD1(fun)
51 # define PL_DECL_SVD2(fun)
52 #endif
53 
54 /* For building the routines, emit function prototype from PL_SIG. This
55    ensures that the correct signature has been chosen (wrong one will be a
56    compile error). PL_SIG is defined differently by various components of the
57    build system to emit entries in the wrappers and entries for mathbench and
58    ulp.  */
59 #define PL_SIG(v, t, a, f, ...) PL_DECL_##v##t##a (f)
60