497cbe
From de69fd334b77ec578c2232574fc76222808148b0 Mon Sep 17 00:00:00 2001
497cbe
From: Ulrich Weigand <uweigand@de.ibm.com>
497cbe
Date: Fri, 30 May 2014 11:34:23 +0100
497cbe
Subject: [PATCH] isfinite, isinf, isnan tests: fix for little-endian PowerPC
497cbe
497cbe
* tests/test-isfinite.c (test_isfinitel): Only manipulate the
497cbe
first double of a PowerPC "double double" pair.
497cbe
* tests/test-isinf.c (test_isinfl): Likewise.
497cbe
* tests/test-isnan.c (test_long_double): Likewise.
497cbe
* tests/test-isnanl.h (main): Likewise.
497cbe
* tests/test-signbit.c (test_signbitl): Likewise.
497cbe
497cbe
[upstream commit e962c07c0c8bb18f9a5969cbf1ddb01d0fe4f55c]
497cbe
497cbe
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
497cbe
---
497cbe
 tests/test-isfinite.c | 9 +++++++++
497cbe
 tests/test-isinf.c    | 9 +++++++++
497cbe
 tests/test-isnanl.h   | 9 +++++++++
497cbe
 3 files changed, 27 insertions(+)
497cbe
497cbe
diff --git a/tests/test-isfinite.c b/tests/test-isfinite.c
497cbe
index 828cd69..8e88b67 100644
497cbe
--- a/tests/test-isfinite.c
497cbe
+++ b/tests/test-isfinite.c
497cbe
@@ -152,6 +152,15 @@ test_isfinitel ()
497cbe
   /* A bit pattern that is different from a Quiet NaN.  With a bit of luck,
497cbe
      it's a Signalling NaN.  */
497cbe
   {
497cbe
+#if defined __powerpc__ && LDBL_MANT_DIG == 106
497cbe
+    /* This is PowerPC "double double", a pair of two doubles.  Inf and Nan are
497cbe
+       represented as the corresponding 64-bit IEEE values in the first double;
497cbe
+       the second is ignored.  Manipulate only the first double.  */
497cbe
+    #undef NWORDS
497cbe
+    #define NWORDS \
497cbe
+      ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
497cbe
+#endif
497cbe
+
497cbe
     memory_long_double m;
497cbe
     m.value = zerol / zerol;
497cbe
 # if LDBL_EXPBIT0_BIT > 0
497cbe
diff --git a/tests/test-isinf.c b/tests/test-isinf.c
497cbe
index 253f341..76c132e 100644
497cbe
--- a/tests/test-isinf.c
497cbe
+++ b/tests/test-isinf.c
497cbe
@@ -158,6 +158,15 @@ test_isinfl ()
497cbe
   /* A bit pattern that is different from a Quiet NaN.  With a bit of luck,
497cbe
      it's a Signalling NaN.  */
497cbe
   {
497cbe
+#if defined __powerpc__ && LDBL_MANT_DIG == 106
497cbe
+    /* This is PowerPC "double double", a pair of two doubles.  Inf and Nan are
497cbe
+       represented as the corresponding 64-bit IEEE values in the first double;
497cbe
+       the second is ignored.  Manipulate only the first double.  */
497cbe
+    #undef NWORDS
497cbe
+    #define NWORDS \
497cbe
+      ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
497cbe
+#endif
497cbe
+
497cbe
     memory_long_double m;
497cbe
     m.value = zerol / zerol;
497cbe
 # if LDBL_EXPBIT0_BIT > 0
497cbe
diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h
497cbe
index 8a9e684..bf81630 100644
497cbe
--- a/tests/test-isnanl.h
497cbe
+++ b/tests/test-isnanl.h
497cbe
@@ -51,6 +51,15 @@ main ()
497cbe
   /* A bit pattern that is different from a Quiet NaN.  With a bit of luck,
497cbe
      it's a Signalling NaN.  */
497cbe
   {
497cbe
+#if defined __powerpc__ && LDBL_MANT_DIG == 106
497cbe
+    /* This is PowerPC "double double", a pair of two doubles.  Inf and Nan are
497cbe
+       represented as the corresponding 64-bit IEEE values in the first double;
497cbe
+       the second is ignored.  Manipulate only the first double.  */
497cbe
+    #undef NWORDS
497cbe
+    #define NWORDS \
497cbe
+      ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
497cbe
+#endif
497cbe
+
497cbe
     memory_long_double m;
497cbe
     m.value = NaNl ();
497cbe
 # if LDBL_EXPBIT0_BIT > 0
497cbe
-- 
497cbe
1.9.3
497cbe