5de29b
# commit 9605ca6c085a749f29b6866a3e00bce1ba1a2698
5de29b
# Author: Alan Modra <amodra@gmail.com>
5de29b
# Date:   Sat Aug 17 18:12:56 2013 +0930
5de29b
# 
5de29b
#     IBM long double mechanical changes to support little-endian
5de29b
#     http://sourceware.org/ml/libc-alpha/2013-07/msg00001.html
5de29b
#     
5de29b
#     This patch starts the process of supporting powerpc64 little-endian
5de29b
#     long double in glibc.  IBM long double is an array of two ieee
5de29b
#     doubles, so making union ibm_extended_long_double reflect this fact is
5de29b
#     the correct way to access fields of the doubles.
5de29b
#     
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/ieee754.h
5de29b
#         (union ibm_extended_long_double): Define as an array of ieee754_double.
5de29b
#         (IBM_EXTENDED_LONG_DOUBLE_BIAS): Delete.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Update all references
5de29b
#         to ibm_extended_long_double and IBM_EXTENDED_LONG_DOUBLE_BIAS.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/e_exp10l.c: Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c: Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/strtold_l.c: Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
5de29b
# 
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c	2014-05-26 21:08:10.000000000 -0500
5de29b
@@ -36,9 +36,9 @@
5de29b
   else if (arg > LDBL_MAX_10_EXP + 1)
5de29b
     return LDBL_MAX * LDBL_MAX;
5de29b
 
5de29b
-  u.d = arg;
5de29b
-  arg_high = u.dd[0];
5de29b
-  arg_low = u.dd[1];
5de29b
+  u.ld = arg;
5de29b
+  arg_high = u.d[0].d;
5de29b
+  arg_low = u.d[1].d;
5de29b
   exp_high = arg_high * log10_high;
5de29b
   exp_low = arg_high * log10_low + arg_low * M_LN10l;
5de29b
   return __ieee754_expl (exp_high) * __ieee754_expl (exp_low);
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c	2014-05-26 21:08:10.000000000 -0500
5de29b
@@ -162,39 +162,39 @@
5de29b
       x = x + xl;
5de29b
 
5de29b
       /* Compute ex2 = 2^n_0 e^(argtable[tval1]) e^(argtable[tval2]).  */
5de29b
-      ex2_u.d = __expl_table[T_EXPL_RES1 + tval1]
5de29b
-		* __expl_table[T_EXPL_RES2 + tval2];
5de29b
+      ex2_u.ld = (__expl_table[T_EXPL_RES1 + tval1]
5de29b
+		  * __expl_table[T_EXPL_RES2 + tval2]);
5de29b
       n_i = (int)n;
5de29b
       /* 'unsafe' is 1 iff n_1 != 0.  */
5de29b
       unsafe = fabsl(n_i) >= -LDBL_MIN_EXP - 1;
5de29b
-      ex2_u.ieee.exponent += n_i >> unsafe;
5de29b
+      ex2_u.d[0].ieee.exponent += n_i >> unsafe;
5de29b
       /* Fortunately, there are no subnormal lowpart doubles in
5de29b
 	 __expl_table, only normal values and zeros.
5de29b
 	 But after scaling it can be subnormal.  */
5de29b
-      exponent2 = ex2_u.ieee.exponent2 + (n_i >> unsafe);
5de29b
-      if (ex2_u.ieee.exponent2 == 0)
5de29b
-	/* assert ((ex2_u.ieee.mantissa2|ex2_u.ieee.mantissa3) == 0) */;
5de29b
+      exponent2 = ex2_u.d[1].ieee.exponent + (n_i >> unsafe);
5de29b
+      if (ex2_u.d[1].ieee.exponent == 0)
5de29b
+	/* assert ((ex2_u.d[1].ieee.mantissa0|ex2_u.d[1].ieee.mantissa1) == 0) */;
5de29b
       else if (exponent2 > 0)
5de29b
-	ex2_u.ieee.exponent2 = exponent2;
5de29b
+	ex2_u.d[1].ieee.exponent = exponent2;
5de29b
       else if (exponent2 <= -54)
5de29b
 	{
5de29b
-	  ex2_u.ieee.exponent2 = 0;
5de29b
-	  ex2_u.ieee.mantissa2 = 0;
5de29b
-	  ex2_u.ieee.mantissa3 = 0;
5de29b
+	  ex2_u.d[1].ieee.exponent = 0;
5de29b
+	  ex2_u.d[1].ieee.mantissa0 = 0;
5de29b
+	  ex2_u.d[1].ieee.mantissa1 = 0;
5de29b
 	}
5de29b
       else
5de29b
 	{
5de29b
 	  static const double
5de29b
 	    two54 = 1.80143985094819840000e+16, /* 4350000000000000 */
5de29b
 	    twom54 = 5.55111512312578270212e-17; /* 3C90000000000000 */
5de29b
-	  ex2_u.dd[1] *= two54;
5de29b
-	  ex2_u.ieee.exponent2 += n_i >> unsafe;
5de29b
-	  ex2_u.dd[1] *= twom54;
5de29b
+	  ex2_u.d[1].d *= two54;
5de29b
+	  ex2_u.d[1].ieee.exponent += n_i >> unsafe;
5de29b
+	  ex2_u.d[1].d *= twom54;
5de29b
 	}
5de29b
 
5de29b
       /* Compute scale = 2^n_1.  */
5de29b
-      scale_u.d = 1.0L;
5de29b
-      scale_u.ieee.exponent += n_i - (n_i >> unsafe);
5de29b
+      scale_u.ld = 1.0L;
5de29b
+      scale_u.d[0].ieee.exponent += n_i - (n_i >> unsafe);
5de29b
 
5de29b
       /* Approximate e^x2 - 1, using a seventh-degree polynomial,
5de29b
 	 with maximum error in [-2^-16-2^-53,2^-16+2^-53]
5de29b
@@ -204,7 +204,7 @@
5de29b
       /* Return result.  */
5de29b
       fesetenv (&oldenv);
5de29b
 
5de29b
-      result = x22 * ex2_u.d + ex2_u.d;
5de29b
+      result = x22 * ex2_u.ld + ex2_u.ld;
5de29b
 
5de29b
       /* Now we can test whether the result is ultimate or if we are unsure.
5de29b
 	 In the later case we should probably call a mpn based routine to give
5de29b
@@ -238,7 +238,7 @@
5de29b
       if (!unsafe)
5de29b
 	return result;
5de29b
       else
5de29b
-	return result * scale_u.d;
5de29b
+	return result * scale_u.ld;
5de29b
     }
5de29b
   /* Exceptional cases:  */
5de29b
   else if (isless (x, himark))
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h	2014-05-26 21:08:10.000000000 -0500
5de29b
@@ -180,29 +180,9 @@
5de29b
 
5de29b
 union ibm_extended_long_double
5de29b
   {
5de29b
-    long double d;
5de29b
-    double dd[2];
5de29b
-
5de29b
-    /* This is the IBM extended format long double.  */
5de29b
-    struct
5de29b
-      { /* Big endian.  There is no other.  */
5de29b
-
5de29b
-	unsigned int negative:1;
5de29b
-	unsigned int exponent:11;
5de29b
-	/* Together Mantissa0-3 comprise the mantissa.  */
5de29b
-	unsigned int mantissa0:20;
5de29b
-	unsigned int mantissa1:32;
5de29b
-
5de29b
-	unsigned int negative2:1;
5de29b
-	unsigned int exponent2:11;
5de29b
-	/* There is an implied 1 here?  */
5de29b
-	/* Together these comprise the mantissa.  */
5de29b
-	unsigned int mantissa2:20;
5de29b
-	unsigned int mantissa3:32;
5de29b
-      } ieee;
5de29b
-   };
5de29b
-
5de29b
-#define IBM_EXTENDED_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent.  */
5de29b
+    long double ld;
5de29b
+    union ieee754_double d[2];
5de29b
+  };
5de29b
 
5de29b
 __END_DECLS
5de29b
 
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c	2014-05-26 21:08:10.000000000 -0500
5de29b
@@ -36,22 +36,22 @@
5de29b
   union ibm_extended_long_double u;
5de29b
   unsigned long long hi, lo;
5de29b
   int ediff;
5de29b
-  u.d = value;
5de29b
+  u.ld = value;
5de29b
 
5de29b
-  *is_neg = u.ieee.negative;
5de29b
-  *expt = (int) u.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
5de29b
+  *is_neg = u.d[0].ieee.negative;
5de29b
+  *expt = (int) u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS;
5de29b
 
5de29b
-  lo = ((long long) u.ieee.mantissa2 << 32) | u.ieee.mantissa3;
5de29b
-  hi = ((long long) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
5de29b
+  lo = ((long long) u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;
5de29b
+  hi = ((long long) u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1;
5de29b
   /* If the lower double is not a denomal or zero then set the hidden
5de29b
      53rd bit.  */
5de29b
-  if (u.ieee.exponent2 > 0)
5de29b
+  if (u.d[1].ieee.exponent > 0)
5de29b
     {
5de29b
       lo |= 1LL << 52;
5de29b
 
5de29b
       /* The lower double is normalized separately from the upper.  We may
5de29b
 	 need to adjust the lower manitissa to reflect this.  */
5de29b
-      ediff = u.ieee.exponent - u.ieee.exponent2;
5de29b
+      ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent;
5de29b
       if (ediff > 53)
5de29b
 	lo = lo >> (ediff-53);
5de29b
     }
5de29b
@@ -59,8 +59,8 @@
5de29b
      difference between the long double and the rounded high double
5de29b
      value.  This is indicated by a differnce between the signs of the
5de29b
      high and low doubles.  */
5de29b
-  if ((u.ieee.negative != u.ieee.negative2)
5de29b
-      && ((u.ieee.exponent2 != 0) && (lo != 0L)))
5de29b
+  if ((u.d[0].ieee.negative != u.d[1].ieee.negative)
5de29b
+      && ((u.d[1].ieee.exponent != 0) && (lo != 0L)))
5de29b
     {
5de29b
       lo = (1ULL << 53) - lo;
5de29b
       if (hi == 0LL)
5de29b
@@ -92,7 +92,7 @@
5de29b
 #define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \
5de29b
 			   - (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB)))
5de29b
 
5de29b
-  if (u.ieee.exponent == 0)
5de29b
+  if (u.d[0].ieee.exponent == 0)
5de29b
     {
5de29b
       /* A biased exponent of zero is a special case.
5de29b
 	 Either it is a zero or it is a denormal number.  */
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h	2014-05-26 21:08:10.000000000 -0500
5de29b
@@ -14,28 +14,28 @@
5de29b
      as bit 53 of the mantissa.  */
5de29b
   uint64_t hi, lo;
5de29b
   int ediff;
5de29b
-  union ibm_extended_long_double eldbl;
5de29b
-  eldbl.d = x;
5de29b
-  *exp = eldbl.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
5de29b
+  union ibm_extended_long_double u;
5de29b
+  u.ld = x;
5de29b
+  *exp = u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS;
5de29b
 
5de29b
-  lo = ((int64_t)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
5de29b
-  hi = ((int64_t)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
5de29b
+  lo = ((uint64_t)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;
5de29b
+  hi = ((uint64_t)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1;
5de29b
   /* If the lower double is not a denomal or zero then set the hidden
5de29b
      53rd bit.  */
5de29b
-  if (eldbl.ieee.exponent2 > 0x001)
5de29b
+  if (u.d[1].ieee.exponent > 0x001)
5de29b
     {
5de29b
       lo |= (1ULL << 52);
5de29b
       lo = lo << 7; /* pre-shift lo to match ieee854.  */
5de29b
       /* The lower double is normalized separately from the upper.  We
5de29b
 	 may need to adjust the lower manitissa to reflect this.  */
5de29b
-      ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;
5de29b
+      ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent;
5de29b
       if (ediff > 53)
5de29b
 	lo = lo >> (ediff-53);
5de29b
       hi |= (1ULL << 52);
5de29b
     }
5de29b
   
5de29b
-  if ((eldbl.ieee.negative != eldbl.ieee.negative2)
5de29b
-      && ((eldbl.ieee.exponent2 != 0) && (lo != 0LL)))
5de29b
+  if ((u.d[0].ieee.negative != u.d[1].ieee.negative)
5de29b
+      && ((u.d[1].ieee.exponent != 0) && (lo != 0LL)))
5de29b
     {
5de29b
       hi--;
5de29b
       lo = (1ULL << 60) - lo;
5de29b
@@ -58,10 +58,10 @@
5de29b
   unsigned long hidden2, lzcount;
5de29b
   unsigned long long hi, lo;
5de29b
 
5de29b
-  u.ieee.negative = sign;
5de29b
-  u.ieee.negative2 = sign;
5de29b
-  u.ieee.exponent = exp + IBM_EXTENDED_LONG_DOUBLE_BIAS;
5de29b
-  u.ieee.exponent2 = exp-53 + IBM_EXTENDED_LONG_DOUBLE_BIAS;
5de29b
+  u.d[0].ieee.negative = sign;
5de29b
+  u.d[1].ieee.negative = sign;
5de29b
+  u.d[0].ieee.exponent = exp + IEEE754_DOUBLE_BIAS;
5de29b
+  u.d[1].ieee.exponent = exp-53 + IEEE754_DOUBLE_BIAS;
5de29b
   /* Expect 113 bits (112 bits + hidden) right justified in two longs.
5de29b
      The low order 53 bits (52 + hidden) go into the lower double */ 
5de29b
   lo = (lo64 >> 7)& ((1ULL << 53) - 1);
5de29b
@@ -78,7 +78,7 @@
5de29b
       if (hidden2)
5de29b
 	{
5de29b
 	  hi++;
5de29b
-	  u.ieee.negative2 = !sign;
5de29b
+	  u.d[1].ieee.negative = !sign;
5de29b
 	  lo = (1ULL << 53) - lo;
5de29b
 	}
5de29b
       /* The hidden bit of the lo mantissa is zero so we need to
5de29b
@@ -94,32 +94,32 @@
5de29b
       lzcount = lzcount - 11;
5de29b
       if (lzcount > 0)
5de29b
 	{
5de29b
-	  int expnt2 = u.ieee.exponent2 - lzcount;
5de29b
+	  int expnt2 = u.d[1].ieee.exponent - lzcount;
5de29b
 	  if (expnt2 >= 1)
5de29b
 	    {
5de29b
 	      /* Not denormal.  Normalize and set low exponent.  */
5de29b
 	      lo = lo << lzcount;
5de29b
-	      u.ieee.exponent2 = expnt2;
5de29b
+	      u.d[1].ieee.exponent = expnt2;
5de29b
 	    }
5de29b
 	  else
5de29b
 	    {
5de29b
 	      /* Is denormal.  */
5de29b
 	      lo = lo << (lzcount + expnt2);
5de29b
-	      u.ieee.exponent2 = 0;
5de29b
+	      u.d[1].ieee.exponent = 0;
5de29b
 	    }
5de29b
 	}
5de29b
     }
5de29b
   else
5de29b
     {
5de29b
-      u.ieee.negative2 = 0;
5de29b
-      u.ieee.exponent2 = 0;
5de29b
+      u.d[1].ieee.negative = 0;
5de29b
+      u.d[1].ieee.exponent = 0;
5de29b
     }
5de29b
 
5de29b
-  u.ieee.mantissa3 = lo & ((1ULL << 32) - 1);
5de29b
-  u.ieee.mantissa2 = (lo >> 32) & ((1ULL << 20) - 1);
5de29b
-  u.ieee.mantissa1 = hi & ((1ULL << 32) - 1);
5de29b
-  u.ieee.mantissa0 = (hi >> 32) & ((1ULL << 20) - 1);
5de29b
-  return u.d;
5de29b
+  u.d[1].ieee.mantissa1 = lo & ((1ULL << 32) - 1);
5de29b
+  u.d[1].ieee.mantissa0 = (lo >> 32) & ((1ULL << 20) - 1);
5de29b
+  u.d[0].ieee.mantissa1 = hi & ((1ULL << 32) - 1);
5de29b
+  u.d[0].ieee.mantissa0 = (hi >> 32) & ((1ULL << 20) - 1);
5de29b
+  return u.ld;
5de29b
 }
5de29b
   
5de29b
 /* Handy utility functions to pack/unpack/cononicalize and find the nearbyint
5de29b
@@ -128,18 +128,18 @@
5de29b
 default_ldbl_pack (double a, double aa)
5de29b
 {
5de29b
   union ibm_extended_long_double u;
5de29b
-  u.dd[0] = a;
5de29b
-  u.dd[1] = aa;
5de29b
-  return u.d;
5de29b
+  u.d[0].d = a;
5de29b
+  u.d[1].d = aa;
5de29b
+  return u.ld;
5de29b
 }
5de29b
 
5de29b
 static inline void
5de29b
 default_ldbl_unpack (long double l, double *a, double *aa)
5de29b
 {
5de29b
   union ibm_extended_long_double u;
5de29b
-  u.d = l;
5de29b
-  *a = u.dd[0];
5de29b
-  *aa = u.dd[1];
5de29b
+  u.ld = l;
5de29b
+  *a = u.d[0].d;
5de29b
+  *aa = u.d[1].d;
5de29b
 }
5de29b
 
5de29b
 #ifndef ldbl_pack
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c	2014-05-26 21:08:10.000000000 -0500
5de29b
@@ -34,11 +34,11 @@
5de29b
   unsigned long long hi, lo;
5de29b
   int exponent2;
5de29b
 
5de29b
-  u.ieee.negative = sign;
5de29b
-  u.ieee.negative2 = sign;
5de29b
-  u.ieee.exponent = expt + IBM_EXTENDED_LONG_DOUBLE_BIAS;
5de29b
-  u.ieee.exponent2 = 0;
5de29b
-  exponent2 = expt - 53 + IBM_EXTENDED_LONG_DOUBLE_BIAS;
5de29b
+  u.d[0].ieee.negative = sign;
5de29b
+  u.d[1].ieee.negative = sign;
5de29b
+  u.d[0].ieee.exponent = expt + IEEE754_DOUBLE_BIAS;
5de29b
+  u.d[1].ieee.exponent = 0;
5de29b
+  exponent2 = expt - 53 + IEEE754_DOUBLE_BIAS;
5de29b
 
5de29b
 #if BITS_PER_MP_LIMB == 32
5de29b
   /* The low order 53 bits (52 + hidden) go into the lower double */
5de29b
@@ -74,15 +74,15 @@
5de29b
       else
5de29b
 	lzcount = lzcount + 42;
5de29b
 
5de29b
-      if (lzcount > u.ieee.exponent)
5de29b
+      if (lzcount > u.d[0].ieee.exponent)
5de29b
 	{
5de29b
-	  lzcount = u.ieee.exponent;
5de29b
-	  u.ieee.exponent = 0;
5de29b
+	  lzcount = u.d[0].ieee.exponent;
5de29b
+	  u.d[0].ieee.exponent = 0;
5de29b
 	  exponent2 -= lzcount;
5de29b
 	}
5de29b
       else
5de29b
 	{
5de29b
-	  u.ieee.exponent -= (lzcount - 1);
5de29b
+	  u.d[0].ieee.exponent -= (lzcount - 1);
5de29b
 	  exponent2 -= (lzcount - 1);
5de29b
 	}
5de29b
 
5de29b
@@ -112,9 +112,9 @@
5de29b
 	    {
5de29b
 	      if ((hi & (1LL << 53)) != 0)
5de29b
 		hi -= 1LL << 52;
5de29b
-	      u.ieee.exponent++;
5de29b
+	      u.d[0].ieee.exponent++;
5de29b
 	    }
5de29b
-	  u.ieee.negative2 = !sign;
5de29b
+	  u.d[1].ieee.negative = !sign;
5de29b
 	  lo = (1LL << 53) - lo;
5de29b
 	}
5de29b
 
5de29b
@@ -135,17 +135,17 @@
5de29b
 	  exponent2 = exponent2 - lzcount;
5de29b
 	}
5de29b
       if (exponent2 > 0)
5de29b
-	u.ieee.exponent2 = exponent2;
5de29b
+	u.d[1].ieee.exponent = exponent2;
5de29b
       else
5de29b
 	lo >>= 1 - exponent2;
5de29b
     }
5de29b
   else
5de29b
-    u.ieee.negative2 = 0;
5de29b
+    u.d[1].ieee.negative = 0;
5de29b
 
5de29b
-  u.ieee.mantissa3 = lo & 0xffffffffLL;
5de29b
-  u.ieee.mantissa2 = (lo >> 32) & 0xfffff;
5de29b
-  u.ieee.mantissa1 = hi & 0xffffffffLL;
5de29b
-  u.ieee.mantissa0 = (hi >> 32) & ((1LL << (LDBL_MANT_DIG - 86)) - 1);
5de29b
+  u.d[1].ieee.mantissa1 = lo & 0xffffffffLL;
5de29b
+  u.d[1].ieee.mantissa0 = (lo >> 32) & 0xfffff;
5de29b
+  u.d[0].ieee.mantissa1 = hi & 0xffffffffLL;
5de29b
+  u.d[0].ieee.mantissa0 = (hi >> 32) & ((1LL << (LDBL_MANT_DIG - 86)) - 1);
5de29b
 
5de29b
-  return u.d;
5de29b
+  return u.ld;
5de29b
 }
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c	2014-05-26 21:08:10.000000000 -0500
5de29b
@@ -27,31 +27,31 @@
5de29b
       unsigned long long int num0, num1;				      \
5de29b
       unsigned long long hi, lo;					      \
5de29b
       int ediff;							      \
5de29b
-      union ibm_extended_long_double eldbl;				      \
5de29b
-      eldbl.d = fpnum.ldbl.d;						      \
5de29b
+      union ibm_extended_long_double u;					      \
5de29b
+      u.ld = fpnum.ldbl.d;						      \
5de29b
 									      \
5de29b
       assert (sizeof (long double) == 16);				      \
5de29b
 									      \
5de29b
-      lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;    \
5de29b
-      hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;    \
5de29b
+      lo = ((long long)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;  \
5de29b
+      hi = ((long long)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1;  \
5de29b
       lo <<= 7; /* pre-shift lo to match ieee854.  */			      \
5de29b
       /* If the lower double is not a denomal or zero then set the hidden     \
5de29b
 	 53rd bit.  */							      \
5de29b
-      if (eldbl.ieee.exponent2 != 0)					      \
5de29b
+      if (u.d[1].ieee.exponent != 0)					      \
5de29b
 	lo |= (1ULL << (52 + 7));					      \
5de29b
       else								      \
5de29b
 	lo <<= 1;							      \
5de29b
       /* The lower double is normalized separately from the upper.  We	      \
5de29b
 	 may need to adjust the lower manitissa to reflect this.  */	      \
5de29b
-      ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;		      \
5de29b
+      ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent;		      \
5de29b
       if (ediff > 53 + 63)						      \
5de29b
 	lo = 0;								      \
5de29b
       else if (ediff > 53)						      \
5de29b
 	lo = lo >> (ediff - 53);					      \
5de29b
-      else if (eldbl.ieee.exponent2 == 0 && ediff < 53)			      \
5de29b
+      else if (u.d[1].ieee.exponent == 0 && ediff < 53)			      \
5de29b
 	lo = lo << (53 - ediff);					      \
5de29b
-      if (eldbl.ieee.negative != eldbl.ieee.negative2			      \
5de29b
-	  && (eldbl.ieee.exponent2 != 0 || lo != 0L))			      \
5de29b
+      if (u.d[0].ieee.negative != u.d[1].ieee.negative			      \
5de29b
+	  && (u.d[1].ieee.exponent != 0 || lo != 0L))			      \
5de29b
 	{								      \
5de29b
 	  lo = (1ULL << 60) - lo;					      \
5de29b
 	  if (hi == 0L)							      \
5de29b
@@ -59,7 +59,7 @@
5de29b
 	      /* we have a borrow from the hidden bit, so shift left 1.  */   \
5de29b
 	      hi = 0xffffffffffffeLL | (lo >> 59);			      \
5de29b
 	      lo = 0xfffffffffffffffLL & (lo << 1);			      \
5de29b
-	      eldbl.ieee.exponent--;					      \
5de29b
+	      u.d[0].ieee.exponent--;					      \
5de29b
 	    }								      \
5de29b
 	  else								      \
5de29b
 	    hi--;							      \
5de29b
@@ -110,9 +110,9 @@
5de29b
 	  *--wnumstr = L'0';						      \
5de29b
 	}								      \
5de29b
 									      \
5de29b
-      leading = eldbl.ieee.exponent == 0 ? '0' : '1';			      \
5de29b
+      leading = u.d[0].ieee.exponent == 0 ? '0' : '1';			      \
5de29b
 									      \
5de29b
-      exponent = eldbl.ieee.exponent;					      \
5de29b
+      exponent = u.d[0].ieee.exponent;					      \
5de29b
 									      \
5de29b
       if (exponent == 0)						      \
5de29b
 	{								      \
5de29b
@@ -122,18 +122,18 @@
5de29b
 	    {								      \
5de29b
 	      /* This is a denormalized number.  */			      \
5de29b
 	      expnegative = 1;						      \
5de29b
-	      exponent = IBM_EXTENDED_LONG_DOUBLE_BIAS - 1;		      \
5de29b
+	      exponent = IEEE754_DOUBLE_BIAS - 1;			      \
5de29b
 	    }								      \
5de29b
 	}								      \
5de29b
-      else if (exponent >= IBM_EXTENDED_LONG_DOUBLE_BIAS)		      \
5de29b
+      else if (exponent >= IEEE754_DOUBLE_BIAS)				      \
5de29b
 	{								      \
5de29b
 	  expnegative = 0;						      \
5de29b
-	  exponent -= IBM_EXTENDED_LONG_DOUBLE_BIAS;			      \
5de29b
+	  exponent -= IEEE754_DOUBLE_BIAS;				      \
5de29b
 	}								      \
5de29b
       else								      \
5de29b
 	{								      \
5de29b
 	  expnegative = 1;						      \
5de29b
-	  exponent = -(exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS);	      \
5de29b
+	  exponent = -(exponent - IEEE754_DOUBLE_BIAS);			      \
5de29b
 	}								      \
5de29b
 } while (0)
5de29b
 
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c	2014-05-26 21:08:10.000000000 -0500
5de29b
@@ -33,11 +33,11 @@
5de29b
   fenv_t env;
5de29b
   static const long double TWO52 = 4503599627370496.0L;
5de29b
   union ibm_extended_long_double u;
5de29b
-  u.d = x;
5de29b
+  u.ld = x;
5de29b
 
5de29b
-  if (fabs (u.dd[0]) < TWO52)
5de29b
+  if (fabs (u.d[0].d) < TWO52)
5de29b
     {
5de29b
-      double high = u.dd[0];
5de29b
+      double high = u.d[0].d;
5de29b
       feholdexcept (&env;;
5de29b
       if (high > 0.0)
5de29b
 	{
5de29b
@@ -51,11 +51,11 @@
5de29b
 	  high += TWO52;
5de29b
           if (high == 0.0) high = -0.0;
5de29b
 	}
5de29b
-      u.dd[0] = high;
5de29b
-      u.dd[1] = 0.0;
5de29b
+      u.d[0].d = high;
5de29b
+      u.d[1].d = 0.0;
5de29b
       fesetenv (&env;;
5de29b
     }
5de29b
-  else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
5de29b
+  else if (fabs (u.d[1].d) < TWO52 && u.d[1].d != 0.0)
5de29b
     {
5de29b
       double high, low, tau;
5de29b
       /* In this case we have to round the low double and handle any
5de29b
@@ -64,55 +64,55 @@
5de29b
          may already be rounded and the low double may have the
5de29b
          opposite sign to compensate.  */
5de29b
       feholdexcept (&env;;
5de29b
-      if (u.dd[0] > 0.0)
5de29b
+      if (u.d[0].d > 0.0)
5de29b
 	{
5de29b
-	  if (u.dd[1] > 0.0)
5de29b
+	  if (u.d[1].d > 0.0)
5de29b
 	    {
5de29b
 	      /* If the high/low doubles are the same sign then simply
5de29b
 	         round the low double.  */
5de29b
-	      high = u.dd[0];
5de29b
-	      low = u.dd[1];
5de29b
+	      high = u.d[0].d;
5de29b
+	      low = u.d[1].d;
5de29b
 	    }
5de29b
-	  else if (u.dd[1] < 0.0)
5de29b
+	  else if (u.d[1].d < 0.0)
5de29b
 	    {
5de29b
 	      /* Else the high double is pre rounded and we need to
5de29b
 	         adjust for that.  */
5de29b
 
5de29b
-	      tau = __nextafter (u.dd[0], 0.0);
5de29b
-	      tau = (u.dd[0] - tau) * 2.0;
5de29b
-	      high = u.dd[0] - tau;
5de29b
-	      low = u.dd[1] + tau;
5de29b
+	      tau = __nextafter (u.d[0].d, 0.0);
5de29b
+	      tau = (u.d[0].d - tau) * 2.0;
5de29b
+	      high = u.d[0].d - tau;
5de29b
+	      low = u.d[1].d + tau;
5de29b
 	    }
5de29b
 	  low += TWO52;
5de29b
 	  low -= TWO52;
5de29b
 	}
5de29b
-      else if (u.dd[0] < 0.0)
5de29b
+      else if (u.d[0].d < 0.0)
5de29b
 	{
5de29b
-	  if (u.dd[1] < 0.0)
5de29b
+	  if (u.d[1].d < 0.0)
5de29b
 	    {
5de29b
 	      /* If the high/low doubles are the same sign then simply
5de29b
 	         round the low double.  */
5de29b
-	      high = u.dd[0];
5de29b
-	      low = u.dd[1];
5de29b
+	      high = u.d[0].d;
5de29b
+	      low = u.d[1].d;
5de29b
 	    }
5de29b
-	  else if (u.dd[1] > 0.0)
5de29b
+	  else if (u.d[1].d > 0.0)
5de29b
 	    {
5de29b
 	      /* Else the high double is pre rounded and we need to
5de29b
 	         adjust for that.  */
5de29b
-	      tau = __nextafter (u.dd[0], 0.0);
5de29b
-	      tau = (u.dd[0] - tau) * 2.0;
5de29b
-	      high = u.dd[0] - tau;
5de29b
-	      low = u.dd[1] + tau;
5de29b
+	      tau = __nextafter (u.d[0].d, 0.0);
5de29b
+	      tau = (u.d[0].d - tau) * 2.0;
5de29b
+	      high = u.d[0].d - tau;
5de29b
+	      low = u.d[1].d + tau;
5de29b
 	    }
5de29b
 	  low = TWO52 - low;
5de29b
 	  low = -(low - TWO52);
5de29b
 	}
5de29b
-      u.dd[0] = high + low;
5de29b
-      u.dd[1] = high - u.dd[0] + low;
5de29b
+      u.d[0].d = high + low;
5de29b
+      u.d[1].d = high - u.d[0].d + low;
5de29b
       fesetenv (&env;;
5de29b
     }
5de29b
 
5de29b
-  return u.d;
5de29b
+  return u.ld;
5de29b
 }
5de29b
 
5de29b
 long_double_symbol (libm, __nearbyintl, nearbyintl);
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/strtold_l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/strtold_l.c	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/strtold_l.c	2014-05-26 21:12:01.000000000 -0500
5de29b
@@ -43,12 +43,11 @@
5de29b
 #define FLOAT_HUGE_VAL	HUGE_VALL
5de29b
 # define SET_MANTISSA(flt, mant) \
5de29b
   do { union ibm_extended_long_double u;				      \
5de29b
-       u.d = (flt);							      \
5de29b
-       if ((mant & 0xfffffffffffffULL) == 0)				      \
5de29b
-	 mant = 0x8000000000000ULL;					      \
5de29b
-       u.ieee.mantissa0 = ((mant) >> 32) & 0xfffff;			      \
5de29b
-       u.ieee.mantissa1 = (mant) & 0xffffffff;				      \
5de29b
-       (flt) = u.d;							      \
5de29b
+       u.ld = (flt);							      \
5de29b
+       u.d[0].ieee_nan.mantissa0 = (mant) >> 32;				      \
5de29b
+       u.d[0].ieee_nan.mantissa1 = (mant);				   	      \
5de29b
+       if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0)	      \
5de29b
+         (flt) = u.ld;							      \
5de29b
   } while (0)
5de29b
 
5de29b
 #include <strtod_l.c>
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c	2014-05-26 21:08:01.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c	2014-05-26 21:08:10.000000000 -0500
5de29b
@@ -89,23 +89,23 @@
5de29b
   double vals[12];
5de29b
   SET_RESTORE_ROUND (FE_TONEAREST);
5de29b
   union ibm_extended_long_double xu, yu;
5de29b
-  xu.d = x;
5de29b
-  yu.d = y;
5de29b
-  if (fabs (xu.dd[1]) < 0x1p-500)
5de29b
-    xu.dd[1] = 0.0;
5de29b
-  if (fabs (yu.dd[1]) < 0x1p-500)
5de29b
-    yu.dd[1] = 0.0;
5de29b
-  mul_split (&vals[1], &vals[0], xu.dd[0], xu.dd[0]);
5de29b
-  mul_split (&vals[3], &vals[2], xu.dd[0], xu.dd[1]);
5de29b
+  xu.ld = x;
5de29b
+  yu.ld = y;
5de29b
+  if (fabs (xu.d[1].d) < 0x1p-500)
5de29b
+    xu.d[1].d = 0.0;
5de29b
+  if (fabs (yu.d[1].d) < 0x1p-500)
5de29b
+    yu.d[1].d = 0.0;
5de29b
+  mul_split (&vals[1], &vals[0], xu.d[0].d, xu.d[0].d);
5de29b
+  mul_split (&vals[3], &vals[2], xu.d[0].d, xu.d[1].d);
5de29b
   vals[2] *= 2.0;
5de29b
   vals[3] *= 2.0;
5de29b
-  mul_split (&vals[5], &vals[4], xu.dd[1], xu.dd[1]);
5de29b
-  mul_split (&vals[7], &vals[6], yu.dd[0], yu.dd[0]);
5de29b
-  mul_split (&vals[9], &vals[8], yu.dd[0], yu.dd[1]);
5de29b
+  mul_split (&vals[5], &vals[4], xu.d[1].d, xu.d[1].d);
5de29b
+  mul_split (&vals[7], &vals[6], yu.d[0].d, yu.d[0].d);
5de29b
+  mul_split (&vals[9], &vals[8], yu.d[0].d, yu.d[1].d);
5de29b
   vals[8] *= 2.0;
5de29b
   vals[9] *= 2.0;
5de29b
-  mul_split (&vals[11], &vals[10], yu.dd[1], yu.dd[1]);
5de29b
-  if (xu.dd[0] >= 0.75)
5de29b
+  mul_split (&vals[11], &vals[10], yu.d[1].d, yu.d[1].d);
5de29b
+  if (xu.d[0].d >= 0.75)
5de29b
     vals[1] -= 1.0;
5de29b
   else
5de29b
     {