about summary refs log tree commit diff
path: root/math/gen-auto-libm-tests.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-01-09 22:40:59 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-01-09 22:40:59 +0000
commit08f7b95dbdf7ddc25899fe5b521a36db03fe6e2a (patch)
tree9cd4770bac4f35d3c84eb24c641901f46bbb9b71 /math/gen-auto-libm-tests.c
parentc6be839efded78768ad3c70d7f2e913a9fb8603c (diff)
downloadglibc-08f7b95dbdf7ddc25899fe5b521a36db03fe6e2a.tar.gz
glibc-08f7b95dbdf7ddc25899fe5b521a36db03fe6e2a.tar.xz
glibc-08f7b95dbdf7ddc25899fe5b521a36db03fe6e2a.zip
Improve libm-test XFAILing for ibm128-libgcc.
This patch further improves XFAILing for ibm128-libgcc of tests in
auto-libm-test-*.

The bulk of the cases needing XFAILing are
xfail-rounding:ibm128-libgcc used for inputs where (possibly after
rounding the inputs to another floating-point type) the result
overflows (and the result in non-default rounding modes may be wildly
wrong with unpatched libgcc) or underflows near 0 (and the result in
non-default rounding modes may end up having the wrong sign).  This
patch makes gen-auto-libm-tests detect such cases and apply
xfail-rounding:ibm128-libgcc automatically to them, so most of the
manual XFAILs in auto-libm-test-in are no longer needed (some are
still needed if e.g. the result is very close to overflow, resulting
in an internal overflow in libgcc in some rounding modes).  A few
manual XFAILs are added for cases not covered by this
gen-auto-libm-tests change, and a few existing such XFAILs are left
in.

Tested for powerpc.

	* math/gen-auto-libm-tests.c (output_for_one_input_case): Apply
	xfail-rounding:ibm128-libgcc automatically to tests overflowing
	and those that can underflow to zero.
	* math/auto-libm-test-in: Remove most XFAILs for ibm128-libgcc and
	add others.
	* math/auto-libm-test-out: Regenerated.
Diffstat (limited to 'math/gen-auto-libm-tests.c')
-rw-r--r--math/gen-auto-libm-tests.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c
index 22dd73f916..9f497e019f 100644
--- a/math/gen-auto-libm-tests.c
+++ b/math/gen-auto-libm-tests.c
@@ -1907,6 +1907,7 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
 		error (EXIT_FAILURE, errno, "write to '%s'", filename);
 	      /* Print outputs.  */
 	      bool must_erange = false;
+	      bool some_underflow_zero = false;
 	      for (size_t i = 0; i < tf->num_ret; i++)
 		{
 		  generic_value g;
@@ -1924,6 +1925,10 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
 			  && (all_exc_before[i][m]
 			      & (1U << exc_underflow)) != 0)
 			must_erange = true;
+		      if (mpfr_zero_p (all_res[i][rm_towardzero])
+			  && (all_exc_before[i][m]
+			      & (1U << exc_underflow)) != 0)
+			some_underflow_zero = true;
 		      mpfr_init2 (g.value.f, fp_formats[f].mant_dig);
 		      assert_exact (mpfr_set (g.value.f, all_res[i][m],
 					      MPFR_RNDN));
@@ -1971,6 +1976,16 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
 		  default:
 		    break;
 		  }
+	      /* For the ibm128 format, expect incorrect overflowing
+		 results in rounding modes other than to nearest;
+		 likewise incorrect results where the result may
+		 underflow to 0.  */
+	      if (f == fp_ldbl_128ibm
+		  && m != rm_tonearest
+		  && (some_underflow_zero
+		      || (merged_exc_before[m] & (1U << exc_overflow)) != 0))
+		if (fputs (" xfail:ibm128-libgcc", fp) < 0)
+		  error (EXIT_FAILURE, errno, "write to '%s'", filename);
 	      /* Print exception flags and compute errno
 		 expectations where not already computed.  */
 	      bool may_edom = false;