From e962c07c0c8bb18f9a5969cbf1ddb01d0fe4f55c Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Fri, 30 May 2014 11:34:23 +0100 Subject: [PATCH] isfinite, isinf, isnan tests: fix for little-endian PowerPC * tests/test-isfinite.c (test_isfinitel): Only manipulate the first double of a PowerPC "double double" pair. * tests/test-isinf.c (test_isinfl): Likewise. * tests/test-isnan.c (test_long_double): Likewise. * tests/test-isnanl.h (main): Likewise. * tests/test-signbit.c (test_signbitl): Likewise. --- ChangeLog | 10 ++++++++++ tests/test-isfinite.c | 9 +++++++++ tests/test-isinf.c | 9 +++++++++ tests/test-isnan.c | 9 +++++++++ tests/test-isnanl.h | 9 +++++++++ tests/test-signbit.c | 10 ++++++++++ 6 files changed, 56 insertions(+) diff --git a/ChangeLog b/ChangeLog index 33ffe6e410..13ea1a8c5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2014-05-30 Ulrich Weigand + + isfinite, isinf, isnan tests: fix for little-endian PowerPC + * tests/test-isfinite.c (test_isfinitel): Only manipulate the + first double of a PowerPC "double double" pair. + * tests/test-isinf.c (test_isinfl): Likewise. + * tests/test-isnan.c (test_long_double): Likewise. + * tests/test-isnanl.h (main): Likewise. + * tests/test-signbit.c (test_signbitl): Likewise. + 2014-05-29 Paul Eggert exclude-tests: port to AIX 7.1 diff --git a/tests/test-isfinite.c b/tests/test-isfinite.c index fa2904ac7a..5d320eafe8 100644 --- a/tests/test-isfinite.c +++ b/tests/test-isfinite.c @@ -152,6 +152,15 @@ test_isfinitel () /* A bit pattern that is different from a Quiet NaN. With a bit of luck, it's a Signalling NaN. */ { +#if defined __powerpc__ && LDBL_MANT_DIG == 106 + /* This is PowerPC "double double", a pair of two doubles. Inf and Nan are + represented as the corresponding 64-bit IEEE values in the first double; + the second is ignored. Manipulate only the first double. */ + #undef NWORDS + #define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +#endif + memory_long_double m; m.value = zerol / zerol; # if LDBL_EXPBIT0_BIT > 0 diff --git a/tests/test-isinf.c b/tests/test-isinf.c index 0a13224e05..2505c32018 100644 --- a/tests/test-isinf.c +++ b/tests/test-isinf.c @@ -158,6 +158,15 @@ test_isinfl () /* A bit pattern that is different from a Quiet NaN. With a bit of luck, it's a Signalling NaN. */ { +#if defined __powerpc__ && LDBL_MANT_DIG == 106 + /* This is PowerPC "double double", a pair of two doubles. Inf and Nan are + represented as the corresponding 64-bit IEEE values in the first double; + the second is ignored. Manipulate only the first double. */ + #undef NWORDS + #define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +#endif + memory_long_double m; m.value = zerol / zerol; # if LDBL_EXPBIT0_BIT > 0 diff --git a/tests/test-isnan.c b/tests/test-isnan.c index e54b654012..9cb5e072ad 100644 --- a/tests/test-isnan.c +++ b/tests/test-isnan.c @@ -139,6 +139,15 @@ test_long_double (void) /* A bit pattern that is different from a Quiet NaN. With a bit of luck, it's a Signalling NaN. */ { +#if defined __powerpc__ && LDBL_MANT_DIG == 106 + /* This is PowerPC "double double", a pair of two doubles. Inf and Nan are + represented as the corresponding 64-bit IEEE values in the first double; + the second is ignored. Manipulate only the first double. */ + #undef NWORDSL + #define NWORDSL \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +#endif + memory_long_double m; m.value = NaNl (); # if LDBL_EXPBIT0_BIT > 0 diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h index eaf5da1084..015b086497 100644 --- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -51,6 +51,15 @@ main () /* A bit pattern that is different from a Quiet NaN. With a bit of luck, it's a Signalling NaN. */ { +#if defined __powerpc__ && LDBL_MANT_DIG == 106 + /* This is PowerPC "double double", a pair of two doubles. Inf and Nan are + represented as the corresponding 64-bit IEEE values in the first double; + the second is ignored. Manipulate only the first double. */ + #undef NWORDS + #define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +#endif + memory_long_double m; m.value = NaNl (); # if LDBL_EXPBIT0_BIT > 0 diff --git a/tests/test-signbit.c b/tests/test-signbit.c index d3ebbd6ec5..584bf4f91d 100644 --- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -151,6 +151,16 @@ test_signbitl () #define NWORDS \ ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) typedef union { long double value; unsigned int word[NWORDS]; } memory_long_double; + +#if defined __powerpc__ && LDBL_MANT_DIG == 106 + /* This is PowerPC "double double", a pair of two doubles. Inf and Nan are + represented as the corresponding 64-bit IEEE values in the first double; + the second is ignored. Manipulate only the first double. */ + #undef NWORDS + #define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +#endif + memory_long_double m; m.value = zerol / zerol; # if LDBL_EXPBIT0_BIT > 0 -- 2.39.5