From 55d530114ef3513eb8588e31e3850f04ac608077 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Tue, 16 Jul 2019 10:39:56 -0300 Subject: Remove finite-math tests Remove the finite-math tests from the testsuite - these are no longer useful after removing math-finite.h header. Passes buildmanyglibc, build&test on x86_64 and AArch64. Reviewed-by: Adhemerval Zanella --- math/Makefile | 48 ++++++-------------------------- math/gen-libm-test.py | 9 ------ math/libm-test-driver.c | 3 -- math/libm-test-support.c | 2 -- math/libm-test-support.h | 2 -- math/test-finite-macros.c | 35 ----------------------- math/test-math-exceptions.h | 19 +++++++++++++ math/test-math-finite.h | 21 -------------- math/test-math-inline.h | 1 - math/test-math-no-finite.h | 20 -------------- math/test-math-vector.h | 1 - math/test-signgam-finite-c11.c | 1 - math/test-signgam-finite-c99.c | 63 ------------------------------------------ math/test-signgam-finite.c | 63 ------------------------------------------ 14 files changed, 27 insertions(+), 261 deletions(-) delete mode 100644 math/test-finite-macros.c create mode 100644 math/test-math-exceptions.h delete mode 100644 math/test-math-finite.h delete mode 100644 math/test-math-no-finite.h delete mode 100644 math/test-signgam-finite-c11.c delete mode 100644 math/test-signgam-finite-c99.c delete mode 100644 math/test-signgam-finite.c diff --git a/math/Makefile b/math/Makefile index 7eba7a0b28..94124882d2 100644 --- a/math/Makefile +++ b/math/Makefile @@ -228,8 +228,7 @@ tests = test-matherr-3 test-fenv basic-test \ test-tgmath-ret bug-nextafter bug-nexttoward bug-tgmath1 \ test-tgmath-int test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan \ test-fenv-tls test-fenv-preserve test-fenv-return test-fenvinline \ - test-nearbyint-except test-fenv-clear test-signgam-finite \ - test-signgam-finite-c99 test-signgam-finite-c11 \ + test-nearbyint-except test-fenv-clear \ test-nearbyint-except-2 test-signgam-uchar test-signgam-uchar-init \ test-signgam-uint test-signgam-uint-init test-signgam-ullong \ test-signgam-ullong-init test-nan-overflow test-nan-payload \ @@ -238,7 +237,7 @@ tests = test-matherr-3 test-fenv basic-test \ test-femode-traps test-iszero-excess-precision \ test-iseqsig-excess-precision test-flt-eval-method \ test-fp-ilogb-constants test-fp-llogb-constants \ - test-fe-snans-always-signal test-finite-macros test-narrow-macros \ + test-fe-snans-always-signal test-narrow-macros \ test-nan-const $(tests-static) tests-static = test-fpucw-static test-fpucw-ieee-static \ test-signgam-uchar-static test-signgam-uchar-init-static \ @@ -298,17 +297,13 @@ generated += libm-test-ulps.h $(libm-test-c-auto) $(libm-test-c-noauto) \ $(libm-test-c-narrow) libm-tests-base-normal = $(foreach t,$(test-types),test-$(t)) -libm-tests-base-finite = $(foreach t,$(test-types),test-$(t)-finite) libm-tests-base-inline = $(foreach t,$(test-types),test-i$(t)) libm-tests-base-narrow = $(foreach t,$(test-type-pairs),test-$(t)) -libm-tests-base = $(libm-tests-base-normal) $(libm-tests-base-finite) \ - $(libm-tests-base-inline) $(libm-vec-tests) +libm-tests-base = $(libm-tests-base-normal) $(libm-tests-base-inline) \ + $(libm-vec-tests) libm-tests-normal = $(foreach t,$(libm-tests-base-normal),\ $(foreach f,$(libm-test-funcs-all),\ $(t)-$(f))) -libm-tests-finite = $(foreach t,$(libm-tests-base-finite),\ - $(foreach f,$(libm-test-funcs-all),\ - $(t)-$(f))) libm-tests-inline = $(foreach t,$(libm-tests-base-inline),\ $(foreach f,$(libm-test-funcs-all),\ $(t)-$(f))) @@ -317,7 +312,7 @@ libm-tests-narrow = $(foreach t,$(libm-tests-base-narrow),\ $(t)-$(f))) libm-tests-vector = $(foreach t,$(libmvec-tests),\ $(foreach f,$($(t)-funcs),test-$(t)-$(f))) -libm-tests = $(libm-tests-normal) $(libm-tests-finite) $(libm-tests-inline) \ +libm-tests = $(libm-tests-normal) $(libm-tests-inline) \ $(libm-tests-narrow) $(libm-tests-vector) libm-tests-compat = $(foreach t,$(libm-tests-base-normal) \ $(libm-tests-base-finite) \ @@ -325,8 +320,7 @@ libm-tests-compat = $(foreach t,$(libm-tests-base-normal) \ $(foreach f,$(libm-test-funcs-compat),\ $(t)-$(f))) libm-tests-for-type = $(foreach f,$(libm-test-funcs-all),\ - test-$(1)-$(f) test-$(1)-finite-$(f) \ - test-i$(1)-$(f)) \ + test-$(1)-$(f) test-i$(1)-$(f)) \ $(filter test-$(1)-%,$(libm-tests-vector) \ $(libm-tests-narrow)) @@ -417,8 +411,6 @@ CFLAGS-test-float-vlen16-wrappers.c += $(float-vlen16-arch-ext-cflags) # validated. libm-test-no-inline-cflags = -fno-inline -ffloat-store -fno-builtin \ -fsignaling-nans -libm-test-finite-cflags = $(libm-test-no-inline-cflags) \ - -U__FINITE_MATH_ONLY__ -D__FINITE_MATH_ONLY__=1 libm-test-inline-cflags = $(libm-test-fast-math-cflags) CFLAGS-test-tgmath.c += -fno-builtin # The following testcase uses very long lines (>3 million), so it may take a @@ -430,9 +422,6 @@ CFLAGS-test-powl.c += -fno-builtin CFLAGS-test-snan.c += -fsignaling-nans -CFLAGS-test-signgam-finite.c += -ffinite-math-only -CFLAGS-test-signgam-finite-c99.c += -ffinite-math-only -std=c99 -CFLAGS-test-signgam-finite-c11.c += -ffinite-math-only -std=c11 CFLAGS-test-signgam-uchar.c += -std=c99 CFLAGS-test-signgam-uchar-init.c += -std=c99 CFLAGS-test-signgam-uchar-static.c += -std=c99 @@ -459,8 +448,6 @@ CFLAGS-test-flt-eval-method.c += -fexcess-precision=standard CFLAGS-test-fe-snans-always-signal.c += -fsignaling-nans -CFLAGS-test-finite-macros.c += -ffinite-math-only - CFLAGS-test-nan-const.c += -fno-builtin include ../Rules @@ -499,25 +486,13 @@ $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c: func=$${type_func#*-}; \ ( \ echo "#include "; \ - echo "#include "; \ + echo "#include "; \ echo "#include "; \ echo "#include "; \ echo "#include "; \ echo "#include "; \ ) > $@ -$(foreach t,$(libm-tests-finite),$(objpfx)$(t).c): $(objpfx)test-%.c: - type_func=$*; \ - type=$${type_func%%-*}; \ - func=$${type_func#*-finite-}; \ - ( \ - echo "#include "; \ - echo "#include "; \ - echo "#include "; \ - echo "#include "; \ - echo "#include "; \ - ) > $@ - $(foreach t,$(libm-tests-inline),$(objpfx)$(t).c): $(objpfx)test-i%.c: type_func=$*; \ type=$${type_func%%-*}; \ @@ -538,7 +513,7 @@ $(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c): $(objpfx)test-%.c: ( \ echo "#include "; \ echo "#include "; \ - echo "#include "; \ + echo "#include "; \ echo "#include "; \ echo "#include "; \ echo "#include "; \ @@ -588,13 +563,6 @@ endef object-suffixes-left := $(libm-tests-base-normal) include $(o-iterator) -define o-iterator-doit -$(foreach f,$(libm-test-funcs-all),\ - $(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-finite-cflags) -endef -object-suffixes-left := $(libm-tests-base-finite) -include $(o-iterator) - define o-iterator-doit $(foreach f,$(libm-test-funcs-all),\ $(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-inline-cflags) diff --git a/math/gen-libm-test.py b/math/gen-libm-test.py index 81d82ceb12..01e0d2397c 100755 --- a/math/gen-libm-test.py +++ b/math/gen-libm-test.py @@ -341,9 +341,6 @@ def apply_lit(arg, macro): def gen_test_args_res(descr_args, descr_res, args, res_rm): """Generate a test given the arguments and per-rounding-mode results.""" - # Determine whether any arguments or results, for any rounding - # mode, are non-finite. - non_finite = False test_snan = False all_args_res = list(args) for r in res_rm: @@ -351,10 +348,6 @@ def gen_test_args_res(descr_args, descr_res, args, res_rm): for a in all_args_res: if 'snan_value' in a: test_snan = True - non_finite = True - elif ('qnan_value' in a or 'plus_infty' in a or 'minus_infty' in a - or 'plus_oflow' in a or 'minus_oflow' in a): - non_finite = True # Process the arguments. args_disp = [] args_c = [] @@ -422,8 +415,6 @@ def gen_test_args_res(descr_args, descr_res, args, res_rm): flags = [] if ignore_result_any: flags.append('IGNORE_RESULT') - if non_finite: - flags.append('NON_FINITE') if test_snan: flags.append('TEST_SNAN') flags.append(res[res_pos]) diff --git a/math/libm-test-driver.c b/math/libm-test-driver.c index d247294a6b..a6fc23d051 100644 --- a/math/libm-test-driver.c +++ b/math/libm-test-driver.c @@ -23,7 +23,6 @@ /* Flags set by the including file. */ const int flag_test_errno = TEST_ERRNO; const int flag_test_exceptions = TEST_EXCEPTIONS; -const int flag_test_finite = TEST_FINITE; const int flag_test_inline = TEST_INLINE; const int flag_test_mathvec = TEST_MATHVEC; @@ -44,8 +43,6 @@ const int snan_tests_arg = SNAN_TESTS (FLOAT); # define TEST_MSG "testing " STR_FLOAT " (vector length " STR_VEC_LEN ")\n" #elif TEST_INLINE # define TEST_MSG "testing " STR_FLOAT " (inline functions)\n" -#elif TEST_FINITE -# define TEST_MSG "testing " STR_FLOAT " (finite-math-only)\n" #elif TEST_NARROW # define TEST_MSG "testing " STR_FLOAT " (argument " STR_ARG_FLOAT ")\n" #else diff --git a/math/libm-test-support.c b/math/libm-test-support.c index 9ba673486b..bd38cea2c3 100644 --- a/math/libm-test-support.c +++ b/math/libm-test-support.c @@ -983,8 +983,6 @@ enable_test (int exceptions) return 0; if (flag_test_inline && (exceptions & NO_TEST_INLINE)) return 0; - if (flag_test_finite && (exceptions & NON_FINITE) != 0) - return 0; if ((!SNAN_TESTS (FLOAT) || !snan_tests_arg) && (exceptions & TEST_SNAN) != 0) return 0; diff --git a/math/libm-test-support.h b/math/libm-test-support.h index de367fe6f5..5a234d42e0 100644 --- a/math/libm-test-support.h +++ b/math/libm-test-support.h @@ -34,7 +34,6 @@ extern const int flag_test_errno; extern const int flag_test_exceptions; -extern const int flag_test_finite; extern const int flag_test_inline; extern const int flag_test_mathvec; extern const int snan_tests_arg; @@ -69,7 +68,6 @@ extern const char doc[]; #define ERRNO_ERANGE 0x20000 /* Flags generated by gen-libm-test.py, not entered here manually. */ #define IGNORE_RESULT 0x40000 -#define NON_FINITE 0x80000 #define TEST_SNAN 0x100000 #define NO_TEST_MATHVEC 0x200000 diff --git a/math/test-finite-macros.c b/math/test-finite-macros.c deleted file mode 100644 index 59b65fa9d9..0000000000 --- a/math/test-finite-macros.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Test finite-math-only code does not conflict with user macros (bug 22028). - Copyright (C) 2017-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* The main test is that the inclusion of compiles. */ -#define f first test macro -#define l second test macro -#define f128 third test macro - -#include - -volatile float a, b; - -static int -do_test (void) -{ - b = acosf (a); - return 0; -} - -#include diff --git a/math/test-math-exceptions.h b/math/test-math-exceptions.h new file mode 100644 index 0000000000..7063714f43 --- /dev/null +++ b/math/test-math-exceptions.h @@ -0,0 +1,19 @@ +/* Common definitions for libm tests for exceptions. + Copyright (C) 1997-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define TEST_EXCEPTIONS 1 diff --git a/math/test-math-finite.h b/math/test-math-finite.h deleted file mode 100644 index 1123127657..0000000000 --- a/math/test-math-finite.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Common definitions for libm tests for finite-math-only. - Copyright (C) 2015-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define TEST_FINITE 1 -#define TEST_ERRNO 0 -#define TEST_EXCEPTIONS 1 diff --git a/math/test-math-inline.h b/math/test-math-inline.h index 367f3a4100..684645238f 100644 --- a/math/test-math-inline.h +++ b/math/test-math-inline.h @@ -17,7 +17,6 @@ . */ #define TEST_INLINE 1 -#define TEST_FINITE 0 #define TEST_ERRNO 0 #define TEST_EXCEPTIONS 0 diff --git a/math/test-math-no-finite.h b/math/test-math-no-finite.h deleted file mode 100644 index 0ef88f533c..0000000000 --- a/math/test-math-no-finite.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Common definitions for libm tests for no-finite-math-only. - Copyright (C) 2015-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define TEST_FINITE 0 -#define TEST_EXCEPTIONS 1 diff --git a/math/test-math-vector.h b/math/test-math-vector.h index 9ce66b0d9d..110e2c0b53 100644 --- a/math/test-math-vector.h +++ b/math/test-math-vector.h @@ -18,7 +18,6 @@ #define TEST_MATHVEC 1 #define TEST_NARROW 0 -#define TEST_FINITE 0 #define TEST_ERRNO 0 #define TEST_EXCEPTIONS 0 diff --git a/math/test-signgam-finite-c11.c b/math/test-signgam-finite-c11.c deleted file mode 100644 index dff132df93..0000000000 --- a/math/test-signgam-finite-c11.c +++ /dev/null @@ -1 +0,0 @@ -#include "test-signgam-finite-c99.c" diff --git a/math/test-signgam-finite-c99.c b/math/test-signgam-finite-c99.c deleted file mode 100644 index 61e7e4b67c..0000000000 --- a/math/test-signgam-finite-c99.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Test lgamma functions do not set signgam for -ffinite-math-only for ISO C. - Copyright (C) 2015-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#undef _LIBC -#undef __LIBC_INTERNAL_MATH_INLINES -#undef _GNU_SOURCE - -#include -#include - -int signgam; - -#define RUN_TESTS(FUNC, TYPE) \ - do \ - { \ - volatile TYPE a, b, c __attribute__ ((unused)); \ - a = 0.5; \ - b = -0.5; \ - signgam = 123; \ - c = FUNC (a); \ - if (signgam == 123) \ - puts ("PASS: " #FUNC " (0.5) setting signgam"); \ - else \ - { \ - puts ("FAIL: " #FUNC " (0.5) setting signgam"); \ - result = 1; \ - } \ - signgam = 123; \ - c = FUNC (b); \ - if (signgam == 123) \ - puts ("PASS: " #FUNC " (-0.5) setting signgam"); \ - else \ - { \ - puts ("FAIL: " #FUNC " (-0.5) setting signgam"); \ - result = 1; \ - } \ - } \ - while (0) - -int -main (void) -{ - int result = 0; - RUN_TESTS (lgammaf, float); - RUN_TESTS (lgamma, double); - RUN_TESTS (lgammal, long double); - return result; -} diff --git a/math/test-signgam-finite.c b/math/test-signgam-finite.c deleted file mode 100644 index 66ae30385a..0000000000 --- a/math/test-signgam-finite.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Test lgamma functions set signgam for -ffinite-math-only (bug 19211). - Copyright (C) 2015-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include - -#define RUN_TESTS(FUNC, TYPE) \ - do \ - { \ - volatile TYPE a, b, c __attribute__ ((unused)); \ - a = 0.5; \ - b = -0.5; \ - signgam = 123; \ - c = FUNC (a); \ - if (signgam == 1) \ - puts ("PASS: " #FUNC " (0.5) setting signgam"); \ - else \ - { \ - puts ("FAIL: " #FUNC " (0.5) setting signgam"); \ - result = 1; \ - } \ - signgam = 123; \ - c = FUNC (b); \ - if (signgam == -1) \ - puts ("PASS: " #FUNC " (-0.5) setting signgam"); \ - else \ - { \ - puts ("FAIL: " #FUNC " (-0.5) setting signgam"); \ - result = 1; \ - } \ - } \ - while (0) - -static int -do_test (void) -{ - int result = 0; - RUN_TESTS (lgammaf, float); - RUN_TESTS (gammaf, float); - RUN_TESTS (lgamma, double); - RUN_TESTS (gamma, double); - RUN_TESTS (lgammal, long double); - RUN_TESTS (gammal, long double); - return result; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" -- cgit 1.4.1