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