aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Blanchard <pierre.blanchard@arm.com>2024-05-14 16:37:59 +0000
committerPierre Blanchard <pierre.blanchard@arm.com>2024-05-14 16:38:53 +0000
commitcb65aa500232772379992c4faf1c5ccaae47cde3 (patch)
treefbdecf1b7e41b4fc3f8115f8037b907609109f8a
parent8928e471b062b008717c9c2958240c446317de53 (diff)
downloadarm-optimized-routines-upstream-master.tar.gz
math: Add options to disable SIMD and exp10 tests.upstream-master
Libc might not provide exp10(l).
-rw-r--r--config.mk.dist10
-rw-r--r--math/Dir.mk7
-rw-r--r--math/test/mathbench_funcs.h4
-rw-r--r--math/test/mathbench_wrappers.h2
-rw-r--r--math/test/mathtest.c6
-rwxr-xr-xmath/test/runulp.sh8
-rw-r--r--math/test/ulp_funcs.h6
-rw-r--r--math/test/ulp_wrappers.h4
8 files changed, 36 insertions, 11 deletions
diff --git a/config.mk.dist b/config.mk.dist
index 03fb54d..85c8418 100644
--- a/config.mk.dist
+++ b/config.mk.dist
@@ -1,6 +1,6 @@
# Example config.mk
#
-# Copyright (c) 2018-2023, Arm Limited.
+# Copyright (c) 2018-2024, Arm Limited.
# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
# Subprojects to build
@@ -76,10 +76,18 @@ math-cflags += -DWANT_SVE_MATH=$(WANT_SVE_MATH)
WANT_ERRNO = 0
math-cflags += -DWANT_ERRNO=$(WANT_ERRNO)
+# Enable SIMD in tests
+WANT_SIMD_TESTS = 1
+math-cflags += -DWANT_SIMD_TESTS=$(WANT_SIMD_TESTS)
+
# If set to 1, set fenv in vector math routines.
WANT_SIMD_EXCEPT = 0
math-cflags += -DWANT_SIMD_EXCEPT=$(WANT_SIMD_EXCEPT)
+# If set to 1, enable tests for exp10.
+WANT_EXP10_TESTS = 1
+math-cflags += -DWANT_EXP10_TESTS=$(WANT_EXP10_TESTS)
+
# Disable fenv checks
#math-ulpflags = -q -f
#math-testflags = -nostatus
diff --git a/math/Dir.mk b/math/Dir.mk
index 5e9494a..31f27d5 100644
--- a/math/Dir.mk
+++ b/math/Dir.mk
@@ -1,6 +1,6 @@
# Makefile fragment - requires GNU make
#
-# Copyright (c) 2019-2023, Arm Limited.
+# Copyright (c) 2019-2024, Arm Limited.
# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
S := $(srcdir)/math
@@ -96,6 +96,9 @@ build/bin/%.sh: $(S)/test/%.sh
cp $< $@
math-tests := $(wildcard $(S)/test/testcases/directed/*.tst)
+ifeq ($(WANT_EXP10_TESTS),0)
+math-tests := $(filter-out %exp10.tst, $(math-tests))
+endif
math-rtests := $(wildcard $(S)/test/testcases/random/*.tst)
check-math-test: $(math-tools)
@@ -105,7 +108,7 @@ check-math-rtest: $(math-host-tools) $(math-tools)
cat $(math-rtests) | build/bin/rtest | $(EMULATOR) build/bin/mathtest $(math-testflags)
check-math-ulp: $(math-tools)
- ULPFLAGS="$(math-ulpflags)" WANT_SIMD_EXCEPT="$(WANT_SIMD_EXCEPT)" build/bin/runulp.sh $(EMULATOR)
+ ULPFLAGS="$(math-ulpflags)" WANT_SIMD_TESTS="$(WANT_SIMD_TESTS)" WANT_SIMD_EXCEPT="$(WANT_SIMD_EXCEPT)" WANT_EXP10_TESTS="$(WANT_EXP10_TESTS)" build/bin/runulp.sh $(EMULATOR)
check-math: check-math-test check-math-rtest check-math-ulp
diff --git a/math/test/mathbench_funcs.h b/math/test/mathbench_funcs.h
index 4df6a0f..c99df75 100644
--- a/math/test/mathbench_funcs.h
+++ b/math/test/mathbench_funcs.h
@@ -7,7 +7,9 @@
/* clang-format off */
D (exp, -9.9, 9.9)
D (exp, 0.5, 1.0)
+#if WANT_EXP10_TESTS
D (exp10, -9.9, 9.9)
+#endif
D (exp2, -9.9, 9.9)
D (log, 0.01, 11.1)
D (log, 0.999, 1.001)
@@ -44,7 +46,7 @@ F (cosf, 3.3, 33.3)
F (cosf, 100, 1000)
F (cosf, 1e6, 1e32)
F (erff, -4.0, 4.0)
-#ifdef __vpcs
+#if WANT_SIMD_TESTS && defined (__vpcs)
VND (_ZGVnN2v_exp, -9.9, 9.9)
VND (_ZGVnN2v_log, 0.01, 11.1)
{"_ZGVnN2vv_pow", 'd', 'n', 0.01, 11.1, {.vnd = xy_Z_pow}},
diff --git a/math/test/mathbench_wrappers.h b/math/test/mathbench_wrappers.h
index 30c4939..1b8bc79 100644
--- a/math/test/mathbench_wrappers.h
+++ b/math/test/mathbench_wrappers.h
@@ -5,7 +5,7 @@
* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
*/
-#ifdef __vpcs
+#if WANT_SIMD_TESTS && defined(__vpcs)
__vpcs static v_float
xy_Z_powf (v_float x)
diff --git a/math/test/mathtest.c b/math/test/mathtest.c
index 834233f..4f58419 100644
--- a/math/test/mathtest.c
+++ b/math/test/mathtest.c
@@ -1,9 +1,10 @@
/*
* mathtest.c - test rig for mathlib
*
- * Copyright (c) 1998-2023, Arm Limited.
+ * Copyright (c) 1998-2024, Arm Limited.
* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
*/
+/* clang-format off */
#include <assert.h>
#include <stdio.h>
@@ -254,7 +255,9 @@ test_func tfuncs[] = {
TFUNCARM(at_s,rt_s, expf, 3*ULPUNIT/4),
TFUNCARM(at_s,rt_s, exp2f, 3*ULPUNIT/4),
TFUNC(at_s,rt_s, expm1f, ULPUNIT),
+#if WANT_EXP10_TESTS
TFUNC(at_d,rt_d, exp10, ULPUNIT),
+#endif
/* power */
TFUNC(at_d2,rt_d, pow, 3*ULPUNIT/4),
@@ -1707,3 +1710,4 @@ void undef_func() {
failed++;
puts("ERROR: undefined function called");
}
+/* clang-format on */
diff --git a/math/test/runulp.sh b/math/test/runulp.sh
index e2e03e3..04f28ee 100755
--- a/math/test/runulp.sh
+++ b/math/test/runulp.sh
@@ -2,7 +2,7 @@
# ULP error check script.
#
-# Copyright (c) 2019-2023, Arm Limited.
+# Copyright (c) 2019-2024, Arm Limited.
# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
#set -x
@@ -72,6 +72,7 @@ t pow 0x1.ffffffffffff0p-1 0x1.0000000000008p0 x 0x1p60 0x1p68 50000
t pow 0x1.ffffffffff000p-1 0x1p0 x 0x1p50 0x1p52 50000
t pow -0x1.ffffffffff000p-1 -0x1p0 x 0x1p50 0x1p52 50000
+if [ $WANT_EXP10_TESTS -eq 1 ]; then
L=0.02
t exp10 0 0x1p-47 5000
t exp10 -0 -0x1p-47 5000
@@ -81,6 +82,7 @@ t exp10 1 0x1.34413509f79ffp8 50000
t exp10 -1 -0x1.434e6420f4374p8 50000
t exp10 0x1.34413509f79ffp8 inf 5000
t exp10 -0x1.434e6420f4374p8 -inf 5000
+fi # WANT_EXP10_TESTS
L=1.0
Ldir=0.9
@@ -154,6 +156,8 @@ done
# vector functions
+if [ $WANT_SIMD_TESTS -eq 1 ]; then
+
Ldir=0.5
r='n'
flags="${ULPFLAGS:--q}"
@@ -276,6 +280,8 @@ cosf _ZGVnN4v_cosf
powf _ZGVnN4vv_powf -f
EOF
+fi # WANT_SIMD_TESTS
+
[ 0 -eq $FAIL ] || {
echo "FAILED $FAIL PASSED $PASS"
exit 1
diff --git a/math/test/ulp_funcs.h b/math/test/ulp_funcs.h
index 84f7927..b8330a8 100644
--- a/math/test/ulp_funcs.h
+++ b/math/test/ulp_funcs.h
@@ -1,7 +1,7 @@
/*
* Function entries for ulp.
*
- * Copyright (c) 2022-2023, Arm Limited.
+ * Copyright (c) 2022-2024, Arm Limited.
* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
*/
/* clang-format off */
@@ -16,13 +16,15 @@
F2 (pow)
F1 (erf)
D1 (exp)
+#if WANT_EXP10_TESTS
D1 (exp10)
+#endif
D1 (exp2)
D1 (log)
D1 (log2)
D2 (pow)
D1 (erf)
-#ifdef __vpcs
+#if WANT_SIMD_TESTS && defined (__vpcs)
F (_ZGVnN4v_sinf, Z_sinf, sin, mpfr_sin, 1, 1, f1, 1)
F (_ZGVnN4v_cosf, Z_cosf, cos, mpfr_cos, 1, 1, f1, 1)
F (_ZGVnN4v_expf_1u, Z_expf_1u, exp, mpfr_exp, 1, 1, f1, 1)
diff --git a/math/test/ulp_wrappers.h b/math/test/ulp_wrappers.h
index 60dc3d6..21cfd10 100644
--- a/math/test/ulp_wrappers.h
+++ b/math/test/ulp_wrappers.h
@@ -1,7 +1,7 @@
/*
* Function wrappers for ulp.
*
- * Copyright (c) 2022-2023, Arm Limited.
+ * Copyright (c) 2022-2024, Arm Limited.
* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
*/
@@ -18,7 +18,7 @@ static int sincos_mpfr_cos(mpfr_t y, const mpfr_t x, mpfr_rnd_t r) { mpfr_sin(y,
#endif
/* Wrappers for vector functions. */
-#ifdef __vpcs
+#if WANT_SIMD_TESTS && defined (__vpcs)
static float Z_sinf(float x) { return _ZGVnN4v_sinf(argf(x))[0]; }
static float Z_cosf(float x) { return _ZGVnN4v_cosf(argf(x))[0]; }
static float Z_expf_1u(float x) { return _ZGVnN4v_expf_1u(argf(x))[0]; }