olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone
00db10
# commit 4a28b3ca4bc52d9a3ac0d9edb53d3de510e1b77c
00db10
# Author: Anton Blanchard <anton@au1.ibm.com>
00db10
# Date:   Sat Aug 17 18:28:55 2013 +0930
00db10
# 
00db10
#     PowerPC floating point little-endian [8 of 15]
00db10
#     http://sourceware.org/ml/libc-alpha/2013-07/msg00199.html
00db10
#     
00db10
#     Corrects floating-point environment code for little-endian.
00db10
#     
00db10
#         * sysdeps/powerpc/fpu/fenv_libc.h (fenv_union_t): Replace int
00db10
#         array with long long.
00db10
#         * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Adjust.
00db10
#         * sysdeps/powerpc/fpu/e_sqrtf.c (__slow_ieee754_sqrtf): Adjust.
00db10
#         * sysdeps/powerpc/fpu/fclrexcpt.c (__feclearexcept): Adjust.
00db10
#         * sysdeps/powerpc/fpu/fedisblxcpt.c (fedisableexcept): Adjust.
00db10
#         * sysdeps/powerpc/fpu/feenablxcpt.c (feenableexcept): Adjust.
00db10
#         * sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Adjust.
00db10
#         * sysdeps/powerpc/fpu/feholdexcpt.c (feholdexcept): Adjust.
00db10
#         * sysdeps/powerpc/fpu/fesetenv.c (__fesetenv): Adjust.
00db10
#         * sysdeps/powerpc/fpu/feupdateenv.c (__feupdateenv): Adjust.
00db10
#         * sysdeps/powerpc/fpu/fgetexcptflg.c (__fegetexceptflag): Adjust.
00db10
#         * sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Adjust.
00db10
#         * sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Adjust.
00db10
#         * sysdeps/powerpc/fpu/ftestexcept.c (fetestexcept): Adjust.
00db10
# 
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrt.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrt.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrt.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -145,7 +145,7 @@
00db10
       feraiseexcept (FE_INVALID_SQRT);
00db10
 
00db10
       fenv_union_t u = { .fenv = fegetenv_register () };
00db10
-      if ((u.l[1] & FE_INVALID) == 0)
00db10
+      if ((u.l & FE_INVALID) == 0)
00db10
 #endif
00db10
 	feraiseexcept (FE_INVALID);
00db10
       x = a_nan.value;
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrtf.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrtf.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrtf.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrtf.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -121,7 +121,7 @@
00db10
       feraiseexcept (FE_INVALID_SQRT);
00db10
 
00db10
       fenv_union_t u = { .fenv = fegetenv_register () };
00db10
-      if ((u.l[1] & FE_INVALID) == 0)
00db10
+      if ((u.l & FE_INVALID) == 0)
00db10
 #endif
00db10
 	feraiseexcept (FE_INVALID);
00db10
       x = a_nan.value;
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fclrexcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fclrexcpt.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fclrexcpt.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fclrexcpt.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -28,8 +28,8 @@
00db10
   u.fenv = fegetenv_register ();
00db10
 
00db10
   /* Clear the relevant bits.  */
00db10
-  u.l[1] = u.l[1] & ~((-(excepts >> (31 - FPSCR_VX) & 1) & FE_ALL_INVALID)
00db10
-		      | (excepts & FPSCR_STICKY_BITS));
00db10
+  u.l = u.l & ~((-(excepts >> (31 - FPSCR_VX) & 1) & FE_ALL_INVALID)
00db10
+		| (excepts & FPSCR_STICKY_BITS));
00db10
 
00db10
   /* Put the new state in effect.  */
00db10
   fesetenv_register (u.fenv);
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -32,15 +32,15 @@
00db10
 
00db10
   fe.fenv = fegetenv_register ();
00db10
   if (excepts & FE_INEXACT)
