about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-03-06 14:15:00 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-03-06 14:15:00 +0000
commit215db4029ef909b305c528ca9d36cc88771e3afe (patch)
tree5afa0520f544fcd7f886c79a1a1f52c360fef3c7
parent67737b8f07c3664c716f69fd1a531f51a002d1f8 (diff)
downloadglibc-215db4029ef909b305c528ca9d36cc88771e3afe.tar.gz
glibc-215db4029ef909b305c528ca9d36cc88771e3afe.tar.xz
glibc-215db4029ef909b305c528ca9d36cc88771e3afe.zip
Prepare libm-test.inc structures for multi-rounding-mode testing.
At present, libm-test.inc tests are run in multiple rounding modes by
having a separate array for each rounding mode (which might or might
not have the same test inputs as the other such arrays), a separate
function calling a RUN_TEST_LOOP_* macro over that array, and a
separate call to that function in main.  The number of functions
tested in multiple rounding modes has gradually increased as
rounding-mode-specific bugs have been found and fixed in different
functions.

It would be better to be able to use a single macro call, in a single
function, to run tests for a function over all rounding modes, with
this being done for all libm functions except in cases where it's
deferred until some bugs can be fixed because XFAILing all affected
tests would be painful (that's why the full set of pow tests isn't
currently run in all rounding modes).  This patch helps prepare for
that by making the structures storing expected results for tests store
results for all four rounding modes.  After this patch, the results
for all modes are just duplicates, but tests access the appropriate
field in the structure, so helping to pave the way for when the fields
stop being duplicates and multiple rounding modes can be tested from a
single array.  Tests might in future specify a single set of results,
to be used in all rounding modes; separate results for each rounding
mode, specified manually; or use of auto-libm-tests-* to generate
results for each rounding mode.

Tested x86_64.

	* math/libm-test.inc (struct test_f_f_data): Move expected results
	into structure for each rounding mode.
	(struct test_ff_f_data): Likewise.
	(struct test_ff_f_data_nexttoward): 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_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.
	(RM_): New macro.
	(RM_FE_DOWNWARD): Likewise.
	(RM_FE_TONEAREST): Likewise.
	(RM_FE_TOWARDZERO): Likewise.
	(RM_FE_UPWARD): Likewise.
	(RUN_TEST_LOOP_f_f): Update references to expected results.
	(RUN_TEST_LOOP_2_f): Likewise.
	(RUN_TEST_LOOP_fff_f): Likewise.
	(RUN_TEST_LOOP_c_f): Likewise.
	(RUN_TEST_LOOP_f_f1): Likewise.
	(RUN_TEST_LOOP_fF_f1): Likewise.
	(RUN_TEST_LOOP_fI_f1): Likewise.
	(RUN_TEST_LOOP_ffI_f1): Likewise.
	(RUN_TEST_LOOP_c_c): Likewise.
	(RUN_TEST_LOOP_cc_c): Likewise.
	(RUN_TEST_LOOP_f_i): Likewise.
	(RUN_TEST_LOOP_f_i_tg): Likewise.
	(RUN_TEST_LOOP_ff_i_tg): Likewise.
	(RUN_TEST_LOOP_f_b): Likewise.
	(RUN_TEST_LOOP_f_b_tg): Likewise.
	(RUN_TEST_LOOP_f_l): Likewise.
	(RUN_TEST_LOOP_f_L): Likewise.
	(RUN_TEST_LOOP_fFF_11): Likewise.
	* math/gen-libm-test.pl (parse_args): Output four copies of
	expected results for each test.
-rw-r--r--ChangeLog45
-rwxr-xr-xmath/gen-libm-test.pl19
-rw-r--r--math/libm-test.inc245
3 files changed, 221 insertions, 88 deletions
diff --git a/ChangeLog b/ChangeLog
index 765f0b703a..0d962af385 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,50 @@
 2014-03-06  Joseph Myers  <joseph@codesourcery.com>
 
