diff mbox

[PATCHv3,11/11] Generate new format names in auto-libm-test-out

Message ID cdb710c6a8a8f601c42dbe60d3d98a78c86a6a08.1464297421.git.murphyp@linux.vnet.ibm.com
State New
Headers show

Commit Message

Paul E. Murphy May 26, 2016, 9:42 p.m. UTC
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(-)

Comments

Joseph Myers June 6, 2016, 9:04 p.m. UTC | #1
On Thu, 26 May 2016, Paul E. Murphy wrote:

> @@ -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)
>      {

Removing the function argument FORMAT means you also need to remove the 
mention of it from the comment above the function.

OK with that change.
Paul E. Murphy June 8, 2016, 8:03 p.m. UTC | #2
On 06/06/2016 04:04 PM, Joseph Myers wrote:
> On Thu, 26 May 2016, Paul E. Murphy wrote:
> 
>> @@ -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)
>>      {
> 
> Removing the function argument FORMAT means you also need to remove the 
> mention of it from the comment above the function.
> 
> OK with that change.
>

Comment updated.  Committed as 5188b97.
diff mbox

Patch

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 cb10fa0..110bb77 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -268,14 +268,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
@@ -405,7 +397,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
@@ -704,14 +696,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");