diff options
author | Elliott Hughes <enh@google.com> | 2023-01-25 16:31:42 +0000 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2023-01-25 18:11:56 +0000 |
commit | 62662f115a17a5548402fcd02f3b7e1b9b38e087 (patch) | |
tree | 945eb1832687ad5eb97c433013617dbe107718e5 /pl/math/test | |
parent | 04d0bc466ce39c702459d77a15754a19533eaec9 (diff) | |
parent | 56e3bf05c19c4e28e1f5edd9093c712f16c5c32a (diff) | |
download | arm-optimized-routines-62662f115a17a5548402fcd02f3b7e1b9b38e087.tar.gz |
Upgrade ARM-software/optimized-routines to v23.01
This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update arm-optimized-routines
For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
Test: TreeHugger
Change-Id: I03de0ecb0ea89c2a77b1c411685af09fd480b63e
Diffstat (limited to 'pl/math/test')
37 files changed, 1533 insertions, 0 deletions
diff --git a/pl/math/test/mathbench_funcs.h b/pl/math/test/mathbench_funcs.h new file mode 100644 index 0000000..e0f6ac7 --- /dev/null +++ b/pl/math/test/mathbench_funcs.h @@ -0,0 +1,86 @@ +// clang-format off +/* + * Function entries for mathbench. + * + * Copyright (c) 2022-2023, Arm Limited. + * 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 _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 _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 _ZSVF1(f, a, b) +#define _ZSVD1(f, a, b) + +#endif + +/* 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. */ + +{"atan2f", 'f', 0, -10.0, 10.0, {.f = atan2f_wrap}}, +{"atan2", 'd', 0, -10.0, 10.0, {.d = atan2_wrap}}, +{"powi", 'd', 0, 0.01, 11.1, {.d = powi_wrap}}, + +{"__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}}, +{"__v_atan2", 'd', 'v', -10.0, 10.0, {.vd = __v_atan2_wrap}}, +{"__vn_atan2f", 'f', 'n', -10.0, 10.0, {.vnf = __vn_atan2f_wrap}}, +{"_ZGVnN4vv_atan2f", 'f', 'n', -10.0, 10.0, {.vnf = _Z_atan2f_wrap}}, +{"__vn_atan2", 'd', 'n', -10.0, 10.0, {.vnd = __vn_atan2_wrap}}, +{"_ZGVnN2vv_atan2", 'd', 'n', -10.0, 10.0, {.vnd = _Z_atan2_wrap}}, + +#if WANT_SVE_MATH +{"__sv_atan2f_x", 'f', 's', -10.0, 10.0, {.svf = __sv_atan2f_wrap}}, +{"_ZGVsMxvv_atan2f", 'f', 's', -10.0, 10.0, {.svf = _Z_sv_atan2f_wrap}}, +{"__sv_atan2_x", 'd', 's', -10.0, 10.0, {.svd = __sv_atan2_wrap}}, +{"_ZGVsM2vv_atan2", 'd', 's', -10.0, 10.0, {.svd = _Z_sv_atan2_wrap}}, +{"__sv_powif_x", 'f', 's', -10.0, 10.0, {.svf = __sv_powif_wrap}}, +{"_ZGVsMxvv_powi", 'f', 's', -10.0, 10.0, {.svf = _Z_sv_powi_wrap}}, +{"__sv_powi_x", 'd', 's', -10.0, 10.0, {.svd = __sv_powi_wrap}}, +{"_ZGVsMxvv_powk", 'd', 's', -10.0, 10.0, {.svd = _Z_sv_powk_wrap}}, +#endif + // clang-format on diff --git a/pl/math/test/mathbench_wrappers.h b/pl/math/test/mathbench_wrappers.h new file mode 100644 index 0000000..eba960e --- /dev/null +++ b/pl/math/test/mathbench_wrappers.h @@ -0,0 +1,133 @@ +/* + * Function wrappers for mathbench. + * + * Copyright (c) 2022-2023, Arm Limited. + * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + */ + +static double +atan2_wrap (double x) +{ + return atan2 (5.0, x); +} + +static float +atan2f_wrap (float x) +{ + return atan2f (5.0f, x); +} + +static double +powi_wrap (double x) +{ + return __builtin_powi (x, (int) round (x)); +} + +#if WANT_VMATH +#if __aarch64__ + +static double +__s_atan2_wrap (double x) +{ + return __s_atan2 (5.0, x); +} + +static float +__s_atan2f_wrap (float x) +{ + return __s_atan2f (5.0f, x); +} + +static v_double +__v_atan2_wrap (v_double x) +{ + return __v_atan2 (v_double_dup (5.0), x); +} + +static v_float +__v_atan2f_wrap (v_float x) +{ + return __v_atan2f (v_float_dup (5.0f), x); +} + +#ifdef __vpcs + +__vpcs static v_double +__vn_atan2_wrap (v_double x) +{ + return __vn_atan2 (v_double_dup (5.0), x); +} + +__vpcs static v_float +__vn_atan2f_wrap (v_float x) +{ + return __vn_atan2f (v_float_dup (5.0f), x); +} + +__vpcs static v_double +_Z_atan2_wrap (v_double x) +{ + return _ZGVnN2vv_atan2 (v_double_dup (5.0), x); +} + +__vpcs static v_float +_Z_atan2f_wrap (v_float x) +{ + return _ZGVnN4vv_atan2f (v_float_dup (5.0f), x); +} + +#endif // __vpcs +#endif // __arch64__ +#endif // WANT_VMATH + +#if WANT_SVE_MATH + +static sv_float +__sv_atan2f_wrap (sv_float x, sv_bool pg) +{ + return __sv_atan2f_x (x, svdup_n_f32 (5.0f), pg); +} + +static sv_float +_Z_sv_atan2f_wrap (sv_float x, sv_bool pg) +{ + return _ZGVsMxvv_atan2f (x, svdup_n_f32 (5.0f), pg); +} + +static sv_double +__sv_atan2_wrap (sv_double x, sv_bool pg) +{ + return __sv_atan2_x (x, svdup_n_f64 (5.0), pg); +} + +static sv_double +_Z_sv_atan2_wrap (sv_double x, sv_bool pg) +{ + return _ZGVsMxvv_atan2 (x, svdup_n_f64 (5.0), pg); +} + +static sv_float +_Z_sv_powi_wrap (sv_float x, sv_bool pg) +{ + return _ZGVsMxvv_powi (x, svcvt_s32_f32_x (pg, x), pg); +} + +static sv_float +__sv_powif_wrap (sv_float x, sv_bool pg) +{ + return __sv_powif_x (x, svcvt_s32_f32_x (pg, x), pg); +} + +static sv_double +_Z_sv_powk_wrap (sv_double x, sv_bool pg) +{ + return _ZGVsMxvv_powk (x, svcvt_s64_f64_x (pg, x), pg); +} + +static sv_double +__sv_powi_wrap (sv_double x, sv_bool pg) +{ + return __sv_powi_x (x, svcvt_s64_f64_x (pg, x), pg); +} + +#endif // WANT_SVE_MATH diff --git a/pl/math/test/pl_test.h b/pl/math/test/pl_test.h new file mode 100644 index 0000000..467d1ca --- /dev/null +++ b/pl/math/test/pl_test.h @@ -0,0 +1,33 @@ +/* + * PL macros for emitting various details about routines for consumption by + * runulp.sh. + * + * Copyright (c) 2022-2023, Arm Limited. + * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception. + */ + +/* Emit the max ULP threshold, l, for routine f. Piggy-back PL_TEST_EXPECT_FENV + on PL_TEST_ULP to add EXPECT_FENV to all scalar routines. */ +#if !(V_SUPPORTED || SV_SUPPORTED) +#define PL_TEST_ULP(f, l) \ + PL_TEST_EXPECT_FENV_ALWAYS (f) \ + PL_TEST_ULP f l +#else +#define PL_TEST_ULP(f, l) PL_TEST_ULP f l +#endif + +/* Emit aliases to allow test params to be mapped from aliases back to their + aliasees. */ +#define PL_ALIAS(a, b) PL_TEST_ALIAS a b + +/* Emit routine name if e == 1 and f is expected to correctly trigger fenv + exceptions. e allows declaration to be emitted conditionally upon certain + build flags - defer expansion by one pass to allow those flags to be expanded + properly. */ +#define PL_TEST_EXPECT_FENV(f, e) PL_TEST_EXPECT_FENV_ (f, e) +#define PL_TEST_EXPECT_FENV_(f, e) PL_TEST_EXPECT_FENV_##e (f) +#define PL_TEST_EXPECT_FENV_1(f) PL_TEST_EXPECT_FENV_ENABLED f +#define PL_TEST_EXPECT_FENV_ALWAYS(f) PL_TEST_EXPECT_FENV (f, 1) + +#define PL_TEST_INTERVAL(f, lo, hi, n) PL_TEST_INTERVAL f lo hi n +#define PL_TEST_INTERVAL_C(f, lo, hi, n, c) PL_TEST_INTERVAL f lo hi n c diff --git a/pl/math/test/runulp.sh b/pl/math/test/runulp.sh new file mode 100755 index 0000000..4d02530 --- /dev/null +++ b/pl/math/test/runulp.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# ULP error check script. +# +# Copyright (c) 2019-2023, Arm Limited. +# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +#set -x +set -eu + +# cd to bin directory. +cd "${0%/*}" + +flags="${ULPFLAGS:--q}" +emu="$@" + +# Enable SVE testing +WANT_SVE_MATH=${WANT_SVE_MATH:-0} + +FAIL=0 +PASS=0 + +t() { + key=$(cat $ALIASES | { grep " $1$" || echo $1; } | awk '{print $1}') + L=$(cat $LIMITS | grep "^$key " | awk '{print $2}') + [[ $L =~ ^[0-9]+\.[0-9]+$ ]] + extra_flags="" + [[ -z "${5:-}" ]] || extra_flags="$extra_flags -c $5" + grep -q "^$key$" $FENV || extra_flags="$extra_flags -f" + $emu ./ulp -e $L $flags ${extra_flags} $1 $2 $3 $4 && PASS=$((PASS+1)) || FAIL=$((FAIL+1)) +} + +check() { + $emu ./ulp -f -q "$@" #>/dev/null +} + +# Regression-test for correct NaN handling in atan2 +check atan2 0x1p-1022 0x1p-1000 x 0 0x1p-1022 40000 +check atan2 0x1.7887a0a717aefp+1017 0x1.7887a0a717aefp+1017 x -nan -nan +check atan2 nan nan x -nan -nan + +# vector functions +flags="${ULPFLAGS:--q}" +runs= +check __s_log10f 1 && runs=1 +runv= +check __v_log10f 1 && runv=1 +runvn= +check __vn_log10f 1 && runvn=1 +runsv= +if [ $WANT_SVE_MATH -eq 1 ]; then +check __sv_cosf 0 && runsv=1 +check __sv_cos 0 && runsv=1 +check __sv_sinf 0 && runsv=1 +check __sv_sin 0 && runsv=1 +# No guarantees about powi accuracy, so regression-test for exactness +# w.r.t. the custom reference impl in ulp_wrappers.h +check -q -f -e 0 __sv_powif 0 inf x 0 1000 100000 && runsv=1 +check -q -f -e 0 __sv_powif -0 -inf x 0 1000 100000 && runsv=1 +check -q -f -e 0 __sv_powif 0 inf x -0 -1000 100000 && runsv=1 +check -q -f -e 0 __sv_powif -0 -inf x -0 -1000 100000 && runsv=1 +check -q -f -e 0 __sv_powi 0 inf x 0 1000 100000 && runsv=1 +check -q -f -e 0 __sv_powi -0 -inf x 0 1000 100000 && runsv=1 +check -q -f -e 0 __sv_powi 0 inf x -0 -1000 100000 && runsv=1 +check -q -f -e 0 __sv_powi -0 -inf x -0 -1000 100000 && runsv=1 +fi + +while read F LO HI N C +do + t $F $LO $HI $N $C +done << EOF +$(cat $INTERVALS) +EOF + +[ 0 -eq $FAIL ] || { + echo "FAILED $FAIL PASSED $PASS" + exit 1 +} diff --git a/pl/math/test/testcases/directed/acosh.tst b/pl/math/test/testcases/directed/acosh.tst new file mode 100644 index 0000000..dd962bd --- /dev/null +++ b/pl/math/test/testcases/directed/acosh.tst @@ -0,0 +1,19 @@ +; acosh.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=acosh op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=acosh op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=acosh op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=acosh op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=acosh op1=7ff00000.00000000 result=7ff00000.00000000 errno=0 +func=acosh op1=3ff00000.00000000 result=00000000.00000000 errno=0 +func=acosh op1=3fefffff.ffffffff result=7ff80000.00000001 errno=EDOM status=i +func=acosh op1=00000000.00000000 result=7ff80000.00000001 errno=EDOM status=i +func=acosh op1=80000000.00000000 result=7ff80000.00000001 errno=EDOM status=i +func=acosh op1=bfefffff.ffffffff result=7ff80000.00000001 errno=EDOM status=i +func=acosh op1=bff00000.00000000 result=7ff80000.00000001 errno=EDOM status=i +func=acosh op1=bff00000.00000001 result=7ff80000.00000001 errno=EDOM status=i +func=acosh op1=fff00000.00000000 result=7ff80000.00000001 errno=EDOM status=i +func=acosh op1=7fe01ac0.7f03a83e result=40862e50.541778f1.8cc error=0 diff --git a/pl/math/test/testcases/directed/acoshf.tst b/pl/math/test/testcases/directed/acoshf.tst new file mode 100644 index 0000000..606c615 --- /dev/null +++ b/pl/math/test/testcases/directed/acoshf.tst @@ -0,0 +1,19 @@ +; acoshf.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=acoshf op1=7fc00001 result=7fc00001 errno=0 +func=acoshf op1=ffc00001 result=7fc00001 errno=0 +func=acoshf op1=7f800001 result=7fc00001 errno=0 status=i +func=acoshf op1=ff800001 result=7fc00001 errno=0 status=i +func=acoshf op1=7f800000 result=7f800000 errno=0 +func=acoshf op1=3f800000 result=00000000 errno=0 +func=acoshf op1=3f7fffff result=7fc00001 errno=EDOM status=i +func=acoshf op1=00000000 result=7fc00001 errno=EDOM status=i +func=acoshf op1=80000000 result=7fc00001 errno=EDOM status=i +func=acoshf op1=bf7fffff result=7fc00001 errno=EDOM status=i +func=acoshf op1=bf800000 result=7fc00001 errno=EDOM status=i +func=acoshf op1=bf800001 result=7fc00001 errno=EDOM status=i +func=acoshf op1=ff800000 result=7fc00001 errno=EDOM status=i +func=acoshf op1=7f767efe result=42b2c19d.83e error=0 diff --git a/pl/math/test/testcases/directed/asinh.tst b/pl/math/test/testcases/directed/asinh.tst new file mode 100644 index 0000000..1485dfe --- /dev/null +++ b/pl/math/test/testcases/directed/asinh.tst @@ -0,0 +1,18 @@ +; asinh.tst +; +; Copyright (c) 2022-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=asinh op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=asinh op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=asinh op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=asinh op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=asinh op1=7ff00000.00000000 result=7ff00000.00000000 errno=0 +func=asinh op1=fff00000.00000000 result=fff00000.00000000 errno=0 +func=asinh op1=00000000.00000000 result=00000000.00000000 errno=0 +func=asinh op1=80000000.00000000 result=80000000.00000000 errno=0 +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=asinh op1=00000000.00000001 result=00000000.00000001 errno=0 maybestatus=ux +func=asinh op1=80000000.00000001 result=80000000.00000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/directed/asinhf.tst b/pl/math/test/testcases/directed/asinhf.tst new file mode 100644 index 0000000..eb76a58 --- /dev/null +++ b/pl/math/test/testcases/directed/asinhf.tst @@ -0,0 +1,18 @@ +; asinhf.tst +; +; Copyright (c) 2007-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=asinhf op1=7fc00001 result=7fc00001 errno=0 +func=asinhf op1=ffc00001 result=7fc00001 errno=0 +func=asinhf op1=7f800001 result=7fc00001 errno=0 status=i +func=asinhf op1=ff800001 result=7fc00001 errno=0 status=i +func=asinhf op1=7f800000 result=7f800000 errno=0 +func=asinhf op1=ff800000 result=ff800000 errno=0 +func=asinhf op1=00000000 result=00000000 errno=0 +func=asinhf op1=80000000 result=80000000 errno=0 +; No exception is raised on certain machines (different version of glibc) +; Same issue encountered with other function similar to x close to 0 +; Could be due to function so boring no flop is involved in some implementations +func=asinhf op1=00000001 result=00000001 errno=0 maybestatus=ux +func=asinhf op1=80000001 result=80000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/directed/atan.tst b/pl/math/test/testcases/directed/atan.tst new file mode 100644 index 0000000..4c67055 --- /dev/null +++ b/pl/math/test/testcases/directed/atan.tst @@ -0,0 +1,22 @@ +; atan.tst +; +; Copyright (c) 1999-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=atan op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan op1=7ff00000.00000000 result=3ff921fb.54442d18.469 errno=0 +func=atan op1=fff00000.00000000 result=bff921fb.54442d18.469 errno=0 +func=atan op1=00000000.00000000 result=00000000.00000000 errno=0 +func=atan op1=80000000.00000000 result=80000000.00000000 errno=0 +; Inconsistent behavior was detected for the following 2 cases. +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=atan op1=00000000.00000001 result=00000000.00000001 errno=0 maybestatus=ux +func=atan op1=80000000.00000001 result=80000000.00000001 errno=0 maybestatus=ux + +func=atan op1=3ff00000.00000000 result=3fe921fb.54442d18.469 errno=0 +func=atan op1=bff00000.00000000 result=bfe921fb.54442d18.469 errno=0 diff --git a/pl/math/test/testcases/directed/atan2.tst b/pl/math/test/testcases/directed/atan2.tst new file mode 100644 index 0000000..647b376 --- /dev/null +++ b/pl/math/test/testcases/directed/atan2.tst @@ -0,0 +1,110 @@ +; atan2.tst +; +; Copyright (c) 1999-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=atan2 op1=7ff00000.00000001 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff00000.00000001 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff00000.00000001 op2=7ff00000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff00000.00000001 op2=fff00000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff00000.00000001 op2=00000000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff00000.00000001 op2=80000000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff00000.00000001 op2=3ff00000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff00000.00000001 op2=bff00000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000001 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000001 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000001 op2=7ff00000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000001 op2=fff00000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000001 op2=00000000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000001 op2=80000000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000001 op2=3ff00000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000001 op2=bff00000.00000000 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff80000.00000001 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff80000.00000001 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff80000.00000001 op2=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff80000.00000001 op2=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff80000.00000001 op2=7ff00000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff80000.00000001 op2=fff00000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff80000.00000001 op2=00000000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff80000.00000001 op2=80000000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff80000.00000001 op2=3ff00000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff80000.00000001 op2=bff00000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff80000.00000001 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff80000.00000001 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff80000.00000001 op2=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff80000.00000001 op2=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff80000.00000001 op2=7ff00000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff80000.00000001 op2=fff00000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff80000.00000001 op2=00000000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff80000.00000001 op2=80000000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff80000.00000001 op2=3ff00000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff80000.00000001 op2=bff00000.00000000 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff00000.00000000 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff00000.00000000 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=7ff00000.00000000 op2=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff00000.00000000 op2=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=7ff00000.00000000 op2=7ff00000.00000000 result=3fe921fb.54442d18.469 errno=0 +func=atan2 op1=7ff00000.00000000 op2=fff00000.00000000 result=4002d97c.7f3321d2.34f errno=0 +func=atan2 op1=7ff00000.00000000 op2=00000000.00000000 result=3ff921fb.54442d18.469 errno=0 +func=atan2 op1=7ff00000.00000000 op2=80000000.00000000 result=3ff921fb.54442d18.469 errno=0 +func=atan2 op1=7ff00000.00000000 op2=3ff00000.00000000 result=3ff921fb.54442d18.469 errno=0 +func=atan2 op1=7ff00000.00000000 op2=bff00000.00000000 result=3ff921fb.54442d18.469 errno=0 +func=atan2 op1=fff00000.00000000 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000000 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=fff00000.00000000 op2=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff00000.00000000 op2=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=fff00000.00000000 op2=7ff00000.00000000 result=bfe921fb.54442d18.469 errno=0 +func=atan2 op1=fff00000.00000000 op2=fff00000.00000000 result=c002d97c.7f3321d2.34f errno=0 +func=atan2 op1=fff00000.00000000 op2=00000000.00000000 result=bff921fb.54442d18.469 errno=0 +func=atan2 op1=fff00000.00000000 op2=80000000.00000000 result=bff921fb.54442d18.469 errno=0 +func=atan2 op1=fff00000.00000000 op2=3ff00000.00000000 result=bff921fb.54442d18.469 errno=0 +func=atan2 op1=fff00000.00000000 op2=bff00000.00000000 result=bff921fb.54442d18.469 errno=0 +func=atan2 op1=00000000.00000000 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=00000000.00000000 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=00000000.00000000 op2=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=00000000.00000000 op2=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=00000000.00000000 op2=7ff00000.00000000 result=00000000.00000000 errno=0 +func=atan2 op1=00000000.00000000 op2=fff00000.00000000 result=400921fb.54442d18.469 errno=0 +func=atan2 op1=00000000.00000000 op2=00000000.00000000 result=00000000.00000000 errno=0 +func=atan2 op1=00000000.00000000 op2=80000000.00000000 result=400921fb.54442d18.469 errno=0 +func=atan2 op1=00000000.00000000 op2=3ff00000.00000000 result=00000000.00000000 errno=0 +func=atan2 op1=00000000.00000000 op2=bff00000.00000000 result=400921fb.54442d18.469 errno=0 +; No exception is raised on certain machines (different version of glibc) +; Same issue encountered with other function similar to x close to 0 +; Could be due to function so boring no flop is involved in some implementations +func=atan2 op1=00000000.00000001 op2=3ff00000.00000000 result=00000000.00000001 errno=0 maybestatus=ux +func=atan2 op1=80000000.00000000 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=80000000.00000000 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=80000000.00000000 op2=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=80000000.00000000 op2=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=80000000.00000000 op2=7ff00000.00000000 result=80000000.00000000 errno=0 +func=atan2 op1=80000000.00000000 op2=fff00000.00000000 result=c00921fb.54442d18.469 errno=0 +func=atan2 op1=80000000.00000000 op2=00000000.00000000 result=80000000.00000000 errno=0 +func=atan2 op1=80000000.00000000 op2=80000000.00000000 result=c00921fb.54442d18.469 errno=0 +func=atan2 op1=80000000.00000000 op2=3ff00000.00000000 result=80000000.00000000 errno=0 +func=atan2 op1=80000000.00000000 op2=bff00000.00000000 result=c00921fb.54442d18.469 errno=0 +; No exception is raised on certain machines (different version of glibc) +; Same issue encountered with other function similar to x close to 0 +; Could be due to function so boring no flop is involved in some implementations +func=atan2 op1=80000000.00000001 op2=3ff00000.00000000 result=80000000.00000001 errno=0 maybestatus=ux +func=atan2 op1=3ff00000.00000000 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=3ff00000.00000000 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=3ff00000.00000000 op2=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=3ff00000.00000000 op2=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=3ff00000.00000000 op2=7ff00000.00000000 result=00000000.00000000 errno=0 +func=atan2 op1=3ff00000.00000000 op2=fff00000.00000000 result=400921fb.54442d18.469 errno=0 +func=atan2 op1=3ff00000.00000000 op2=00000000.00000000 result=3ff921fb.54442d18.469 errno=0 +func=atan2 op1=3ff00000.00000000 op2=80000000.00000000 result=3ff921fb.54442d18.469 errno=0 +func=atan2 op1=3ff00000.00000000 op2=3ff00000.00000000 result=3fe921fb.54442d18.469 errno=0 +func=atan2 op1=3ff00000.00000000 op2=bff00000.00000000 result=4002d97c.7f3321d2.34f errno=0 +func=atan2 op1=bff00000.00000000 op2=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=bff00000.00000000 op2=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atan2 op1=bff00000.00000000 op2=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=bff00000.00000000 op2=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atan2 op1=bff00000.00000000 op2=7ff00000.00000000 result=80000000.00000000 errno=0 +func=atan2 op1=bff00000.00000000 op2=fff00000.00000000 result=c00921fb.54442d18.469 errno=0 +func=atan2 op1=bff00000.00000000 op2=00000000.00000000 result=bff921fb.54442d18.469 errno=0 +func=atan2 op1=bff00000.00000000 op2=80000000.00000000 result=bff921fb.54442d18.469 errno=0 +func=atan2 op1=bff00000.00000000 op2=3ff00000.00000000 result=bfe921fb.54442d18.469 errno=0 +func=atan2 op1=bff00000.00000000 op2=bff00000.00000000 result=c002d97c.7f3321d2.34f errno=0 +func=atan2 op1=3ff00000.00000000 op2=3ff00000.00000000 result=3fe921fb.54442d18 errno=0 diff --git a/pl/math/test/testcases/directed/atan2f.tst b/pl/math/test/testcases/directed/atan2f.tst new file mode 100644 index 0000000..85c5c5d --- /dev/null +++ b/pl/math/test/testcases/directed/atan2f.tst @@ -0,0 +1,121 @@ +; atan2f.tst +; +; Copyright (c) 1999-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=atan2f op1=7f800001 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800001 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800001 op2=7fc00001 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800001 op2=ffc00001 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800001 op2=7f800000 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800001 op2=ff800000 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800001 op2=00000000 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800001 op2=80000000 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800001 op2=3f800000 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800001 op2=bf800000 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=7fc00001 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=ffc00001 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=7f800000 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=ff800000 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=00000000 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=80000000 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=3f800000 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800001 op2=bf800000 result=7fc00001 errno=0 status=i +func=atan2f op1=7fc00001 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=7fc00001 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=7fc00001 op2=7fc00001 result=7fc00001 errno=0 +func=atan2f op1=7fc00001 op2=ffc00001 result=7fc00001 errno=0 +func=atan2f op1=7fc00001 op2=7f800000 result=7fc00001 errno=0 +func=atan2f op1=7fc00001 op2=ff800000 result=7fc00001 errno=0 +func=atan2f op1=7fc00001 op2=00000000 result=7fc00001 errno=0 +func=atan2f op1=7fc00001 op2=80000000 result=7fc00001 errno=0 +func=atan2f op1=7fc00001 op2=3f800000 result=7fc00001 errno=0 +func=atan2f op1=7fc00001 op2=bf800000 result=7fc00001 errno=0 +func=atan2f op1=ffc00001 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=ffc00001 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=ffc00001 op2=7fc00001 result=ffc00001 errno=0 +func=atan2f op1=ffc00001 op2=ffc00001 result=ffc00001 errno=0 +func=atan2f op1=ffc00001 op2=7f800000 result=ffc00001 errno=0 +func=atan2f op1=ffc00001 op2=ff800000 result=ffc00001 errno=0 +func=atan2f op1=ffc00001 op2=00000000 result=ffc00001 errno=0 +func=atan2f op1=ffc00001 op2=80000000 result=ffc00001 errno=0 +func=atan2f op1=ffc00001 op2=3f800000 result=ffc00001 errno=0 +func=atan2f op1=ffc00001 op2=bf800000 result=ffc00001 errno=0 +func=atan2f op1=7f800000 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800000 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=7f800000 op2=7fc00001 result=7fc00001 errno=0 +func=atan2f op1=7f800000 op2=ffc00001 result=7fc00001 errno=0 +func=atan2f op1=7f800000 op2=7f800000 result=3f490fda.a22 errno=0 +func=atan2f op1=7f800000 op2=ff800000 result=4016cbe3.f99 errno=0 +func=atan2f op1=7f800000 op2=00000000 result=3fc90fda.a22 errno=0 +func=atan2f op1=7f800000 op2=80000000 result=3fc90fda.a22 errno=0 +func=atan2f op1=7f800000 op2=3f800000 result=3fc90fda.a22 errno=0 +func=atan2f op1=7f800000 op2=bf800000 result=3fc90fda.a22 errno=0 +func=atan2f op1=ff800000 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800000 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=ff800000 op2=7fc00001 result=7fc00001 errno=0 +func=atan2f op1=ff800000 op2=ffc00001 result=ffc00001 errno=0 +func=atan2f op1=ff800000 op2=7f800000 result=bf490fda.a22 errno=0 +func=atan2f op1=ff800000 op2=ff800000 result=c016cbe3.f99 errno=0 +func=atan2f op1=ff800000 op2=00000000 result=bfc90fda.a22 errno=0 +func=atan2f op1=ff800000 op2=80000000 result=bfc90fda.a22 errno=0 +func=atan2f op1=ff800000 op2=3f800000 result=bfc90fda.a22 errno=0 +func=atan2f op1=ff800000 op2=bf800000 result=bfc90fda.a22 errno=0 +func=atan2f op1=00000000 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=00000000 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=00000000 op2=7fc00001 result=7fc00001 errno=0 +func=atan2f op1=00000000 op2=ffc00001 result=ffc00001 errno=0 +func=atan2f op1=00000000 op2=7f800000 result=00000000 errno=0 +func=atan2f op1=00000000 op2=ff800000 result=40490fda.a22 errno=0 +func=atan2f op1=00000000 op2=00000000 result=00000000 errno=0 +func=atan2f op1=00000000 op2=80000000 result=40490fda.a22 errno=0 +func=atan2f op1=00000000 op2=3f800000 result=00000000 errno=0 +func=atan2f op1=00000000 op2=bf800000 result=40490fda.a22 errno=0 +; No exception is raised on certain machines (different version of glibc) +; Same issue encountered with other function similar to x close to 0 +; Could be due to function so boring no flop is involved in some implementations +func=atan2f op1=00000001 op2=3f800000 result=00000001 errno=0 maybestatus=ux + +func=atan2f op1=80000000 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=80000000 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=80000000 op2=7fc00001 result=7fc00001 errno=0 +func=atan2f op1=80000000 op2=ffc00001 result=ffc00001 errno=0 +func=atan2f op1=80000000 op2=7f800000 result=80000000 errno=0 +func=atan2f op1=80000000 op2=ff800000 result=c0490fda.a22 errno=0 +func=atan2f op1=80000000 op2=00000000 result=80000000 errno=0 +func=atan2f op1=80000000 op2=80000000 result=c0490fda.a22 errno=0 +func=atan2f op1=80000000 op2=3f800000 result=80000000 errno=0 +func=atan2f op1=80000000 op2=bf800000 result=c0490fda.a22 errno=0 +; No exception is raised on certain machines (different version of glibc) +; Same issue encountered with other function similar to x close to 0 +; Could be due to function so boring no flop is involved in some implementations +func=atan2f op1=80000001 op2=3f800000 result=80000001 errno=0 maybestatus=ux + +func=atan2f op1=3f800000 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=3f800000 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=3f800000 op2=7fc00001 result=7fc00001 errno=0 +func=atan2f op1=3f800000 op2=ffc00001 result=ffc00001 errno=0 +func=atan2f op1=3f800000 op2=7f800000 result=00000000 errno=0 +func=atan2f op1=3f800000 op2=ff800000 result=40490fda.a22 errno=0 +func=atan2f op1=3f800000 op2=00000000 result=3fc90fda.a22 errno=0 +func=atan2f op1=3f800000 op2=80000000 result=3fc90fda.a22 errno=0 +func=atan2f op1=3f800000 op2=3f800000 result=3f490fda.a22 errno=0 +func=atan2f op1=3f800000 op2=bf800000 result=4016cbe3.f99 errno=0 +func=atan2f op1=bf800000 op2=7f800001 result=7fc00001 errno=0 status=i +func=atan2f op1=bf800000 op2=ff800001 result=7fc00001 errno=0 status=i +func=atan2f op1=bf800000 op2=7fc00001 result=7fc00001 errno=0 +func=atan2f op1=bf800000 op2=ffc00001 result=ffc00001 errno=0 +func=atan2f op1=bf800000 op2=7f800000 result=80000000 errno=0 +func=atan2f op1=bf800000 op2=ff800000 result=c0490fda.a22 errno=0 +func=atan2f op1=bf800000 op2=00000000 result=bfc90fda.a22 errno=0 +func=atan2f op1=bf800000 op2=80000000 result=bfc90fda.a22 errno=0 +func=atan2f op1=bf800000 op2=3f800000 result=bf490fda.a22 errno=0 +func=atan2f op1=bf800000 op2=bf800000 result=c016cbe3.f99 errno=0 +func=atan2f op1=8005f16d op2=002bb601 result=be0a60a5.d88 error=0 +func=atan2f op1=80818ec8 op2=80ba5db9 result=c0222eda.f42 error=0 + +func=atan2f op1=ff7fffff op2=ff7fffff result=c016cbe3.f99 errno=0 +func=atan2f op1=bfc00001 op2=7f7fffff result=80300000.700 errno=0 status=u +func=atan2f op1=80800001 op2=40000000 result=80400000.800 errno=0 status=u diff --git a/pl/math/test/testcases/directed/atanf.tst b/pl/math/test/testcases/directed/atanf.tst new file mode 100644 index 0000000..0a0bfc2 --- /dev/null +++ b/pl/math/test/testcases/directed/atanf.tst @@ -0,0 +1,22 @@ +; atanf.tst +; +; Copyright (c) 2007-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=atanf op1=7fc00001 result=7fc00001 errno=0 +func=atanf op1=ffc00001 result=7fc00001 errno=0 +func=atanf op1=7f800001 result=7fc00001 errno=0 status=i +func=atanf op1=ff800001 result=7fc00001 errno=0 status=i +func=atanf op1=7f800000 result=3fc90fda.a22 errno=0 +func=atanf op1=ff800000 result=bfc90fda.a22 errno=0 +func=atanf op1=00000000 result=00000000 errno=0 +func=atanf op1=80000000 result=80000000 errno=0 +; Inconsistent behavior was detected for the following 2 cases. +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=atanf op1=00000001 result=00000001 errno=0 maybestatus=ux +func=atanf op1=80000001 result=80000001 errno=0 maybestatus=ux + +func=atanf op1=3f800000 result=3f490fda.a22 errno=0 +func=atanf op1=bf800000 result=bf490fda.a22 errno=0 diff --git a/pl/math/test/testcases/directed/atanh.tst b/pl/math/test/testcases/directed/atanh.tst new file mode 100644 index 0000000..d96ff32 --- /dev/null +++ b/pl/math/test/testcases/directed/atanh.tst @@ -0,0 +1,22 @@ +; atanh.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=atanh op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=atanh op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=atanh op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atanh op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=atanh op1=7ff00000.00000000 result=7ff80000.00000001 errno=EDOM status=i +func=atanh op1=fff00000.00000000 result=7ff80000.00000001 errno=EDOM status=i +func=atanh op1=3ff00000.00000001 result=7ff80000.00000001 errno=EDOM status=i +func=atanh op1=bff00000.00000001 result=7ff80000.00000001 errno=EDOM status=i +func=atanh op1=3ff00000.00000000 result=7ff00000.00000000 errno=ERANGE status=z +func=atanh op1=bff00000.00000000 result=fff00000.00000000 errno=ERANGE status=z +func=atanh op1=00000000.00000000 result=00000000.00000000 errno=0 +func=atanh op1=80000000.00000000 result=80000000.00000000 errno=0 +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=atanh op1=00000000.00000001 result=00000000.00000001 errno=0 maybestatus=ux +func=atanh op1=80000000.00000001 result=80000000.00000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/directed/atanhf.tst b/pl/math/test/testcases/directed/atanhf.tst new file mode 100644 index 0000000..21a68a6 --- /dev/null +++ b/pl/math/test/testcases/directed/atanhf.tst @@ -0,0 +1,23 @@ +; atanhf.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=atanhf op1=7fc00001 result=7fc00001 errno=0 +func=atanhf op1=ffc00001 result=7fc00001 errno=0 +func=atanhf op1=7f800001 result=7fc00001 errno=0 status=i +func=atanhf op1=ff800001 result=7fc00001 errno=0 status=i +func=atanhf op1=7f800000 result=7fc00001 errno=EDOM status=i +func=atanhf op1=ff800000 result=7fc00001 errno=EDOM status=i +func=atanhf op1=3f800001 result=7fc00001 errno=EDOM status=i +func=atanhf op1=bf800001 result=7fc00001 errno=EDOM status=i +func=atanhf op1=3f800000 result=7f800000 errno=ERANGE status=z +func=atanhf op1=bf800000 result=ff800000 errno=ERANGE status=z +func=atanhf op1=00000000 result=00000000 errno=0 +func=atanhf op1=80000000 result=80000000 errno=0 + +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=atanhf op1=00000001 result=00000001 errno=0 maybestatus=ux +func=atanhf op1=80000001 result=80000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/directed/cbrtf.tst b/pl/math/test/testcases/directed/cbrtf.tst new file mode 100644 index 0000000..0dd8d09 --- /dev/null +++ b/pl/math/test/testcases/directed/cbrtf.tst @@ -0,0 +1,29 @@ +; cbrtf.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=cbrtf op1=7f800000 result=7f800000 errno=0 +func=cbrtf op1=ff800000 result=ff800000 errno=0 +func=cbrtf op1=7f800001 result=7fc00001 errno=0 status=i +func=cbrtf op1=7fc00001 result=7fc00001 errno=0 +func=cbrtf op1=00000000 result=00000000 errno=0 +func=cbrtf op1=00000001 result=26a14517.cc7 errno=0 +func=cbrtf op1=00000002 result=26cb2ff5.29f errno=0 +func=cbrtf op1=00000003 result=26e89768.579 errno=0 +func=cbrtf op1=00000004 result=27000000.000 errno=0 +func=cbrtf op1=00400000 result=2a4b2ff5.29f errno=0 +func=cbrtf op1=00800000 result=2a800000.000 errno=0 +func=cbrtf op1=3f800000 result=3f800000.000 errno=0 +func=cbrtf op1=40000000 result=3fa14517.cc7 errno=0 +func=cbrtf op1=7f7fffff result=54cb2ff4.e63 errno=0 +func=cbrtf op1=80000000 result=80000000 errno=0 +func=cbrtf op1=80000001 result=a6a14517.cc7 errno=0 +func=cbrtf op1=80000002 result=a6cb2ff5.29f errno=0 +func=cbrtf op1=80000003 result=a6e89768.579 errno=0 +func=cbrtf op1=80000004 result=a7000000.000 errno=0 +func=cbrtf op1=80400000 result=aa4b2ff5.29f errno=0 +func=cbrtf op1=80800000 result=aa800000.000 errno=0 +func=cbrtf op1=bf800000 result=bf800000.000 errno=0 +func=cbrtf op1=c0000000 result=bfa14517.cc7 errno=0 +func=cbrtf op1=ff7fffff result=d4cb2ff4.e63 errno=0 diff --git a/pl/math/test/testcases/directed/cosh.tst b/pl/math/test/testcases/directed/cosh.tst new file mode 100644 index 0000000..c4efacb --- /dev/null +++ b/pl/math/test/testcases/directed/cosh.tst @@ -0,0 +1,15 @@ +; cosh.tst +; +; Copyright (c) 1999-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=cosh op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=cosh op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=cosh op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=cosh op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=cosh op1=7ff00000.00000000 result=7ff00000.00000000 errno=0 +func=cosh op1=7fefffff.ffffffff result=7ff00000.00000000 errno=ERANGE status=ox +func=cosh op1=fff00000.00000000 result=7ff00000.00000000 errno=0 +func=cosh op1=ffefffff.ffffffff result=7ff00000.00000000 errno=ERANGE status=ox +func=cosh op1=00000000.00000000 result=3ff00000.00000000 errno=0 +func=cosh op1=80000000.00000000 result=3ff00000.00000000 errno=0 diff --git a/pl/math/test/testcases/directed/coshf.tst b/pl/math/test/testcases/directed/coshf.tst new file mode 100644 index 0000000..2b967e7 --- /dev/null +++ b/pl/math/test/testcases/directed/coshf.tst @@ -0,0 +1,15 @@ +; coshf.tst +; +; Copyright (c) 2007-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=coshf op1=7fc00001 result=7fc00001 errno=0 +func=coshf op1=ffc00001 result=7fc00001 errno=0 +func=coshf op1=7f800001 result=7fc00001 errno=0 status=i +func=coshf op1=ff800001 result=7fc00001 errno=0 status=i +func=coshf op1=7f800000 result=7f800000 errno=0 +func=coshf op1=7f7fffff result=7f800000 errno=ERANGE status=ox +func=coshf op1=ff800000 result=7f800000 errno=0 +func=coshf op1=ff7fffff result=7f800000 errno=ERANGE status=ox +func=coshf op1=00000000 result=3f800000 errno=0 +func=coshf op1=80000000 result=3f800000 errno=0 diff --git a/pl/math/test/testcases/directed/erfc.tst b/pl/math/test/testcases/directed/erfc.tst new file mode 100644 index 0000000..c03fc59 --- /dev/null +++ b/pl/math/test/testcases/directed/erfc.tst @@ -0,0 +1,23 @@ +; erfc.tst - Directed test cases for erfc +; +; Copyright (c) 2022-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=erfc op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=erfc op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=erfc op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=erfc op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=erfc op1=7ff00000.00000000 result=00000000.00000000 errno=0 +func=erfc op1=7fefffff.ffffffff result=00000000.00000000 errno=ERANGE status=ux +; We deliberately turned off errno setting in erf, as standard simply +; state that errno `may` be set to ERANGE in case of underflow. +; As a result the following condition on errno cannot be satisfied. +; +; func=erfc op1=403b44af.48b01531 result=00000000.00000000 errno=ERANGE status=ux +; +func=erfc op1=c03b44af.48b01531 result=40000000.00000000 errno=0 +func=erfc op1=403bffff.ffffffff result=00000000.00000000 errno=ERANGE status=ux +func=erfc op1=c03bffff.ffffffff result=40000000.00000000 errno=0 +func=erfc op1=fff00000.00000000 result=40000000.00000000 errno=0 +func=erfc op1=00000000.00000000 result=3ff00000.00000000 errno=0 +func=erfc op1=80000000.00000000 result=3ff00000.00000000 errno=0 diff --git a/pl/math/test/testcases/directed/erfcf.tst b/pl/math/test/testcases/directed/erfcf.tst new file mode 100644 index 0000000..719bacc --- /dev/null +++ b/pl/math/test/testcases/directed/erfcf.tst @@ -0,0 +1,14 @@ +; erfcf.tst - Directed test cases for erfcf +; +; Copyright (c) 2007-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=erfcf op1=7fc00001 result=7fc00001 errno=0 +func=erfcf op1=ffc00001 result=7fc00001 errno=0 +func=erfcf op1=7f800001 result=7fc00001 errno=0 status=i +func=erfcf op1=ff800001 result=7fc00001 errno=0 status=i +func=erfcf op1=7f800000 result=00000000 errno=0 +func=erfcf op1=7f7fffff result=00000000 errno=ERANGE status=ux +func=erfcf op1=ff800000 result=40000000 errno=0 +func=erfcf op1=00000000 result=3f800000 errno=0 +func=erfcf op1=80000000 result=3f800000 errno=0 diff --git a/pl/math/test/testcases/directed/erff.tst b/pl/math/test/testcases/directed/erff.tst new file mode 100644 index 0000000..9b1d3d5 --- /dev/null +++ b/pl/math/test/testcases/directed/erff.tst @@ -0,0 +1,17 @@ +; erff.tst +; +; Copyright (c) 2007-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=erff op1=7fc00001 result=7fc00001 errno=0 +func=erff op1=ffc00001 result=7fc00001 errno=0 +func=erff op1=7f800001 result=7fc00001 errno=0 status=i +func=erff op1=ff800001 result=7fc00001 errno=0 status=i +func=erff op1=7f800000 result=3f800000 errno=0 +func=erff op1=ff800000 result=bf800000 errno=0 +func=erff op1=00000000 result=00000000 errno=ERANGE +func=erff op1=80000000 result=80000000 errno=ERANGE +func=erff op1=00000001 result=00000001 errno=0 status=ux +func=erff op1=80000001 result=80000001 errno=0 status=ux +func=erff op1=3f800000 result=3f57bb3d.3a0 errno=0 +func=erff op1=bf800000 result=bf57bb3d.3a0 errno=0 diff --git a/pl/math/test/testcases/directed/expm1.tst b/pl/math/test/testcases/directed/expm1.tst new file mode 100644 index 0000000..609d6f4 --- /dev/null +++ b/pl/math/test/testcases/directed/expm1.tst @@ -0,0 +1,21 @@ +; expm1.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=expm1 op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=expm1 op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=expm1 op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=expm1 op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=expm1 op1=7ff00000.00000000 result=7ff00000.00000000 errno=0 +func=expm1 op1=7fefffff.ffffffff result=7ff00000.00000000 errno=ERANGE status=ox +func=expm1 op1=fff00000.00000000 result=bff00000.00000000 errno=0 +func=expm1 op1=ffefffff.ffffffff result=bff00000.00000000 errno=0 +func=expm1 op1=00000000.00000000 result=00000000.00000000 errno=0 +func=expm1 op1=80000000.00000000 result=80000000.00000000 errno=0 +; Inconsistent behavior was detected for the following 2 cases. +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=expm1 op1=00000000.00000001 result=00000000.00000001 errno=0 maybestatus=ux +func=expm1 op1=80000000.00000001 result=80000000.00000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/directed/expm1f.tst b/pl/math/test/testcases/directed/expm1f.tst new file mode 100644 index 0000000..44c3842 --- /dev/null +++ b/pl/math/test/testcases/directed/expm1f.tst @@ -0,0 +1,57 @@ +; expm1f.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=expm1f op1=7fc00001 result=7fc00001 errno=0 +func=expm1f op1=ffc00001 result=7fc00001 errno=0 +func=expm1f op1=7f800001 result=7fc00001 errno=0 status=i +func=expm1f op1=ff800001 result=7fc00001 errno=0 status=i +func=expm1f op1=7f800000 result=7f800000 errno=0 +func=expm1f op1=7f7fffff result=7f800000 errno=ERANGE status=ox +func=expm1f op1=ff800000 result=bf800000 errno=0 +func=expm1f op1=ff7fffff result=bf800000 errno=0 +func=expm1f op1=00000000 result=00000000 errno=0 +func=expm1f op1=80000000 result=80000000 errno=0 + +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. + +func=expm1f op1=00000001 result=00000001 errno=0 maybestatus=ux +func=expm1f op1=80000001 result=80000001 errno=0 maybestatus=ux + +func=expm1f op1=42b145c0 result=7f6ac2dd.9b8 errno=0 + +; Check both sides of the over/underflow thresholds in the code. +func=expm1f op1=c2000000 result=bf7fffff.fff error=0 +func=expm1f op1=c2000001 result=bf7fffff.fff error=0 +func=expm1f op1=43000000 result=7f800000 error=overflow +func=expm1f op1=43000001 result=7f800000 error=overflow +func=expm1f op1=c2a80000 result=bf800000.000 error=0 +func=expm1f op1=c2a80001 result=bf800000.000 error=0 + +; Check values for which exp goes denormal. expm1f should not report +; spurious overflow. +func=expm1f op1=c2b00f34 result=bf800000.000 error=0 +func=expm1f op1=c2ce8ed0 result=bf800000.000 error=0 +func=expm1f op1=c2dc6bba result=bf800000.000 error=0 + +; Regression tests for significance loss when the two components of +; the result have opposite sign but similar magnitude +func=expm1f op1=be8516c1 result=be6a652b.0dc error=0 +func=expm1f op1=be851714 result=be6a65ab.0e5 error=0 +func=expm1f op1=be851cc7 result=be6a6e75.111 error=0 +func=expm1f op1=be851d1a result=be6a6ef5.102 error=0 +func=expm1f op1=be851d6d result=be6a6f75.0f2 error=0 +func=expm1f op1=be852065 result=be6a7409.0e4 error=0 +func=expm1f op1=be8520b8 result=be6a7489.0c7 error=0 +func=expm1f op1=be85210b result=be6a7509.0a8 error=0 +func=expm1f op1=be855401 result=be6ac39b.0d5 error=0 +func=expm1f op1=be933307 result=be7fdbf0.d8d error=0 +func=expm1f op1=be92ed6b result=be7f737a.d81 error=0 +func=expm1f op1=be933b90 result=be7fe8be.d76 error=0 +func=expm1f op1=3eb11364 result=3ed38deb.0c0 error=0 +func=expm1f op1=3f28e830 result=3f6f344b.0da error=0 +func=expm1f op1=3eb1578f result=3ed3ee47.13b error=0 +func=expm1f op1=3f50176a result=3fa08e36.fea error=0 diff --git a/pl/math/test/testcases/directed/log10.tst b/pl/math/test/testcases/directed/log10.tst new file mode 100644 index 0000000..3483143 --- /dev/null +++ b/pl/math/test/testcases/directed/log10.tst @@ -0,0 +1,16 @@ +; log10.tst +; +; Copyright (c) 2007-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=log10 op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=log10 op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=log10 op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=log10 op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=log10 op1=fff02000.00000000 result=7ff80000.00000001 errno=0 status=i +func=log10 op1=7ff00000.00000000 result=7ff00000.00000000 errno=0 +func=log10 op1=3ff00000.00000000 result=00000000.00000000 errno=0 +func=log10 op1=fff00000.00000000 result=7ff80000.00000001 errno=EDOM status=i +func=log10 op1=00000000.00000000 result=fff00000.00000000 errno=ERANGE status=z +func=log10 op1=80000000.00000000 result=fff00000.00000000 errno=ERANGE status=z +func=log10 op1=80000000.00000001 result=7ff80000.00000001 errno=EDOM status=i diff --git a/pl/math/test/testcases/directed/log10f.tst b/pl/math/test/testcases/directed/log10f.tst new file mode 100644 index 0000000..d5744a6 --- /dev/null +++ b/pl/math/test/testcases/directed/log10f.tst @@ -0,0 +1,69 @@ +; log10f.tst +; +; Copyright (c) 2007-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=log10f op1=7fc00001 result=7fc00001 errno=0 +func=log10f op1=ffc00001 result=7fc00001 errno=0 +func=log10f op1=7f800001 result=7fc00001 errno=0 status=i +func=log10f op1=ff800001 result=7fc00001 errno=0 status=i +func=log10f op1=ff810000 result=7fc00001 errno=0 status=i +func=log10f op1=7f800000 result=7f800000 errno=0 +func=log10f op1=3f800000 result=00000000 errno=0 +func=log10f op1=ff800000 result=7fc00001 errno=EDOM status=i +func=log10f op1=00000000 result=ff800000 errno=ERANGE status=z +func=log10f op1=80000000 result=ff800000 errno=ERANGE status=z +func=log10f op1=80000001 result=7fc00001 errno=EDOM status=i + +; Directed tests for the special-case handling of log10 of things +; very near 1 +func=log10f op1=3f81a618 result=3bb62472.b92 error=0 +func=log10f op1=3f876783 result=3cc811f4.26c error=0 +func=log10f op1=3f816af8 result=3b9cc4c7.057 error=0 +func=log10f op1=3f7bed7d result=bbe432cb.e23 error=0 +func=log10f op1=3f803ece result=3a59ff3a.a84 error=0 +func=log10f op1=3f80089f result=38ef9728.aa6 error=0 +func=log10f op1=3f86ab72 result=3cb4b711.457 error=0 +func=log10f op1=3f780854 result=bc60f953.904 error=0 +func=log10f op1=3f7c6d76 result=bbc7fd01.01c error=0 +func=log10f op1=3f85dff6 result=3c9fa76f.81f error=0 +func=log10f op1=3f7b87f4 result=bbfa9edc.be4 error=0 +func=log10f op1=3f81c710 result=3bc4457b.745 error=0 +func=log10f op1=3f80946d result=3b00a140.c06 error=0 +func=log10f op1=3f7e87ea result=bb23cd70.828 error=0 +func=log10f op1=3f811437 result=3b6ee960.b40 error=0 +func=log10f op1=3f858dcf result=3c971d9b.2ea error=0 +func=log10f op1=3f7f61a3 result=ba89b814.4e0 error=0 +func=log10f op1=3f82d642 result=3c1bfb8d.517 error=0 +func=log10f op1=3f80f3bc result=3b52ebe8.c75 error=0 +func=log10f op1=3f85eff9 result=3ca150d9.7e8 error=0 +func=log10f op1=3f843eb8 result=3c68263f.771 error=0 +func=log10f op1=3f78e691 result=bc481cf4.50a error=0 +func=log10f op1=3f87c56f result=3cd1b268.5e6 error=0 +func=log10f op1=3f83b711 result=3c4b94c5.918 error=0 +func=log10f op1=3f823b2b result=3bf5eb02.e2a error=0 +func=log10f op1=3f7f2c4e result=bab82c80.519 error=0 +func=log10f op1=3f83fc92 result=3c5a3ba1.543 error=0 +func=log10f op1=3f793956 result=bc3ee04e.03c error=0 +func=log10f op1=3f839ba5 result=3c45caca.92a error=0 +func=log10f op1=3f862f30 result=3ca7de76.16f error=0 +func=log10f op1=3f832a20 result=3c2dc6e9.afd error=0 +func=log10f op1=3f810296 result=3b5fb92a.429 error=0 +func=log10f op1=3f7e58c9 result=bb38655a.0a4 error=0 +func=log10f op1=3f8362e7 result=3c39cc65.d15 error=0 +func=log10f op1=3f7fdb85 result=b97d9016.40b error=0 +func=log10f op1=3f84484e result=3c6a29f2.f74 error=0 +func=log10f op1=3f861862 result=3ca5819e.f2d error=0 +func=log10f op1=3f7c027b result=bbdf912d.440 error=0 +func=log10f op1=3f867803 result=3caf6744.34d error=0 +func=log10f op1=3f789a89 result=bc509bce.458 error=0 +func=log10f op1=3f8361d9 result=3c399347.379 error=0 +func=log10f op1=3f7d3ac3 result=bb9ad93a.93d error=0 +func=log10f op1=3f7ee241 result=baf8bd12.a62 error=0 +func=log10f op1=3f83a1fd result=3c4721bd.0a4 error=0 +func=log10f op1=3f840da3 result=3c5dd375.675 error=0 +func=log10f op1=3f79c2fe result=bc2f8a60.8c5 error=0 +func=log10f op1=3f854a93 result=3c901cc9.add error=0 +func=log10f op1=3f87a50a result=3cce6125.cd6 error=0 +func=log10f op1=3f818bf5 result=3baaee68.a55 error=0 +func=log10f op1=3f830a44 result=3c2705c4.d87 error=0 diff --git a/pl/math/test/testcases/directed/log1p.tst b/pl/math/test/testcases/directed/log1p.tst new file mode 100644 index 0000000..9ee8c62 --- /dev/null +++ b/pl/math/test/testcases/directed/log1p.tst @@ -0,0 +1,22 @@ +; log1p.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=log1p op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=log1p op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=log1p op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=log1p op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=log1p op1=fff02000.00000000 result=7ff80000.00000001 errno=0 status=i +func=log1p op1=7ff00000.00000000 result=7ff00000.00000000 errno=0 +; Cases 6, 9 , 10, 11, 12 fail with certain versions of GLIBC and not others. +; The main reason seems to be the handling of errno and exceptions. + +func=log1p op1=00000000.00000000 result=00000000.00000000 errno=0 +func=log1p op1=80000000.00000000 result=80000000.00000000 errno=0 + +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=log1p op1=00000000.00000001 result=00000000.00000001 errno=0 maybestatus=ux +func=log1p op1=80000000.00000001 result=80000000.00000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/directed/log1pf.tst b/pl/math/test/testcases/directed/log1pf.tst new file mode 100644 index 0000000..aaa01d6 --- /dev/null +++ b/pl/math/test/testcases/directed/log1pf.tst @@ -0,0 +1,130 @@ +; log1pf.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=log1pf op1=7fc00001 result=7fc00001 errno=0 +func=log1pf op1=ffc00001 result=7fc00001 errno=0 +func=log1pf op1=7f800001 result=7fc00001 errno=0 status=i +func=log1pf op1=ff800001 result=7fc00001 errno=0 status=i +func=log1pf op1=ff810000 result=7fc00001 errno=0 status=i +func=log1pf op1=7f800000 result=7f800000 errno=0 + +; Cases 6, 9 , 10, 11, 12 fail with certain versions of GLIBC and not others. +; The main reason seems to be the handling of errno and exceptions. + +func=log1pf op1=00000000 result=00000000 errno=0 +func=log1pf op1=80000000 result=80000000 errno=0 + +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=log1pf op1=00000001 result=00000001 errno=0 maybestatus=ux +func=log1pf op1=80000001 result=80000001 errno=0 maybestatus=ux + +func=log1pf op1=3f1e91ee result=3ef6d127.fdb errno=0 +func=log1pf op1=3f201046 result=3ef8a881.fba errno=0 +func=log1pf op1=3f21b916 result=3efab23b.f9f errno=0 +func=log1pf op1=3f21bde6 result=3efab821.fee errno=0 +func=log1pf op1=3f22a5ee result=3efbd435.ff2 errno=0 +func=log1pf op1=3f231b56 result=3efc63b7.e26 errno=0 +func=log1pf op1=3f23ce96 result=3efd3e83.fc8 errno=0 +func=log1pf op1=3eee18c6 result=3ec38576.02e errno=0 +func=log1pf op1=3eee2f41 result=3ec394ce.057 errno=0 +func=log1pf op1=3eee770d result=3ec3c5cc.00c errno=0 +func=log1pf op1=3eee7fed result=3ec3cbda.065 errno=0 +func=log1pf op1=3eee8fb2 result=3ec3d69c.008 errno=0 +func=log1pf op1=3eeeb8eb result=3ec3f2ba.061 errno=0 +func=log1pf op1=3eeeccfd result=3ec4006a.01d errno=0 +func=log1pf op1=3eeef5f0 result=3ec41c56.020 errno=0 +func=log1pf op1=3eeeff12 result=3ec42290.00c errno=0 +func=log1pf op1=3eef05cf result=3ec42728.052 errno=0 +func=log1pf op1=3eef13d3 result=3ec430b6.00e errno=0 +func=log1pf op1=3eef2e70 result=3ec442da.04a errno=0 +func=log1pf op1=3eef3fbf result=3ec44ea6.055 errno=0 +func=log1pf op1=3eef3feb result=3ec44ec4.021 errno=0 +func=log1pf op1=3eef4399 result=3ec45146.011 errno=0 +func=log1pf op1=3eef452e result=3ec4525a.049 errno=0 +func=log1pf op1=3eef4ea9 result=3ec458d0.020 errno=0 +func=log1pf op1=3eef7365 result=3ec471d8.05e errno=0 +func=log1pf op1=3eefa38f result=3ec492a8.003 errno=0 +func=log1pf op1=3eefb1f1 result=3ec49c74.015 errno=0 +func=log1pf op1=3eefb334 result=3ec49d50.023 errno=0 +func=log1pf op1=3eefb3c1 result=3ec49db0.0bf errno=0 +func=log1pf op1=3eefb591 result=3ec49eec.15d errno=0 +func=log1pf op1=3eefd736 result=3ec4b5d6.02d errno=0 +func=log1pf op1=3eefd797 result=3ec4b618.114 errno=0 +func=log1pf op1=3eefee5d result=3ec4c59a.071 errno=0 +func=log1pf op1=3eeffff4 result=3ec4d194.0a7 errno=0 +func=log1pf op1=3ef00cd1 result=3ec4da56.025 errno=0 +func=log1pf op1=3ef0163a result=3ec4e0be.07a errno=0 +func=log1pf op1=3ef01e89 result=3ec4e666.007 errno=0 +func=log1pf op1=3ef02004 result=3ec4e768.00a errno=0 +func=log1pf op1=3ef02c40 result=3ec4efbc.017 errno=0 +func=log1pf op1=3ef05b50 result=3ec50fc4.031 errno=0 +func=log1pf op1=3ef05bb1 result=3ec51006.05f errno=0 +func=log1pf op1=3ef0651b result=3ec5166e.0d9 errno=0 +func=log1pf op1=3ef06609 result=3ec51710.02a errno=0 +func=log1pf op1=3ef0666a result=3ec51752.049 errno=0 +func=log1pf op1=3ef0791e result=3ec5240c.0a8 errno=0 +func=log1pf op1=3ef07d46 result=3ec526e0.00e errno=0 +func=log1pf op1=3ef091fd result=3ec534f8.03c errno=0 +func=log1pf op1=3ef09602 result=3ec537b4.128 errno=0 +func=log1pf op1=3ef09848 result=3ec53940.044 errno=0 +func=log1pf op1=3ef0a04f result=3ec53eb6.07d errno=0 +func=log1pf op1=3ef0ab6a result=3ec54644.062 errno=0 +func=log1pf op1=3ef0ae49 result=3ec54838.002 errno=0 +func=log1pf op1=3ef0c1b8 result=3ec55570.000 errno=0 +func=log1pf op1=3ef0ca06 result=3ec55b16.00d errno=0 +func=log1pf op1=3ef0cc29 result=3ec55c8a.095 errno=0 +func=log1pf op1=3ef0d228 result=3ec5609e.04f errno=0 +func=log1pf op1=3ef0d8c0 result=3ec5651a.05e errno=0 +func=log1pf op1=3ef0dc0c result=3ec56758.029 errno=0 +func=log1pf op1=3ef0e0e8 result=3ec56aa6.02e errno=0 +func=log1pf op1=3ef0e502 result=3ec56d70.102 errno=0 +func=log1pf op1=3ef0e754 result=3ec56f04.017 errno=0 +func=log1pf op1=3ef0efe9 result=3ec574da.01c errno=0 +func=log1pf op1=3ef0f309 result=3ec576fa.016 errno=0 +func=log1pf op1=3ef0f499 result=3ec5780a.005 errno=0 +func=log1pf op1=3ef0f6c2 result=3ec57982.083 errno=0 +func=log1pf op1=3ef0f852 result=3ec57a92.05d errno=0 +func=log1pf op1=3ef0f9e2 result=3ec57ba2.02e errno=0 +func=log1pf op1=3ef119ee result=3ec5916c.024 errno=0 +func=log1pf op1=3ef11edf result=3ec594c8.03d errno=0 +func=log1pf op1=3ef128c4 result=3ec59b82.001 errno=0 +func=log1pf op1=3ef12ac1 result=3ec59cdc.04b errno=0 +func=log1pf op1=3ef12fea result=3ec5a05e.045 errno=0 +func=log1pf op1=3ef131e7 result=3ec5a1b8.05a errno=0 +func=log1pf op1=3ef134e1 result=3ec5a3be.00e errno=0 +func=log1pf op1=3ef1397a result=3ec5a6de.127 errno=0 +func=log1pf op1=3ef13ade result=3ec5a7d0.0f6 errno=0 +func=log1pf op1=3ef13c0d result=3ec5a89e.054 errno=0 +func=log1pf op1=3ef13d71 result=3ec5a990.016 errno=0 +func=log1pf op1=3ef14074 result=3ec5ab9c.12c errno=0 +func=log1pf op1=3ef146a0 result=3ec5afce.035 errno=0 +func=log1pf op1=3ef14a39 result=3ec5b240.024 errno=0 +func=log1pf op1=3ef14d39 result=3ec5b44a.00c errno=0 +func=log1pf op1=3ef152a3 result=3ec5b7f8.04d errno=0 +func=log1pf op1=3ef170a1 result=3ec5cc5a.021 errno=0 +func=log1pf op1=3ef17855 result=3ec5d196.0dc errno=0 +func=log1pf op1=3ef17ece result=3ec5d5fc.010 errno=0 +func=log1pf op1=3ef1810c result=3ec5d782.08e errno=0 +func=log1pf op1=3ef18da9 result=3ec5e014.0ae errno=0 +func=log1pf op1=3ef19054 result=3ec5e1e4.1a2 errno=0 +func=log1pf op1=3ef190ea result=3ec5e24a.048 errno=0 +func=log1pf op1=3ef1a739 result=3ec5f172.0d8 errno=0 +func=log1pf op1=3ef1a83c result=3ec5f222.018 errno=0 +func=log1pf op1=3ef1bbcc result=3ec5ff6c.09d errno=0 +func=log1pf op1=3ef1bd3c result=3ec60066.03a errno=0 +func=log1pf op1=3ef1d6ee result=3ec611da.056 errno=0 +func=log1pf op1=3ef1de36 result=3ec616cc.01b errno=0 +func=log1pf op1=3ef1e623 result=3ec61c2e.008 errno=0 +func=log1pf op1=3ef1e9b1 result=3ec61e98.029 errno=0 +func=log1pf op1=3ef1ee19 result=3ec62196.0d8 errno=0 +func=log1pf op1=3ef1f13a result=3ec623b6.039 errno=0 +func=log1pf op1=3ef1f1a7 result=3ec62400.091 errno=0 +func=log1pf op1=3ef1f214 result=3ec6244a.0e8 errno=0 +func=log1pf op1=3ef206e1 result=3ec6326a.09b errno=0 +func=log1pf op1=3ef21245 result=3ec63a26.012 errno=0 +func=log1pf op1=3ef217fd result=3ec63e08.048 errno=0 +func=log1pf op1=3ef2186a result=3ec63e52.063 errno=0 diff --git a/pl/math/test/testcases/directed/log2.tst b/pl/math/test/testcases/directed/log2.tst new file mode 100644 index 0000000..5d1eb9b --- /dev/null +++ b/pl/math/test/testcases/directed/log2.tst @@ -0,0 +1,21 @@ +; Directed test cases for log2 +; +; Copyright (c) 2018-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=log2 op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=log2 op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=log2 op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=log2 op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=log2 op1=7ff00000.00000000 result=7ff00000.00000000 errno=0 +func=log2 op1=fff00000.00000000 result=7ff80000.00000001 errno=EDOM status=i +func=log2 op1=7fefffff.ffffffff result=408fffff.ffffffff.ffa errno=0 +func=log2 op1=ffefffff.ffffffff result=7ff80000.00000001 errno=EDOM status=i +func=log2 op1=3ff00000.00000000 result=00000000.00000000 errno=0 +func=log2 op1=bff00000.00000000 result=7ff80000.00000001 errno=EDOM status=i +func=log2 op1=00000000.00000000 result=fff00000.00000000 errno=ERANGE status=z +func=log2 op1=80000000.00000000 result=fff00000.00000000 errno=ERANGE status=z +func=log2 op1=00000000.00000001 result=c090c800.00000000 errno=0 +func=log2 op1=80000000.00000001 result=7ff80000.00000001 errno=EDOM status=i +func=log2 op1=40000000.00000000 result=3ff00000.00000000 errno=0 +func=log2 op1=3fe00000.00000000 result=bff00000.00000000 errno=0 diff --git a/pl/math/test/testcases/directed/log2f.tst b/pl/math/test/testcases/directed/log2f.tst new file mode 100644 index 0000000..4e08110 --- /dev/null +++ b/pl/math/test/testcases/directed/log2f.tst @@ -0,0 +1,27 @@ +; log2f.tst - Directed test cases for log2f +; +; Copyright (c) 2017-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=log2f op1=7fc00001 result=7fc00001 errno=0 +func=log2f op1=ffc00001 result=7fc00001 errno=0 +func=log2f op1=7f800001 result=7fc00001 errno=0 status=i +func=log2f op1=ff800001 result=7fc00001 errno=0 status=i +func=log2f op1=ff810000 result=7fc00001 errno=0 status=i +func=log2f op1=7f800000 result=7f800000 errno=0 +func=log2f op1=ff800000 result=7fc00001 errno=EDOM status=i +func=log2f op1=3f800000 result=00000000 errno=0 +func=log2f op1=00000000 result=ff800000 errno=ERANGE status=z +func=log2f op1=80000000 result=ff800000 errno=ERANGE status=z +func=log2f op1=80000001 result=7fc00001 errno=EDOM status=i + +func=log2f op1=3f7d70a4 result=bc6d8f8b.7d4 error=0 +func=log2f op1=3f604189 result=be4394c8.395 error=0 +func=log2f op1=3f278034 result=bf1caa73.88e error=0 +func=log2f op1=3edd3c36 result=bf9af3b9.619 error=0 +func=log2f op1=3e61259a result=c00bdb95.650 error=0 +func=log2f op1=3f8147ae result=3c6b3267.d6a error=0 +func=log2f op1=3f8fbe77 result=3e2b5fe2.a1c error=0 +func=log2f op1=3fac3eea result=3edb4d5e.1fc error=0 +func=log2f op1=3fd6e632 result=3f3f5d3a.827 error=0 +func=log2f op1=40070838 result=3f89e055.a0a error=0 diff --git a/pl/math/test/testcases/directed/sinh.tst b/pl/math/test/testcases/directed/sinh.tst new file mode 100644 index 0000000..d6a3da8 --- /dev/null +++ b/pl/math/test/testcases/directed/sinh.tst @@ -0,0 +1,21 @@ +; sinh.tst +; +; Copyright (c) 1999-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=sinh op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=sinh op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=sinh op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=sinh op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=sinh op1=7ff00000.00000000 result=7ff00000.00000000 errno=0 +func=sinh op1=7fefffff.ffffffff result=7ff00000.00000000 errno=ERANGE status=ox +func=sinh op1=fff00000.00000000 result=fff00000.00000000 errno=0 +func=sinh op1=ffefffff.ffffffff result=fff00000.00000000 errno=ERANGE status=ox +func=sinh op1=00000000.00000000 result=00000000.00000000 errno=0 +func=sinh op1=80000000.00000000 result=80000000.00000000 errno=0 + +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=sinh op1=00000000.00000001 result=00000000.00000001 errno=0 maybestatus=ux +func=sinh op1=80000000.00000001 result=80000000.00000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/directed/sinhf.tst b/pl/math/test/testcases/directed/sinhf.tst new file mode 100644 index 0000000..5f7bd1b --- /dev/null +++ b/pl/math/test/testcases/directed/sinhf.tst @@ -0,0 +1,21 @@ +; sinhf.tst +; +; Copyright (c) 2009-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=sinhf op1=7fc00001 result=7fc00001 errno=0 +func=sinhf op1=ffc00001 result=7fc00001 errno=0 +func=sinhf op1=7f800001 result=7fc00001 errno=0 status=i +func=sinhf op1=ff800001 result=7fc00001 errno=0 status=i +func=sinhf op1=7f800000 result=7f800000 errno=0 +func=sinhf op1=7f7fffff result=7f800000 errno=ERANGE status=ox +func=sinhf op1=ff800000 result=ff800000 errno=0 +func=sinhf op1=ff7fffff result=ff800000 errno=ERANGE status=ox +func=sinhf op1=00000000 result=00000000 errno=0 +func=sinhf op1=80000000 result=80000000 errno=0 + +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=sinhf op1=00000001 result=00000001 errno=0 maybestatus=ux +func=sinhf op1=80000001 result=80000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/directed/tanf.tst b/pl/math/test/testcases/directed/tanf.tst new file mode 100644 index 0000000..3161f70 --- /dev/null +++ b/pl/math/test/testcases/directed/tanf.tst @@ -0,0 +1,25 @@ +; tanf.tst +; +; Copyright (c) 2022-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=tanf op1=7fc00001 result=7fc00001 errno=0 +func=tanf op1=ffc00001 result=7fc00001 errno=0 +func=tanf op1=7f800001 result=7fc00001 errno=0 status=i +func=tanf op1=ff800001 result=7fc00001 errno=0 status=i +func=tanf op1=7f800000 result=7fc00001 errno=EDOM status=i +func=tanf op1=ff800000 result=7fc00001 errno=EDOM status=i +func=tanf op1=00000000 result=00000000 errno=0 +func=tanf op1=80000000 result=80000000 errno=0 +; SDCOMP-26094: check tanf in the cases for which the range reducer +; returns values furthest beyond its nominal upper bound of pi/4. +func=tanf op1=46427f1b result=3f80396d.599 error=0 +func=tanf op1=4647e568 result=3f8039a6.c9f error=0 +func=tanf op1=46428bac result=3f803a03.148 error=0 +func=tanf op1=4647f1f9 result=3f803a3c.852 error=0 +func=tanf op1=4647fe8a result=3f803ad2.410 error=0 +func=tanf op1=45d8d7f1 result=bf800669.901 error=0 +func=tanf op1=45d371a4 result=bf800686.3cd error=0 +func=tanf op1=45ce0b57 result=bf8006a2.e9a error=0 +func=tanf op1=45d35882 result=bf80071b.bc4 error=0 +func=tanf op1=45cdf235 result=bf800738.693 error=0 diff --git a/pl/math/test/testcases/directed/tanh.tst b/pl/math/test/testcases/directed/tanh.tst new file mode 100644 index 0000000..78776e6 --- /dev/null +++ b/pl/math/test/testcases/directed/tanh.tst @@ -0,0 +1,18 @@ +; tanh.tst +; +; Copyright (c) 1999-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=tanh op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=tanh op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=tanh op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=tanh op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=tanh op1=7ff00000.00000000 result=3ff00000.00000000 errno=0 +func=tanh op1=fff00000.00000000 result=bff00000.00000000 errno=0 +func=tanh op1=00000000.00000000 result=00000000.00000000 errno=0 +func=tanh op1=80000000.00000000 result=80000000.00000000 errno=0 +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +func=tanh op1=00000000.00000001 result=00000000.00000001 errno=0 maybestatus=ux +func=tanh op1=80000000.00000001 result=80000000.00000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/directed/tanhf.tst b/pl/math/test/testcases/directed/tanhf.tst new file mode 100644 index 0000000..603e310 --- /dev/null +++ b/pl/math/test/testcases/directed/tanhf.tst @@ -0,0 +1,20 @@ +; tanhf.tst +; +; Copyright (c) 2007-2023, Arm Limited. +; SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +func=tanhf op1=7fc00001 result=7fc00001 errno=0 +func=tanhf op1=ffc00001 result=7fc00001 errno=0 +func=tanhf op1=7f800001 result=7fc00001 errno=0 status=i +func=tanhf op1=ff800001 result=7fc00001 errno=0 status=i +func=tanhf op1=7f800000 result=3f800000 errno=0 +func=tanhf op1=ff800000 result=bf800000 errno=0 +func=tanhf op1=00000000 result=00000000 errno=0 +func=tanhf op1=80000000 result=80000000 errno=0 +; No exception is raised with certain versions of glibc. Functions +; approximated by x near zero may not generate/implement flops and +; thus may not raise exceptions. +; func=tanhf op1=00000001 result=00000001 errno=0 maybestatus=ux +; func=tanhf op1=80000001 result=80000001 errno=0 maybestatus=ux +func=tanhf op1=00000001 result=00000001 errno=0 maybestatus=ux +func=tanhf op1=80000001 result=80000001 errno=0 maybestatus=ux diff --git a/pl/math/test/testcases/random/double.tst b/pl/math/test/testcases/random/double.tst new file mode 100644 index 0000000..d83283e --- /dev/null +++ b/pl/math/test/testcases/random/double.tst @@ -0,0 +1,6 @@ +!! double.tst - Random test case specification for DP functions +!! +!! Copyright (c) 1999-2023, Arm Limited. +!! SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +test log10 10000 diff --git a/pl/math/test/testcases/random/float.tst b/pl/math/test/testcases/random/float.tst new file mode 100644 index 0000000..fa77efe --- /dev/null +++ b/pl/math/test/testcases/random/float.tst @@ -0,0 +1,8 @@ +!! float.tst - Random test case specification for SP functions +!! +!! Copyright (c) 2022-2023, Arm Limited. +!! SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +test erff 10000 +test log10f 10000 +test tanf 10000 diff --git a/pl/math/test/ulp_funcs.h b/pl/math/test/ulp_funcs.h new file mode 100644 index 0000000..5e3133e --- /dev/null +++ b/pl/math/test/ulp_funcs.h @@ -0,0 +1,66 @@ +/* + * Function entries for ulp. + * + * Copyright (c) 2022-2023, Arm Limited. + * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + */ + +#ifdef __vpcs + +#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 _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 _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) + +#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 +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) +#endif diff --git a/pl/math/test/ulp_wrappers.h b/pl/math/test/ulp_wrappers.h new file mode 100644 index 0000000..b682e93 --- /dev/null +++ b/pl/math/test/ulp_wrappers.h @@ -0,0 +1,148 @@ +// clang-format off +/* + * Function wrappers for ulp. + * + * Copyright (c) 2022-2023, Arm Limited. + * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + */ + +#include <stdbool.h> + +#if USE_MPFR +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); +} +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); +} +static int wrap_mpfr_powi(mpfr_t ret, const mpfr_t x, const mpfr_t y, mpfr_rnd_t rnd) { + mpfr_t y2; + mpfr_init(y2); + mpfr_trunc(y2, y); + return mpfr_pow(ret, x, y2, rnd); +} +#endif + +/* Our implementations of powi/powk are too imprecise to verify + against any established pow implementation. Instead we have the + following simple implementation, against which it is enough to + maintain bitwise reproducibility. Note the test framework expects + the reference impl to be of higher precision than the function + under test. For instance this means that the reference for + double-precision powi will be passed a long double, so to check + bitwise reproducibility we have to cast it back down to + double. This is fine since a round-trip to higher precision and + back down is correctly rounded. */ +#define DECL_POW_INT_REF(NAME, DBL_T, FLT_T, INT_T) \ + static DBL_T NAME (DBL_T in_val, DBL_T y) \ + { \ + INT_T n = (INT_T) round (y); \ + FLT_T acc = 1.0; \ + bool want_recip = n < 0; \ + n = n < 0 ? -n : n; \ + \ + for (FLT_T c = in_val; n; c *= c, n >>= 1) \ + { \ + if (n & 0x1) \ + { \ + acc *= c; \ + } \ + } \ + if (want_recip) \ + { \ + acc = 1.0 / acc; \ + } \ + return acc; \ + } + +DECL_POW_INT_REF(ref_powif, double, float, int) +DECL_POW_INT_REF(ref_powi, long double, double, int) + +#define VF1_WRAP(func) static float v_##func##f(float x) { return __v_##func##f(argf(x))[0]; } +#define VF2_WRAP(func) static float v_##func##f(float x, float y) { return __v_##func##f(argf(x), argf(y))[0]; } +#define VD1_WRAP(func) static double v_##func(double x) { return __v_##func(argd(x))[0]; } +#define VD2_WRAP(func) static double v_##func(double x, double y) { return __v_##func(argd(x), argd(y))[0]; } + +#define VNF1_WRAP(func) static float vn_##func##f(float x) { return __vn_##func##f(argf(x))[0]; } +#define VNF2_WRAP(func) static float vn_##func##f(float x, float y) { return __vn_##func##f(argf(x), argf(y))[0]; } +#define VND1_WRAP(func) static double vn_##func(double x) { return __vn_##func(argd(x))[0]; } +#define VND2_WRAP(func) static double vn_##func(double x, double y) { return __vn_##func(argd(x), argd(y))[0]; } + +#define ZVF1_WRAP(func) static float Z_##func##f(float x) { return _ZGVnN4v_##func##f(argf(x))[0]; } +#define ZVF2_WRAP(func) static float Z_##func##f(float x, float y) { return _ZGVnN4vv_##func##f(argf(x), argf(y))[0]; } +#define ZVD1_WRAP(func) static double Z_##func(double x) { return _ZGVnN2v_##func(argd(x))[0]; } +#define ZVD2_WRAP(func) static double Z_##func(double x, double y) { return _ZGVnN2vv_##func(argd(x), argd(y))[0]; } + +#ifdef __vpcs + +#define ZVNF1_WRAP(func) VF1_WRAP(func) VNF1_WRAP(func) ZVF1_WRAP(func) +#define ZVNF2_WRAP(func) VF2_WRAP(func) VNF2_WRAP(func) ZVF2_WRAP(func) +#define ZVND1_WRAP(func) VD1_WRAP(func) VND1_WRAP(func) ZVD1_WRAP(func) +#define ZVND2_WRAP(func) VD2_WRAP(func) VND2_WRAP(func) ZVD2_WRAP(func) + +#elif __aarch64__ + +#define ZVNF1_WRAP(func) VF1_WRAP(func) VNF1_WRAP(func) +#define ZVNF2_WRAP(func) VF2_WRAP(func) VNF2_WRAP(func) +#define ZVND1_WRAP(func) VD1_WRAP(func) VND1_WRAP(func) +#define ZVND2_WRAP(func) VD2_WRAP(func) VND2_WRAP(func) + +#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())); } +#define SVF2_WRAP(func) static float sv_##func##f(float x, float y) { return svretf(__sv_##func##f_x(svargf(x), svargf(y), svptrue_b32())); } +#define SVD1_WRAP(func) static double sv_##func(double x) { return svretd(__sv_##func##_x(svargd(x), svptrue_b64())); } +#define SVD2_WRAP(func) static double sv_##func(double x, double y) { return svretd(__sv_##func##_x(svargd(x), svargd(y), svptrue_b64())); } + +#define ZSVF1_WRAP(func) static float Z_sv_##func##f(float x) { return svretf(_ZGVsMxv_##func##f(svargf(x), svptrue_b32())); } +#define ZSVF2_WRAP(func) static float Z_sv_##func##f(float x, float y) { return svretf(_ZGVsMxvv_##func##f(svargf(x), svargf(y), svptrue_b32())); } +#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) + +#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 +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())); } +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 +// clang-format on |