1*412f47f9SXin Li /* 2*412f47f9SXin Li * PL macros for emitting various ulp/bench entries based on function signature 3*412f47f9SXin Li * 4*412f47f9SXin Li * Copyright (c) 2022-2024, Arm Limited. 5*412f47f9SXin Li * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception. 6*412f47f9SXin Li */ 7*412f47f9SXin Li 8*412f47f9SXin Li #define PL_DECL_SF1(fun) float fun##f (float); 9*412f47f9SXin Li #define PL_DECL_SF2(fun) float fun##f (float, float); 10*412f47f9SXin Li #define PL_DECL_SD1(fun) double fun (double); 11*412f47f9SXin Li #define PL_DECL_SD2(fun) double fun (double, double); 12*412f47f9SXin Li 13*412f47f9SXin Li #if WANT_VMATH 14*412f47f9SXin Li # define V_NAME_F1(fun) _ZGVnN4v_##fun##f 15*412f47f9SXin Li # define V_NAME_D1(fun) _ZGVnN2v_##fun 16*412f47f9SXin Li # define V_NAME_F2(fun) _ZGVnN4vv_##fun##f 17*412f47f9SXin Li # define V_NAME_D2(fun) _ZGVnN2vv_##fun 18*412f47f9SXin Li # define PL_DECL_VF1(fun) \ 19*412f47f9SXin Li VPCS_ATTR float32x4_t V_NAME_F1 (fun##f) (float32x4_t); 20*412f47f9SXin Li # define PL_DECL_VF2(fun) \ 21*412f47f9SXin Li VPCS_ATTR float32x4_t V_NAME_F2 (fun##f) (float32x4_t, float32x4_t); 22*412f47f9SXin Li # define PL_DECL_VD1(fun) VPCS_ATTR float64x2_t V_NAME_D1 (fun) (float64x2_t); 23*412f47f9SXin Li # define PL_DECL_VD2(fun) \ 24*412f47f9SXin Li VPCS_ATTR float64x2_t V_NAME_D2 (fun) (float64x2_t, float64x2_t); 25*412f47f9SXin Li #endif 26*412f47f9SXin Li 27*412f47f9SXin Li #if WANT_SVE_MATH 28*412f47f9SXin Li # define SV_NAME_F1(fun) _ZGVsMxv_##fun##f 29*412f47f9SXin Li # define SV_NAME_D1(fun) _ZGVsMxv_##fun 30*412f47f9SXin Li # define SV_NAME_F2(fun) _ZGVsMxvv_##fun##f 31*412f47f9SXin Li # define SV_NAME_D2(fun) _ZGVsMxvv_##fun 32*412f47f9SXin Li # define PL_DECL_SVF1(fun) \ 33*412f47f9SXin Li svfloat32_t SV_NAME_F1 (fun) (svfloat32_t, svbool_t); 34*412f47f9SXin Li # define PL_DECL_SVF2(fun) \ 35*412f47f9SXin Li svfloat32_t SV_NAME_F2 (fun) (svfloat32_t, svfloat32_t, svbool_t); 36*412f47f9SXin Li # define PL_DECL_SVD1(fun) \ 37*412f47f9SXin Li svfloat64_t SV_NAME_D1 (fun) (svfloat64_t, svbool_t); 38*412f47f9SXin Li # define PL_DECL_SVD2(fun) \ 39*412f47f9SXin Li svfloat64_t SV_NAME_D2 (fun) (svfloat64_t, svfloat64_t, svbool_t); 40*412f47f9SXin Li #endif 41*412f47f9SXin Li 42*412f47f9SXin Li /* For building the routines, emit function prototype from PL_SIG. This 43*412f47f9SXin Li ensures that the correct signature has been chosen (wrong one will be a 44*412f47f9SXin Li compile error). PL_SIG is defined differently by various components of the 45*412f47f9SXin Li build system to emit entries in the wrappers and entries for mathbench and 46*412f47f9SXin Li ulp. */ 47*412f47f9SXin Li #ifndef _PL_SIG 48*412f47f9SXin Li # if defined(EMIT_ULP_FUNCS) 49*412f47f9SXin Li # define _PL_SIG(v, t, a, f, ...) PL_SIG _Z##v##t##a (f) 50*412f47f9SXin Li # elif defined(EMIT_ULP_WRAPPERS) 51*412f47f9SXin Li # define _PL_SIG(v, t, a, f, ...) PL_SIG Z##v##N##t##a##_WRAP (f) 52*412f47f9SXin Li # elif defined(EMIT_MATHBENCH_FUNCS) 53*412f47f9SXin Li # define _PL_SIG(v, t, a, f, ...) PL_SIG _Z##v##t##a (f, ##__VA_ARGS__) 54*412f47f9SXin Li # else 55*412f47f9SXin Li # define _PL_SIG(v, t, a, f, ...) PL_DECL_##v##t##a (f) 56*412f47f9SXin Li # endif 57*412f47f9SXin Li #endif 58*412f47f9SXin Li 59*412f47f9SXin Li #define PL_SIG(...) _PL_SIG (__VA_ARGS__) 60