+	* math/libm-test.inc (struct test_f_f_data): Move expected results
+	into structure for each rounding mode.
+	(struct test_ff_f_data): Likewise.
+	(struct test_ff_f_data_nexttoward): 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_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.
+	(RM_): New macro.
+	(RM_FE_DOWNWARD): Likewise.
+	(RM_FE_TONEAREST): Likewise.
+	(RM_FE_TOWARDZERO): Likewise.
+	(RM_FE_UPWARD): Likewise.
+	(RUN_TEST_LOOP_f_f): Update references to expected results.
+	(RUN_TEST_LOOP_2_f): Likewise.
+	(RUN_TEST_LOOP_fff_f): Likewise.
+	(RUN_TEST_LOOP_c_f): Likewise.
+	(RUN_TEST_LOOP_f_f1): Likewise.
+	(RUN_TEST_LOOP_fF_f1): Likewise.
+	(RUN_TEST_LOOP_fI_f1): Likewise.
+	(RUN_TEST_LOOP_ffI_f1): Likewise.
+	(RUN_TEST_LOOP_c_c): Likewise.
+	(RUN_TEST_LOOP_cc_c): Likewise.
+	(RUN_TEST_LOOP_f_i): Likewise.
+	(RUN_TEST_LOOP_f_i_tg): Likewise.
+	(RUN_TEST_LOOP_ff_i_tg): Likewise.
+	(RUN_TEST_LOOP_f_b): Likewise.
+	(RUN_TEST_LOOP_f_b_tg): Likewise.
+	(RUN_TEST_LOOP_f_l): Likewise.
+	(RUN_TEST_LOOP_f_L): Likewise.
+	(RUN_TEST_LOOP_fFF_11): Likewise.
+	* math/gen-libm-test.pl (parse_args): Output four copies of
+	expected results for each test.
+
 	* sysdeps/unix/sysv/linux/aarch64/kernel-features.h
 	(__ASSUME_UTIMES): Remove.
 	* sysdeps/unix/sysv/linux/tile/kernel-features.h
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index a5abda2fb0..097488c17c 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -154,7 +154,7 @@ sub show_exceptions {
 sub parse_args {
   my ($file, $descr, $args) = @_;
   my (@args, $descr_args, $descr_res, @descr);
-  my ($current_arg, $cline, $i);
+  my ($current_arg, $cline, $cline_res, $i);
   my (@special);
   my ($call_args);
   my ($ignore_result_any, $ignore_result_all);
@@ -247,6 +247,7 @@ sub parse_args {
   @descr = split //,$descr_res;
   $ignore_result_any = 0;
   $ignore_result_all = 1;
+  $cline_res = "";
   foreach (@descr) {
     if ($_ =~ /b|f|i|l|L/ ) {
       my ($result) = $args[$current_arg];
@@ -256,7 +257,7 @@ sub parse_args {
       } else {
 	$ignore_result_all = 0;
       }
-      $cline .= ", $result";
+      $cline_res .= ", $result";
       $current_arg++;
     } elsif ($_ eq 'c') {
       my ($result1) = $args[$current_arg];
@@ -273,7 +274,7 @@ sub parse_args {
       } else {
 	$ignore_result_all = 0;
       }
-      $cline .= ", $result1, $result2";
+      $cline_res .= ", $result1, $result2";
       $current_arg += 2;
     } elsif ($_ eq '1') {
       push @special, $args[$current_arg];
@@ -284,10 +285,10 @@ sub parse_args {
     die ("some but not all function results ignored\n");
   }
   # Add exceptions.
-  $cline .= show_exceptions ($ignore_result_any,
-			     ($current_arg <= $#args)
-			     ? $args[$current_arg]
-			     : undef);
+  $cline_res .= show_exceptions ($ignore_result_any,
+				 ($current_arg <= $#args)
+				 ? $args[$current_arg]
+				 : undef);
 
   # special treatment for some functions
   $i = 0;
@@ -298,8 +299,10 @@ sub parse_args {
     if (!$run_extra) {
       $extra_expected = "0";
     }
-    $cline .= ", $run_extra, $extra_expected";
+    $cline_res .= ", $run_extra, $extra_expected";
   }
+  $cline_res =~ s/^, //;
+  $cline .= ", { $cline_res }, { $cline_res }, { $cline_res }, { $cline_res }";
   print $file "    $cline },\n";
 }
 
diff --git a/math/libm-test.inc b/math/libm-test.inc
index b1074328f0..13332aea1a 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -1044,103 +1044,142 @@ struct test_f_f_data
 {
   const char *arg_str;
   FLOAT arg;
-  FLOAT expected;
-  int exceptions;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_ff_f_data
 {
   const char *arg_str;
   FLOAT arg1, arg2;
-  FLOAT expected;
-  int exceptions;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_ff_f_data_nexttoward
 {
   const char *arg_str;
   FLOAT arg1;
   long double arg2;
-  FLOAT expected;
-  int exceptions;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_fi_f_data
 {
   const char *arg_str;
   FLOAT arg1;
   int arg2;
-  FLOAT expected;
-  int exceptions;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_fl_f_data
 {
   const char *arg_str;
   FLOAT arg1;
   long int arg2;
-  FLOAT expected;
-  int exceptions;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_if_f_data
 {
   const char *arg_str;
   int arg1;
   FLOAT arg2;
-  FLOAT expected;
-  int exceptions;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_fff_f_data
 {
   const char *arg_str;
   FLOAT arg1, arg2, arg3;
-  FLOAT expected;
-  int exceptions;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_c_f_data
 {
   const char *arg_str;
   FLOAT argr, argc;
-  FLOAT expected;
-  int exceptions;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 /* Used for both RUN_TEST_LOOP_f_f1 and RUN_TEST_LOOP_fI_f1.  */
 struct test_f_f1_data
 {
   const char *arg_str;
   FLOAT arg;
-  FLOAT expected;
-  int exceptions;
-  int extra_test;
-  int extra_expected;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+    int extra_test;
+    int extra_expected;
+  } rd, rn, rz, ru;
 };
 struct test_fF_f1_data
 {
   const char *arg_str;
   FLOAT arg;
-  FLOAT expected;
-  int exceptions;
-  int extra_test;
-  FLOAT extra_expected;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+    int extra_test;
+    FLOAT extra_expected;
+  } rd, rn, rz, ru;
 };
 struct test_ffI_f1_data
 {
   const char *arg_str;
   FLOAT arg1, arg2;
-  FLOAT expected;
-  int exceptions;
-  int extra_test;
-  int extra_expected;
+  struct
+  {
+    FLOAT expected;
+    int exceptions;
+    int extra_test;
+    int extra_expected;
+  } rd, rn, rz, ru;
 };
 struct test_c_c_data
 {
   const char *arg_str;
   FLOAT argr, argc;
-  FLOAT expr, expc;
-  int exceptions;
+  struct
+  {
+    FLOAT expr, expc;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_cc_c_data
 {
   const char *arg_str;
   FLOAT arg1r, arg1c, arg2r, arg2c;
-  FLOAT expr, expc;
-  int exceptions;
+  struct
+  {
+    FLOAT expr, expc;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 /* Used for all of RUN_TEST_LOOP_f_i, RUN_TEST_LOOP_f_i_tg,
    RUN_TEST_LOOP_f_b and RUN_TEST_LOOP_f_b_tg.  */
@@ -1148,39 +1187,54 @@ struct test_f_i_data
 {
   const char *arg_str;
   FLOAT arg;
-  int expected;
-  int exceptions;
+  struct
+  {
+    int expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_ff_i_data
 {
   const char *arg_str;
   FLOAT arg1, arg2;
-  int expected;
-  int exceptions;
+  struct
+  {
+    int expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_f_l_data
 {
   const char *arg_str;
   FLOAT arg;
-  long int expected;
-  int exceptions;
+  struct
+  {
+    long int expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_f_L_data
 {
   const char *arg_str;
   FLOAT arg;
-  long long int expected;
-  int exceptions;
+  struct
+  {
+    long long int expected;
+    int exceptions;
+  } rd, rn, rz, ru;
 };
 struct test_fFF_11_data
 {
   const char *arg_str;
   FLOAT arg;
-  int exceptions;
-  int extra1_test;
-  FLOAT extra1_expected;
-  int extra2_test;
-  FLOAT extra2_expected;
+  struct
+  {
+    int exceptions;
+    int extra1_test;
+    FLOAT extra1_expected;
+    int extra2_test;
+    FLOAT extra2_expected;
+  } rd, rn, rz, ru;
 };
 
 /* Set the rounding mode, or restore the saved value.  */
@@ -1211,6 +1265,13 @@ struct test_fFF_11_data
 #define ROUND_RESTORE_FE_UPWARD			\
   fesetround (save_round_mode)
 
+/* Field name to use for a given rounding mode.  */
+#define RM_			rn
+#define RM_FE_DOWNWARD		rd
+#define RM_FE_TONEAREST		rn
+#define RM_FE_TOWARDZERO	rz
+#define RM_FE_UPWARD		ru
+
 /* Common setup for an individual test.  */
 #define COMMON_TEST_SETUP(ARG_STR)					\
   char *test_name;							\
@@ -1249,7 +1310,8 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_f_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		    (ARRAY)[i].expected, (ARRAY)[i].exceptions);	\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_2_f(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED,	\
 		     EXCEPTIONS)				\
@@ -1266,8 +1328,9 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_2_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1,	\
-		    (ARRAY)[i].arg2, (ARRAY)[i].expected,		\
-		    (ARRAY)[i].exceptions);				\
+		    (ARRAY)[i].arg2,					\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_ff_f RUN_TEST_2_f
 #define RUN_TEST_LOOP_ff_f RUN_TEST_LOOP_2_f
@@ -1293,7 +1356,8 @@ struct test_fFF_11_data
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_fff_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1,	\
 		      (ARRAY)[i].arg2, (ARRAY)[i].arg3,			\
-		      (ARRAY)[i].expected, (ARRAY)[i].exceptions);	\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_c_f(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED,		\
 		     EXCEPTIONS)					\
@@ -1311,8 +1375,9 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_c_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].argr,	\
-		    (ARRAY)[i].argc, (ARRAY)[i].expected,		\
-		    (ARRAY)[i].exceptions);				\
+		    (ARRAY)[i].argc,					\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_f_f1(ARG_STR, FUNC_NAME, ARG, EXPECTED,		\
 		      EXCEPTIONS, EXTRA_VAR, EXTRA_TEST,		\
@@ -1335,9 +1400,11 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_f_f1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		     (ARRAY)[i].expected, (ARRAY)[i].exceptions,	\
-		     EXTRA_VAR, (ARRAY)[i].extra_test,			\
-		     (ARRAY)[i].extra_expected);			\
+		     (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		     (ARRAY)[i].RM_##ROUNDING_MODE.exceptions,		\
+		     EXTRA_VAR,						\
+		     (ARRAY)[i].RM_##ROUNDING_MODE.extra_test,		\
+		     (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_fF_f1(ARG_STR, FUNC_NAME, ARG, EXPECTED,		\
 		       EXCEPTIONS, EXTRA_VAR, EXTRA_TEST,		\
@@ -1360,9 +1427,11 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_fF_f1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		      (ARRAY)[i].expected, (ARRAY)[i].exceptions,	\
-		      EXTRA_VAR, (ARRAY)[i].extra_test,			\
-		      (ARRAY)[i].extra_expected);			\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.exceptions,		\
+		      EXTRA_VAR,					\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.extra_test,		\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_fI_f1(ARG_STR, FUNC_NAME, ARG, EXPECTED,		\
 		       EXCEPTIONS, EXTRA_VAR, EXTRA_TEST,		\
@@ -1385,9 +1454,11 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_fI_f1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		      (ARRAY)[i].expected, (ARRAY)[i].exceptions,	\
-		      EXTRA_VAR, (ARRAY)[i].extra_test,			\
-		      (ARRAY)[i].extra_expected);			\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.exceptions,		\
+		      EXTRA_VAR,					\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.extra_test,		\
+		      (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_ffI_f1(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED,	\
 			EXCEPTIONS, EXTRA_VAR, EXTRA_TEST,		\
@@ -1413,9 +1484,11 @@ struct test_fFF_11_data
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_ffI_f1 ((ARRAY)[i].arg_str, FUNC_NAME,			\
 		       (ARRAY)[i].arg1, (ARRAY)[i].arg2,		\
-		       (ARRAY)[i].expected, (ARRAY)[i].exceptions,	\
-		       EXTRA_VAR, (ARRAY)[i].extra_test,		\
-		       (ARRAY)[i].extra_expected);			\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.exceptions,	\
+		       EXTRA_VAR,					\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.extra_test,	\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_c_c(ARG_STR, FUNC_NAME, ARGR, ARGC, EXPR, EXPC,	\
 		     EXCEPTIONS)					\
@@ -1433,8 +1506,10 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_c_c ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].argr,	\
-		    (ARRAY)[i].argc, (ARRAY)[i].expr, (ARRAY)[i].expc,	\
-		    (ARRAY)[i].exceptions);				\
+		    (ARRAY)[i].argc,					\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.expr,			\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.expc,			\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_cc_c(ARG_STR, FUNC_NAME, ARG1R, ARG1C, ARG2R, ARG2C,	\
 		      EXPR, EXPC, EXCEPTIONS)				\
@@ -1454,8 +1529,10 @@ struct test_fFF_11_data
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_cc_c ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1r,	\
 		     (ARRAY)[i].arg1c, (ARRAY)[i].arg2r,		\
-		     (ARRAY)[i].arg2c, (ARRAY)[i].expr,			\
-		     (ARRAY)[i].expc, (ARRAY)[i].exceptions);		\
+		     (ARRAY)[i].arg2c,					\
+		     (ARRAY)[i].RM_##ROUNDING_MODE.expr,		\
+		     (ARRAY)[i].RM_##ROUNDING_MODE.expc,		\
+		     (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_f_i(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS)	\
   do									\
@@ -1471,7 +1548,8 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_f_i ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		    (ARRAY)[i].expected, (ARRAY)[i].exceptions);	\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_f_i_tg(ARG_STR, FUNC_NAME, ARG, EXPECTED,		\
 			EXCEPTIONS)					\
@@ -1487,7 +1565,8 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_f_i_tg ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		       (ARRAY)[i].expected, (ARRAY)[i].exceptions);	\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_ff_i_tg(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED,	\
 			 EXCEPTIONS)					\
@@ -1503,9 +1582,10 @@ struct test_fFF_11_data
 #define RUN_TEST_LOOP_ff_i_tg(FUNC_NAME, ARRAY, ROUNDING_MODE)		\
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
-      RUN_TEST_ff_i_tg ((ARRAY)[i].arg_str, FUNC_NAME,		\
+      RUN_TEST_ff_i_tg ((ARRAY)[i].arg_str, FUNC_NAME,			\
 			(ARRAY)[i].arg1, (ARRAY)[i].arg2,		\
-			(ARRAY)[i].expected, (ARRAY)[i].exceptions);	\
+			(ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+			(ARRAY)[i].RM_##ROUNDING_MODE.exceptions);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_f_b(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS)	\
   do									\
@@ -1521,7 +1601,8 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_f_b ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		    (ARRAY)[i].expected, (ARRAY)[i].exceptions);	\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_f_b_tg(ARG_STR, FUNC_NAME, ARG, EXPECTED,		\
 			EXCEPTIONS)					\
@@ -1537,7 +1618,8 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_f_b_tg ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		       (ARRAY)[i].expected, (ARRAY)[i].exceptions);	\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_f_l(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS)	\
   do									\
@@ -1553,7 +1635,8 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_f_l ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		    (ARRAY)[i].expected, (ARRAY)[i].exceptions);	\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_f_L(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS)	\
   do									\
@@ -1569,7 +1652,8 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_f_L ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		    (ARRAY)[i].expected, (ARRAY)[i].exceptions);	\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
+		    (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_fFF_11(ARG_STR, FUNC_NAME, ARG, EXCEPTIONS,		\
 			EXTRA1_VAR, EXTRA1_TEST,			\
@@ -1597,12 +1681,13 @@ struct test_fFF_11_data
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
       RUN_TEST_fFF_11 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg,	\
-		       (ARRAY)[i].exceptions,				\
-		       EXTRA1_VAR, (ARRAY)[i].extra1_test,		\
-		       (ARRAY)[i].extra1_expected,			\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.exceptions,	\
+		       EXTRA1_VAR,					\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.extra1_test,	\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.extra1_expected,	\
 		       EXTRA2_VAR,					\
-		       (ARRAY)[i].extra2_test,				\
-		       (ARRAY)[i].extra2_expected);			\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.extra2_test,	\
+		       (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 
 /* Start and end the tests for a given function.  */