00db10
-    fe.l[1] &= ~(1 << (31 - FPSCR_XE));
00db10
+    fe.l &= ~(1 << (31 - FPSCR_XE));
00db10
   if (excepts & FE_DIVBYZERO)
00db10
-    fe.l[1] &= ~(1 << (31 - FPSCR_ZE));
00db10
+    fe.l &= ~(1 << (31 - FPSCR_ZE));
00db10
   if (excepts & FE_UNDERFLOW)
00db10
-    fe.l[1] &= ~(1 << (31 - FPSCR_UE));
00db10
+    fe.l &= ~(1 << (31 - FPSCR_UE));
00db10
   if (excepts & FE_OVERFLOW)
00db10
-    fe.l[1] &= ~(1 << (31 - FPSCR_OE));
00db10
+    fe.l &= ~(1 << (31 - FPSCR_OE));
00db10
   if (excepts & FE_INVALID)
00db10
-    fe.l[1] &= ~(1 << (31 - FPSCR_VE));
00db10
+    fe.l &= ~(1 << (31 - FPSCR_VE));
00db10
   fesetenv_register (fe.fenv);
00db10
 
00db10
   new = __fegetexcept ();
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -32,15 +32,15 @@
00db10
 
00db10
   fe.fenv = fegetenv_register ();
00db10
   if (excepts & FE_INEXACT)
00db10
-    fe.l[1] |= (1 << (31 - FPSCR_XE));
00db10
+    fe.l |= (1 << (31 - FPSCR_XE));
00db10
   if (excepts & FE_DIVBYZERO)
00db10
-    fe.l[1] |= (1 << (31 - FPSCR_ZE));
00db10
+    fe.l |= (1 << (31 - FPSCR_ZE));
00db10
   if (excepts & FE_UNDERFLOW)
00db10
-    fe.l[1] |= (1 << (31 - FPSCR_UE));
00db10
+    fe.l |= (1 << (31 - FPSCR_UE));
00db10
   if (excepts & FE_OVERFLOW)
00db10
-    fe.l[1] |= (1 << (31 - FPSCR_OE));
00db10
+    fe.l |= (1 << (31 - FPSCR_OE));
00db10
   if (excepts & FE_INVALID)
00db10
-    fe.l[1] |= (1 << (31 - FPSCR_VE));
00db10
+    fe.l |= (1 << (31 - FPSCR_VE));
00db10
   fesetenv_register (fe.fenv);
00db10
 
00db10
   new = __fegetexcept ();
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -27,15 +27,15 @@
00db10
 
00db10
   fe.fenv = fegetenv_register ();
00db10
 
00db10
-  if (fe.l[1] & (1 << (31 - FPSCR_XE)))
00db10
+  if (fe.l & (1 << (31 - FPSCR_XE)))
00db10
       result |= FE_INEXACT;
00db10
-  if (fe.l[1] & (1 << (31 - FPSCR_ZE)))
00db10
+  if (fe.l & (1 << (31 - FPSCR_ZE)))
00db10
       result |= FE_DIVBYZERO;
00db10
-  if (fe.l[1] & (1 << (31 - FPSCR_UE)))
00db10
+  if (fe.l & (1 << (31 - FPSCR_UE)))
00db10
       result |= FE_UNDERFLOW;
00db10
-  if (fe.l[1] & (1 << (31 - FPSCR_OE)))
00db10
+  if (fe.l & (1 << (31 - FPSCR_OE)))
00db10
       result |= FE_OVERFLOW;
00db10
-  if (fe.l[1] & (1 << (31 - FPSCR_VE)))
00db10
+  if (fe.l & (1 << (31 - FPSCR_VE)))
00db10
       result |= FE_INVALID;
00db10
 
00db10
   return result;
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feholdexcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/feholdexcpt.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/feholdexcpt.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/feholdexcpt.c	2014-05-27 22:33:09.000000000 -0500
00db10
@@ -30,13 +30,12 @@
00db10
 
