aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-02-06 18:12:16 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-02-06 18:12:16 +0000
commit5a68e857bf1b64c2576bbf32429aed5162e90bb9 (patch)
treeb5bf107ee99011f9c5d6132b5495e349cc873916
parentdd18757bd3650d5dfea8aaba37869df89ce6c17d (diff)
downloadglibc-5a68e857bf1b64c2576bbf32429aed5162e90bb9.tar.xz
glibc-5a68e857bf1b64c2576bbf32429aed5162e90bb9.zip
Move non-function-specific parts of libm-test.inc to separate file.
libm-test.inc contains both test infrastructure and tests of individual functions. This patch moves the infrastructure to a separate file libm-test-driver.c. This is in preparation for splitting the tests of individual functions into separate source files, which will be processed individually by gen-libm-test.pl (so e.g. libm-test-acos.inc and auto-libm-test-out-acos will be processed by gen-libm-test.pl to produce libm-test-acos.c, and files such as test-double-acos.c will be generated by the Makefile to include appropriate headers, libm-test-driver.c and libm-test-acos.c so tests of each function get run separately). It is no doubt possible to split things up further, so that functions not depending on the type being tested only get compiled once and most of those depending on the type being tested get compiled once per type (rather than separately for variants such as inline / no-inline, and separately for each function being tested after that split), but this rearrangement as-is seems a useful incremental step towards splitting these tests by function. * math/libm-test-driver.c: New file. Based on math/libm-test.inc. * math/libm-test.inc: Move all contents, other than tests of individual functions, to libm-test-driver.c. [!FE_TONEAREST] (FE_TONEAREST): Move to libm-test-driver.c. [!FE_TOWARDZERO] (FE_TOWARDZERO): Likewise. [!FE_UPWARD] (FE_UPWARD): Likewise. [!FE_DOWNWARD] (FE_DOWNWARD): Likewise. (NO_EXCEPTION): Likewise. (INVALID_EXCEPTION): Likewise. (DIVIDE_BY_ZERO_EXCEPTION): Likewise. (OVERFLOW_EXCEPTION): Likewise. (UNDERFLOW_EXCEPTION): Likewise. (INEXACT_EXCEPTION): Likewise. (INVALID_EXCEPTION_OK): Likewise. (DIVIDE_BY_ZERO_EXCEPTION_OK): Likewise. (OVERFLOW_EXCEPTION_OK): Likewise. (UNDERFLOW_EXCEPTION_OK): Likewise. (NO_INEXACT_EXCEPTION): Likewise. (EXCEPTIONS_OK): Likewise. (IGNORE_ZERO_INF_SIGN): Likewise. (TEST_NAN_SIGN): Likewise. (TEST_NAN_PAYLOAD): Likewise. (NO_TEST_INLINE): Likewise. (XFAIL_TEST): Likewise. (ERRNO_UNCHANGED): Likewise. (ERRNO_EDOM): Likewise. (ERRNO_ERANGE): Likewise. (IGNORE_RESULT): Likewise. (NON_FINITE): Likewise. (TEST_SNAN): Likewise. (NO_TEST_MATHVEC): Likewise. (TEST_NAN_PAYLOAD_CANONICALIZE): Likewise. (__CONCATX): Likewise. (TYPE_MIN): Likewise. (TYPE_TRUE_MIN): Likewise. (TYPE_MAX): Likewise. (MIN_EXP): Likewise. (MAX_EXP): Likewise. (MANT_DIG): Likewise. (FSTR_MAX): Likewise. (ULP_IDX): Likewise. (QTYPE_STR): Likewise. (TEST_COND_binary32): Likewise. (TEST_COND_binary64): Likewise. (TEST_COND_binary128): Likewise. (TEST_COND_ibm128): Likewise. (TEST_COND_intel96): Likewise. (TEST_COND_m68k96): Likewise. (TEST_COND_ibm128_libgcc): Likewise. (XFAIL_IBM128_LIBGCC): Likewise. (PAYLOAD_DIG): Likewise. (UNDERFLOW_EXCEPTION_FLOAT): Likewise. (UNDERFLOW_EXCEPTION_OK_FLOAT): Likewise. (UNDERFLOW_EXCEPTION_DOUBLE): Likewise. (UNDERFLOW_EXCEPTION_OK_DOUBLE): Likewise. (UNDERFLOW_EXCEPTION_LDOUBLE_IBM): Likewise. (UNDERFLOW_EXCEPTION_BEFORE_ROUNDING): Likewise. (TEST_COND_long32): Likewise. (TEST_COND_long64): Likewise. (TEST_COND_before_rounding): Likewise. (TEST_COND_after_rounding): Likewise. (lit_pi_3_m_4_d): Likewise. (lit_pi_3_m_4_ln10_m_d): Likewise. (lit_pi_2_ln10_m_d): Likewise. (lit_pi_4_ln10_m_d): Likewise. (lit_pi_ln10_d): Likewise. (lit_pi_2_d): Likewise. (lit_pi_4_d): Likewise. (lit_pi): Likewise. (lit_e): Likewise. (ulps_file_name): Likewise. (ulps_file): Likewise. (output_ulps): Likewise. (output_dir): Likewise. (noErrors): Likewise. (noTests): Likewise. (noExcTests): Likewise. (noErrnoTests): Likewise. (verbose): Likewise. (output_max_error): Likewise. (output_points): Likewise. (ignore_max_ulp): Likewise. (plus_zero): Likewise. (minus_zero): Likewise. (plus_infty): Likewise. (minus_infty): Likewise. (qnan_value_pl): Likewise. (qnan_value): Likewise. (snan_value_pl): Likewise. (snan_value): Likewise. (max_value): Likewise. (min_value): Likewise. (min_subnorm_value): Likewise. (snan_value_ld): Likewise. (max_error): Likewise. (real_max_error): Likewise. (imag_max_error): Likewise. (prev_max_error): Likewise. (prev_real_max_error): Likewise. (prev_imag_max_error): Likewise. (max_valid_error): Likewise. (TYPE_DECIMAL_DIG): Likewise. (TYPE_HEX_DIG): Likewise. (fmt_ftostr): Likewise. (compare_ulp_data): Likewise. (find_ulps): Likewise. (init_max_error): Likewise. (set_max_error): Likewise. (print_float): Likewise. (print_screen): Likewise. (print_screen_max_error): Likewise. (update_stats): Likewise. (print_function_ulps): Likewise. (print_complex_function_ulps): Likewise. (fpstack_test): Likewise. (print_max_error): Likewise. (print_complex_max_error): Likewise. (test_single_exception): Likewise. (test_exceptions): Likewise. (test_single_errno): Likewise. (test_errno): Likewise. (ULPDIFF): Likewise. (ulp): Likewise. (check_float_internal): Likewise. (check_float): Likewise. (check_complex): Likewise. (check_int): Likewise. (check_long): Likewise. (check_bool): Likewise. (check_longlong): Likewise. (check_intmax_t): Likewise. (check_uintmax_t): Likewise. (enable_test): Likewise. (struct test_f_f_data): Likewise. (struct test_ff_f_data): Likewise. (struct test_fj_f_data): Likewise. (struct test_fi_f_data): Likewise. (struct test_fl_f_data): Likewise. (struct test_if_f_data): Likewise. (struct test_fff_f_data): Likewise. (struct test_fiu_M_data): Likewise. (struct test_fiu_U_data): Likewise. (struct test_c_f_data): Likewise. (struct test_f_f1_data): Likewise. (struct test_fF_f1_data): Likewise. (struct test_ffI_f1_data): Likewise. (struct test_c_c_data): Likewise. (struct test_cc_c_data): Likewise. (struct test_f_i_data): Likewise. (struct test_ff_i_data): Likewise. (struct test_f_l_data): Likewise. (struct test_f_L_data): Likewise. (struct test_fFF_11_data): Likewise. (struct test_Ff_b1_data): Likewise. (IF_ROUND_INIT_): Likewise. (IF_ROUND_INIT_FE_DOWNWARD): Likewise. (IF_ROUND_INIT_FE_TONEAREST): Likewise. (IF_ROUND_INIT_FE_TOWARDZERO): Likewise. (IF_ROUND_INIT_FE_UPWARD): Likewise. (ROUND_RESTORE_): Likewise. (ROUND_RESTORE_FE_DOWNWARD): Likewise. (ROUND_RESTORE_FE_TONEAREST): Likewise. (ROUND_RESTORE_FE_TOWARDZERO): Likewise. (ROUND_RESTORE_FE_UPWARD): Likewise. (RM_): Likewise. (RM_FE_DOWNWARD): Likewise. (RM_FE_TONEAREST): Likewise. (RM_FE_TOWARDZERO): Likewise. (RM_FE_UPWARD): Likewise. (COMMON_TEST_SETUP): Likewise. (EXTRA_OUTPUT_TEST_SETUP): Likewise. (COMMON_TEST_CLEANUP): Likewise. (EXTRA_OUTPUT_TEST_CLEANUP): Likewise. (RUN_TEST_f_f): Likewise. (RUN_TEST_LOOP_f_f): Likewise. (RUN_TEST_fp_f): Likewise. (RUN_TEST_LOOP_fp_f): Likewise. (RUN_TEST_2_f): Likewise. (RUN_TEST_LOOP_2_f): Likewise. (RUN_TEST_ff_f): Likewise. (RUN_TEST_LOOP_ff_f): Likewise. (RUN_TEST_LOOP_fj_f): Likewise. (RUN_TEST_fi_f): Likewise. (RUN_TEST_LOOP_fi_f): Likewise. (RUN_TEST_fl_f): Likewise. (RUN_TEST_LOOP_fl_f): Likewise. (RUN_TEST_if_f): Likewise. (RUN_TEST_LOOP_if_f): Likewise. (RUN_TEST_fff_f): Likewise. (RUN_TEST_LOOP_fff_f): Likewise. (RUN_TEST_fiu_M): Likewise. (RUN_TEST_LOOP_fiu_M): Likewise. (RUN_TEST_fiu_U): Likewise. (RUN_TEST_LOOP_fiu_U): Likewise. (RUN_TEST_c_f): Likewise. (RUN_TEST_LOOP_c_f): Likewise. (RUN_TEST_f_f1): Likewise. (RUN_TEST_LOOP_f_f1): Likewise. (RUN_TEST_fF_f1): Likewise. (RUN_TEST_LOOP_fF_f1): Likewise. (RUN_TEST_fI_f1): Likewise. (RUN_TEST_LOOP_fI_f1): Likewise. (RUN_TEST_ffI_f1_mod8): Likewise. (RUN_TEST_LOOP_ffI_f1_mod8): Likewise. (RUN_TEST_Ff_b1): Likewise. (RUN_TEST_LOOP_Ff_b1): Likewise. (RUN_TEST_Ffp_b1): Likewise. (RUN_TEST_LOOP_Ffp_b1): Likewise. (RUN_TEST_c_c): Likewise. (RUN_TEST_LOOP_c_c): Likewise. (RUN_TEST_cc_c): Likewise. (RUN_TEST_LOOP_cc_c): Likewise. (RUN_TEST_f_i): Likewise. (RUN_TEST_LOOP_f_i): Likewise. (RUN_TEST_f_i_tg): Likewise. (RUN_TEST_LOOP_f_i_tg): Likewise. (RUN_TEST_ff_b): Likewise. (RUN_TEST_LOOP_ff_b): Likewise. (RUN_TEST_ff_i_tg): Likewise. (RUN_TEST_LOOP_ff_i_tg): Likewise. (RUN_TEST_f_b): Likewise. (RUN_TEST_LOOP_f_b): Likewise. (RUN_TEST_f_b_tg): Likewise. (RUN_TEST_LOOP_f_b_tg): Likewise. (RUN_TEST_f_l): Likewise. (RUN_TEST_LOOP_f_l): Likewise. (RUN_TEST_f_L): Likewise. (RUN_TEST_LOOP_f_L): Likewise. (RUN_TEST_fFF_11): Likewise. (RUN_TEST_LOOP_fFF_11): Likewise. (VEC_SUFF): Likewise. (STR_CONCAT): Likewise. (STR_CON3): Likewise. (HAVE_VECTOR): Likewise. (START): Likewise. (END): Likewise. (END_COMPLEX): Likewise. (ALL_RM_TEST): Likewise. (matherr): Likewise. (initialize): Likewise. (options): Likewise. (doc): Likewise. (parse_opt): Likewise. (argp): Likewise. (check_ulp): Likewise. (main): Likewise. (do_test): New function. Call tests of individual functions previously called from main.
-rw-r--r--ChangeLog249
-rw-r--r--math/libm-test-driver.c2286
-rw-r--r--math/libm-test.inc2267
3 files changed, 2539 insertions, 2263 deletions
diff --git a/ChangeLog b/ChangeLog
index 76051c8070..db64d85ee1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,254 @@
2017-02-06 Joseph Myers <joseph@codesourcery.com>
+ * math/libm-test-driver.c: New file. Based on math/libm-test.inc.
+ * math/libm-test.inc: Move all contents, other than tests of
+ individual functions, to libm-test-driver.c.
+ [!FE_TONEAREST] (FE_TONEAREST): Move to libm-test-driver.c.
+ [!FE_TOWARDZERO] (FE_TOWARDZERO): Likewise.
+ [!FE_UPWARD] (FE_UPWARD): Likewise.
+ [!FE_DOWNWARD] (FE_DOWNWARD): Likewise.
+ (NO_EXCEPTION): Likewise.
+ (INVALID_EXCEPTION): Likewise.
+ (DIVIDE_BY_ZERO_EXCEPTION): Likewise.
+ (OVERFLOW_EXCEPTION): Likewise.
+ (UNDERFLOW_EXCEPTION): Likewise.
+ (INEXACT_EXCEPTION): Likewise.
+ (INVALID_EXCEPTION_OK): Likewise.
+ (DIVIDE_BY_ZERO_EXCEPTION_OK): Likewise.
+ (OVERFLOW_EXCEPTION_OK): Likewise.
+ (UNDERFLOW_EXCEPTION_OK): Likewise.
+ (NO_INEXACT_EXCEPTION): Likewise.
+ (EXCEPTIONS_OK): Likewise.
+ (IGNORE_ZERO_INF_SIGN): Likewise.
+ (TEST_NAN_SIGN): Likewise.
+ (TEST_NAN_PAYLOAD): Likewise.
+ (NO_TEST_INLINE): Likewise.
+ (XFAIL_TEST): Likewise.
+ (ERRNO_UNCHANGED): Likewise.
+ (ERRNO_EDOM): Likewise.
+ (ERRNO_ERANGE): Likewise.
+ (IGNORE_RESULT): Likewise.
+ (NON_FINITE): Likewise.
+ (TEST_SNAN): Likewise.
+ (NO_TEST_MATHVEC): Likewise.
+ (TEST_NAN_PAYLOAD_CANONICALIZE): Likewise.
+ (__CONCATX): Likewise.
+ (TYPE_MIN): Likewise.
+ (TYPE_TRUE_MIN): Likewise.
+ (TYPE_MAX): Likewise.
+ (MIN_EXP): Likewise.
+ (MAX_EXP): Likewise.
+ (MANT_DIG): Likewise.
+ (FSTR_MAX): Likewise.
+ (ULP_IDX): Likewise.
+ (QTYPE_STR): Likewise.
+ (TEST_COND_binary32): Likewise.
+ (TEST_COND_binary64): Likewise.
+ (TEST_COND_binary128): Likewise.
+ (TEST_COND_ibm128): Likewise.
+ (TEST_COND_intel96): Likewise.
+ (TEST_COND_m68k96): Likewise.
+ (TEST_COND_ibm128_libgcc): Likewise.
+ (XFAIL_IBM128_LIBGCC): Likewise.
+ (PAYLOAD_DIG): Likewise.
+ (UNDERFLOW_EXCEPTION_FLOAT): Likewise.
+ (UNDERFLOW_EXCEPTION_OK_FLOAT): Likewise.
+ (UNDERFLOW_EXCEPTION_DOUBLE): Likewise.
+ (UNDERFLOW_EXCEPTION_OK_DOUBLE): Likewise.
+ (UNDERFLOW_EXCEPTION_LDOUBLE_IBM): Likewise.
+ (UNDERFLOW_EXCEPTION_BEFORE_ROUNDING): Likewise.
+ (TEST_COND_long32): Likewise.
+ (TEST_COND_long64): Likewise.
+ (TEST_COND_before_rounding): Likewise.
+ (TEST_COND_after_rounding): Likewise.
+ (lit_pi_3_m_4_d): Likewise.
+ (lit_pi_3_m_4_ln10_m_d): Likewise.
+ (lit_pi_2_ln10_m_d): Likewise.
+ (lit_pi_4_ln10_m_d): Likewise.
+ (lit_pi_ln10_d): Likewise.
+ (lit_pi_2_d): Likewise.
+ (lit_pi_4_d): Likewise.
+ (lit_pi): Likewise.
+ (lit_e): Likewise.
+ (ulps_file_name): Likewise.
+ (ulps_file): Likewise.
+ (output_ulps): Likewise.
+ (output_dir): Likewise.
+ (noErrors): Likewise.
+ (noTests): Likewise.
+ (noExcTests): Likewise.
+ (noErrnoTests): Likewise.
+ (verbose): Likewise.
+ (output_max_error): Likewise.
+ (output_points): Likewise.
+ (ignore_max_ulp): Likewise.
+ (plus_zero): Likewise.
+ (minus_zero): Likewise.
+ (plus_infty): Likewise.
+ (minus_infty): Likewise.
+ (qnan_value_pl): Likewise.
+ (qnan_value): Likewise.
+ (snan_value_pl): Likewise.
+ (snan_value): Likewise.
+ (max_value): Likewise.
+ (min_value): Likewise.
+ (min_subnorm_value): Likewise.
+ (snan_value_ld): Likewise.
+ (max_error): Likewise.
+ (real_max_error): Likewise.
+ (imag_max_error): Likewise.
+ (prev_max_error): Likewise.
+ (prev_real_max_error): Likewise.
+ (prev_imag_max_error): Likewise.
+ (max_valid_error): Likewise.
+ (TYPE_DECIMAL_DIG): Likewise.
+ (TYPE_HEX_DIG): Likewise.
+ (fmt_ftostr): Likewise.
+ (compare_ulp_data): Likewise.
+ (find_ulps): Likewise.
+ (init_max_error): Likewise.
+ (set_max_error): Likewise.
+ (print_float): Likewise.
+ (print_screen): Likewise.
+ (print_screen_max_error): Likewise.
+ (update_stats): Likewise.
+ (print_function_ulps): Likewise.
+ (print_complex_function_ulps): Likewise.
+ (fpstack_test): Likewise.
+ (print_max_error): Likewise.
+ (print_complex_max_error): Likewise.
+ (test_single_exception): Likewise.
+ (test_exceptions): Likewise.
+ (test_single_errno): Likewise.
+ (test_errno): Likewise.
+ (ULPDIFF): Likewise.
+ (ulp): Likewise.
+ (check_float_internal): Likewise.
+ (check_float): Likewise.
+ (check_complex): Likewise.
+ (check_int): Likewise.
+ (check_long): Likewise.
+ (check_bool): Likewise.
+ (check_longlong): Likewise.
+ (check_intmax_t): Likewise.
+ (check_uintmax_t): Likewise.
+ (enable_test): Likewise.
+ (struct test_f_f_data): Likewise.
+ (struct test_ff_f_data): Likewise.
+ (struct test_fj_f_data): Likewise.
+ (struct test_fi_f_data): Likewise.
+ (struct test_fl_f_data): Likewise.
+ (struct test_if_f_data): Likewise.
+ (struct test_fff_f_data): Likewise.
+ (struct test_fiu_M_data): Likewise.
+ (struct test_fiu_U_data): Likewise.
+ (struct test_c_f_data): Likewise.
+ (struct test_f_f1_data): Likewise.
+ (struct test_fF_f1_data): Likewise.
+ (struct test_ffI_f1_data): Likewise.
+ (struct test_c_c_data): Likewise.
+ (struct test_cc_c_data): Likewise.
+ (struct test_f_i_data): Likewise.
+ (struct test_ff_i_data): Likewise.
+ (struct test_f_l_data): Likewise.
+ (struct test_f_L_data): Likewise.
+ (struct test_fFF_11_data): Likewise.
+ (struct test_Ff_b1_data): Likewise.
+ (IF_ROUND_INIT_): Likewise.
+ (IF_ROUND_INIT_FE_DOWNWARD): Likewise.
+ (IF_ROUND_INIT_FE_TONEAREST): Likewise.
+ (IF_ROUND_INIT_FE_TOWARDZERO): Likewise.
+ (IF_ROUND_INIT_FE_UPWARD): Likewise.
+ (ROUND_RESTORE_): Likewise.
+ (ROUND_RESTORE_FE_DOWNWARD): Likewise.
+ (ROUND_RESTORE_FE_TONEAREST): Likewise.
+ (ROUND_RESTORE_FE_TOWARDZERO): Likewise.
+ (ROUND_RESTORE_FE_UPWARD): Likewise.
+ (RM_): Likewise.
+ (RM_FE_DOWNWARD): Likewise.
+ (RM_FE_TONEAREST): Likewise.
+ (RM_FE_TOWARDZERO): Likewise.
+ (RM_FE_UPWARD): Likewise.
+ (COMMON_TEST_SETUP): Likewise.
+ (EXTRA_OUTPUT_TEST_SETUP): Likewise.
+ (COMMON_TEST_CLEANUP): Likewise.
+ (EXTRA_OUTPUT_TEST_CLEANUP): Likewise.
+ (RUN_TEST_f_f): Likewise.
+ (RUN_TEST_LOOP_f_f): Likewise.
+ (RUN_TEST_fp_f): Likewise.
+ (RUN_TEST_LOOP_fp_f): Likewise.
+ (RUN_TEST_2_f): Likewise.
+ (RUN_TEST_LOOP_2_f): Likewise.
+ (RUN_TEST_ff_f): Likewise.
+ (RUN_TEST_LOOP_ff_f): Likewise.
+ (RUN_TEST_LOOP_fj_f): Likewise.
+ (RUN_TEST_fi_f): Likewise.
+ (RUN_TEST_LOOP_fi_f): Likewise.
+ (RUN_TEST_fl_f): Likewise.
+ (RUN_TEST_LOOP_fl_f): Likewise.
+ (RUN_TEST_if_f): Likewise.
+ (RUN_TEST_LOOP_if_f): Likewise.
+ (RUN_TEST_fff_f): Likewise.
+ (RUN_TEST_LOOP_fff_f): Likewise.
+ (RUN_TEST_fiu_M): Likewise.
+ (RUN_TEST_LOOP_fiu_M): Likewise.
+ (RUN_TEST_fiu_U): Likewise.
+ (RUN_TEST_LOOP_fiu_U): Likewise.
+ (RUN_TEST_c_f): Likewise.
+ (RUN_TEST_LOOP_c_f): Likewise.
+ (RUN_TEST_f_f1): Likewise.
+ (RUN_TEST_LOOP_f_f1): Likewise.
+ (RUN_TEST_fF_f1): Likewise.
+ (RUN_TEST_LOOP_fF_f1): Likewise.
+ (RUN_TEST_fI_f1): Likewise.
+ (RUN_TEST_LOOP_fI_f1): Likewise.
+ (RUN_TEST_ffI_f1_mod8): Likewise.
+ (RUN_TEST_LOOP_ffI_f1_mod8): Likewise.
+ (RUN_TEST_Ff_b1): Likewise.
+ (RUN_TEST_LOOP_Ff_b1): Likewise.
+ (RUN_TEST_Ffp_b1): Likewise.
+ (RUN_TEST_LOOP_Ffp_b1): Likewise.
+ (RUN_TEST_c_c): Likewise.
+ (RUN_TEST_LOOP_c_c): Likewise.
+ (RUN_TEST_cc_c): Likewise.
+ (RUN_TEST_LOOP_cc_c): Likewise.
+ (RUN_TEST_f_i): Likewise.
+ (RUN_TEST_LOOP_f_i): Likewise.
+ (RUN_TEST_f_i_tg): Likewise.
+ (RUN_TEST_LOOP_f_i_tg): Likewise.
+ (RUN_TEST_ff_b): Likewise.
+ (RUN_TEST_LOOP_ff_b): Likewise.
+ (RUN_TEST_ff_i_tg): Likewise.
+ (RUN_TEST_LOOP_ff_i_tg): Likewise.
+ (RUN_TEST_f_b): Likewise.
+ (RUN_TEST_LOOP_f_b): Likewise.
+ (RUN_TEST_f_b_tg): Likewise.
+ (RUN_TEST_LOOP_f_b_tg): Likewise.
+ (RUN_TEST_f_l): Likewise.
+ (RUN_TEST_LOOP_f_l): Likewise.
+ (RUN_TEST_f_L): Likewise.
+ (RUN_TEST_LOOP_f_L): Likewise.
+ (RUN_TEST_fFF_11): Likewise.
+ (RUN_TEST_LOOP_fFF_11): Likewise.
+ (VEC_SUFF): Likewise.
+ (STR_CONCAT): Likewise.
+ (STR_CON3): Likewise.
+ (HAVE_VECTOR): Likewise.
+ (START): Likewise.
+ (END): Likewise.
+ (END_COMPLEX): Likewise.
+ (ALL_RM_TEST): Likewise.
+ (matherr): Likewise.
+ (initialize): Likewise.
+ (options): Likewise.
+ (doc): Likewise.
+ (parse_opt): Likewise.
+ (argp): Likewise.
+ (check_ulp): Likewise.
+ (main): Likewise.
+ (do_test): New function. Call tests of individual functions
+ previously called from main.
+
* math/libm-test.inc: Remove comment listing functions tested and
not tested.
diff --git a/math/libm-test-driver.c b/math/libm-test-driver.c
new file mode 100644
index 0000000000..1227d52d06
--- /dev/null
+++ b/math/libm-test-driver.c
@@ -0,0 +1,2286 @@
+/* Support code for testing libm functions.
+ Copyright (C) 1997-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+/* Part of testsuite for libm.
+
+ libm-test.inc is processed by a perl script. The resulting file has to
+ be included by a master file that defines:
+
+ Macros:
+ FUNC(function): converts general function name (like cos) to
+ name with correct suffix (e.g. cosl or cosf)
+ FLOAT: floating point type to test
+ - TEST_MSG: informal message to be displayed
+ chooses one of the parameters as delta for testing
+ equality
+ PREFIX A macro which defines the prefix for common macros for the
+ type (i.e LDBL, DBL, or FLT).
+ LIT A function which appends the correct suffix to a literal.
+ TYPE_STR A macro which defines a stringitized name of the type.
+ FTOSTR This macro defines a function similar in type to strfromf
+ which converts a FLOAT to a string. */
+
+/* Parameter handling is primitive in the moment:
+ --verbose=[0..3] for different levels of output:
+ 0: only error count
+ 1: basic report on failed tests (default)
+ 2: full report on all tests
+ -v for full output (equals --verbose=3)
+ -u for generation of an ULPs file
+ */
+
+/* "Philosophy":
+
+ This suite tests some aspects of the correct implementation of
+ mathematical functions in libm. Some simple, specific parameters
+ are tested for correctness but there's no exhaustive
+ testing. Handling of specific inputs (e.g. infinity, not-a-number)
+ is also tested. Correct handling of exceptions is checked
+ against. These implemented tests should check all cases that are
+ specified in ISO C99.
+
+ NaN values: The payload of NaNs is set in inputs for functions
+ where it is significant, and is examined in the outputs of some
+ functions.
+
+ Inline functions: Inlining functions should give an improvement in
+ speed - but not in precission. The inlined functions return
+ reasonable values for a reasonable range of input values. The
+ result is not necessarily correct for all values and exceptions are
+ not correctly raised in all cases. Problematic input and return
+ values are infinity, not-a-number and minus zero. This suite
+ therefore does not check these specific inputs and the exception
+ handling for inlined mathematical functions - just the "reasonable"
+ values are checked.
+
+ Beware: The tests might fail for any of the following reasons:
+ - Tests are wrong
+ - Functions are wrong
+ - Floating Point Unit not working properly
+ - Compiler has errors
+
+ With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
+
+
+ To Do: All parameter should be numbers that can be represented as
+ exact floating point values. Currently some values cannot be
+ represented exactly and therefore the result is not the expected
+ result. For this we will use 36 digits so that numbers can be
+ represented exactly. */
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#include <complex.h>
+#include <math.h>
+#include <float.h>
+#include <fenv.h>
+#include <limits.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <argp.h>
+#include <tininess.h>
+#include <math-tests.h>
+#include <math-tests-arch.h>
+#include <nan-high-order-bit.h>
+
+/* This header defines func_ulps, func_real_ulps and func_imag_ulps
+ arrays. */
+#include "libm-test-ulps.h"
+
+/* Allow platforms without all rounding modes to test properly,
+ assuming they provide an __FE_UNDEFINED in <bits/fenv.h> which
+ causes fesetround() to return failure. */
+#ifndef FE_TONEAREST
+# define FE_TONEAREST __FE_UNDEFINED
+#endif
+#ifndef FE_TOWARDZERO
+# define FE_TOWARDZERO __FE_UNDEFINED
+#endif
+#ifndef FE_UPWARD
+# define FE_UPWARD __FE_UNDEFINED
+#endif
+#ifndef FE_DOWNWARD
+# define FE_DOWNWARD __FE_UNDEFINED
+#endif
+
+/* Possible exceptions */
+#define NO_EXCEPTION 0x0
+#define INVALID_EXCEPTION 0x1
+#define DIVIDE_BY_ZERO_EXCEPTION 0x2
+#define OVERFLOW_EXCEPTION 0x4
+#define UNDERFLOW_EXCEPTION 0x8
+#define INEXACT_EXCEPTION 0x10
+/* The next flags signals that those exceptions are allowed but not required. */
+#define INVALID_EXCEPTION_OK 0x20
+#define DIVIDE_BY_ZERO_EXCEPTION_OK 0x40
+#define OVERFLOW_EXCEPTION_OK 0x80
+#define UNDERFLOW_EXCEPTION_OK 0x100
+/* For "inexact" exceptions, the default is allowed but not required
+ unless INEXACT_EXCEPTION or NO_INEXACT_EXCEPTION is specified. */
+#define NO_INEXACT_EXCEPTION 0x200
+#define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
+/* Some special test flags, passed together with exceptions. */
+#define IGNORE_ZERO_INF_SIGN 0x400
+#define TEST_NAN_SIGN 0x800
+#define TEST_NAN_PAYLOAD 0x1000
+#define NO_TEST_INLINE 0x2000
+#define XFAIL_TEST 0x4000
+/* Indicate errno settings required or disallowed. */
+#define ERRNO_UNCHANGED 0x8000
+#define ERRNO_EDOM 0x10000
+#define ERRNO_ERANGE 0x20000
+/* Flags generated by gen-libm-test.pl, not entered here manually. */
+#define IGNORE_RESULT 0x40000
+#define NON_FINITE 0x80000
+#define TEST_SNAN 0x100000
+#define NO_TEST_MATHVEC 0x200000
+
+#define TEST_NAN_PAYLOAD_CANONICALIZE (SNAN_TESTS_PRESERVE_PAYLOAD \
+ ? TEST_NAN_PAYLOAD \
+ : 0)
+
+#define __CONCATX(a,b) __CONCAT(a,b)
+
+#define TYPE_MIN __CONCATX (PREFIX, _MIN)
+#define TYPE_TRUE_MIN __CONCATX (PREFIX, _TRUE_MIN)
+#define TYPE_MAX __CONCATX (PREFIX, _MAX)
+#define MIN_EXP __CONCATX (PREFIX, _MIN_EXP)
+#define MAX_EXP __CONCATX (PREFIX, _MAX_EXP)
+#define MANT_DIG __CONCATX (PREFIX, _MANT_DIG)
+
+/* Maximum character buffer to store a stringitized FLOAT value. */
+#define FSTR_MAX (128)
+
+#if TEST_INLINE
+# define ULP_IDX __CONCATX (ULP_I_, PREFIX)
+# define QTYPE_STR "i" TYPE_STR
+#else
+# define ULP_IDX __CONCATX (ULP_, PREFIX)
+# define QTYPE_STR TYPE_STR
+#endif
+
+/* Format specific test macros. */
+#define TEST_COND_binary32 (MANT_DIG == 24 \
+ && MIN_EXP == -125 \
+ && MAX_EXP == 128)
+
+#define TEST_COND_binary64 (MANT_DIG == 53 \
+ && MIN_EXP == -1021 \
+ && MAX_EXP == 1024)
+
+#define TEST_COND_binary128 (MANT_DIG == 113 \
+ && MIN_EXP == -16381 \
+ && MAX_EXP == 16384)
+
+#define TEST_COND_ibm128 (MANT_DIG == 106)
+
+#define TEST_COND_intel96 (MANT_DIG == 64 \
+ && MIN_EXP == -16381 \
+ && MAX_EXP == 16384)
+
+#define TEST_COND_m68k96 (MANT_DIG == 64 \
+ && MIN_EXP == -16382 \
+ && MAX_EXP == 16384)
+
+/* The condition ibm128-libgcc is used instead of ibm128 to mark tests
+ where in principle the glibc code is OK but the tests fail because
+ of limitations of the libgcc support for that format (e.g. GCC bug
+ 59666, in non-default rounding modes). */
+#define TEST_COND_ibm128_libgcc TEST_COND_ibm128
+
+/* Mark a test as expected to fail for ibm128-libgcc. This is used
+ via XFAIL_ROUNDING_IBM128_LIBGCC, which gen-libm-test.pl transforms
+ appropriately for each rounding mode. */
+#define XFAIL_IBM128_LIBGCC (TEST_COND_ibm128_libgcc ? XFAIL_TEST : 0)
+
+/* Number of bits in NaN payload. */
+#if TEST_COND_ibm128
+# define PAYLOAD_DIG (DBL_MANT_DIG - 2)
+#else
+# define PAYLOAD_DIG (MANT_DIG - 2)
+#endif
+
+/* Values underflowing only for float. */
+#if TEST_COND_binary32
+# define UNDERFLOW_EXCEPTION_FLOAT UNDERFLOW_EXCEPTION
+# define UNDERFLOW_EXCEPTION_OK_FLOAT UNDERFLOW_EXCEPTION_OK
+#else
+# define UNDERFLOW_EXCEPTION_FLOAT 0
+# define UNDERFLOW_EXCEPTION_OK_FLOAT 0
+#endif
+
+/* Values underflowing only for double or types with a larger least
+ positive normal value. */
+#if TEST_COND_binary32 || TEST_COND_binary64 || TEST_COND_ibm128
+# define UNDERFLOW_EXCEPTION_DOUBLE UNDERFLOW_EXCEPTION
+# define UNDERFLOW_EXCEPTION_OK_DOUBLE UNDERFLOW_EXCEPTION_OK
+#else
+# define UNDERFLOW_EXCEPTION_DOUBLE 0
+# define UNDERFLOW_EXCEPTION_OK_DOUBLE 0
+#endif
+
+/* Values underflowing only for IBM long double or types with a larger least
+ positive normal value. */
+#if TEST_COND_binary32 || TEST_COND_ibm128
+# define UNDERFLOW_EXCEPTION_LDOUBLE_IBM UNDERFLOW_EXCEPTION
+#else
+# define UNDERFLOW_EXCEPTION_LDOUBLE_IBM 0
+#endif
+
+/* Values underflowing on architectures detecting tininess before
+ rounding, but not on those detecting tininess after rounding. */
+#define UNDERFLOW_EXCEPTION_BEFORE_ROUNDING (TININESS_AFTER_ROUNDING \
+ ? 0 \
+ : UNDERFLOW_EXCEPTION)
+
+#if LONG_MAX == 0x7fffffff
+# define TEST_COND_long32 1
+# define TEST_COND_long64 0
+#else
+# define TEST_COND_long32 0
+# define TEST_COND_long64 1
+#endif
+#define TEST_COND_before_rounding (!TININESS_AFTER_ROUNDING)
+#define TEST_COND_after_rounding TININESS_AFTER_ROUNDING
+
+/* Various constants derived fr