diff options
73 files changed, 393 insertions, 245 deletions
diff --git a/pl/math/Dir.mk b/pl/math/Dir.mk index 0fe1e67..b866fa4 100644 --- a/pl/math/Dir.mk +++ b/pl/math/Dir.mk @@ -54,7 +54,23 @@ $(B)/test/mathtest.o: CFLAGS_PL += -fmath-errno $(math-host-objs): CC = $(HOST_CC) $(math-host-objs): CFLAGS_PL = $(HOST_CFLAGS) -$(B)/test/ulp.o: $(AOR)/test/ulp.h +build/pl/include/test/ulp_funcs_gen.h: $(math-lib-srcs) + # Replace PL_SIG + cat $^ | grep PL_SIG | $(CC) -xc - -o - -E "-DPL_SIG(v, t, a, f, ...)=_Z##v##t##a(f)" -P > $@ + +build/pl/include/test/mathbench_funcs_gen.h: $(math-lib-srcs) + # Replace PL_SIG macros with mathbench func entries + cat $^ | grep PL_SIG | $(CC) -xc - -o - -E "-DPL_SIG(v, t, a, f, ...)=_Z##v##t##a(f, ##__VA_ARGS__)" -P > $@ + +build/pl/include/test/ulp_wrappers_gen.h: $(math-lib-srcs) + # Replace PL_SIG macros with ULP wrapper declarations + cat $^ | grep PL_SIG | $(CC) -xc - -o - -E "-DPL_SIG(v, t, a, f, ...)=Z##v##N##t##a##_WRAP(f)" -P > $@ + +$(B)/test/ulp.o: $(AOR)/test/ulp.h build/pl/include/test/ulp_funcs_gen.h build/pl/include/test/ulp_wrappers_gen.h +$(B)/test/ulp.o: CFLAGS_PL += -I build/pl/include/test + +$(B)/test/mathbench.o: build/pl/include/test/mathbench_funcs_gen.h +$(B)/test/mathbench.o: CFLAGS_PL += -I build/pl/include/test build/pl/lib/libmathlib.so: $(math-lib-objs:%.o=%.os) $(CC) $(CFLAGS_PL) $(LDFLAGS) -shared -o $@ $^ diff --git a/pl/math/acosh_3u.c b/pl/math/acosh_3u.c index 6ac64f6..e0014d6 100644 --- a/pl/math/acosh_3u.c +++ b/pl/math/acosh_3u.c @@ -5,6 +5,7 @@ */ #include "math_config.h" +#include "pl_sig.h" #define Ln2 (0x1.62e42fefa39efp-1) #define MinusZero (0x8000000000000000) @@ -53,3 +54,5 @@ acosh (double x) double xm1 = x - 1; return log1p (xm1 + sqrt (2 * xm1 + xm1 * xm1)); } + +PL_SIG (S, D, 1, acosh, 1.0, 10.0) diff --git a/pl/math/acoshf_2u8.c b/pl/math/acoshf_2u8.c index fb8d12d..0b1e9c7 100644 --- a/pl/math/acoshf_2u8.c +++ b/pl/math/acoshf_2u8.c @@ -5,6 +5,7 @@ */ #include "math_config.h" +#include "pl_sig.h" #define Ln2 (0x1.62e4p-1f) #define MinusZero 0x80000000 @@ -50,3 +51,5 @@ acoshf (float x) float xm1 = x - 1; return log1pf (xm1 + sqrtf (2 * xm1 + xm1 * xm1)); } + +PL_SIG (S, F, 1, acosh, 1.0, 10.0) diff --git a/pl/math/asinh_2u5.c b/pl/math/asinh_2u5.c index 9cbdd33..bbe6bee 100644 --- a/pl/math/asinh_2u5.c +++ b/pl/math/asinh_2u5.c @@ -4,8 +4,9 @@ * Copyright (c) 2022, Arm Limited. * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "estrin.h" +#include "math_config.h" +#include "pl_sig.h" #define AbsMask 0x7fffffffffffffff #define ExpM26 0x3e50000000000000 /* asuint64(0x1.0p-26). */ @@ -72,3 +73,5 @@ asinh (double x) return asdouble (asuint64 (optr_aor_log_f64 (ax + sqrt (ax * ax + 1))) | sign); } + +PL_SIG (S, D, 1, asinh, -10.0, 10.0) diff --git a/pl/math/asinhf_3u5.c b/pl/math/asinhf_3u5.c index 48acdef..ec3dd9b 100644 --- a/pl/math/asinhf_3u5.c +++ b/pl/math/asinhf_3u5.c @@ -4,8 +4,9 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "estrinf.h" +#include "math_config.h" +#include "pl_sig.h" #define AbsMask (0x7fffffff) #define SqrtFltMax (0x1.749e96p+10f) @@ -66,3 +67,5 @@ asinhf (float x) return asfloat (asuint (optr_aor_log_f32 (ax + sqrtf (ax * ax + 1))) | sign); } + +PL_SIG (S, F, 1, asinh, -10.0, 10.0) diff --git a/pl/math/atan2_2u5.c b/pl/math/atan2_2u5.c index 471c5c9..c1cf7a3 100644 --- a/pl/math/atan2_2u5.c +++ b/pl/math/atan2_2u5.c @@ -7,8 +7,9 @@ #include <stdbool.h> -#include "math_config.h" #include "atan_common.h" +#include "math_config.h" +#include "pl_sig.h" #define Pi (0x1.921fb54442d18p+1) #define PiOver2 (0x1.921fb54442d18p+0) @@ -146,3 +147,6 @@ atan2 (double y, double x) /* Account for the sign of x and y. */ return asdouble (asuint64 (ret) ^ sign_xy); } + +/* Arity of 2 means no mathbench entry emitted. See test/mathbench_funcs.h. */ +PL_SIG (S, D, 2, atan2) diff --git a/pl/math/atan2f_3u.c b/pl/math/atan2f_3u.c index 3fa6296..7780be6 100644 --- a/pl/math/atan2f_3u.c +++ b/pl/math/atan2f_3u.c @@ -7,8 +7,9 @@ #include <stdbool.h> -#include "math_config.h" #include "atanf_common.h" +#include "math_config.h" +#include "pl_sig.h" #define Pi (0x1.921fb6p+1f) #define PiOver2 (0x1.921fb6p+0f) @@ -154,3 +155,6 @@ atan2f (float y, float x) /* Account for the sign of x and y. */ return asfloat (asuint (ret) ^ sign_xy); } + +/* Arity of 2 means no mathbench entry emitted. See test/mathbench_funcs.h. */ +PL_SIG (S, F, 2, atan2) diff --git a/pl/math/atanhf_3u1.c b/pl/math/atanhf_3u1.c index 77795c8..db663bf 100644 --- a/pl/math/atanhf_3u1.c +++ b/pl/math/atanhf_3u1.c @@ -6,6 +6,7 @@ #include "math_config.h" #include "mathlib.h" +#include "pl_sig.h" #define AbsMask 0x7fffffff #define Half 0x3f000000 @@ -74,3 +75,5 @@ atanhf (float x) float ax = asfloat (iax); return halfsign * log1pf_inline ((2 * ax) / (1 - ax)); } + +PL_SIG (S, F, 1, atanh, -1.0, 1.0) diff --git a/pl/math/cbrtf_1u5.c b/pl/math/cbrtf_1u5.c index d544a68..74e7a49 100644 --- a/pl/math/cbrtf_1u5.c +++ b/pl/math/cbrtf_1u5.c @@ -5,10 +5,9 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include <math.h> - -#include "math_config.h" #include "estrinf.h" +#include "math_config.h" +#include "pl_sig.h" #define AbsMask 0x7fffffff #define SignMask 0x80000000 @@ -60,3 +59,5 @@ cbrtf (float x) Which can be done easily using ldexpf. */ return asfloat (asuint (ldexpf (a * T (2 + e % 3), e / 3)) | sign); } + +PL_SIG (S, F, 1, cbrt, -10.0, 10.0) diff --git a/pl/math/cosh_2u.c b/pl/math/cosh_2u.c index 7526cdf..6be189d 100644 --- a/pl/math/cosh_2u.c +++ b/pl/math/cosh_2u.c @@ -6,6 +6,7 @@ */ #include "math_config.h" +#include "pl_sig.h" #define AbsMask 0x7fffffffffffffff #define SpecialBound \ @@ -53,3 +54,5 @@ cosh (double x) double t = __exp_dd (ax, 0); return 0.5 * t + 0.5 / t; } + +PL_SIG (S, D, 1, cosh, -10.0, 10.0) diff --git a/pl/math/coshf_1u9.c b/pl/math/coshf_1u9.c index ca3f767..b9cbe54 100644 --- a/pl/math/coshf_1u9.c +++ b/pl/math/coshf_1u9.c @@ -6,6 +6,7 @@ */ #include "math_config.h" +#include "pl_sig.h" #define AbsMask 0x7fffffff #define TinyBound 0x20000000 /* 0x1p-63: Round to 1 below this. */ @@ -58,3 +59,5 @@ coshf (float x) float t = optr_aor_exp_f32 (ax); return 0.5f * t + 0.5f / t; } + +PL_SIG (S, F, 1, cosh, -10.0, 10.0) diff --git a/pl/math/erfc_4u5.c b/pl/math/erfc_4u5.c index 8088562..b418421 100644 --- a/pl/math/erfc_4u5.c +++ b/pl/math/erfc_4u5.c @@ -5,11 +5,9 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include <stdint.h> -#include <math.h> -#include <errno.h> #include "math_config.h" #include "pairwise_horner.h" +#include "pl_sig.h" #define AbsMask (0x7fffffffffffffff) @@ -145,3 +143,5 @@ erfc (double x) return __math_uflow (0); } } + +PL_SIG (S, D, 1, erfc, -6.0, 28.0) diff --git a/pl/math/erfcf_2u.c b/pl/math/erfcf_2u.c index 8d4bba1..32a96dc 100644 --- a/pl/math/erfcf_2u.c +++ b/pl/math/erfcf_2u.c @@ -7,6 +7,7 @@ #include "erfcf.h" #include "math_config.h" +#include "pl_sig.h" #define P(i) __erfcf_poly_data.poly[i] @@ -120,3 +121,5 @@ erfcf (float x) } return __math_uflowf (0); } + +PL_SIG (S, F, 1, erfc, -4.0, 10.0) diff --git a/pl/math/erff_1u5.c b/pl/math/erff_1u5.c index bad68a6..afa5880 100644 --- a/pl/math/erff_1u5.c +++ b/pl/math/erff_1u5.c @@ -4,13 +4,10 @@ * Copyright (c) 2020-2022, Arm Limited. * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ - -#include <stdint.h> -#include <math.h> - -#include "math_config.h" -#include "hornerf.h" #include "estrinf.h" +#include "hornerf.h" +#include "math_config.h" +#include "pl_sig.h" #define TwoOverSqrtPiMinusOne 0x1.06eba8p-3f #define A __erff_data.erff_poly_A @@ -99,3 +96,5 @@ erff (float x) } return r; } + +PL_SIG (S, F, 1, erf, -4.0, 4.0) diff --git a/pl/math/expm1_2u5.c b/pl/math/expm1_2u5.c index 98ef078..55ddbd1 100644 --- a/pl/math/expm1_2u5.c +++ b/pl/math/expm1_2u5.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "estrin.h" +#include "math_config.h" +#include "pl_sig.h" #define InvLn2 0x1.71547652b82fep0 #define Ln2hi 0x1.62e42fefa39efp-1 @@ -73,3 +74,5 @@ expm1 (double x) /* expm1(x) ~= 2 * (p * t + (t - 1/2)). */ return 2 * fma (p, t, t - 0.5); } + +PL_SIG (S, D, 1, expm1, -9.9, 9.9) diff --git a/pl/math/expm1f_1u6.c b/pl/math/expm1f_1u6.c index 0904652..9c0c178 100644 --- a/pl/math/expm1f_1u6.c +++ b/pl/math/expm1f_1u6.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "hornerf.h" +#include "math_config.h" +#include "pl_sig.h" #define Shift (0x1.8p23f) #define InvLn2 (0x1.715476p+0f) @@ -69,3 +70,5 @@ expm1f (float x) /* expm1(x) ~= 2 * (p * t + (t - 1/2)). */ return 2 * fmaf (p, t, t - 0.5f); } + +PL_SIG (S, F, 1, expm1, -9.9, 9.9) diff --git a/pl/math/log10_2u.c b/pl/math/log10_2u.c index 3330389..b05e17b 100644 --- a/pl/math/log10_2u.c +++ b/pl/math/log10_2u.c @@ -6,9 +6,7 @@ */ #include "math_config.h" -#include <float.h> -#include <math.h> -#include <stdint.h> +#include "pl_sig.h" /* Polynomial coefficients and lookup tables. */ #define T __log10_data.tab @@ -143,3 +141,5 @@ log10l (long double x) #endif #endif // clang-format on + +PL_SIG (S, D, 1, log10, 0.01, 11.1) diff --git a/pl/math/log10f.c b/pl/math/log10f.c index 79f5d12..ea67b4b 100644 --- a/pl/math/log10f.c +++ b/pl/math/log10f.c @@ -6,6 +6,7 @@ */ #include "math_config.h" +#include "pl_sig.h" #include <math.h> #include <stdint.h> @@ -84,7 +85,12 @@ log10f (float x) return eval_as_float (y); } + +// clang-format off #if USE_GLIBC_ABI strong_alias (log10f, __log10f_finite) hidden_alias (log10f, __ieee754_log10f) #endif + +PL_SIG (S, F, 1, log10, 0.01, 11.1) + // clang-format on diff --git a/pl/math/log1p_2u.c b/pl/math/log1p_2u.c index ade5d87..20b4811 100644 --- a/pl/math/log1p_2u.c +++ b/pl/math/log1p_2u.c @@ -4,8 +4,9 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "estrin.h" +#include "math_config.h" +#include "pl_sig.h" #define Ln2Hi 0x1.62e42fefa3800p-1 #define Ln2Lo 0x1.ef35793c76730p-45 @@ -120,3 +121,5 @@ log1p (double x) double y = fma (Ln2Lo, kd, cm); return y + fma (Ln2Hi, kd, p); } + +PL_SIG (S, D, 1, log1p, -0.9, 10.0) diff --git a/pl/math/log1pf_2u1.c b/pl/math/log1pf_2u1.c index 9b7cb94..97dd1c4 100644 --- a/pl/math/log1pf_2u1.c +++ b/pl/math/log1pf_2u1.c @@ -4,8 +4,9 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "hornerf.h" +#include "math_config.h" +#include "pl_sig.h" #define Ln2 (0x1.62e43p-1f) #define SignMask (0x80000000) @@ -149,3 +150,5 @@ log1pf (float x) /* Apply the scaling back. */ return fmaf (scale_back, Ln2, p); } + +PL_SIG (S, F, 1, log1p, -0.9, 10.0) diff --git a/pl/math/pl_sig.h b/pl/math/pl_sig.h new file mode 100644 index 0000000..e9f54c0 --- /dev/null +++ b/pl/math/pl_sig.h @@ -0,0 +1,43 @@ +/* + * PL macros for emitting various ulp/bench entries based on function signature + * + * Copyright (c) 2022, Arm Limited. + * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception. + */ +#define PL_DECL_SF1(fun) float fun##f (float); +#define PL_DECL_SF2(fun) float fun##f (float, float); +#define PL_DECL_SD1(fun) double fun (double); +#define PL_DECL_SD2(fun) double fun (double, double); + +#if V_SUPPORTED +#define PL_DECL_VF1(fun) VPCS_ATTR v_f32_t V_NAME (fun##f) (v_f32_t); +#define PL_DECL_VF2(fun) VPCS_ATTR v_f32_t V_NAME (fun##f) (v_f32_t, v_f32_t); +#define PL_DECL_VD1(fun) VPCS_ATTR v_f64_t V_NAME (fun) (v_f64_t); +#define PL_DECL_VD2(fun) VPCS_ATTR v_f64_t V_NAME (fun) (v_f64_t, v_f64_t); +#else +#define PL_DECL_VF1(fun) +#define PL_DECL_VF2(fun) +#define PL_DECL_VD1(fun) +#define PL_DECL_VD2(fun) +#endif + +#if SV_SUPPORTED +#define PL_DECL_SVF1(fun) sv_f32_t __sv_##fun##f_x (sv_f32_t, svbool_t); +#define PL_DECL_SVF2(fun) \ + sv_f32_t __sv_##fun##f_x (sv_f32_t, sv_f32_t, svbool_t); +#define PL_DECL_SVD1(fun) sv_f64_t __sv_##fun##_x (sv_f64_t, svbool_t); +#define PL_DECL_SVD2(fun) \ + sv_f64_t __sv_##fun##_x (sv_f64_t, sv_f64_t, svbool_t); +#else +#define PL_DECL_SVF1(fun) +#define PL_DECL_SVF2(fun) +#define PL_DECL_SVD1(fun) +#define PL_DECL_SVD2(fun) +#endif + +/* For building the routines, emit function prototype from PL_SIG. This + ensures that the correct signature has been chosen (wrong one will be a + compile error). PL_SIG is defined differently by various components of the + build system to emit entries in the wrappers and entries for mathbench and + ulp. */ +#define PL_SIG(v, t, a, f, ...) PL_DECL_##v##t##a (f) diff --git a/pl/math/sinh_3u.c b/pl/math/sinh_3u.c index ce3ff13..f56b8d0 100644 --- a/pl/math/sinh_3u.c +++ b/pl/math/sinh_3u.c @@ -6,6 +6,7 @@ */ #include "math_config.h" +#include "pl_sig.h" #define AbsMask 0x7fffffffffffffff #define Half 0x3fe0000000000000 @@ -53,3 +54,5 @@ sinh (double x) (t + t / (t + 1)) / -2 for x < 0. */ return (t + t / (t + 1)) * halfsign; } + +PL_SIG (S, D, 1, sinh, -10.0, 10.0) diff --git a/pl/math/sinhf_2u3.c b/pl/math/sinhf_2u3.c index c616dac..cb5eb51 100644 --- a/pl/math/sinhf_2u3.c +++ b/pl/math/sinhf_2u3.c @@ -6,6 +6,7 @@ */ #include "math_config.h" +#include "pl_sig.h" #define AbsMask 0x7fffffff #define Half 0x3f000000 @@ -63,3 +64,5 @@ sinhf (float x) (t + t / (t + 1)) / -2 for x < 0. */ return (t + t / (t + 1)) * halfsign; } + +PL_SIG (S, F, 1, sinh, -10.0, 10.0) diff --git a/pl/math/sv_atan2_2u5.c b/pl/math/sv_atan2_2u5.c index bc98ccd..c047595 100644 --- a/pl/math/sv_atan2_2u5.c +++ b/pl/math/sv_atan2_2u5.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #include "sv_atan_common.h" @@ -79,4 +81,7 @@ __sv_atan2_x (sv_f64_t y, sv_f64_t x, const svbool_t pg) strong_alias (__sv_atan2_x, _ZGVsMxvv_atan2) + /* Arity of 2 means no mathbench entry emitted. See test/mathbench_funcs.h. + */ + PL_SIG (SV, D, 2, atan2) #endif diff --git a/pl/math/sv_atan2f_3u.c b/pl/math/sv_atan2f_3u.c index 5f93c49..0ce7071 100644 --- a/pl/math/sv_atan2f_3u.c +++ b/pl/math/sv_atan2f_3u.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #include "sv_atanf_common.h" @@ -80,4 +82,7 @@ __sv_atan2f_x (sv_f32_t y, sv_f32_t x, const svbool_t pg) strong_alias (__sv_atan2f_x, _ZGVsMxvv_atan2f) + /* Arity of 2 means no mathbench entry emitted. See test/mathbench_funcs.h. + */ + PL_SIG (SV, F, 2, atan2) #endif diff --git a/pl/math/sv_atan_2u5.c b/pl/math/sv_atan_2u5.c index 49c5e82..4f52b43 100644 --- a/pl/math/sv_atan_2u5.c +++ b/pl/math/sv_atan_2u5.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #include "sv_atan_common.h" @@ -49,4 +51,5 @@ __sv_atan_x (sv_f64_t x, const svbool_t pg) strong_alias (__sv_atan_x, _ZGVsMxv_atan) + PL_SIG (SV, D, 1, atan, -3.1, 3.1) #endif diff --git a/pl/math/sv_atanf_2u9.c b/pl/math/sv_atanf_2u9.c index d195ca5..db15830 100644 --- a/pl/math/sv_atanf_2u9.c +++ b/pl/math/sv_atanf_2u9.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #include "sv_atanf_common.h" @@ -46,4 +48,5 @@ __sv_atanf_x (sv_f32_t x, const svbool_t pg) strong_alias (__sv_atanf_x, _ZGVsMxv_atanf) + PL_SIG (SV, F, 1, atan, -3.1, 3.1) #endif diff --git a/pl/math/sv_cos_2u5.c b/pl/math/sv_cos_2u5.c index 483c73f..a19be9b 100644 --- a/pl/math/sv_cos_2u5.c +++ b/pl/math/sv_cos_2u5.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #define InvPio2 (sv_f64 (0x1.45f306dc9c882p-1)) @@ -74,4 +76,5 @@ __sv_cos_x (sv_f64_t x, const svbool_t pg) strong_alias (__sv_cos_x, _ZGVsMxv_cos) + PL_SIG (SV, D, 1, cos, -3.1, 3.1) #endif diff --git a/pl/math/sv_cosf_2u1.c b/pl/math/sv_cosf_2u1.c index 70057ea..3bc3d71 100644 --- a/pl/math/sv_cosf_2u1.c +++ b/pl/math/sv_cosf_2u1.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #define NegPio2_1 (sv_f32 (-0x1.921fb6p+0f)) @@ -72,4 +74,5 @@ __sv_cosf_x (sv_f32_t x, const svbool_t pg) strong_alias (__sv_cosf_x, _ZGVsMxv_cosf) + PL_SIG (SV, F, 1, cos, -3.1, 3.1) #endif diff --git a/pl/math/sv_erf_2u5.c b/pl/math/sv_erf_2u5.c index 1265047..eac500c 100644 --- a/pl/math/sv_erf_2u5.c +++ b/pl/math/sv_erf_2u5.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #define Scale (8.0) @@ -87,4 +89,5 @@ __sv_erf_x (sv_f64_t x, const svbool_t pg) strong_alias (__sv_erf_x, _ZGVsMxv_erf) + PL_SIG (SV, D, 1, erf, -4.0, 4.0) #endif diff --git a/pl/math/sv_erfc_4u.c b/pl/math/sv_erfc_4u.c index 33c1c62..41fb654 100644 --- a/pl/math/sv_erfc_4u.c +++ b/pl/math/sv_erfc_4u.c @@ -6,6 +6,7 @@ */ #include "sv_math.h" +#include "pl_sig.h" #if SV_SUPPORTED #include "sv_exp_tail.h" @@ -133,4 +134,5 @@ __sv_erfc_x (sv_f64_t x, const svbool_t pg) strong_alias (__sv_erfc_x, _ZGVsMxv_erfc) + PL_SIG (SV, D, 1, erfc, -4.0, 10.0) #endif diff --git a/pl/math/sv_erff_1u3.c b/pl/math/sv_erff_1u3.c index f0af98e..02d7625 100644 --- a/pl/math/sv_erff_1u3.c +++ b/pl/math/sv_erff_1u3.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #define AbsMask (0x7fffffff) @@ -88,4 +90,5 @@ __sv_erff_x (sv_f32_t x, const svbool_t pg) strong_alias (__sv_erff_x, _ZGVsMxv_erff) + PL_SIG (SV, F, 1, erf, -4.0, 4.0) #endif diff --git a/pl/math/sv_expf_2u.c b/pl/math/sv_expf_2u.c index 9ae9d60..d301392 100644 --- a/pl/math/sv_expf_2u.c +++ b/pl/math/sv_expf_2u.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #define C(i) __sv_expf_poly[i] @@ -140,4 +142,5 @@ __sv_expf_x (sv_f32_t x, const svbool_t pg) strong_alias (__sv_expf_x, _ZGVsMxv_expf) + PL_SIG (SV, F, 1, exp, -9.9, 9.9) #endif // SV_SUPPORTED diff --git a/pl/math/sv_log10_2u5.c b/pl/math/sv_log10_2u5.c index 92dbfa4..d6ed49a 100644 --- a/pl/math/sv_log10_2u5.c +++ b/pl/math/sv_log10_2u5.c @@ -5,8 +5,9 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "sv_math.h" +#include "math_config.h" +#include "pl_sig.h" #if SV_SUPPORTED @@ -76,4 +77,5 @@ __sv_log10_x (sv_f64_t x, const svbool_t pg) strong_alias (__sv_log10_x, _ZGVsMxv_log10) + PL_SIG (SV, D, 1, log10, 0.01, 11.1) #endif diff --git a/pl/math/sv_log10f_3u5.c b/pl/math/sv_log10f_3u5.c index fe8ecfd..c1ff196 100644 --- a/pl/math/sv_log10f_3u5.c +++ b/pl/math/sv_log10f_3u5.c @@ -6,6 +6,7 @@ */ #include "sv_math.h" +#include "pl_sig.h" #if SV_SUPPORTED @@ -75,4 +76,5 @@ __sv_log10f_x (sv_f32_t x, const svbool_t pg) strong_alias (__sv_log10f_x, _ZGVsMxv_log10f) + PL_SIG (SV, F, 1, log10, 0.01, 11.1) #endif diff --git a/pl/math/sv_log_2u5.c b/pl/math/sv_log_2u5.c index c10299c..a50c3d6 100644 --- a/pl/math/sv_log_2u5.c +++ b/pl/math/sv_log_2u5.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #define A(i) __sv_log_data.poly[i] @@ -71,4 +73,5 @@ __sv_log_x (sv_f64_t x, const svbool_t pg) strong_alias (__sv_log_x, _ZGVsMxv_log); +PL_SIG (SV, D, 1, log, 0.01, 11.1) #endif // SV_SUPPORTED diff --git a/pl/math/sv_logf_3u4.c b/pl/math/sv_logf_3u4.c index 125f806..e9147e4 100644 --- a/pl/math/sv_logf_3u4.c +++ b/pl/math/sv_logf_3u4.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #define P(i) __sv_logf_poly[i] @@ -63,4 +65,5 @@ __sv_logf_x (sv_f32_t x, const svbool_t pg) strong_alias (__sv_logf_x, _ZGVsMxv_logf) + PL_SIG (SV, F, 1, log, 0.01, 11.1) #endif // SV_SUPPORTED diff --git a/pl/math/sv_sin_3u.c b/pl/math/sv_sin_3u.c index be873a2..4d879e0 100644 --- a/pl/math/sv_sin_3u.c +++ b/pl/math/sv_sin_3u.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #define InvPi (sv_f64 (0x1.45f306dc9c883p-2)) @@ -79,4 +81,5 @@ __sv_sin_x (sv_f64_t x, const svbool_t pg) strong_alias (__sv_sin_x, _ZGVsMxv_sin) + PL_SIG (SV, D, 1, sin, -3.1, 3.1) #endif diff --git a/pl/math/sv_sinf_1u9.c b/pl/math/sv_sinf_1u9.c index f7913ca..5634a87 100644 --- a/pl/math/sv_sinf_1u9.c +++ b/pl/math/sv_sinf_1u9.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED #define A3 (sv_f32 (__sv_sinf_data.coeffs[3])) @@ -74,4 +76,5 @@ __sv_sinf_x (sv_f32_t x, const svbool_t pg) strong_alias (__sv_sinf_x, _ZGVsMxv_sinf) + PL_SIG (SV, F, 1, sin, -3.1, 3.1) #endif diff --git a/pl/math/sv_tanf_3u2.c b/pl/math/sv_tanf_3u2.c index e1d3757..2f28239 100644 --- a/pl/math/sv_tanf_3u2.c +++ b/pl/math/sv_tanf_3u2.c @@ -6,6 +6,8 @@ */ #include "sv_math.h" +#include "pl_sig.h" + #if SV_SUPPORTED /* Constants. */ @@ -98,4 +100,5 @@ __sv_tanf_x (sv_f32_t x, const svbool_t pg) strong_alias (__sv_tanf_x, _ZGVsMxv_tanf) + PL_SIG (SV, F, 1, tan, -3.1, 3.1) #endif diff --git a/pl/math/tanf_3u3.c b/pl/math/tanf_3u3.c index e6f899f..3e4ad38 100644 --- a/pl/math/tanf_3u3.c +++ b/pl/math/tanf_3u3.c @@ -5,6 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ #include "math_config.h" +#include "pl_sig.h" /* Useful constants. */ #define NegPio2_1 (-0x1.921fb6p+0f) @@ -190,3 +191,5 @@ tanf (float x) /* A unified way of assembling the result on both interval types. */ return fmaf (scale, p, offset); } + +PL_SIG (S, F, 1, tan, -3.1, 3.1) diff --git a/pl/math/tanhf_2u6.c b/pl/math/tanhf_2u6.c index 145f437..90f561f 100644 --- a/pl/math/tanhf_2u6.c +++ b/pl/math/tanhf_2u6.c @@ -5,6 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ #include "math_config.h" +#include "pl_sig.h" #define BoringBound \ 0x41102cb3 /* 0x1.205966p+3, above which tanhf rounds to 1 (or -1 for \ @@ -78,3 +79,5 @@ tanhf (float x) float q = expm1f_inline (2 * x); return q / (q + 2); } + +PL_SIG (S, F, 1, tanh, -10.0, 10.0) diff --git a/pl/math/test/mathbench_funcs.h b/pl/math/test/mathbench_funcs.h index 9e3b9a0..e3eda6f 100644 --- a/pl/math/test/mathbench_funcs.h +++ b/pl/math/test/mathbench_funcs.h @@ -6,86 +6,64 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ +#define _ZSF1(fun, a, b) F(fun##f, a, b) +#define _ZSD1(f, a, b) D(f, a, b) + #ifdef __vpcs -#define ZVNF(f, a, b) F(__s_##f, a, b) VF(__v_##f, a, b) VNF(__vn_##f, a, b) VNF(_ZGVnN4v_##f, a, b) -#define ZVND(f, a, b) D(__s_##f, a, b) VD(__v_##f, a, b) VND(__vn_##f, a, b) VND(_ZGVnN2v_##f, a, b) +#define _ZVF1(fun, a, b) F(__s_##fun##f, a, b) VF(__v_##fun##f, a, b) VNF(__vn_##fun##f, a, b) VNF(_ZGVnN4v_##fun##f, a, b) +#define _ZVD1(f, a, b) D(__s_##f, a, b) VD(__v_##f, a, b) VND(__vn_##f, a, b) VND(_ZGVnN2v_##f, a, b) #elif __aarch64__ -#define ZVNF(f, a, b) F(__s_##f, a, b) VF(__v_##f, a, b) -#define ZVND(f, a, b) D(__s_##f, a, b) VD(__v_##f, a, b) +#define _ZVF1(fun, a, b) F(__s_##fun##f, a, b) VF(__v_##fun##f, a, b) +#define _ZVD1(f, a, b) D(__s_##f, a, b) VD(__v_##f, a, b) + +#elif WANT_VMATH + +#define _ZVF1(fun, a, b) F(__s_##fun##f, a, b) +#define _ZVD1(f, a, b) D(__s_##f, a, b) + +#else + +#define _ZVF1(f, a, b) +#define _ZVD1(f, a, b) + +#endif + +#if WANT_SVE_MATH + +#define _ZSVF1(fun, a, b) SVF(__sv_##fun##f_x, a, b) SVF(_ZGVsMxv_##fun##f, a, b) +#define _ZSVD1(f, a, b) SVD(__sv_##f##_x, a, b) SVD(_ZGVsMxv_##f, a, b) #else -#define ZVNF(f, a, b) F(__s_##f, a, b) -#define ZVND(f, a, b) D(__s_##f, a, b) +#define _ZSVF1(f, a, b) +#define _ZSVD1(f, a, b) #endif -#define VZSVF(f, a, b) SVF(__sv_##f##_x, a, b) SVF(_ZGVsMxv_##f, a, b) -#define VZSVD(f, a, b) SVD(__sv_##f##_x, a, b) SVD(_ZGVsMxv_##f, a, b) +/* No auto-generated wrappers for binary functions - they have be + manually defined in mathbench_wrappers.h. We have to define silent + macros for them anyway as they will be emitted by PL_SIG. */ +#define _ZSF2(...) +#define _ZSD2(...) +#define _ZVF2(...) +#define _ZVD2(...) +#define _ZSVF2(...) +#define _ZSVD2(...) + +#include "mathbench_funcs_gen.h" + +/* PL_SIG only emits entries for unary functions, since if a function + needs to be wrapped in mathbench there is no way for it to know the + same of the wrapper. Add entries for binary functions, or any other + exotic signatures that need wrapping, below. */ -F (acoshf, 1.0, 10.0) -F (asinhf, -10.0, 10.0) -F (atanf, -10.0, 10.0) {"atan2f", 'f', 0, -10.0, 10.0, {.f = atan2f_wrap}}, -F (atanhf, -1.0, 1.0) -F (cbrtf, -10.0, 10.0) -F (cosf, -3.1, 3.1) -F (coshf, -10.0, 10.0) -F (erfcf, -4.0, 10.0) -F (erff, -4.0, 4.0) -F (expm1f, -9.9, 9.9) -F (log10f, 0.01, 11.1) -F (log1pf, -0.9, 10.0) -F (log2f, 0.01, 11.1) -F (sinf, -3.1, 3.1) -F (sinhf, -10.0, 10.0) -F (tanf, -3.1, 3.1) -F (tanhf, -10.0, 10.0) - -D (acosh, 1.0, 10.0) -D (asinh, -10.0, 10.0) -D (atan, -10.0, 10.0) {"atan2", 'd', 0, -10.0, 10.0, {.d = atan2_wrap}}, -D (cos, -3.1, 3.1) -D (cosh, -10.0, 10.0) -D (erf, -6,6) -D (erfc, -6.0, 28.0) -D (expm1, -9.9, 9.9) -D (log10, 0.01, 11.1) -D (log1p, -0.9, 10.0) -D (log2, 0.01, 11.1) {"powi", 'd', 0, 0.01, 11.1, {.d = powi_wrap}}, -D (sin, -3.1, 3.1) -D (sinh, -10.0, 10.0) - -#if WANT_VMATH -ZVNF (asinhf, -10.0, 10.0) -ZVND (asinh, -10.0, 10.0) -ZVNF (atanf, -10.0, 10.0) -ZVNF (atanhf, -1.0, 1.0) -ZVND (atan, -10.0, 10.0) -ZVNF (cbrtf, -10.0, 10.0) -ZVNF (coshf, -10.0, 10.0) -ZVND (cosh, -10.0, 10.0) -ZVNF (erff, -4.0, 4.0) -ZVND (erf, -6.0, 6.0) -ZVNF (erfcf, -6.0, 28.0) -ZVND (erfc, -6.0, 28.0) -ZVNF (expm1f, -9.9, 9.9) -ZVND (expm1, -9.9, 9.9) -ZVNF (log10f, 0.01, 11.1) -ZVND (log10, 0.01, 11.1) -ZVNF (log1pf, -0.9, 10.0) -ZVND (log1p, -0.9, 10.0) -ZVNF (log2f, 0.01, 11.1) -ZVND (log2, 0.01, 11.1) -ZVNF (sinhf, -10.0, 10.0) -ZVND (sinh, -10.0, 10.0) -ZVNF (tanf, -3.1, 3.1) -ZVNF (tanhf, -10.0, 10.0) + {"__s_atan2f", 'f', 0, -10.0, 10.0, {.f = __s_atan2f_wrap}}, {"__s_atan2", 'd', 0, -10.0, 10.0, {.d = __s_atan2_wrap}}, {"__v_atan2f", 'f', 'v', -10.0, 10.0, {.vf = __v_atan2f_wrap}}, @@ -96,30 +74,13 @@ ZVNF (tanhf, -10.0, 10.0) {"_ZGVnN2vv_atan2", 'd', 'n', -10.0, 10.0, {.vnd = _Z_atan2_wrap}}, #if WANT_SVE_MATH -VZSVF (atanf, -3.1, 3.1) -VZSVD (atan, -3.1, 3.1) {"__sv_atan2f_x", 'f', 'n', -10.0, 10.0, {.svf = __sv_atan2f_wrap}}, {"_ZGVsMxvv_atan2f", 'f', 'n', -10.0, 10.0, {.svf = _Z_sv_atan2f_wrap}}, {"__sv_atan2_x", 'd', 'n', -10.0, 10.0, {.svd = __sv_atan2_wrap}}, {"_ZGVsM2vv_atan2", 'd', 'n', -10.0, 10.0, {.svd = _Z_sv_atan2_wrap}}, -VZSVF (erff, -4.0, 4.0) -VZSVD (erf, -4.0, 4.0) -VZSVD (erfc, -4, 10) -VZSVF (expf, -9.9, 9.9) -VZSVF (cosf, -3.1, 3.1) -VZSVD (cos, -3.1, 3.1) -VZSVF (sinf, -3.1, 3.1) -VZSVD (sin, -3.1, 3.1) -VZSVF (logf, 0.01, 11.1) -VZSVD (log, 0.01, 11.1) -VZSVF (log10f, 0.01, 11.1) -VZSVD (log10, 0.01, 11.1) -VZSVF (tanf, -3.1, 3.1) {"__sv_powif_x", 'f', 'n', -10.0, 10.0, {.svf = __sv_powif_wrap}}, {"_ZGVsMxvv_powi", 'f', 'n', -10.0, 10.0, {.svf = _Z_sv_powi_wrap}}, {"__sv_powi_x", 'd', 'n', -10.0, 10.0, {.svd = __sv_powi_wrap}}, {"_ZGVsMxvv_powk", 'd', 'n', -10.0, 10.0, {.svd = _Z_sv_powk_wrap}}, - -#endif #endif // clang-format on diff --git a/pl/math/test/ulp_funcs.h b/pl/math/test/ulp_funcs.h index 86e2bed..af1c464 100644 --- a/pl/math/test/ulp_funcs.h +++ b/pl/math/test/ulp_funcs.h @@ -7,103 +7,60 @@ #ifdef __vpcs -#define _ZVNF1(f) SF1 (f) VF1 (f) ZVNF1 (f) -#define _ZVND1(f) SD1 (f) VD1 (f) ZVND1 (f) -#define _ZVNF2(f) SF2 (f) VF2 (f) ZVNF2 (f) -#define _ZVND2(f) SD2 (f) VD2 (f) ZVND2 (f) +#define _ZVF1(f) SF1 (f) VF1 (f) ZVNF1 (f) +#define _ZVD1(f) SD1 (f) VD1 (f) ZVND1 (f) +#define _ZVF2(f) SF2 (f) VF2 (f) ZVNF2 (f) +#define _ZVD2(f) SD2 (f) VD2 (f) ZVND2 (f) #elif __aarch64 -#define _ZVNF1(f) SF1 (f) VF1 (f) -#define _ZVND1(f) SD1 (f) VD1 (f) -#define _ZVNF2(f) SF2 (f) VF2 (f) -#define _ZVND2(f) SD2 (f) VD2 (f) +#define _ZVF1(f) SF1 (f) VF1 (f) +#define _ZVD1(f) SD1 (f) VD1 (f) +#define _ZVF2(f) SF2 (f) VF2 (f) +#define _ZVD2(f) SD2 (f) VD2 (f) + +#elif WANT_VMATH + +#define _ZVF1(f) SF1 (f) +#define _ZVD1(f) SD1 (f) +#define _ZVF2(f) SF2 (f) +#define _ZVD2(f) SD2 (f) #else -#define _ZVNF1(f) SF1 (f) -#define _ZVND1(f) SD1 (f) -#define _ZVNF2(f) SF2 (f) -#define _ZVND2(f) SD2 (f) +#define _ZVF1(f) +#define _ZVD1(f) +#define _ZVF2(f) +#define _ZVD2(f) #endif +#if WANT_SVE_MATH + #define _ZSVF1(f) SVF1 (f) ZSVF1 (f) #define _ZSVF2(f) SVF2 (f) ZSVF2 (f) #define _ZSVD1(f) SVD1 (f) ZSVD1 (f) #define _ZSVD2(f) SVD2 (f) ZSVD2 (f) -F1 (acosh) -F1 (asinh) -F2 (atan2) -F1 (atanh) -F1 (cbrt) -F1 (cosh) -F1 (erfc) -F1 (erf) -F1 (expm1) -F1 (log10) -F1 (log1p) -F1 (sinh) -F1 (tan) -F1 (tanh) -D1 (acosh) -D1 (asinh) -D2 (atan2) -D1 (cosh) -D1 (erfc) -D1 (expm1) -D1 (log10) -D1 (log1p) -D1 (sinh) -#if WANT_VMATH -_ZVNF1 (asinh) -_ZVND1 (asinh) -_ZVNF1 (atan) -_ZVND1 (atan) -_ZVNF2 (atan2) -_ZVND2 (atan2) -_ZVNF1 (atanh) -_ZVNF1 (cbrt) -_ZVNF1 (cosh) -_ZVND1 (cosh) -_ZVNF1 (erf) -_ZVND1 (erf) -_ZVNF1 (erfc) -_ZVND1 (erfc) -_ZVNF1 (expm1) -_ZVND1 (expm1) -_ZVNF1 (log10) -_ZVND1 (log10) -_ZVNF1 (log1p) -_ZVND1 (log1p) -_ZVNF1 (log2) -_ZVND1 (log2) -_ZVNF1 (sinh) -_ZVND1 (sinh) -_ZVNF1 (tan) -_ZVNF1 (tanh) +#else + +#define _ZSVF1(f) +#define _ZSVF2(f) +#define _ZSVD1(f) +#define _ZSVD2(f) + +#endif + +#define _ZSF1(f) F1 (f) +#define _ZSF2(f) F2 (f) +#define _ZSD1(f) D1 (f) +#define _ZSD2(f) D2 (f) + +#include "ulp_funcs_gen.h" + #if WANT_SVE_MATH -_ZSVF2 (atan2) -_ZSVD2 (atan2) -_ZSVF1 (atan) -_ZSVD1 (atan) -_ZSVF1 (cos) -_ZSVD1 (cos) -_ZSVF1 (erf) -_ZSVD1 (erf) -_ZSVD1 (erfc) -_ZSVF1 (exp) -_ZSVF1 (log) -_ZSVD1 (log) -_ZSVF1 (log10) -_ZSVD1 (log10) F (__sv_powi, sv_powi, ref_powi, mpfr_powi, 2, 0, d2, 0) F (_ZGVsMxvv_powk, Z_sv_powk, ref_powi, mpfr_powi, 2, 0, d2, 0) F (__sv_powif, sv_powif, ref_powif, mpfr_powi, 2, 1, f2, 0) F (_ZGVsMxvv_powi, Z_sv_powi, ref_powif, mpfr_powi, 2, 1, f2, 0) -_ZSVF1 (sin) -_ZSVD1 (sin) -_ZSVF1 (tan) -#endif #endif diff --git a/pl/math/test/ulp_wrappers.h b/pl/math/test/ulp_wrappers.h index be87c21..e91cbe5 100644 --- a/pl/math/test/ulp_wrappers.h +++ b/pl/math/test/ulp_wrappers.h @@ -89,13 +89,20 @@ DECL_POW_INT_REF(ref_powi, long double, double, int) #define ZVND1_WRAP(func) VD1_WRAP(func) VND1_WRAP(func) #define ZVND2_WRAP(func) VD2_WRAP(func) VND2_WRAP(func) -#else +#elif WANT_VMATH #define ZVNF1_WRAP(func) VF1_WRAP(func) #define ZVNF2_WRAP(func) VF2_WRAP(func) #define ZVND1_WRAP(func) VD1_WRAP(func) #define ZVND2_WRAP(func) VD2_WRAP(func) +#else + +#define ZVNF1_WRAP(func) +#define ZVNF2_WRAP(func) +#define ZVND1_WRAP(func) +#define ZVND2_WRAP(func) + #endif #define SVF1_WRAP(func) static float sv_##func##f(float x) { return svretf(__sv_##func##f_x(svargf(x), svptrue_b32())); } @@ -108,62 +115,34 @@ DECL_POW_INT_REF(ref_powi, long double, double, int) #define ZSVD1_WRAP(func) static double Z_sv_##func(double x) { return svretd(_ZGVsMxv_##func(svargd(x), svptrue_b64())); } #define ZSVD2_WRAP(func) static double Z_sv_##func(double x, double y) { return svretd(_ZGVsMxvv_##func(svargd(x), svargd(y), svptrue_b64())); } +#if WANT_SVE_MATH + #define ZSVNF1_WRAP(func) SVF1_WRAP(func) ZSVF1_WRAP(func) #define ZSVNF2_WRAP(func) SVF2_WRAP(func) ZSVF2_WRAP(func) #define ZSVND1_WRAP(func) SVD1_WRAP(func) ZSVD1_WRAP(func) #define ZSVND2_WRAP(func) SVD2_WRAP(func) ZSVD2_WRAP(func) -/* Wrappers for vector functions. */ -#if WANT_VMATH -ZVNF1_WRAP(asinh) -ZVNF1_WRAP(atan) -ZVNF2_WRAP(atan2) -ZVNF1_WRAP(atanh) -ZVNF1_WRAP(cbrt) -ZVNF1_WRAP(cosh) -ZVNF1_WRAP(erf) -ZVNF1_WRAP(erfc) -ZVNF1_WRAP(expm1) -ZVNF1_WRAP(log10) -ZVNF1_WRAP(log1p) -ZVNF1_WRAP(log2) -ZVNF1_WRAP(sinh) -ZVNF1_WRAP(tan) -ZVNF1_WRAP(tanh) -ZVND1_WRAP(asinh) -ZVND1_WRAP(atan) -ZVND2_WRAP(atan2) -ZVND1_WRAP(cosh) -ZVND1_WRAP(erf) -ZVND1_WRAP(erfc) -ZVND1_WRAP(expm1) -ZVND1_WRAP(log10) -ZVND1_WRAP(log1p) -ZVND1_WRAP(log2) -ZVND1_WRAP(sinh) +#else + +#define ZSVNF1_WRAP(func) +#define ZSVNF2_WRAP(func) +#define ZSVND1_WRAP(func) +#define ZSVND2_WRAP(func) + +#endif + +/* No wrappers for scalar routines, but PL_SIG will emit them. */ +#define ZSNF1_WRAP(func) +#define ZSNF2_WRAP(func) +#define ZSND1_WRAP(func) +#define ZSND2_WRAP(func) + +#include "ulp_wrappers_gen.h" + #if WANT_SVE_MATH -ZSVNF2_WRAP(atan2) -ZSVNF1_WRAP(atan) -ZSVNF1_WRAP(cos) -ZSVNF1_WRAP(erf) -ZSVNF1_WRAP(exp) -ZSVNF1_WRAP(log) -ZSVNF1_WRAP(log10) -ZSVNF1_WRAP(sin) -ZSVNF1_WRAP(tan) static float Z_sv_powi(float x, float y) { return svretf(_ZGVsMxvv_powi(svargf(x), svdup_n_s32((int)round(y)), svptrue_b32())); } static float sv_powif(float x, float y) { return svretf(__sv_powif_x(svargf(x), svdup_n_s32((int)round(y)), svptrue_b32())); } - -ZSVND2_WRAP(atan2) -ZSVND1_WRAP(atan) -ZSVND1_WRAP(cos) -ZSVND1_WRAP(erf) -ZSVND1_WRAP(erfc) -ZSVND1_WRAP(log) -ZSVND1_WRAP(log10) -ZSVND1_WRAP(sin) static double Z_sv_powk(double x, double y) { return svretd(_ZGVsMxvv_powk(svargd(x), svdup_n_s64((long)round(y)), svptrue_b64())); } static double sv_powi(double x, double y) { return svretd(__sv_powi_x(svargd(x), svdup_n_s64((long)round(y)), svptrue_b64())); } #endif -#endif // clang-format on diff --git a/pl/math/v_asinh_2u5.c b/pl/math/v_asinh_2u5.c index 974e6df..02e8098 100644 --- a/pl/math/v_asinh_2u5.c +++ b/pl/math/v_asinh_2u5.c @@ -6,6 +6,7 @@ #include "v_math.h" #include "estrin.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -152,4 +153,5 @@ VPCS_ATTR v_f64_t V_NAME (asinh) (v_f64_t x) } VPCS_ALIAS +PL_SIG (V, D, 1, asinh, -10.0, 10.0) #endif diff --git a/pl/math/v_asinhf_2u7.c b/pl/math/v_asinhf_2u7.c index 7bce7ff..18a2395 100644 --- a/pl/math/v_asinhf_2u7.c +++ b/pl/math/v_asinhf_2u7.c @@ -6,6 +6,7 @@ #include "v_math.h" #include "include/mathlib.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -53,4 +54,5 @@ VPCS_ATTR v_f32_t V_NAME (asinhf) (v_f32_t x) } VPCS_ALIAS +PL_SIG (V, F, 1, asinh, -10.0, 10.0) #endif diff --git a/pl/math/v_atan2_3u.c b/pl/math/v_atan2_3u.c index d69d221..2b31bec 100644 --- a/pl/math/v_atan2_3u.c +++ b/pl/math/v_atan2_3u.c @@ -6,6 +6,8 @@ */ #include "v_math.h" +#include "pl_sig.h" + #if V_SUPPORTED #include "atan_common.h" @@ -75,4 +77,6 @@ v_f64_t V_NAME (atan2) (v_f64_t y, v_f64_t x) } VPCS_ALIAS +/* Arity of 2 means no mathbench entry emitted. See test/mathbench_funcs.h. */ +PL_SIG (V, D, 2, atan2) #endif diff --git a/pl/math/v_atan2f_3u.c b/pl/math/v_atan2f_3u.c index dc0fbca..8c2c8f2 100644 --- a/pl/math/v_atan2f_3u.c +++ b/pl/math/v_atan2f_3u.c @@ -6,6 +6,8 @@ */ #include "v_math.h" +#include "pl_sig.h" + #if V_SUPPORTED #include "atanf_common.h" @@ -75,4 +77,6 @@ v_f32_t V_NAME (atan2f) (v_f32_t y, v_f32_t x) } VPCS_ALIAS +/* Arity of 2 means no mathbench entry emitted. See test/mathbench_funcs.h. */ +PL_SIG (V, F, 2, atan2) #endif diff --git a/pl/math/v_atan_2u5.c b/pl/math/v_atan_2u5.c index 05c77c0..3e504e7 100644 --- a/pl/math/v_atan_2u5.c +++ b/pl/math/v_atan_2u5.c @@ -6,6 +6,8 @@ */ #include "v_math.h" +#include "pl_sig.h" + #if V_SUPPORTED #include "atan_common.h" @@ -47,4 +49,6 @@ v_f64_t V_NAME (atan) (v_f64_t x) return y; } VPCS_ALIAS + +PL_SIG (V, D, 1, atan, -10.0, 10.0) #endif diff --git a/pl/math/v_atanf_3u.c b/pl/math/v_atanf_3u.c index 7c84244..9a0230a 100644 --- a/pl/math/v_atanf_3u.c +++ b/pl/math/v_atanf_3u.c @@ -6,6 +6,8 @@ */ #include "v_math.h" +#include "pl_sig.h" + #if V_SUPPORTED #include "atanf_common.h" @@ -46,4 +48,6 @@ v_f32_t V_NAME (atanf) (v_f32_t x) return y; } VPCS_ALIAS + +PL_SIG (V, F, 1, atan, -10.0, 10.0) #endif diff --git a/pl/math/v_atanhf_3u1.c b/pl/math/v_atanhf_3u1.c index 1e3a561..5c9ceb1 100644 --- a/pl/math/v_atanhf_3u1.c +++ b/pl/math/v_atanhf_3u1.c @@ -6,6 +6,7 @@ #include "v_math.h" #include "mathlib.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -48,4 +49,5 @@ VPCS_ATTR v_f32_t V_NAME (atanhf) (v_f32_t x) VPCS_ALIAS +PL_SIG (V, F, 1, atanh, -1.0, 1.0) #endif diff --git a/pl/math/v_cbrtf_1u5.c b/pl/math/v_cbrtf_1u5.c index fd43051..9db2579 100644 --- a/pl/math/v_cbrtf_1u5.c +++ b/pl/math/v_cbrtf_1u5.c @@ -6,6 +6,7 @@ #include "v_math.h" #include "mathlib.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -85,4 +86,5 @@ VPCS_ATTR v_f32_t V_NAME (cbrtf) (v_f32_t x) } VPCS_ALIAS +PL_SIG (V, F, 1, cbrt, -10.0, 10.0) #endif diff --git a/pl/math/v_cosh_2u.c b/pl/math/v_cosh_2u.c index 6d1a9ed..fa4f1e6 100644 --- a/pl/math/v_cosh_2u.c +++ b/pl/math/v_cosh_2u.c @@ -5,6 +5,7 @@ */ #include "v_math.h" +#include "pl_sig.h" #include "v_exp_tail.h" #define C1 v_f64 (C1_scal) @@ -83,4 +84,5 @@ VPCS_ATTR v_f64_t V_NAME (cosh) (v_f64_t x) } VPCS_ALIAS +PL_SIG (V, D, 1, cosh, -10.0, 10.0) #endif diff --git a/pl/math/v_coshf_2u4.c b/pl/math/v_coshf_2u4.c index 7d7a228..95288d9 100644 --- a/pl/math/v_coshf_2u4.c +++ b/pl/math/v_coshf_2u4.c @@ -6,6 +6,7 @@ #include "v_math.h" #include "mathlib.h" +#include "pl_sig.h" #define AbsMask 0x7fffffff #define TinyBound 0x20000000 /* 0x1p-63: Round to 1 below this. */ @@ -59,4 +60,5 @@ VPCS_ATTR v_f32_t V_NAME (coshf) (v_f32_t x) } VPCS_ALIAS +PL_SIG (V, F, 1, cosh, -10.0, 10.0) #endif diff --git a/pl/math/v_erf_2u.c b/pl/math/v_erf_2u.c index 5a7403f..192b6ed 100644 --- a/pl/math/v_erf_2u.c +++ b/pl/math/v_erf_2u.c @@ -5,9 +5,11 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ +#include "v_math.h" #include "include/mathlib.h" #include "math_config.h" -#include "v_math.h" +#include "pl_sig.h" + #if V_SUPPORTED #define AbsMask v_u64 (0x7fffffffffffffff) @@ -101,4 +103,6 @@ v_f64_t V_NAME (erf) (v_f64_t x) return y; } VPCS_ALIAS + +PL_SIG (V, D, 1, erf, -6.0, 6.0) #endif diff --git a/pl/math/v_erfc_4u.c b/pl/math/v_erfc_4u.c index 80e11e7..88f5172 100644 --- a/pl/math/v_erfc_4u.c +++ b/pl/math/v_erfc_4u.c @@ -5,9 +5,11 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "v_math.h" #include "horner.h" +#include "math_config.h" +#include "pl_sig.h" + #if V_SUPPORTED /* Accurate exponential (vector variant of exp_dd). */ @@ -153,4 +155,6 @@ v_f64_t V_NAME (erfc) (v_f64_t x) return y; } VPCS_ALIAS + +PL_SIG (V, D, 1, erfc, -6.0, 28.0) #endif diff --git a/pl/math/v_erfcf_1u.c b/pl/math/v_erfcf_1u.c index d9c65a5..cf2b174 100644 --- a/pl/math/v_erfcf_1u.c +++ b/pl/math/v_erfcf_1u.c @@ -8,6 +8,7 @@ #include "v_math.h" #include "erfcf.h" #include "estrin.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -169,4 +170,6 @@ v_f32_t V_NAME (erfcf) (v_f32_t x) return y; } VPCS_ALIAS + +PL_SIG (V, F, 1, erfc, -6.0, 28.0) #endif diff --git a/pl/math/v_erff_1u5.c b/pl/math/v_erff_1u5.c index 4407cd1..3e8d400 100644 --- a/pl/math/v_erff_1u5.c +++ b/pl/math/v_erff_1u5.c @@ -5,9 +5,11 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ +#include "v_math.h" #include "include/mathlib.h" #include "math_config.h" -#include "v_math.h" +#include "pl_sig.h" + #if V_SUPPORTED VPCS_ATTR v_f32_t V_NAME (expf) (v_f32_t); @@ -101,4 +103,6 @@ v_f32_t V_NAME (erff) (v_f32_t x) return y; } VPCS_ALIAS + +PL_SIG (V, F, 1, erf, -4.0, 4.0) #endif diff --git a/pl/math/v_exp_tail.c b/pl/math/v_exp_tail.c index cf834e6..fabc110 100644 --- a/pl/math/v_exp_tail.c +++ b/pl/math/v_exp_tail.c @@ -5,8 +5,8 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "v_math.h" +#include "math_config.h" #if V_SUPPORTED #include "v_exp_tail.h" diff --git a/pl/math/v_expf.c b/pl/math/v_expf.c index 2707ebc..d6e5720 100644 --- a/pl/math/v_expf.c +++ b/pl/math/v_expf.c @@ -5,8 +5,8 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "mathlib.h" #include "v_math.h" +#include "mathlib.h" #if V_SUPPORTED static const float Poly[] = { diff --git a/pl/math/v_expm1_2u5.c b/pl/math/v_expm1_2u5.c index 7a5818b..78576a9 100644 --- a/pl/math/v_expm1_2u5.c +++ b/pl/math/v_expm1_2u5.c @@ -6,6 +6,7 @@ */ #include "v_math.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -98,4 +99,6 @@ v_f64_t V_NAME (expm1) (v_f64_t x) return y; } VPCS_ALIAS + +PL_SIG (V, D, 1, expm1, -9.9, 9.9) #endif diff --git a/pl/math/v_expm1f_1u6.c b/pl/math/v_expm1f_1u6.c index e18814e..6d1ae0e 100644 --- a/pl/math/v_expm1f_1u6.c +++ b/pl/math/v_expm1f_1u6.c @@ -6,6 +6,7 @@ */ #include "v_math.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -81,4 +82,6 @@ v_f32_t V_NAME (expm1f) (v_f32_t x) return y; } VPCS_ALIAS + +PL_SIG (V, F, 1, expm1, -9.9, 9.9) #endif diff --git a/pl/math/v_log10_2u5.c b/pl/math/v_log10_2u5.c index c34167f..c481b00 100644 --- a/pl/math/v_log10_2u5.c +++ b/pl/math/v_log10_2u5.c @@ -5,8 +5,10 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "include/mathlib.h" #include "v_math.h" +#include "include/mathlib.h" +#include "pl_sig.h" + #if V_SUPPORTED #define A(i) v_f64 (__v_log10_data.poly[i]) @@ -98,4 +100,5 @@ v_f64_t V_NAME (log10) (v_f64_t x) } VPCS_ALIAS +PL_SIG (V, D, 1, log10, 0.01, 11.1) #endif diff --git a/pl/math/v_log10f_3u5.c b/pl/math/v_log10f_3u5.c index 4dede3d..8bf8bb3 100644 --- a/pl/math/v_log10f_3u5.c +++ b/pl/math/v_log10f_3u5.c @@ -5,8 +5,10 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "mathlib.h" #include "v_math.h" +#include "mathlib.h" +#include "pl_sig.h" + #if V_SUPPORTED #define P(i) v_f32 (__v_log10f_poly[i]) @@ -70,4 +72,6 @@ v_f32_t V_NAME (log10f) (v_f32_t x) return y; } VPCS_ALIAS + +PL_SIG (V, F, 1, log10, 0.01, 11.1) #endif diff --git a/pl/math/v_log1p_2u5.c b/pl/math/v_log1p_2u5.c index 3781522..e0d58ec 100644 --- a/pl/math/v_log1p_2u5.c +++ b/pl/math/v_log1p_2u5.c @@ -5,6 +5,8 @@ */ #include "v_math.h" +#include "pl_sig.h" + #if V_SUPPORTED #include "estrin.h" @@ -104,4 +106,5 @@ VPCS_ATTR v_f64_t V_NAME (log1p) (v_f64_t x) VPCS_ALIAS +PL_SIG (V, D, 1, log1p, -0.9, 10.0) #endif diff --git a/pl/math/v_log1pf_2u1.c b/pl/math/v_log1pf_2u1.c index 3ef8416..361fa4f 100644 --- a/pl/math/v_log1pf_2u1.c +++ b/pl/math/v_log1pf_2u1.c @@ -5,6 +5,8 @@ */ #include "v_math.h" +#include "pl_sig.h" + #if V_SUPPORTED #define AbsMask 0x7fffffff @@ -142,4 +144,5 @@ VPCS_ATTR v_f32_t V_NAME (log1pf) (v_f32_t x) } VPCS_ALIAS +PL_SIG (V, F, 1, log1p, -0.9, 10.0) #endif diff --git a/pl/math/v_log2_3u.c b/pl/math/v_log2_3u.c index af7340d..07afced 100644 --- a/pl/math/v_log2_3u.c +++ b/pl/math/v_log2_3u.c @@ -5,8 +5,10 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "include/mathlib.h" #include "v_math.h" +#include "include/mathlib.h" +#include "pl_sig.h" + #if V_SUPPORTED #define InvLn2 v_f64 (0x1.71547652b82fep0) @@ -85,4 +87,5 @@ v_f64_t V_NAME (log2) (v_f64_t x) } VPCS_ALIAS +PL_SIG (V, D, 1, log2, 0.01, 11.1) #endif diff --git a/pl/math/v_log2f_2u6.c b/pl/math/v_log2f_2u6.c index 73bb84f..335b324 100644 --- a/pl/math/v_log2f_2u6.c +++ b/pl/math/v_log2f_2u6.c @@ -5,8 +5,10 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "math_config.h" #include "v_math.h" +#include "math_config.h" +#include "pl_sig.h" + #if V_SUPPORTED #define N (1 << V_LOG2F_TABLE_BITS) @@ -116,4 +118,6 @@ VPCS_ATTR v_f32_t V_NAME (log2f) (v_f32_t x) return y; } VPCS_ALIAS + +PL_SIG (V, F, 1, log2, 0.01, 11.1) #endif diff --git a/pl/math/v_sinh_3u.c b/pl/math/v_sinh_3u.c index c707364..cec8208 100644 --- a/pl/math/v_sinh_3u.c +++ b/pl/math/v_sinh_3u.c @@ -6,6 +6,7 @@ #include "v_math.h" #include "mathlib.h" +#include "pl_sig.h" #define AbsMask 0x7fffffffffffffff #define Half 0x3fe0000000000000 @@ -42,4 +43,5 @@ VPCS_ATTR v_f64_t V_NAME (sinh) (v_f64_t x) } VPCS_ALIAS +PL_SIG (V, D, 1, sinh, -10.0, 10.0) #endif diff --git a/pl/math/v_sinhf_2u3.c b/pl/math/v_sinhf_2u3.c index 4397bca..299f081 100644 --- a/pl/math/v_sinhf_2u3.c +++ b/pl/math/v_sinhf_2u3.c @@ -6,6 +6,7 @@ #include "v_math.h" #include "mathlib.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -41,4 +42,5 @@ VPCS_ATTR v_f32_t V_NAME (sinhf) (v_f32_t x) } VPCS_ALIAS +PL_SIG (V, F, 1, sinh, -10.0, 10.0) #endif diff --git a/pl/math/v_tanf_3u2.c b/pl/math/v_tanf_3u2.c index 8b3869c..9a11ba4 100644 --- a/pl/math/v_tanf_3u2.c +++ b/pl/math/v_tanf_3u2.c @@ -7,6 +7,7 @@ #include "v_math.h" #include "estrinf.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -114,4 +115,6 @@ v_f32_t V_NAME (tanf) (v_f32_t x) return y; } VPCS_ALIAS + +PL_SIG (V, F, 1, tan, -3.1, 3.1) #endif diff --git a/pl/math/v_tanhf_2u6.c b/pl/math/v_tanhf_2u6.c index 67e4520..1196c4a 100644 --- a/pl/math/v_tanhf_2u6.c +++ b/pl/math/v_tanhf_2u6.c @@ -5,8 +5,9 @@ */ #include "v_math.h" -#include "mathlib.h" #include "estrinf.h" +#include "mathlib.h" +#include "pl_sig.h" #if V_SUPPORTED @@ -88,4 +89,5 @@ VPCS_ATTR v_f32_t V_NAME (tanhf) (v_f32_t x) } VPCS_ALIAS +PL_SIG (V, F, 1, tanh, -10.0, 10.0) #endif |