diff mbox series

[v2] Use the right argument code in unnormal tests

Message ID 20210113043856.214762-1-siddhesh@sourceware.org
State New
Headers show
Series [v2] Use the right argument code in unnormal tests | expand

Commit Message

Siddhesh Poyarekar Jan. 13, 2021, 4:38 a.m. UTC
Use the right argument code (j) in the unnormal tests and cast inputs
from the ieee_long_double_shape_type struct to Float64x to properly
test it.
---
Changes:

- Dropped the TEST_COND_unnormal macro since TEST_COND_intel96 was
  sufficient; I failed to notice that TEST_COND_intel96 would only be
  true for long double.

 math/libm-test-driver.c        | 12 +++++++-----
 math/libm-test-fpclassify.inc  | 14 +++++++-------
 math/libm-test-isinf.inc       | 14 +++++++-------
 math/libm-test-isnan.inc       | 14 +++++++-------
 math/libm-test-issignaling.inc | 14 +++++++-------
 5 files changed, 35 insertions(+), 33 deletions(-)

Comments

Joseph Myers Jan. 13, 2021, 5:41 p.m. UTC | #1
On Wed, 13 Jan 2021, Siddhesh Poyarekar via Libc-alpha wrote:

> Use the right argument code (j) in the unnormal tests and cast inputs
> from the ieee_long_double_shape_type struct to Float64x to properly
> test it.

This patch is OK.
diff mbox series

Patch

diff --git a/math/libm-test-driver.c b/math/libm-test-driver.c
index f7c0861c39..0a430a8606 100644
--- a/math/libm-test-driver.c
+++ b/math/libm-test-driver.c
@@ -328,7 +328,7 @@  struct test_f_i_data
 };
 /* Used for RUN_TEST_LOOP_f_i_tg_u and RUN_TEST_LOOP_f_b_tg_u.  */
 #if TEST_COND_intel96
