Blame SOURCES/glibc-ppc64le-08.patch

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