This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCHv2 14/14] Generate new format names in auto-libm-test-out
- From: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 20 May 2016 16:37:23 -0500
- Subject: [PATCHv2 14/14] Generate new format names in auto-libm-test-out
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1463779745 dot git dot murphyp at linux dot vnet dot ibm dot com>
- References: <cover dot 1463599718 dot git dot murphyp at linux dot vnet dot ibm dot com> <cover dot 1463779745 dot git dot murphyp at linux dot vnet dot ibm dot com>
This converts the inclusion macro for each test to use
the format specific macro. In addition, the format
specifier is removed as it is applied via the LIT() macro
which is itself applied when converting the auto inputs and
libm-test.inc into libm-test.c.
* math/gen-auto-libm-test.c (fp_format_desc): remove
suffix member.
(output_generic_value): Remove usage of suffix member,
and the resulting unuse of the fp_format argument.
(output_for_one_input_case): Remove unused fp_format
parameter.
* math/auto-libm-test-out: Regenerate.
* math/libm-test.inc [TEST_COND_ldbl_128ibm]: replace
usage with TEST_COND_ibm128.
[TEST_COND_flt_32]: Remove.
[TEST_COND_dbl_64]: Remove.
[TEST_COND_ldbl_96_intel]: Remove.
[TEST_COND_ldbl_96_m68k]: Remove.
[TEST_COND_ldbl_128]: Remove.
---
math/gen-auto-libm-tests.c | 24 ++++++++++--------------
math/libm-test.inc | 14 +++-----------
2 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c
index 0a57382..0d10197 100644
--- a/math/gen-auto-libm-tests.c
+++ b/math/gen-auto-libm-tests.c
@@ -158,9 +158,6 @@ typedef struct
{
/* The name of the format. */
const char *name;
- /* The suffix to use on floating-point constants with this
- format. */
- const char *suffix;
/* A string for the largest normal value, or NULL for IEEE formats
where this can be determined automatically. */
const char *max_string;
@@ -186,12 +183,12 @@ typedef struct
enumeration. */
static fp_format_desc fp_formats[fp_num_formats] =
{
- { "flt-32", "f", NULL, 24, 128, -125, {}, {}, {}, {}, {} },
- { "dbl-64", "", NULL, 53, 1024, -1021, {}, {}, {}, {}, {} },
- { "ldbl-96-intel", "L", NULL, 64, 16384, -16381, {}, {}, {}, {}, {} },
- { "ldbl-96-m68k", "L", NULL, 64, 16384, -16382, {}, {}, {}, {}, {} },
- { "ldbl-128", "L", NULL, 113, 16384, -16381, {}, {}, {}, {}, {} },
- { "ldbl-128ibm", "L", "0x1.fffffffffffff7ffffffffffff8p+1023",
+ { "binary32", NULL, 24, 128, -125, {}, {}, {}, {}, {} },
+ { "binary64", NULL, 53, 1024, -1021, {}, {}, {}, {}, {} },
+ { "intel96", NULL, 64, 16384, -16381, {}, {}, {}, {}, {} },
+ { "m68k96", NULL, 64, 16384, -16382, {}, {}, {}, {}, {} },
+ { "binary128", NULL, 113, 16384, -16381, {}, {}, {}, {}, {} },
+ { "ibm128", "0x1.fffffffffffff7ffffffffffff8p+1023",
106, 1024, -968, {}, {}, {}, {}, {} },
};
@@ -1648,8 +1645,7 @@ int_fits_type (mpz_t z, arg_ret_type type, int long_bits)
static void
output_generic_value (FILE *fp, const char *filename, const generic_value *v,
- bool ignore, arg_ret_type type, fp_format format,
- int long_bits)
+ bool ignore, arg_ret_type type, int long_bits)
{
if (ignore)
{
@@ -1662,7 +1658,7 @@ output_generic_value (FILE *fp, const char *filename, const generic_value *v,
switch (type)
{
case type_fp:
- suffix = fp_formats[format].suffix;
+ suffix = "";
break;
case type_int:
@@ -1906,7 +1902,7 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
/* Print inputs. */
for (size_t i = 0; i < tf->num_args; i++)
output_generic_value (fp, filename, &inputs[i], false,
- tf->arg_types[i], f, long_bits);
+ tf->arg_types[i], long_bits);
if (fputs (" :", fp) < 0)
error (EXIT_FAILURE, errno, "write to '%s'", filename);
/* Print outputs. */
@@ -1942,7 +1938,7 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
abort ();
}
output_generic_value (fp, filename, &g, ignore_output[i],
- tf->ret_types[i], f, long_bits);
+ tf->ret_types[i], long_bits);
generic_value_free (&g);
}
if (fputs (" :", fp) < 0)
diff --git a/math/libm-test.inc b/math/libm-test.inc
index adc1d69..442666c 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -271,14 +271,6 @@
# define NO_TEST_INLINE_DOUBLE 0
#endif
-/* Conditions used by tests generated by gen-auto-libm-tests.c. */
-#define TEST_COND_flt_32 TEST_COND_binary32
-#define TEST_COND_dbl_64 TEST_COND_binary64
-#define TEST_COND_ldbl_96_intel TEST_COND_intel96
-#define TEST_COND_ldbl_96_m68k TEST_COND_m68k96
-#define TEST_COND_ldbl_128 TEST_COND_binary128
-#define TEST_COND_ldbl_128ibm TEST_COND_ibm128
-
#if LONG_MAX == 0x7fffffff
# define TEST_COND_long32 1
# define TEST_COND_long64 0
@@ -406,7 +398,7 @@ init_max_error (const char *name, int exact)
prev_imag_max_error = find_ulps (name, func_imag_ulps,
(sizeof (func_imag_ulps)
/ sizeof (func_imag_ulps[0])));
-#if TEST_COND_ldbl_128ibm
+#if TEST_COND_ibm128
/* The documented accuracy of IBM long double division is 3ulp (see
libgcc/config/rs6000/ibm-ldouble-format), so do not require
better accuracy for libm functions that are exactly defined for
@@ -705,14 +697,14 @@ test_exceptions (const char *test_name, int exception)
arithmetic. */
#ifdef FE_UNDERFLOW
if ((exception & UNDERFLOW_EXCEPTION_OK) == 0
- && !(TEST_COND_ldbl_128ibm
+ && !(TEST_COND_ibm128
&& (exception & UNDERFLOW_EXCEPTION) == 0))
test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION,
FE_UNDERFLOW, "Underflow");
#endif
#ifdef FE_INEXACT
if ((exception & (INEXACT_EXCEPTION | NO_INEXACT_EXCEPTION)) != 0
- && !(TEST_COND_ldbl_128ibm
+ && !(TEST_COND_ibm128
&& (exception & NO_INEXACT_EXCEPTION) != 0))
test_single_exception (test_name, exception, INEXACT_EXCEPTION,
FE_INEXACT, "Inexact");
--
2.4.11