-struct test_f_i_data_u
+struct test_j_i_data_u
 {
   const char *arg_str;
   ieee_long_double_shape_type arg;
@@ -855,17 +855,19 @@  struct test_Ff_b1_data
 		       (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
 		       (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
-#define RUN_TEST_LOOP_f_b_tg_u(FUNC_NAME, ARRAY, ROUNDING_MODE)		\
+#define RUN_TEST_LOOP_j_b_tg_u(FUNC_NAME, ARRAY, ROUNDING_MODE)		\
   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.value,	\
+  RUN_TEST_f_b_tg ((ARRAY)[i].arg_str, FUNC_NAME,			\
+		   (FLOAT)(ARRAY)[i].arg.value,				\
 		   (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
 		   (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
-#define RUN_TEST_LOOP_f_i_tg_u(FUNC_NAME, ARRAY, ROUNDING_MODE)		\
+#define RUN_TEST_LOOP_j_i_tg_u(FUNC_NAME, ARRAY, ROUNDING_MODE)		\
   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.value,	\
+  RUN_TEST_f_i_tg ((ARRAY)[i].arg_str, FUNC_NAME,			\
+		   (FLOAT)(ARRAY)[i].arg.value,				\
 		   (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
 		   (ARRAY)[i].RM_##ROUNDING_MODE.exceptions);		\
   ROUND_RESTORE_ ## ROUNDING_MODE
diff --git a/math/libm-test-fpclassify.inc b/math/libm-test-fpclassify.inc
index c1c7e1ead1..1e30479473 100644
--- a/math/libm-test-fpclassify.inc
+++ b/math/libm-test-fpclassify.inc
@@ -38,13 +38,13 @@  static const struct test_f_i_data fpclassify_test_data[] =
   };
 
 #if TEST_COND_intel96
-static const struct test_f_i_data_u fpclassify_test_data_u[] =
+static const struct test_j_i_data_u fpclassify_test_data_u[] =
   {
-    TEST_f_i (fpclassify, pseudo_zero, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_i (fpclassify, pseudo_inf, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_i (fpclassify, pseudo_qnan, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_i (fpclassify, pseudo_snan, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_i (fpclassify, pseudo_unnormal, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_i (fpclassify, pseudo_zero, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_i (fpclassify, pseudo_inf, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_i (fpclassify, pseudo_qnan, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_i (fpclassify, pseudo_snan, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_i (fpclassify, pseudo_unnormal, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
   };
 #endif
 
@@ -53,7 +53,7 @@  fpclassify_test (void)
 {
   ALL_RM_TEST (fpclassify, 1, fpclassify_test_data, RUN_TEST_LOOP_f_i_tg, END);
 #if TEST_COND_intel96
-  ALL_RM_TEST (fpclassify, 1, fpclassify_test_data_u, RUN_TEST_LOOP_f_i_tg_u, END);
+  ALL_RM_TEST (fpclassify, 1, fpclassify_test_data_u, RUN_TEST_LOOP_j_i_tg_u, END);
 #endif
 }
 
diff --git a/math/libm-test-isinf.inc b/math/libm-test-isinf.inc
index 7d4b27a45c..7eeb33c211 100644
--- a/math/libm-test-isinf.inc
+++ b/math/libm-test-isinf.inc
@@ -38,13 +38,13 @@  static const struct test_f_i_data isinf_test_data[] =
   };
 
 #if TEST_COND_intel96
-static const struct test_f_i_data_u isinf_test_data_u[] =
+static const struct test_j_i_data_u isinf_test_data_u[] =
   {
-    TEST_f_b (isinf, pseudo_zero, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (isinf, pseudo_inf, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (isinf, pseudo_qnan, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (isinf, pseudo_snan, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (isinf, pseudo_unnormal, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isinf, pseudo_zero, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isinf, pseudo_inf, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isinf, pseudo_qnan, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isinf, pseudo_snan, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isinf, pseudo_unnormal, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
   };
 #endif
 
@@ -53,7 +53,7 @@  isinf_test (void)
 {
   ALL_RM_TEST (isinf, 1, isinf_test_data, RUN_TEST_LOOP_f_b_tg, END);
 #if TEST_COND_intel96
-  ALL_RM_TEST (isinf, 1, isinf_test_data_u, RUN_TEST_LOOP_f_b_tg_u, END);
+  ALL_RM_TEST (isinf, 1, isinf_test_data_u, RUN_TEST_LOOP_j_b_tg_u, END);
 #endif
 }
 
diff --git a/math/libm-test-isnan.inc b/math/libm-test-isnan.inc
index 501bb1856f..c78143da37 100644
--- a/math/libm-test-isnan.inc
+++ b/math/libm-test-isnan.inc
@@ -38,13 +38,13 @@  static const struct test_f_i_data isnan_test_data[] =
   };
 
 #if TEST_COND_intel96
-static const struct test_f_i_data_u isnan_test_data_u[] =
+static const struct test_j_i_data_u isnan_test_data_u[] =
   {
-    TEST_f_b (isnan, pseudo_zero, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (isnan, pseudo_inf, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (isnan, pseudo_qnan, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (isnan, pseudo_snan, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (isnan, pseudo_unnormal, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isnan, pseudo_zero, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isnan, pseudo_inf, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isnan, pseudo_qnan, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isnan, pseudo_snan, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (isnan, pseudo_unnormal, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
   };
 #endif
 
@@ -53,7 +53,7 @@  isnan_test (void)
 {
   ALL_RM_TEST (isnan, 1, isnan_test_data, RUN_TEST_LOOP_f_b_tg, END);
 #if TEST_COND_intel96
-  ALL_RM_TEST (isnan, 1, isnan_test_data_u, RUN_TEST_LOOP_f_b_tg_u, END);
+  ALL_RM_TEST (isnan, 1, isnan_test_data_u, RUN_TEST_LOOP_j_b_tg_u, END);
 #endif
 }
 
diff --git a/math/libm-test-issignaling.inc b/math/libm-test-issignaling.inc
index bea61a3664..3e27474f77 100644
--- a/math/libm-test-issignaling.inc
+++ b/math/libm-test-issignaling.inc
@@ -40,13 +40,13 @@  static const struct test_f_i_data issignaling_test_data[] =
   };
 
 #if TEST_COND_intel96
-static const struct test_f_i_data_u issignaling_test_data_u[] =
+static const struct test_j_i_data_u issignaling_test_data_u[] =
   {
-    TEST_f_b (issignaling, pseudo_zero, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (issignaling, pseudo_inf, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (issignaling, pseudo_qnan, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (issignaling, pseudo_snan, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
-    TEST_f_b (issignaling, pseudo_unnormal, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (issignaling, pseudo_zero, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (issignaling, pseudo_inf, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (issignaling, pseudo_qnan, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (issignaling, pseudo_snan, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_j_b (issignaling, pseudo_unnormal, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
   };
 #endif
 
@@ -55,7 +55,7 @@  issignaling_test (void)
 {
   ALL_RM_TEST (issignaling, 1, issignaling_test_data, RUN_TEST_LOOP_f_b_tg, END);
 #if TEST_COND_intel96
-  ALL_RM_TEST (issignaling, 1, issignaling_test_data_u, RUN_TEST_LOOP_f_b_tg_u, END);
+  ALL_RM_TEST (issignaling, 1, issignaling_test_data_u, RUN_TEST_LOOP_j_b_tg_u, END);
 #endif
 }