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