00db10
   /* Clear everything except for the rounding modes and non-IEEE arithmetic
00db10
      flag.  */
00db10
-  new.l[1] = old.l[1] & 7;
00db10
-  new.l[0] = old.l[0];
00db10
+  new.l = old.l & 0xffffffff00000007LL;
00db10
   
00db10
   /* If the old env had any eabled exceptions, then mask SIGFPE in the
00db10
      MSR FE0/FE1 bits.  This may allow the FPU to run faster because it
00db10
      always takes the default action and can not generate SIGFPE. */
00db10
-  if ((old.l[1] & _FPU_MASK_ALL) != 0)
00db10
+  if ((old.l & _FPU_MASK_ALL) != 0)
00db10
     (void)__fe_mask_env ();
00db10
 
00db10
   /* Put the new state in effect.  */
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fenv_libc.h glibc-2.17-c758a686/sysdeps/powerpc/fpu/fenv_libc.h
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fenv_libc.h	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fenv_libc.h	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -69,7 +69,7 @@
00db10
 typedef union
00db10
 {
00db10
   fenv_t fenv;
00db10
-  unsigned int l[2];
00db10
+  unsigned long long l;
00db10
 } fenv_union_t;
00db10
 
00db10
 
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c	2014-05-27 22:35:18.000000000 -0500
00db10
@@ -36,14 +36,14 @@
00db10
      exceptions, then unmask SIGFPE in the MSR FE0/FE1 bits.  This will put the
00db10
      hardware into "precise mode" and may cause the FPU to run slower on some
00db10
      hardware.  */
00db10
-  if ((old.l[1] & _FPU_MASK_ALL) == 0 && (new.l[1] & _FPU_MASK_ALL) != 0)
00db10
+  if ((old.l & _FPU_MASK_ALL) == 0 && (new.l & _FPU_MASK_ALL) != 0)
00db10
     (void)__fe_nomask_env ();
00db10
   
00db10
   /* If the old env had any enabled exceptions and the new env has no enabled
00db10
      exceptions, then mask SIGFPE in the MSR FE0/FE1 bits.  This may allow the
00db10
      FPU to run faster because it always takes the default action and can not 
00db10
      generate SIGFPE. */
00db10
-  if ((old.l[1] & _FPU_MASK_ALL) != 0 && (new.l[1] & _FPU_MASK_ALL) == 0)
00db10
+  if ((old.l & _FPU_MASK_ALL) != 0 && (new.l & _FPU_MASK_ALL) == 0)
00db10
     (void)__fe_mask_env ();
00db10
     
00db10
   fesetenv_register (*envp);
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c	2014-05-27 22:34:23.000000000 -0500
00db10
@@ -36,20 +36,20 @@
00db10
   /* Restore rounding mode and exception enable from *envp and merge
00db10
      exceptions.  Leave fraction rounded/inexact and FP result/CC bits
00db10
      unchanged.  */
00db10
-  new.l[1] = (old.l[1] & 0x1FFFFF00) | (new.l[1] & 0x1FF80FFF);
00db10
+  new.l = (old.l & 0xffffffff1fffff00LL) | (new.l & 0x1ff80fff);
00db10
   
00db10
   /* If the old env has no eabled exceptions and the new env has any enabled
00db10
      exceptions, then unmask SIGFPE in the MSR FE0/FE1 bits.  This will put
00db10
      the hardware into "precise mode" and may cause the FPU to run slower on
00db10
      some hardware.  */
00db10
-  if ((old.l[1] & _FPU_MASK_ALL) == 0 && (new.l[1] & _FPU_MASK_ALL) != 0)
00db10
+  if ((old.l & _FPU_MASK_ALL) == 0 && (new.l & _FPU_MASK_ALL) != 0)
00db10
     (void)__fe_nomask_env ();
00db10
   
