[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r2678 - in glibc-package/branches/glibc-2.7/debian: . patches patches/alpha



Author: aurel32
Date: 2007-11-16 22:07:41 +0000 (Fri, 16 Nov 2007)
New Revision: 2678

Added:
   glibc-package/branches/glibc-2.7/debian/patches/alpha/submitted-fpu-round.diff
Modified:
   glibc-package/branches/glibc-2.7/debian/changelog
   glibc-package/branches/glibc-2.7/debian/patches/series
Log:
  * patches/alpha/submitted-fpu-round.diff: restore the old version of
    ceil/floor/rint functions.  Closes: #442568.



Modified: glibc-package/branches/glibc-2.7/debian/changelog
===================================================================
--- glibc-package/branches/glibc-2.7/debian/changelog	2007-11-16 15:14:44 UTC (rev 2677)
+++ glibc-package/branches/glibc-2.7/debian/changelog	2007-11-16 22:07:41 UTC (rev 2678)
@@ -113,6 +113,8 @@
     by the maintainer scripts of tzdata.  Closes: bug#448796.
   * patches/all/local-alias-et_EE.diff: switch estonian locales alias to
     ISO-8859-15.
+  * patches/alpha/submitted-fpu-round.diff: restore the old version of
+    ceil/floor/rint functions.  Closes: #442568.
 
   [ Petr Salinger]
   * any/local-linuxthreads-unwind.diff: provide unwind-resume routine for
@@ -136,7 +138,7 @@
   [ Samuel Thibault ]
   * hurd-i386/submitted-ptr-mangle.diff: Define PTR_MANGLE for assembly.
 
- -- Aurelien Jarno <aurel32@debian.org>  Fri, 16 Nov 2007 16:13:37 +0100
+ -- Aurelien Jarno <aurel32@debian.org>  Fri, 16 Nov 2007 23:03:56 +0100
 
 glibc (2.6.1-6) unstable; urgency=low
 

Added: glibc-package/branches/glibc-2.7/debian/patches/alpha/submitted-fpu-round.diff
===================================================================
--- glibc-package/branches/glibc-2.7/debian/patches/alpha/submitted-fpu-round.diff	                        (rev 0)
+++ glibc-package/branches/glibc-2.7/debian/patches/alpha/submitted-fpu-round.diff	2007-11-16 22:07:41 UTC (rev 2678)
@@ -0,0 +1,265 @@
+2007-11-16  Aurelien Jarno  <aurelien@aurel32.net>
+
+        * sysdeps/alpha/fpu/s_ceil.c: Restore old version.
+        * sysdeps/alpha/fpu/s_ceilf.c: Likewise.
+        * sysdeps/alpha/fpu/s_floor.c: Likewise.
+        * sysdeps/alpha/fpu/s_floorf.c: Likewise.
+        * sysdeps/alpha/fpu/s_rint.c: Likewise.
+        * sysdeps/alpha/fpu/s_rintf.c: Likewise.
+
+
+--- sysdeps/alpha/fpu/s_ceil.c.orig
++++ sysdeps/alpha/fpu/s_ceil.c
+@@ -27,20 +27,25 @@
+ double
+ __ceil (double x)
+ {
+-  double two52 = copysign (0x1.0p52, x);
+-  double r, tmp;
+-  
+-  __asm (
++  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
++    {
++      double tmp1, new_x;
++
++      new_x = -x;
++      __asm (
+ #ifdef _IEEE_FP_INEXACT
+-	 "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
++	     "cvttq/svim %2,%1\n\t"
+ #else
+-	 "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
++	     "cvttq/svm %2,%1\n\t"
+ #endif
+-	 : "=&f"(r), "=&f"(tmp)
+-	 : "f"(-x), "f"(-two52));
++	     "cvtqt/m %1,%0\n\t"
++	     : "=f"(new_x), "=&f"(tmp1)
++	     : "f"(new_x));
+ 
+-  /* Fix up the negation we did above, as well as handling -0 properly. */
+-  return copysign (r, x);
++      /* Fix up the negation we did above, as well as handling -0 properly. */
++      x = copysign(new_x, x);
++    }
++  return x;
+ }
+ 
+ weak_alias (__ceil, ceil)
+--- sysdeps/alpha/fpu/s_ceilf.c.orig
++++ sysdeps/alpha/fpu/s_ceilf.c
+@@ -26,20 +26,30 @@
+ float
+ __ceilf (float x)
+ {
+-  float two23 = copysignf (0x1.0p23, x);
+-  float r, tmp;
+-  
+-  __asm (
++  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
++    {
++      /* Note that Alpha S_Floating is stored in registers in a
++	 restricted T_Floating format, so we don't even need to
++	 convert back to S_Floating in the end.  The initial
++	 conversion to T_Floating is needed to handle denormals.  */
++
++      float tmp1, tmp2, new_x;
++
++      new_x = -x;
++      __asm ("cvtst/s %3,%2\n\t"
+ #ifdef _IEEE_FP_INEXACT
+-	 "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
++	     "cvttq/svim %2,%1\n\t"
+ #else
+-	 "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
++	     "cvttq/svm %2,%1\n\t"
+ #endif
+-	 : "=&f"(r), "=&f"(tmp)
+-	 : "f"(-x), "f"(-two23));
++	     "cvtqt/m %1,%0\n\t"
++	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
++	     : "f"(new_x));
+ 
+-  /* Fix up the negation we did above, as well as handling -0 properly. */
+-  return copysignf (r, x);
++      /* Fix up the negation we did above, as well as handling -0 properly. */
++      x = copysignf(new_x, x);
++    }
++  return x;
+ }
+ 
+ weak_alias (__ceilf, ceilf)
+--- sysdeps/alpha/fpu/s_floor.c.orig
++++ sysdeps/alpha/fpu/s_floor.c
+@@ -21,26 +21,32 @@
+ #include <math_ldbl_opt.h>
+ 
+ 
+-/* Use the -inf rounding mode conversion instructions to implement floor.  */
++/* Use the -inf rounding mode conversion instructions to implement
++   floor.  We note when the exponent is large enough that the value
++   must be integral, as this avoids unpleasant integer overflows.  */
+ 
+ double
+ __floor (double x)
+ {
+-  double two52 = copysign (0x1.0p52, x);
+-  double r, tmp;
+-  
+-  __asm (
++  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
++    {
++      double tmp1, new_x;
++
++      __asm (
+ #ifdef _IEEE_FP_INEXACT
+-	 "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
++	     "cvttq/svim %2,%1\n\t"
+ #else
+-	 "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
++	     "cvttq/svm %2,%1\n\t"
+ #endif
+-	 : "=&f"(r), "=&f"(tmp)
+-	 : "f"(x), "f"(two52));
++	     "cvtqt/m %1,%0\n\t"
++	     : "=f"(new_x), "=&f"(tmp1)
++	     : "f"(x));
+ 
+-  /* floor(-0) == -0, and in general we'll always have the same
+-     sign as our input.  */
+-  return copysign (r, x);
++      /* floor(-0) == -0, and in general we'll always have the same
++	 sign as our input.  */
++      x = copysign(new_x, x);
++    }
++  return x;
+ }
+ 
+ weak_alias (__floor, floor)
+--- sysdeps/alpha/fpu/s_floorf.c.orig
++++ sysdeps/alpha/fpu/s_floorf.c
+@@ -20,26 +20,37 @@
+ #include <math.h>
+ 
+ 
+-/* Use the -inf rounding mode conversion instructions to implement floor.  */
++/* Use the -inf rounding mode conversion instructions to implement
++   floor.  We note when the exponent is large enough that the value
++   must be integral, as this avoids unpleasant integer overflows.  */
+ 
+ float
+ __floorf (float x)
+ {
+-  float two23 = copysignf (0x1.0p23, x);
+-  float r, tmp;
+-  
+-  __asm (
++  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
++    {
++      /* Note that Alpha S_Floating is stored in registers in a
++	 restricted T_Floating format, so we don't even need to
++	 convert back to S_Floating in the end.  The initial
++	 conversion to T_Floating is needed to handle denormals.  */
++
++      float tmp1, tmp2, new_x;
++
++      __asm ("cvtst/s %3,%2\n\t"
+ #ifdef _IEEE_FP_INEXACT
+-	 "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
++	     "cvttq/svim %2,%1\n\t"
+ #else
+-	 "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
++	     "cvttq/svm %2,%1\n\t"
+ #endif
+-	 : "=&f"(r), "=&f"(tmp)
+-	 : "f"(x), "f"(two23));
++	     "cvtqt/m %1,%0\n\t"
++	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
++	     : "f"(x));
+ 
+-  /* floor(-0) == -0, and in general we'll always have the same
+-     sign as our input.  */
+-  return copysignf (r, x);
++      /* floor(-0) == -0, and in general we'll always have the same
++	 sign as our input.  */
++      x = copysignf(new_x, x);
++    }
++  return x;
+ }
+ 
+ weak_alias (__floorf, floorf)
+--- sysdeps/alpha/fpu/s_rint.c.orig
++++ sysdeps/alpha/fpu/s_rint.c
+@@ -24,15 +24,24 @@
+ double
+ __rint (double x)
+ {
+-  double two52 = copysign (0x1.0p52, x);
+-  double r;
+-  
+-  r = x + two52;
+-  r = r - two52;
++  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
++    {
++      double tmp1, new_x;
++      __asm (
++#ifdef _IEEE_FP_INEXACT
++	     "cvttq/svid %2,%1\n\t"
++#else
++	     "cvttq/svd %2,%1\n\t"
++#endif
++	     "cvtqt/d %1,%0\n\t"
++	     : "=f"(new_x), "=&f"(tmp1)
++	     : "f"(x));
+ 
+-  /* rint(-0.1) == -0, and in general we'll always have the same sign
+-     as our input.  */
+-  return copysign (r, x);
++      /* rint(-0.1) == -0, and in general we'll always have the same
++	 sign as our input.  */
++      x = copysign(new_x, x);
++    }
++  return x;
+ }
+ 
+ weak_alias (__rint, rint)
+--- sysdeps/alpha/fpu/s_rintf.c.orig
++++ sysdeps/alpha/fpu/s_rintf.c
+@@ -23,15 +23,30 @@
+ float
+ __rintf (float x)
+ {
+-  float two23 = copysignf (0x1.0p23, x);
+-  float r;
++  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
++    {
++      /* Note that Alpha S_Floating is stored in registers in a
++	 restricted T_Floating format, so we don't even need to
++	 convert back to S_Floating in the end.  The initial
++	 conversion to T_Floating is needed to handle denormals.  */
+ 
+-  r = x + two23;
+-  r = r - two23;
++      float tmp1, tmp2, new_x;
+ 
+-  /* rint(-0.1) == -0, and in general we'll always have the same sign
+-     as our input.  */
+-  return copysign (r, x);
++      __asm ("cvtst/s %3,%2\n\t"
++#ifdef _IEEE_FP_INEXACT
++	     "cvttq/svid %2,%1\n\t"
++#else
++	     "cvttq/svd %2,%1\n\t"
++#endif
++	     "cvtqt/d %1,%0\n\t"
++	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
++	     : "f"(x));
++
++      /* rint(-0.1) == -0, and in general we'll always have the same
++	 sign as our input.  */
++      x = copysignf(new_x, x);
++    }
++  return x;
+ }
+ 
+ weak_alias (__rintf, rintf)

Modified: glibc-package/branches/glibc-2.7/debian/patches/series
===================================================================
--- glibc-package/branches/glibc-2.7/debian/patches/series	2007-11-16 15:14:44 UTC (rev 2677)
+++ glibc-package/branches/glibc-2.7/debian/patches/series	2007-11-16 22:07:41 UTC (rev 2678)
@@ -50,6 +50,7 @@
 localedata/cvs-locale-ug_CN.diff
 
 alpha/local-gcc4.1.diff -p0
+alpha/submitted-fpu-round.diff -p0
 alpha/submitted-xstat.diff -p0
 alpha/submitted-PTR_MANGLE.diff
 



Reply to: