5de29b
# commit 765714cafcad7e6168518c61111f07bd955a9fee
5de29b
# Author: Alan Modra <amodra@gmail.com>
5de29b
# Date:   Sat Aug 17 18:24:58 2013 +0930
5de29b
# 
5de29b
#     PowerPC floating point little-endian [3 of 15]
5de29b
#     http://sourceware.org/ml/libc-alpha/2013-08/msg00083.html
5de29b
#     
5de29b
#     Further replacement of ieee854 macros and unions.  These files also
5de29b
#     have some optimisations for comparison against 0.0L, infinity and nan.
5de29b
#     Since the ABI specifies that the high double of an IBM long double
5de29b
#     pair is the value rounded to double, a high double of 0.0 means the
5de29b
#     low double must also be 0.0.  The ABI also says that infinity and
5de29b
#     nan are encoded in the high double, with the low double unspecified.
5de29b
#     This means that tests for 0.0L, +/-Infinity and +/-NaN need only check
5de29b
#     the high double.
5de29b
#     
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/e_atan2l.c (__ieee754_atan2l): Rewrite
5de29b
#         all uses of ieee854 long double macros and unions.  Simplify tests
5de29b
#         for long doubles that are fully specified by the high double.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r):
5de29b
#         Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c (__ieee754_ilogbl): Likewise.
5de29b
#         Remove dead code too.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
5de29b
#         (__ieee754_ynl): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/e_log10l.c (__ieee754_log10l): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/e_logl.c (__ieee754_logl): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Likewise.
5de29b
#         Remove dead code too.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/k_tanl.c (__kernel_tanl): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (__expm1l): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_frexpl.c (__frexpl): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c (__isinf_nsl): Likewise.
5de29b
#         Simplify.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_isinfl.c (___isinfl): Likewise.
5de29b
#         Simplify.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_modfl.c (__modfl): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Likewise.
5de29b
#         Comment on variable precision.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf):
5de29b
#         Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c (__scalblnl): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c (__scalbnl): Likewise.
5de29b
#         * sysdeps/ieee754/ldbl-128ibm/s_tanhl.c (__tanhl): Likewise.
5de29b
#         * sysdeps/powerpc/fpu/libm-test-ulps: Adjust tan_towardzero ulps.
5de29b
# 
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -56,11 +56,15 @@
5de29b
 {
5de29b
 	long double z;
5de29b
 	int64_t k,m,hx,hy,ix,iy;
5de29b
-	u_int64_t lx,ly;
5de29b
+	uint64_t lx;
5de29b
+	double xhi, xlo, yhi;
5de29b
 
5de29b
-	GET_LDOUBLE_WORDS64(hx,lx,x);
5de29b
+	ldbl_unpack (x, &xhi, &xlo;;
5de29b
+	EXTRACT_WORDS64 (hx, xhi);
5de29b
+	EXTRACT_WORDS64 (lx, xlo);
5de29b
 	ix = hx&0x7fffffffffffffffLL;
5de29b
-	GET_LDOUBLE_WORDS64(hy,ly,y);
5de29b
+	yhi = ldbl_high (y);
5de29b
+	EXTRACT_WORDS64 (hy, yhi);
5de29b
 	iy = hy&0x7fffffffffffffffLL;
5de29b
 	if(((ix)>0x7ff0000000000000LL)||
5de29b
 	   ((iy)>0x7ff0000000000000LL))	/* x or y is NaN */
5de29b
@@ -70,7 +74,7 @@
5de29b
 	m = ((hy>>63)&1)|((hx>>62)&2;;	/* 2*sign(x)+sign(y) */
5de29b
 
5de29b
     /* when y = 0 */
5de29b
-	if((iy|(ly&0x7fffffffffffffffLL))==0) {
5de29b
+	if(iy==0) {
5de29b
 	    switch(m) {
5de29b
 		case 0:
5de29b
 		case 1: return y;	/* atan(+-0,+anything)=+-0 */
5de29b
@@ -79,7 +83,7 @@
5de29b
 	    }
5de29b
 	}
5de29b
     /* when x = 0 */
5de29b
-	if((ix|(lx&0x7fffffffffffffff))==0) return (hy<0)?  -pi_o_2-tiny: pi_o_2+tiny;
5de29b
+	if(ix==0) return (hy<0)?  -pi_o_2-tiny: pi_o_2+tiny;
5de29b
 
5de29b
     /* when x is INF */
5de29b
 	if(ix==0x7ff0000000000000LL) {
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -29,11 +29,12 @@
5de29b
      and the exp function.  But due to the required boundary
5de29b
      conditions we must check some values separately.  */
5de29b
   int64_t hx;
5de29b
-  u_int64_t lx;
5de29b
+  double xhi;
5de29b
 
5de29b
-  GET_LDOUBLE_WORDS64 (hx, lx, x);
5de29b
+  xhi = ldbl_high (x);
5de29b
+  EXTRACT_WORDS64 (hx, xhi);
5de29b
 
5de29b
-  if (((hx | lx) & 0x7fffffffffffffffLL) == 0)
5de29b
+  if ((hx & 0x7fffffffffffffffLL) == 0)
5de29b
     {
5de29b
       /* Return value for x == 0 is Inf with divide by zero exception.  */
5de29b
       *signgamp = 0;
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -31,26 +31,24 @@
5de29b
 
5de29b
 int __ieee754_ilogbl(long double x)
5de29b
 {
5de29b
-	int64_t hx,lx;
5de29b
+	int64_t hx;
5de29b
 	int ix;
5de29b
+	double xhi;
5de29b
 
5de29b
-	GET_LDOUBLE_WORDS64(hx,lx,x);
5de29b
+	xhi = ldbl_high (x);
5de29b
+	EXTRACT_WORDS64 (hx, xhi);
5de29b
 	hx &= 0x7fffffffffffffffLL;
5de29b
 	if(hx <= 0x0010000000000000LL) {
5de29b
-	    if((hx|(lx&0x7fffffffffffffffLL))==0)
5de29b
+	    if(hx==0)
5de29b
 		return FP_ILOGB0;	/* ilogbl(0) = FP_ILOGB0 */
5de29b
 	    else			/* subnormal x */
5de29b
-		if(hx==0) {
5de29b
-		    for (ix = -1043; lx>0; lx<<=1) ix -=1;
5de29b
-		} else {
5de29b
-		    for (ix = -1022, hx<<=11; hx>0; hx<<=1) ix -=1;
5de29b
-		}
5de29b
+		for (ix = -1022, hx<<=11; hx>0; hx<<=1) ix -=1;
5de29b
 	    return ix;
5de29b
 	}
5de29b
 	else if (hx<0x7ff0000000000000LL) return (hx>>52)-0x3ff;
5de29b
 	else if (FP_ILOGBNAN != INT_MAX) {
5de29b
 	    /* ISO C99 requires ilogbl(+-Inf) == INT_MAX.  */
5de29b
-	    if (((hx^0x7ff0000000000000LL)|lx) == 0)
5de29b
+	    if (hx==0x7ff0000000000000LL)
5de29b
 		return INT_MAX;
5de29b
 	}
5de29b
 	return FP_ILOGBNAN;
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_jnl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_jnl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_jnl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -70,26 +70,25 @@
5de29b
 long double
5de29b
 __ieee754_jnl (int n, long double x)
5de29b
 {
5de29b
-  u_int32_t se;
5de29b
+  uint32_t se, lx;
5de29b
   int32_t i, ix, sgn;
5de29b
   long double a, b, temp, di;
5de29b
   long double z, w;
5de29b
-  ieee854_long_double_shape_type u;
5de29b
+  double xhi;
5de29b
 
5de29b
 
5de29b
   /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
5de29b
    * Thus, J(-n,x) = J(n,-x)
5de29b
    */
5de29b
 
5de29b
-  u.value = x;
5de29b
-  se = u.parts32.w0;
5de29b
+  xhi = ldbl_high (x);
5de29b
+  EXTRACT_WORDS (se, lx, xhi);
5de29b
   ix = se & 0x7fffffff;
5de29b
 
5de29b
   /* if J(n,NaN) is NaN */
5de29b
   if (ix >= 0x7ff00000)
5de29b
     {
5de29b
-      if ((u.parts32.w0 & 0xfffff) | u.parts32.w1
5de29b
-	  | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3)
5de29b
+      if (((ix - 0x7ff00000) | lx) != 0)
5de29b
 	return x + x;
5de29b
     }
5de29b
 
5de29b
@@ -298,21 +297,20 @@
5de29b
 long double
5de29b
 __ieee754_ynl (int n, long double x)
5de29b
 {
5de29b
-  u_int32_t se;
5de29b
+  uint32_t se, lx;
5de29b
   int32_t i, ix;
5de29b
   int32_t sign;
5de29b
   long double a, b, temp;
5de29b
-  ieee854_long_double_shape_type u;
5de29b
+  double xhi;
5de29b
 
5de29b
-  u.value = x;
5de29b
-  se = u.parts32.w0;
5de29b
+  xhi = ldbl_high (x);
5de29b
+  EXTRACT_WORDS (se, lx, xhi);
5de29b
   ix = se & 0x7fffffff;
5de29b
 
5de29b
   /* if Y(n,NaN) is NaN */
5de29b
   if (ix >= 0x7ff00000)
5de29b
     {
5de29b
-      if ((u.parts32.w0 & 0xfffff) | u.parts32.w1
5de29b
-	  | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3)
5de29b
+      if (((ix - 0x7ff00000) | lx) != 0)
5de29b
 	return x + x;
5de29b
     }
5de29b
   if (x <= 0.0L)
5de29b
@@ -377,14 +375,16 @@
5de29b
       a = __ieee754_y0l (x);
5de29b
       b = __ieee754_y1l (x);
5de29b
       /* quit if b is -inf */
5de29b
-      u.value = b;
5de29b
-      se = u.parts32.w0 & 0xfff00000;
5de29b
+      xhi = ldbl_high (b);
5de29b
+      GET_HIGH_WORD (se, xhi);
5de29b
+      se &= 0xfff00000;
5de29b
       for (i = 1; i < n && se != 0xfff00000; i++)
5de29b
 	{
5de29b
 	  temp = b;
5de29b
 	  b = ((long double) (i + i) / x) * b - a;
5de29b
-	  u.value = b;
5de29b
-	  se = u.parts32.w0 & 0xfff00000;
5de29b
+	  xhi = ldbl_high (b);
5de29b
+	  GET_HIGH_WORD (se, xhi);
5de29b
+	  se &= 0xfff00000;
5de29b
 	  a = temp;
5de29b
 	}
5de29b
     }
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_log10l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_log10l.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_log10l.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -182,11 +182,13 @@
5de29b
   long double z;
5de29b
   long double y;
5de29b
   int e;
5de29b
-  int64_t hx, lx;
5de29b
+  int64_t hx;
5de29b
+  double xhi;
5de29b
 
5de29b
 /* Test for domain */
5de29b
-  GET_LDOUBLE_WORDS64 (hx, lx, x);
5de29b
-  if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
5de29b
+  xhi = ldbl_high (x);
5de29b
+  EXTRACT_WORDS64 (hx, xhi);
5de29b
+  if ((hx & 0x7fffffffffffffffLL) == 0)
5de29b
     return (-1.0L / (x - x));
5de29b
   if (hx < 0)
5de29b
     return (x - x) / (x - x);
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_logl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_logl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_logl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_logl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -185,18 +185,20 @@
5de29b
 long double
5de29b
 __ieee754_logl(long double x)
5de29b
 {
5de29b
-  long double z, y, w;
5de29b
-  ieee854_long_double_shape_type u, t;
5de29b
+  long double z, y, w, t;
5de29b
   unsigned int m;
5de29b
   int k, e;
5de29b
+  double xhi;
5de29b
+  uint32_t hx, lx;
5de29b
 
5de29b
-  u.value = x;
5de29b
-  m = u.parts32.w0;
5de29b
+  xhi = ldbl_high (x);
5de29b
+  EXTRACT_WORDS (hx, lx, xhi);
5de29b
+  m = hx;
5de29b
 
5de29b
   /* Check for IEEE special cases.  */
5de29b
   k = m & 0x7fffffff;
5de29b
   /* log(0) = -infinity. */
5de29b
-  if ((k | u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
5de29b
+  if ((k | lx) == 0)
5de29b
     {
5de29b
       return -0.5L / ZERO;
5de29b
     }
5de29b
@@ -216,7 +218,7 @@
5de29b
     {
5de29b
       z = x - 1.0L;
5de29b
       k = 64;
5de29b
-      t.value  = 1.0L;
5de29b
+      t = 1.0L;
5de29b
       e = 0;
5de29b
     }
5de29b
   else
5de29b
@@ -233,10 +235,8 @@
5de29b
 	  k = (m - 0xff000) >> 13;
5de29b
 	  /* t is the argument 0.5 + (k+26)/128
5de29b
 	     of the nearest item to u in the lookup table.  */
5de29b
-	  t.parts32.w0 = 0x3ff00000 + (k << 13);
5de29b
-	  t.parts32.w1 = 0;
5de29b
-	  t.parts32.w2 = 0;
5de29b
-	  t.parts32.w3 = 0;
5de29b
+	  INSERT_WORDS (xhi, 0x3ff00000 + (k << 13), 0);
5de29b
+	  t = xhi;
5de29b
 	  w0 += 0x100000;
5de29b
 	  e -= 1;
5de29b
 	  k += 64;
5de29b
@@ -244,17 +244,15 @@
5de29b
       else
5de29b
 	{
5de29b
 	  k = (m - 0xfe000) >> 14;
5de29b
-	  t.parts32.w0 = 0x3fe00000 + (k << 14);
5de29b
-	  t.parts32.w1 = 0;
5de29b
-	  t.parts32.w2 = 0;
5de29b
-	  t.parts32.w3 = 0;
5de29b
+	  INSERT_WORDS (xhi, 0x3fe00000 + (k << 14), 0);
5de29b
+	  t = xhi;
5de29b
 	}
5de29b
-      u.value = __scalbnl (u.value, ((int) ((w0 - u.parts32.w0) * 2)) >> 21);
5de29b
+      x = __scalbnl (x, ((int) ((w0 - hx) * 2)) >> 21);
5de29b
       /* log(u) = log( t u/t ) = log(t) + log(u/t)
5de29b
 	 log(t) is tabulated in the lookup table.
5de29b
 	 Express log(u/t) = log(1+z),  where z = u/t - 1 = (u-t)/t.
5de29b
 	 cf. Cody & Waite. */
5de29b
-      z = (u.value - t.value) / t.value;
5de29b
+      z = (x - t) / t;
5de29b
     }
5de29b
   /* Series expansion of log(1+z).  */
5de29b
   w = z * z;
5de29b
@@ -275,7 +273,7 @@
5de29b
   y += e * ln2b;  /* Base 2 exponent offset times ln(2).  */
5de29b
   y += z;
5de29b
   y += logtbl[k-26]; /* log(t) - (t-1) */
5de29b
-  y += (t.value - 1.0L);
5de29b
+  y += (t - 1.0L);
5de29b
   y += e * ln2a;
5de29b
   return y;
5de29b
 }
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_powl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_powl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_powl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_powl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -151,37 +151,32 @@
5de29b
   long double y1, t1, t2, r, s, t, u, v, w;
5de29b
   long double s2, s_h, s_l, t_h, t_l, ay;
5de29b
   int32_t i, j, k, yisint, n;
5de29b
-  u_int32_t ix, iy;
5de29b
-  int32_t hx, hy;
5de29b
-  ieee854_long_double_shape_type o, p, q;
5de29b
+  uint32_t ix, iy;
5de29b
+  int32_t hx, hy, hax;
5de29b
+  double ohi, xhi, xlo, yhi, ylo;
5de29b
+  uint32_t lx, ly, lj;
5de29b
 
5de29b
-  p.value = x;
5de29b
-  hx = p.parts32.w0;
5de29b
+  ldbl_unpack (x, &xhi, &xlo;;
5de29b
+  EXTRACT_WORDS (hx, lx, xhi);
5de29b
   ix = hx & 0x7fffffff;
5de29b
 
5de29b
-  q.value = y;
5de29b
-  hy = q.parts32.w0;
5de29b
+  ldbl_unpack (y, &yhi, &ylo);
5de29b
+  EXTRACT_WORDS (hy, ly, yhi);
5de29b
   iy = hy & 0x7fffffff;
5de29b
 
5de29b
-
5de29b
   /* y==zero: x**0 = 1 */
5de29b
-  if ((iy | q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
5de29b
+  if ((iy | ly) == 0)
5de29b
     return one;
5de29b
 
5de29b
   /* 1.0**y = 1; -1.0**+-Inf = 1 */
5de29b
   if (x == one)
5de29b
     return one;
5de29b
-  if (x == -1.0L && iy == 0x7ff00000
5de29b
-      && (q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
5de29b
+  if (x == -1.0L && ((iy - 0x7ff00000) | ly) == 0)
5de29b
     return one;
5de29b
 
5de29b
   /* +-NaN return x+y */
5de29b
-  if ((ix > 0x7ff00000)
5de29b
-      || ((ix == 0x7ff00000)
5de29b
-	  && ((p.parts32.w1 | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) != 0))
5de29b
-      || (iy > 0x7ff00000)
5de29b
-      || ((iy == 0x7ff00000)
5de29b
-	  && ((q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) != 0)))
5de29b
+  if ((ix >= 0x7ff00000 && ((ix - 0x7ff00000) | lx) != 0)
5de29b
+      || (iy >= 0x7ff00000 && ((iy - 0x7ff00000) | ly) != 0))
5de29b
     return x + y;
5de29b
 
5de29b
   /* determine if y is an odd int when x < 0
5de29b
@@ -192,7 +187,10 @@
5de29b
   yisint = 0;
5de29b
   if (hx < 0)
5de29b
     {
5de29b
-      if ((q.parts32.w2 & 0x7fffffff) >= 0x43400000)	/* Low part >= 2^53 */
5de29b
+      uint32_t low_ye;
5de29b
+
5de29b
+      GET_HIGH_WORD (low_ye, ylo);
5de29b
+      if ((low_ye & 0x7fffffff) >= 0x43400000)	/* Low part >= 2^53 */
5de29b
 	yisint = 2;		/* even integer y */
5de29b
       else if (iy >= 0x3ff00000)	/* 1.0 */
5de29b
 	{
5de29b
@@ -207,42 +205,43 @@
5de29b
 	}
5de29b
     }
5de29b
 
5de29b
+  ax = fabsl (x);
5de29b
+
5de29b
   /* special value of y */
5de29b
-  if ((q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
5de29b
+  if (ly == 0)
5de29b
     {
5de29b
-      if (iy == 0x7ff00000 && q.parts32.w1 == 0)	/* y is +-inf */
5de29b
+      if (iy == 0x7ff00000)	/* y is +-inf */
5de29b
 	{
5de29b
-	  if (((ix - 0x3ff00000) | p.parts32.w1
5de29b
-	       | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) == 0)
5de29b
-	    return y - y;	/* inf**+-1 is NaN */
5de29b
-	  else if (ix > 0x3ff00000 || fabsl (x) > 1.0L)
5de29b
+	  if (ax > one)
5de29b
 	    /* (|x|>1)**+-inf = inf,0 */
5de29b
 	    return (hy >= 0) ? y : zero;
5de29b
 	  else
5de29b
 	    /* (|x|<1)**-,+inf = inf,0 */
5de29b
 	    return (hy < 0) ? -y : zero;
5de29b
 	}
5de29b
-      if (iy == 0x3ff00000)
5de29b
-	{			/* y is  +-1 */
5de29b
-	  if (hy < 0)
5de29b
-	    return one / x;
5de29b
-	  else
5de29b
-	    return x;
5de29b
-	}
5de29b
-      if (hy == 0x40000000)
5de29b
-	return x * x;		/* y is  2 */
5de29b
-      if (hy == 0x3fe00000)
5de29b
-	{			/* y is  0.5 */
5de29b
-	  if (hx >= 0)		/* x >= +0 */
5de29b
-	    return __ieee754_sqrtl (x);
5de29b
+      if (ylo == 0.0)
5de29b
+	{
5de29b
+	  if (iy == 0x3ff00000)
5de29b
+	    {			/* y is  +-1 */
5de29b
+	      if (hy < 0)
5de29b
+		return one / x;
5de29b
+	      else
5de29b
+		return x;
5de29b
+	    }
5de29b
+	  if (hy == 0x40000000)
5de29b
+	    return x * x;		/* y is  2 */
5de29b
+	  if (hy == 0x3fe00000)
5de29b
+	    {			/* y is  0.5 */
5de29b
+	      if (hx >= 0)		/* x >= +0 */
5de29b
+		return __ieee754_sqrtl (x);
5de29b
+	    }
5de29b
 	}
5de29b
     }
5de29b
 
5de29b
-  ax = fabsl (x);
5de29b
   /* special value of x */
5de29b
-  if ((p.parts32.w1 | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) == 0)
5de29b
+  if (lx == 0)
5de29b
     {
5de29b
-      if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000)
5de29b
+      if (ix == 0x7ff00000 || ix == 0 || (ix == 0x3ff00000 && xlo == 0.0))
5de29b
 	{
5de29b
 	  z = ax;		/*x is +-0,+-inf,+-1 */
5de29b
 	  if (hy < 0)
5de29b
@@ -294,8 +293,8 @@
5de29b
     {
5de29b
       ax *= two113;
5de29b
       n -= 113;
5de29b
-      o.value = ax;
5de29b
-      ix = o.parts32.w0;
5de29b
+      ohi = ldbl_high (ax);
5de29b
+      GET_HIGH_WORD (ix, ohi);
5de29b
     }
5de29b
   n += ((ix) >> 20) - 0x3ff;
5de29b
   j = ix & 0x000fffff;
5de29b
@@ -312,26 +311,19 @@
5de29b
       ix -= 0x00100000;
5de29b
     }
5de29b
 
5de29b
-  o.value = ax;
5de29b
-  o.value = __scalbnl (o.value, ((int) ((ix - o.parts32.w0) * 2)) >> 21);
5de29b
-  ax = o.value;
5de29b
+  ohi = ldbl_high (ax);
5de29b
+  GET_HIGH_WORD (hax, ohi);
5de29b
+  ax = __scalbnl (ax, ((int) ((ix - hax) * 2)) >> 21);
5de29b
 
5de29b
   /* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
5de29b
   u = ax - bp[k];		/* bp[0]=1.0, bp[1]=1.5 */
5de29b
   v = one / (ax + bp[k]);
5de29b
   s = u * v;
5de29b
-  s_h = s;
5de29b
+  s_h = ldbl_high (s);
5de29b
 
5de29b
-  o.value = s_h;
5de29b
-  o.parts32.w3 = 0;
5de29b
-  o.parts32.w2 = 0;
5de29b
-  s_h = o.value;
5de29b
   /* t_h=ax+bp[k] High */
5de29b
   t_h = ax + bp[k];
5de29b
-  o.value = t_h;
5de29b
-  o.parts32.w3 = 0;
5de29b
-  o.parts32.w2 = 0;
5de29b
-  t_h = o.value;
5de29b
+  t_h = ldbl_high (t_h);
5de29b
   t_l = ax - (t_h - bp[k]);
5de29b
   s_l = v * ((u - s_h * t_h) - s_h * t_l);
5de29b
   /* compute log(ax) */
5de29b
@@ -342,30 +334,21 @@
5de29b
   r += s_l * (s_h + s);
5de29b
   s2 = s_h * s_h;
5de29b
   t_h = 3.0 + s2 + r;
5de29b
-  o.value = t_h;
5de29b
-  o.parts32.w3 = 0;
5de29b
-  o.parts32.w2 = 0;
5de29b
-  t_h = o.value;
5de29b
+  t_h = ldbl_high (t_h);
5de29b
   t_l = r - ((t_h - 3.0) - s2);
5de29b
   /* u+v = s*(1+...) */
5de29b
   u = s_h * t_h;
5de29b
   v = s_l * t_h + t_l * s;
5de29b
   /* 2/(3log2)*(s+...) */
5de29b
   p_h = u + v;
5de29b
-  o.value = p_h;
5de29b
-  o.parts32.w3 = 0;
5de29b
-  o.parts32.w2 = 0;
5de29b
-  p_h = o.value;
5de29b
+  p_h = ldbl_high (p_h);
5de29b
   p_l = v - (p_h - u);
5de29b
   z_h = cp_h * p_h;		/* cp_h+cp_l = 2/(3*log2) */
5de29b
   z_l = cp_l * p_h + p_l * cp + dp_l[k];
5de29b
   /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */
5de29b
   t = (long double) n;
5de29b
   t1 = (((z_h + z_l) + dp_h[k]) + t);
5de29b
-  o.value = t1;
5de29b
-  o.parts32.w3 = 0;
5de29b
-  o.parts32.w2 = 0;
5de29b
-  t1 = o.value;
5de29b
+  t1 = ldbl_high (t1);
5de29b
   t2 = z_l - (((t1 - t) - dp_h[k]) - z_h);
5de29b
 
5de29b
   /* s (sign of result -ve**odd) = -1 else = 1 */
5de29b
@@ -374,21 +357,16 @@
5de29b
     s = -one;			/* (-ve)**(odd int) */
5de29b
 
5de29b
   /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
5de29b
-  y1 = y;
5de29b
-  o.value = y1;
5de29b
-  o.parts32.w3 = 0;
5de29b
-  o.parts32.w2 = 0;
5de29b
-  y1 = o.value;
5de29b
+  y1 = ldbl_high (y);
5de29b
   p_l = (y - y1) * t1 + y * t2;
5de29b
   p_h = y1 * t1;
5de29b
   z = p_l + p_h;
5de29b
-  o.value = z;
5de29b
-  j = o.parts32.w0;
5de29b
+  ohi = ldbl_high (z);
5de29b
+  EXTRACT_WORDS (j, lj, ohi);
5de29b
   if (j >= 0x40d00000) /* z >= 16384 */
5de29b
     {
5de29b
       /* if z > 16384 */
5de29b
-      if (((j - 0x40d00000) | o.parts32.w1
5de29b
-	| (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
5de29b
+      if (((j - 0x40d00000) | lj) != 0)
5de29b
 	return s * huge * huge;	/* overflow */
5de29b
       else
5de29b
 	{
5de29b
@@ -399,8 +377,7 @@
5de29b
   else if ((j & 0x7fffffff) >= 0x40d01b90)	/* z <= -16495 */
5de29b
     {
5de29b
       /* z < -16495 */
5de29b
-      if (((j - 0xc0d01bc0) | o.parts32.w1
5de29b
-	 | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
5de29b
+      if (((j - 0xc0d01bc0) | lj) != 0)
5de29b
 	return s * tiny * tiny;	/* underflow */
5de29b
       else
5de29b
 	{
5de29b
@@ -419,10 +396,7 @@
5de29b
       p_h -= t;
5de29b
     }
5de29b
   t = p_l + p_h;
5de29b
-  o.value = t;
5de29b
-  o.parts32.w3 = 0;
5de29b
-  o.parts32.w2 = 0;
5de29b
-  t = o.value;
5de29b
+  t = ldbl_high (t);
5de29b
   u = t * lg2_h;
5de29b
   v = (p_l - (t - p_h)) * lg2 + t * lg2_l;
5de29b
   z = u + v;
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_tanl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_tanl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_tanl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -85,17 +85,17 @@
5de29b
 __kernel_tanl (long double x, long double y, int iy)
5de29b
 {
5de29b
   long double z, r, v, w, s;
5de29b
-  int32_t ix, sign;
5de29b
-  ieee854_long_double_shape_type u, u1;
5de29b
+  int32_t ix, sign, hx, lx;
5de29b
+  double xhi;
5de29b
 
5de29b
-  u.value = x;
5de29b
-  ix = u.parts32.w0 & 0x7fffffff;
5de29b
+  xhi = ldbl_high (x);
5de29b
+  EXTRACT_WORDS (hx, lx, xhi);
5de29b
+  ix = hx & 0x7fffffff;
5de29b
   if (ix < 0x3c600000)		/* x < 2**-57 */
5de29b
     {
5de29b
-      if ((int) x == 0)
5de29b
-	{			/* generate inexact */
5de29b
-	  if ((ix | u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3
5de29b
-	       | (iy + 1)) == 0)
5de29b
+      if ((int) x == 0)		/* generate inexact */
5de29b
+	{
5de29b
+	  if ((ix | lx | (iy + 1)) == 0)
5de29b
 	    return one / fabs (x);
5de29b
 	  else
5de29b
 	    return (iy == 1) ? x : -one / x;
5de29b
@@ -103,7 +103,7 @@
5de29b
     }
5de29b
   if (ix >= 0x3fe59420) /* |x| >= 0.6743316650390625 */
5de29b
     {
5de29b
-      if ((u.parts32.w0 & 0x80000000) != 0)
5de29b
+      if ((hx & 0x80000000) != 0)
5de29b
 	{
5de29b
 	  x = -x;
5de29b
 	  y = -y;
5de29b
@@ -139,15 +139,13 @@
5de29b
     {				/* if allow error up to 2 ulp,
5de29b
 				   simply return -1.0/(x+r) here */
5de29b
       /*  compute -1.0/(x+r) accurately */
5de29b
-      u1.value = w;
5de29b
-      u1.parts32.w2 = 0;
5de29b
-      u1.parts32.w3 = 0;
5de29b
-      v = r - (u1.value - x);		/* u1+v = r+x */
5de29b
+      long double u1, z1;
5de29b
+
5de29b
+      u1 = ldbl_high (w);
5de29b
+      v = r - (u1 - x);		/* u1+v = r+x */
5de29b
       z = -1.0 / w;
5de29b
-      u.value = z;
5de29b
-      u.parts32.w2 = 0;
5de29b
-      u.parts32.w3 = 0;
5de29b
-      s = 1.0 + u.value * u1.value;
5de29b
-      return u.value + z * (s + u.value * v);
5de29b
+      z1 = ldbl_high (z);
5de29b
+      s = 1.0 + z1 * u1;
5de29b
+      return z1 + z * (s + z1 * v);
5de29b
     }
5de29b
 }
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -92,19 +92,19 @@
5de29b
 __expm1l (long double x)
5de29b
 {
5de29b
   long double px, qx, xx;
5de29b
-  int32_t ix, sign;
5de29b
-  ieee854_long_double_shape_type u;
5de29b
+  int32_t ix, lx, sign;
5de29b
   int k;
5de29b
+  double xhi;
5de29b
 
5de29b
   /* Detect infinity and NaN.  */
5de29b
-  u.value = x;
5de29b
-  ix = u.parts32.w0;
5de29b
+  xhi = ldbl_high (x);
5de29b
+  EXTRACT_WORDS (ix, lx, xhi);
5de29b
   sign = ix & 0x80000000;
5de29b
   ix &= 0x7fffffff;
5de29b
   if (ix >= 0x7ff00000)
5de29b
     {
5de29b
       /* Infinity. */
5de29b
-      if (((ix & 0xfffff) | u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
5de29b
+      if (((ix - 0x7ff00000) | lx) == 0)
5de29b
 	{
5de29b
 	  if (sign)
5de29b
 	    return -1.0L;
5de29b
@@ -116,7 +116,7 @@
5de29b
     }
5de29b
 
5de29b
   /* expm1(+- 0) = +- 0.  */
5de29b
-  if ((ix == 0) && (u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
5de29b
+  if ((ix | lx) == 0)
5de29b
     return x;
5de29b
 
5de29b
   /* Overflow.  */
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -36,16 +36,21 @@
5de29b
 
5de29b
 long double __frexpl(long double x, int *eptr)
5de29b
 {
5de29b
-	u_int64_t hx, lx, ix, ixl;
5de29b
+	uint64_t hx, lx, ix, ixl;
5de29b
 	int64_t explo;
5de29b
-	GET_LDOUBLE_WORDS64(hx,lx,x);
5de29b
+	double xhi, xlo;
5de29b
+
5de29b
+	ldbl_unpack (x, &xhi, &xlo;;
5de29b
+	EXTRACT_WORDS64 (hx, xhi);
5de29b
+	EXTRACT_WORDS64 (lx, xlo);
5de29b
 	ixl = 0x7fffffffffffffffULL&lx;
5de29b
 	ix =  0x7fffffffffffffffULL&hx;
5de29b
 	*eptr = 0;
5de29b
-	if(ix>=0x7ff0000000000000ULL||((ix|ixl)==0)) return x;	/* 0,inf,nan */
5de29b
+	if(ix>=0x7ff0000000000000ULL||ix==0) return x;	/* 0,inf,nan */
5de29b
 	if (ix<0x0010000000000000ULL) {		/* subnormal */
5de29b
 	    x *= two107;
5de29b
-	    GET_LDOUBLE_MSW64(hx,x);
5de29b
+	    xhi = ldbl_high (x);
5de29b
+	    EXTRACT_WORDS64 (hx, xhi);
5de29b
 	    ix = hx&0x7fffffffffffffffULL;
5de29b
 	    *eptr = -107;
5de29b
 	}
5de29b
@@ -54,7 +59,7 @@
5de29b
 	if (ixl != 0ULL) {
5de29b
 	  explo = (ixl>>52) - (ix>>52) + 0x3fe;
5de29b
 	  if ((ixl&0x7ff0000000000000ULL) == 0LL) {
5de29b
-	    /* the lower double is a denomal so we need to correct its
5de29b
+	    /* the lower double is a denormal so we need to correct its
5de29b
 	       mantissa and perhaps its exponent.  */
5de29b
 	    int cnt;
5de29b
 
5de29b
@@ -73,7 +78,9 @@
5de29b
 	  lx = 0ULL;
5de29b
 
5de29b
 	hx = (hx&0x800fffffffffffffULL) | 0x3fe0000000000000ULL;
5de29b
-	SET_LDOUBLE_WORDS64(x,hx,lx);
5de29b
+	INSERT_WORDS64 (xhi, hx);
5de29b
+	INSERT_WORDS64 (xlo, lx);
5de29b
+	x = ldbl_pack (xhi, xlo);
5de29b
 	return x;
5de29b
 }
5de29b
 #ifdef IS_IN_libm
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -1,6 +1,7 @@
5de29b
 /*
5de29b
  * __isinf_nsl(x) returns != 0 if x is ±inf, else 0;
5de29b
  * no branching!
5de29b
+ * slightly dodgy in relying on signed shift right copying sign bit
5de29b
  */
5de29b
 
5de29b
 #include <math.h>
5de29b
@@ -9,8 +10,14 @@
5de29b
 int
5de29b
 __isinf_nsl (long double x)
5de29b
 {
5de29b
-	int64_t hx,lx;
5de29b
-	GET_LDOUBLE_WORDS64(hx,lx,x);
5de29b
-	return !((lx & 0x7fffffffffffffffLL)
5de29b
-		 | ((hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL));
5de29b
+  double xhi;
5de29b
+  int64_t hx, mask;
5de29b
+
5de29b
+  xhi = ldbl_high (x);
5de29b
+  EXTRACT_WORDS64 (hx, xhi);
5de29b
+
5de29b
+  mask = (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL;
5de29b
+  mask |= -mask;
5de29b
+  mask >>= 63;
5de29b
+  return ~mask;
5de29b
 }
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -11,6 +11,7 @@
5de29b
 /*
5de29b
  * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
5de29b
  * no branching!
5de29b
+ * slightly dodgy in relying on signed shift right copying sign bit
5de29b
  */
5de29b
 
5de29b
 #include <math.h>
5de29b
@@ -20,12 +21,16 @@
5de29b
 int
5de29b
 ___isinfl (long double x)
5de29b
 {
5de29b
-	int64_t hx,lx;
5de29b
-	GET_LDOUBLE_WORDS64(hx,lx,x);
5de29b
-	lx = (lx & 0x7fffffffffffffffLL);
5de29b
-	lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL;
5de29b
-	lx |= -lx;
5de29b
-	return ~(lx >> 63) & (hx >> 62);
5de29b
+  double xhi;
5de29b
+  int64_t hx, mask;
5de29b
+
5de29b
+  xhi = ldbl_high (x);
5de29b
+  EXTRACT_WORDS64 (hx, xhi);
5de29b
+
5de29b
+  mask = (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL;
5de29b
+  mask |= -mask;
5de29b
+  mask >>= 63;
5de29b
+  return ~mask & (hx >> 62);
5de29b
 }
5de29b
 hidden_ver (___isinfl, __isinfl)
5de29b
 #ifndef IS_IN_libm
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -126,19 +126,18 @@
5de29b
 __log1pl (long double xm1)
5de29b
 {
5de29b
   long double x, y, z, r, s;
5de29b
-  ieee854_long_double_shape_type u;
5de29b
-  int32_t hx;
5de29b
+  double xhi;
5de29b
+  int32_t hx, lx;
5de29b
   int e;
5de29b
 
5de29b
   /* Test for NaN or infinity input. */
5de29b
-  u.value = xm1;
5de29b
-  hx = u.parts32.w0;
5de29b
+  xhi = ldbl_high (xm1);
5de29b
+  EXTRACT_WORDS (hx, lx, xhi);
5de29b
   if (hx >= 0x7ff00000)
5de29b
     return xm1;
5de29b
 
5de29b
   /* log1p(+- 0) = +- 0.  */
5de29b
-  if (((hx & 0x7fffffff) == 0)
5de29b
-      && (u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
5de29b
+  if (((hx & 0x7fffffff) | lx) == 0)
5de29b
     return xm1;
5de29b
 
5de29b
   x = xm1 + 1.0L;
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_modfl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_modfl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_modfl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -37,43 +37,54 @@
5de29b
 {
5de29b
 	int64_t i0,i1,j0;
5de29b
 	u_int64_t i;
5de29b
-	GET_LDOUBLE_WORDS64(i0,i1,x);
5de29b
+	double xhi, xlo;
5de29b
+
5de29b
+	ldbl_unpack (x, &xhi, &xlo;;
5de29b
+	EXTRACT_WORDS64 (i0, xhi);
5de29b
+	EXTRACT_WORDS64 (i1, xlo);
5de29b
 	i1 &= 0x000fffffffffffffLL;
5de29b
 	j0 = ((i0>>52)&0x7ff)-0x3ff;	/* exponent of x */
5de29b
 	if(j0<52) {			/* integer part in high x */
5de29b
 	    if(j0<0) {			/* |x|<1 */
5de29b
 		/* *iptr = +-0 */
5de29b
-	        SET_LDOUBLE_WORDS64(*iptr,i0&0x8000000000000000ULL,0);
5de29b
+		INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL);
5de29b
+		*iptr = xhi;
5de29b
 		return x;
5de29b
 	    } else {
5de29b
 		i = (0x000fffffffffffffLL)>>j0;
5de29b
 		if(((i0&i)|(i1&0x7fffffffffffffffLL))==0) {		/* x is integral */
5de29b
 		    *iptr = x;
5de29b
 		    /* return +-0 */
5de29b
-		    SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
5de29b
+		    INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL);
5de29b
+		    x = xhi;
5de29b
 		    return x;
5de29b
 		} else {
5de29b
-		    SET_LDOUBLE_WORDS64(*iptr,i0&(~i),0);
5de29b
+		    INSERT_WORDS64 (xhi, i0&(~i));
5de29b
+		    *iptr = xhi;
5de29b
 		    return x - *iptr;
5de29b
 		}
5de29b
 	    }
5de29b
 	} else if (j0>103) {		/* no fraction part */
5de29b
 	    *iptr = x*one;
5de29b
 	    /* We must handle NaNs separately.  */
5de29b
-	    if (j0 == 0x400 && ((i0 & 0x000fffffffffffffLL) | i1))
5de29b
+	    if ((i0 & 0x7fffffffffffffffLL) > 0x7ff0000000000000LL)
5de29b
 	      return x*one;
5de29b
 	    /* return +-0 */
5de29b
-	    SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
5de29b
+	    INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL);
5de29b
+	    x = xhi;
5de29b
 	    return x;
5de29b
 	} else {			/* fraction part in low x */
5de29b
 	    i = -1ULL>>(j0-52);
5de29b
 	    if((i1&i)==0) { 		/* x is integral */
5de29b
 		*iptr = x;
5de29b
 		/* return +-0 */
5de29b
-		SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
5de29b
+		INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL);
5de29b
+		x = xhi;
5de29b
 		return x;
5de29b
 	    } else {
5de29b
-		SET_LDOUBLE_WORDS64(*iptr,i0,i1&(~i));
5de29b
+		INSERT_WORDS64 (xhi, i0);
5de29b
+		INSERT_WORDS64 (xlo, i1&(~i));
5de29b
+		*iptr = ldbl_pack (xhi, xlo);
5de29b
 		return x - *iptr;
5de29b
 	    }
5de29b
 	}
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -30,27 +30,28 @@
5de29b
 
5de29b
 long double __nextafterl(long double x, long double y)
5de29b
 {
5de29b
-	int64_t hx,hy,ihx,ihy,ilx;
5de29b
-	u_int64_t lx;
5de29b
-	u_int64_t ly __attribute__ ((unused));
5de29b
+	int64_t hx,hy,ihx,ihy;
5de29b
+	uint64_t lx;
5de29b
+	double xhi, xlo, yhi;
5de29b
 
5de29b
-	GET_LDOUBLE_WORDS64(hx,lx,x);
5de29b
-	GET_LDOUBLE_WORDS64(hy,ly,y);
5de29b
+	ldbl_unpack (x, &xhi, &xlo;;
5de29b
+	EXTRACT_WORDS64 (hx, xhi);
5de29b
+	EXTRACT_WORDS64 (lx, xlo);
5de29b
+	yhi = ldbl_high (y);
5de29b
+	EXTRACT_WORDS64 (hy, yhi);
5de29b
 	ihx = hx&0x7fffffffffffffffLL;		/* |hx| */
5de29b
-	ilx = lx&0x7fffffffffffffffLL;		/* |lx| */
5de29b
 	ihy = hy&0x7fffffffffffffffLL;		/* |hy| */
5de29b
 
5de29b
-	if((((ihx&0x7ff0000000000000LL)==0x7ff0000000000000LL)&&
5de29b
-	    ((ihx&0x000fffffffffffffLL)!=0)) ||   /* x is nan */
5de29b
-	   (((ihy&0x7ff0000000000000LL)==0x7ff0000000000000LL)&&
5de29b
-	    ((ihy&0x000fffffffffffffLL)!=0)))     /* y is nan */
5de29b
+	if((ihx>0x7ff0000000000000LL) ||	/* x is nan */
5de29b
+	   (ihy>0x7ff0000000000000LL))		/* y is nan */
5de29b
 	    return x+y; /* signal the nan */
5de29b
 	if(x==y)
5de29b
 	    return y;		/* x=y, return y */
5de29b
-	if(ihx == 0 && ilx == 0) {			/* x == 0 */
5de29b
-	    long double u;
5de29b
+	if(ihx == 0) {				/* x == 0 */
5de29b
+	    long double u;			/* return +-minsubnormal */
5de29b
 	    hy = (hy & 0x8000000000000000ULL) | 1;
5de29b
-	    SET_LDOUBLE_WORDS64(x,hy,0ULL);/* return +-minsubnormal */
5de29b
+	    INSERT_WORDS64 (yhi, hy);
5de29b
+	    x = yhi;
5de29b
 	    u = math_opt_barrier (x);
5de29b
 	    u = u * u;
5de29b
 	    math_force_eval (u);		/* raise underflow flag */
5de29b
@@ -59,10 +60,16 @@
5de29b
 	
5de29b
 	long double u;
5de29b
 	if(x > y) {	/* x > y, x -= ulp */
5de29b
+	    /* This isn't the largest magnitude correctly rounded
5de29b
+	       long double as you can see from the lowest mantissa
5de29b
+	       bit being zero.  It is however the largest magnitude
5de29b
+	       long double with a 106 bit mantissa, and nextafterl
5de29b
+	       is insane with variable precision.  So to make
5de29b
+	       nextafterl sane we assume 106 bit precision.  */
5de29b
 	    if((hx==0xffefffffffffffffLL)&&(lx==0xfc8ffffffffffffeLL))
5de29b
 	      return x+x;	/* overflow, return -inf */
5de29b
 	    if (hx >= 0x7ff0000000000000LL) {
5de29b
-	      SET_LDOUBLE_WORDS64(u,0x7fefffffffffffffLL,0x7c8ffffffffffffeLL);
5de29b
+	      u = 0x1.fffffffffffff7ffffffffffff8p+1023L;
5de29b
 	      return u;
5de29b
 	    }
5de29b
 	    if(ihx <= 0x0360000000000000LL) {  /* x <= LDBL_MIN */
5de29b
@@ -77,16 +84,19 @@
5de29b
 	      return x;
5de29b
 	    }
5de29b
 	    if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
5de29b
-	      SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL);
5de29b
+	      INSERT_WORDS64 (yhi, hx & (0x7ffLL<<52));
5de29b
+	      u = yhi;
5de29b
 	      u *= 0x1.0000000000000p-105L;
5de29b
-	    } else
5de29b
-	      SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL);
5de29b
+	    } else {
5de29b
+	      INSERT_WORDS64 (yhi, (hx & (0x7ffLL<<52))-(0x069LL<<52));
5de29b
+	      u = yhi;
5de29b
+	    }
5de29b
 	    return x - u;
5de29b
 	} else {				/* x < y, x += ulp */
5de29b
 	    if((hx==0x7fefffffffffffffLL)&&(lx==0x7c8ffffffffffffeLL))
5de29b
 	      return x+x;	/* overflow, return +inf */
5de29b
-	    if ((u_int64_t) hx >= 0xfff0000000000000ULL) {
5de29b
-	      SET_LDOUBLE_WORDS64(u,0xffefffffffffffffLL,0xfc8ffffffffffffeLL);
5de29b
+	    if ((uint64_t) hx >= 0xfff0000000000000ULL) {
5de29b
+	      u = -0x1.fffffffffffff7ffffffffffff8p+1023L;
5de29b
 	      return u;
5de29b
 	    }
5de29b
 	    if(ihx <= 0x0360000000000000LL) {  /* x <= LDBL_MIN */
5de29b
@@ -103,10 +113,13 @@
5de29b
 	      return x;
5de29b
 	    }
5de29b
 	    if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
5de29b
-	      SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL);
5de29b
+	      INSERT_WORDS64 (yhi, hx & (0x7ffLL<<52));
5de29b
+	      u = yhi;
5de29b
 	      u *= 0x1.0000000000000p-105L;
5de29b
-	    } else
5de29b
-	      SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL);
5de29b
+	    } else {
5de29b
+	      INSERT_WORDS64 (yhi, (hx & (0x7ffLL<<52))-(0x069LL<<52));
5de29b
+	      u = yhi;
5de29b
+	    }
5de29b
 	    return x + u;
5de29b
 	}
5de29b
 }
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c	2014-05-27 23:10:26.000000000 -0500
5de29b
@@ -34,23 +34,23 @@
5de29b
 {
5de29b
 	int32_t hx,ix;
5de29b
 	int64_t hy,iy;
5de29b
-	u_int32_t lx;
5de29b
-	u_int64_t ly,uly;
5de29b
+	uint32_t lx;
5de29b
+	double yhi;
5de29b
+
5de29b
 
5de29b
 	EXTRACT_WORDS(hx,lx,x);
5de29b
-	GET_LDOUBLE_WORDS64(hy,ly,y);
5de29b
+	yhi = ldbl_high (y);
5de29b
+	EXTRACT_WORDS64(hy,yhi);
5de29b
 	ix = hx&0x7fffffff;		/* |x| */
5de29b
 	iy = hy&0x7fffffffffffffffLL;	/* |y| */
5de29b
-	uly = ly&0x7fffffffffffffffLL;	/* |y| */
5de29b
 
5de29b
 	if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) ||   /* x is nan */
5de29b
-	   ((iy>=0x7ff0000000000000LL)&&((iy-0x7ff0000000000000LL)|uly)!=0))
5de29b
-	   						    /* y is nan */
5de29b
+	   iy>0x7ff0000000000000LL)			    /* y is nan */
5de29b
 	   return x+y;
5de29b
 	if((long double) x==y) return y;	/* x=y, return y */
5de29b
 	if((ix|lx)==0) {			/* x == 0 */
5de29b
 	    double u;
5de29b
-	    INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */
5de29b
+	    INSERT_WORDS(x,(uint32_t)((hy>>32)&0x80000000),1);/* return +-minsub */
5de29b
 	    u = math_opt_barrier (x);
5de29b
 	    u = u * u;
5de29b
 	    math_force_eval (u);		/* raise underflow flag */
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -27,16 +27,16 @@
5de29b
 {
5de29b
 	int32_t hx,ix;
5de29b
 	int64_t hy,iy;
5de29b
-	u_int64_t ly, uly;
5de29b
+	double yhi;
5de29b
 
5de29b
 	GET_FLOAT_WORD(hx,x);
5de29b
-	GET_LDOUBLE_WORDS64(hy,ly,y);
5de29b
+	yhi = ldbl_high (y);
5de29b
+	EXTRACT_WORDS64 (hy, yhi);
5de29b
 	ix = hx&0x7fffffff;		/* |x| */
5de29b
 	iy = hy&0x7fffffffffffffffLL;	/* |y| */
5de29b
-	uly = ly&0x7fffffffffffffffLL;	/* |y| */
5de29b
 
5de29b
 	if((ix>0x7f800000) ||   /* x is nan */
5de29b
-	   ((iy>=0x7ff0000000000000LL)&&((iy-0x7ff0000000000000LL)|uly)!=0))
5de29b
+	   (iy>0x7ff0000000000000LL))
5de29b
 				/* y is nan */
5de29b
 	   return x+y;
5de29b
 	if((long double) x==y) return y;	/* x=y, return y */
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_remquol.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_remquol.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_remquol.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -33,20 +33,24 @@
5de29b
   int64_t hx,hy;
5de29b
   u_int64_t sx,lx,ly,qs;
5de29b
   int cquo;
5de29b
+  double xhi, xlo, yhi, ylo;
5de29b
 
5de29b
-  GET_LDOUBLE_WORDS64 (hx, lx, x);
5de29b
-  GET_LDOUBLE_WORDS64 (hy, ly, y);
5de29b
+  ldbl_unpack (x, &xhi, &xlo;;
5de29b
+  EXTRACT_WORDS64 (hx, xhi);
5de29b
+  EXTRACT_WORDS64 (lx, xlo);
5de29b
+  ldbl_unpack (y, &yhi, &ylo);
5de29b
+  EXTRACT_WORDS64 (hy, yhi);
5de29b
+  EXTRACT_WORDS64 (ly, ylo);
5de29b
   sx = hx & 0x8000000000000000ULL;
5de29b
   qs = sx ^ (hy & 0x8000000000000000ULL);
5de29b
   hy &= 0x7fffffffffffffffLL;
5de29b
   hx &= 0x7fffffffffffffffLL;
5de29b
 
5de29b
   /* Purge off exception values.  */
5de29b
-  if ((hy | (ly & 0x7fffffffffffffff)) == 0)
5de29b
+  if (hy == 0)
5de29b
     return (x * y) / (x * y); 			/* y = 0 */
5de29b
   if ((hx >= 0x7ff0000000000000LL)		/* x not finite */
5de29b
-      || ((hy >= 0x7ff0000000000000LL)		/* y is NaN */
5de29b
-	  && (((hy - 0x7ff0000000000000LL) | ly) != 0)))
5de29b
+      || (hy > 0x7ff0000000000000LL))		/* y is NaN */
5de29b
     return (x * y) / (x * y);
5de29b
 
5de29b
   if (hy <= 0x7fbfffffffffffffLL)
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c	2014-05-27 23:15:30.000000000 -0500
5de29b
@@ -41,11 +41,15 @@
5de29b
 {
5de29b
 	int64_t k,l,hx,lx;
5de29b
 	union { int64_t i; double d; } u;
5de29b
-	GET_LDOUBLE_WORDS64(hx,lx,x);
5de29b
+	double xhi, xlo;
5de29b
+
5de29b
+	ldbl_unpack (x, &xhi, &xlo;;
5de29b
+	EXTRACT_WORDS64 (hx, xhi);
5de29b
+	EXTRACT_WORDS64 (lx, xlo);
5de29b
 	k = (hx>>52)&0x7ff;		/* extract exponent */
5de29b
 	l = (lx>>52)&0x7ff;
5de29b
 	if (k==0) {				/* 0 or subnormal x */
5de29b
-	    if (((hx|lx)&0x7fffffffffffffffULL)==0) return x; /* +-0 */
5de29b
+	    if ((hx&0x7fffffffffffffffULL)==0) return x; /* +-0 */
5de29b
 	    u.i = hx;
5de29b
 	    u.d *= two54;
5de29b
 	    hx = u.i;
5de29b
@@ -61,7 +65,9 @@
5de29b
 	if (k > 0) {				/* normal result */
5de29b
 	    hx = (hx&0x800fffffffffffffULL)|(k<<52);
5de29b
 	    if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
5de29b
-	    	SET_LDOUBLE_WORDS64(x,hx,lx);
5de29b
+		INSERT_WORDS64 (xhi, hx);
5de29b
+		INSERT_WORDS64 (xlo, lx);
5de29b
+		x = ldbl_pack (xhi, xlo);
5de29b
 	    	return x;
5de29b
 	    }
5de29b
 	    if (l == 0) { /* low part subnormal */
5de29b
@@ -81,14 +87,19 @@
5de29b
 	    	u.d *= twom54;
5de29b
 	    	lx = u.i;
5de29b
 	    }
5de29b
-	    SET_LDOUBLE_WORDS64(x,hx,lx);
5de29b
+	    INSERT_WORDS64 (xhi, hx);
5de29b
+	    INSERT_WORDS64 (xlo, lx);
5de29b
+	    x = ldbl_pack (xhi, xlo);
5de29b
 	    return x;
5de29b
 	}
5de29b
 	if (k <= -54)
5de29b
 	  return tiny*__copysignl(tiny,x); 	/*underflow*/
5de29b
 	k += 54;				/* subnormal result */
5de29b
 	lx &= 0x8000000000000000ULL;
5de29b
-	SET_LDOUBLE_WORDS64(x,(hx&0x800fffffffffffffULL)|(k<<52),lx);
5de29b
+	hx &= 0x800fffffffffffffULL;
5de29b
+	INSERT_WORDS64 (xhi, hx|(k<<52));
5de29b
+	INSERT_WORDS64 (xlo, lx);
5de29b
+	x = ldbl_pack (xhi, xlo);
5de29b
 	return x*twolm54;
5de29b
 }
5de29b
 long_double_symbol (libm, __scalblnl, scalblnl);
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c	2014-05-27 23:16:25.000000000 -0500
5de29b
@@ -41,11 +41,15 @@
5de29b
 {
5de29b
 	int64_t k,l,hx,lx;
5de29b
 	union { int64_t i; double d; } u;
5de29b
-	GET_LDOUBLE_WORDS64(hx,lx,x);
5de29b
+	double xhi, xlo;
5de29b
+
5de29b
+	ldbl_unpack (x, &xhi, &xlo;;
5de29b
+	EXTRACT_WORDS64 (hx, xhi);
5de29b
+	EXTRACT_WORDS64 (lx, xlo);
5de29b
 	k = (hx>>52)&0x7ff;		/* extract exponent */
5de29b
 	l = (lx>>52)&0x7ff;
5de29b
 	if (k==0) {				/* 0 or subnormal x */
5de29b
-	    if (((hx|lx)&0x7fffffffffffffffULL)==0) return x; /* +-0 */
5de29b
+	    if ((hx&0x7fffffffffffffffULL)==0) return x; /* +-0 */
5de29b
 	    u.i = hx;
5de29b
 	    u.d *= two54;
5de29b
 	    hx = u.i;
5de29b
@@ -61,7 +65,9 @@
5de29b
 	if (k > 0) {				/* normal result */
5de29b
 	    hx = (hx&0x800fffffffffffffULL)|(k<<52);
5de29b
 	    if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
5de29b
-	    	SET_LDOUBLE_WORDS64(x,hx,lx);
5de29b
+		INSERT_WORDS64 (xhi, hx);
5de29b
+		INSERT_WORDS64 (xlo, lx);
5de29b
+		x = ldbl_pack (xhi, xlo);
5de29b
 	    	return x;
5de29b
 	    }
5de29b
 	    if (l == 0) { /* low part subnormal */
5de29b
@@ -81,14 +87,19 @@
5de29b
 	    	u.d *= twom54;
5de29b
 	    	lx = u.i;
5de29b
 	    }
5de29b
-	    SET_LDOUBLE_WORDS64(x,hx,lx);
5de29b
+	    INSERT_WORDS64 (xhi, hx);
5de29b
+	    INSERT_WORDS64 (xlo, lx);
5de29b
+	    x = ldbl_pack (xhi, xlo);
5de29b
 	    return x;
5de29b
 	}
5de29b
 	if (k <= -54)
5de29b
 	  return tiny*__copysignl(tiny,x); 	/*underflow*/
5de29b
 	k += 54;				/* subnormal result */
5de29b
 	lx &= 0x8000000000000000ULL;
5de29b
-	SET_LDOUBLE_WORDS64(x,(hx&0x800fffffffffffffULL)|(k<<52),lx);
5de29b
+	hx &= 0x800fffffffffffffULL;
5de29b
+	INSERT_WORDS64 (xhi, hx|(k<<52));
5de29b
+	INSERT_WORDS64 (xlo, lx);
5de29b
+	x = ldbl_pack (xhi, xlo);
5de29b
 	return x*twolm54;
5de29b
 }
5de29b
 #ifdef IS_IN_libm
12745e
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c	2014-05-27 23:05:55.000000000 -0500
5de29b
@@ -47,10 +47,12 @@
5de29b
 long double __tanhl(long double x)
5de29b
 {
5de29b
 	long double t,z;
5de29b
-	int64_t jx,ix,lx;
5de29b
+	int64_t jx,ix;
5de29b
+	double xhi;
5de29b
 
5de29b
     /* High word of |x|. */
5de29b
-	GET_LDOUBLE_WORDS64(jx,lx,x);
5de29b
+	xhi = ldbl_high (x);
5de29b
+	EXTRACT_WORDS64 (jx, xhi);
5de29b
 	ix = jx&0x7fffffffffffffffLL;
5de29b
 
5de29b
     /* x is INF or NaN */
5de29b
@@ -61,7 +63,7 @@
5de29b
 
5de29b
     /* |x| < 22 */
5de29b
 	if (ix < 0x4036000000000000LL) {		/* |x|<22 */
5de29b
-	    if ((ix | (lx&0x7fffffffffffffffLL)) == 0)
5de29b
+	    if (ix == 0)
5de29b
 		return x;		/* x == +-0 */
5de29b
 	    if (ix<0x3c60000000000000LL) 	/* |x|<2**-57 */
5de29b
 		return x*(one+x);    	/* tanh(small) = small */
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/libm-test-ulps glibc-2.17-c758a686/sysdeps/powerpc/fpu/libm-test-ulps
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/libm-test-ulps	2014-05-27 23:05:51.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/libm-test-ulps	2014-05-27 23:08:26.000000000 -0500
5de29b
@@ -2641,6 +2641,9 @@
5de29b
 ifloat: 1
5de29b
 ildouble: 2
5de29b
 ldouble: 2
5de29b
+Test "tan_towardzero (2)":
5de29b
+ildouble: 1
5de29b
+ldouble: 1
5de29b
 Test "tan_towardzero (3) == -0.1425465430742778052956354105339134932261":
5de29b
 float: 1
5de29b
 ifloat: 1