00db10
   /* If the old env had any eabled exceptions and the new env has no enabled
00db10
      exceptions, then mask SIGFPE in the MSR FE0/FE1 bits.  This may allow the
00db10
      FPU to run faster because it always takes the default action and can not 
00db10
      generate SIGFPE. */
00db10
-  if ((old.l[1] & _FPU_MASK_ALL) != 0 && (new.l[1] & _FPU_MASK_ALL) == 0)
00db10
+  if ((old.l & _FPU_MASK_ALL) != 0 && (new.l & _FPU_MASK_ALL) == 0)
00db10
     (void)__fe_mask_env ();
00db10
 
00db10
   /* Atomically enable and raise (if appropriate) exceptions set in `new'. */
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fgetexcptflg.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fgetexcptflg.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fgetexcptflg.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fgetexcptflg.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -28,7 +28,7 @@
00db10
   u.fenv = fegetenv_register ();
00db10
 
00db10
   /* Return (all of) it.  */
00db10
-  *flagp = u.l[1] & excepts & FE_ALL_EXCEPT;
00db10
+  *flagp = u.l & excepts & FE_ALL_EXCEPT;
00db10
 
00db10
   /* Success.  */
00db10
   return 0;
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -34,11 +34,11 @@
00db10
   u.fenv = fegetenv_register ();
00db10
 
00db10
   /* Add the exceptions */
00db10
-  u.l[1] = (u.l[1]
00db10
-	    | (excepts & FPSCR_STICKY_BITS)
00db10
-	    /* Turn FE_INVALID into FE_INVALID_SOFTWARE.  */
00db10
-	    | (excepts >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
00db10
-	       & FE_INVALID_SOFTWARE));
00db10
+  u.l = (u.l
00db10
+	 | (excepts & FPSCR_STICKY_BITS)
00db10
+	 /* Turn FE_INVALID into FE_INVALID_SOFTWARE.  */
00db10
+	 | (excepts >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
00db10
+	    & FE_INVALID_SOFTWARE));
00db10
 
00db10
   /* Store the new status word (along with the rest of the environment),
00db10
      triggering any appropriate exceptions.  */
00db10
@@ -50,7 +50,7 @@
00db10
 	 don't have FE_INVALID_SOFTWARE implemented.  Detect this
00db10
 	 case and raise FE_INVALID_SNAN instead.  */
00db10
       u.fenv = fegetenv_register ();
00db10
-      if ((u.l[1] & FE_INVALID) == 0)
00db10
+      if ((u.l & FE_INVALID) == 0)
00db10
 	set_fpscr_bit (FPSCR_VXSNAN);
00db10
     }
00db10
 
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -32,10 +32,10 @@
00db10
   flag = *flagp & excepts;
00db10
 
00db10
   /* Replace the exception status */
00db10
-  u.l[1] = ((u.l[1] & ~(FPSCR_STICKY_BITS & excepts))
00db10
-	    | (flag & FPSCR_STICKY_BITS)
00db10
-	    | (flag >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
00db10
-	       & FE_INVALID_SOFTWARE));
00db10
+  u.l = ((u.l & ~(FPSCR_STICKY_BITS & excepts))
00db10
+	 | (flag & FPSCR_STICKY_BITS)
00db10
+	 | (flag >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
00db10
+	    & FE_INVALID_SOFTWARE));
00db10
 
00db10
   /* Store the new status word (along with the rest of the environment).
00db10
      This may cause floating-point exceptions if the restored state
00db10
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/ftestexcept.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/ftestexcept.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/ftestexcept.c	2014-05-27 22:31:42.000000000 -0500
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/ftestexcept.c	2014-05-27 22:31:43.000000000 -0500
00db10
@@ -28,6 +28,6 @@
00db10
 
00db10
   /* The FE_INVALID bit is dealt with correctly by the hardware, so we can
00db10
      just:  */
00db10
-  return u.l[1] & excepts;
00db10
+  return u.l & excepts;
00db10
 }
00db10
 libm_hidden_def (fetestexcept)