This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch siddhesh/libm-mpa updated. glibc-2.17-167-g983452e


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, siddhesh/libm-mpa has been updated
       via  983452ef2a2dd27666aac460357eb1c88667dd51 (commit)
       via  1451e90dd1e118836eda158a551c2e3646b7add0 (commit)
       via  8a89625f30c49731ba7a7875c280941872f44431 (commit)
       via  b328d82785e0cb7cc11053385a310d33fe881d05 (commit)
       via  1cadc64a0d093c85cc924df6d275264cdd0b2e3b (commit)
       via  0b11c10442d9e650066015a46ac85aac22b79ca0 (commit)
       via  bea815025b96c0e5e10a12348e735c746a886d79 (commit)
       via  0fd266b1cb2bd279cf54eb0f594fd3819303ec9e (commit)
       via  4e6714feb958ef0315cecaa5958a2f17bed7c8a9 (commit)
       via  071c5de261c47662623e1682d814642bd1b774db (commit)
       via  b44b6186b92ed29bbee8d42e2c065f33fa4965fe (commit)
       via  3885365d55a88fcd2f7041320f3f3bab2f895fe5 (commit)
       via  59920cc4272b8edc472996760e2122077c43b07c (commit)
       via  5d07a8cb50946512ae2d7e7bb50274b6544a8442 (commit)
       via  25ed1319b49c50c644984a8963c3eddc7d2587aa (commit)
       via  604e904da2925507d71eb909b5129c0d0d31e028 (commit)
      from  1ec4ecfb7d178e185925dccc7d579a58013dbed8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=983452ef2a2dd27666aac460357eb1c88667dd51

commit 983452ef2a2dd27666aac460357eb1c88667dd51
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Sat Jan 19 00:36:20 2013 +0530

    Use long wherever possible
    
    avoid moves between 32 and 64-bit registers

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 8f3412b..830e157 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -56,10 +56,10 @@ const mp_no mptwo = {1, {1, 2}};
 
 #ifndef NO___ACR
 /* Compare the absolute values of two multiple precision numbers.  */
-int
+long
 __acr (const mp_no *x, const mp_no *y, int p)
 {
-  int i;
+  long i;
 
   if (X[0] == 0 || Y[0] == 0)
     return X[0] - Y[0];
@@ -80,10 +80,11 @@ __acr (const mp_no *x, const mp_no *y, int p)
 /* Copy multiple precision number X into Y.  They could be the same
    number.  */
 void
-__cpy (const mp_no *x, mp_no *y, int p)
+__cpy (const mp_no *x, mp_no *y, int p2)
 {
+  long p = p2;
   EY = EX;
-  for (int i = 0; i <= p; i++)
+  for (long i = 0; i <= p; i++)
     Y[i] = X[i];
 }
 #endif
@@ -92,12 +93,13 @@ __cpy (const mp_no *x, mp_no *y, int p)
 /* Convert a multiple precision number *X into a double precision
    number *Y, normalized case  (|x| >= 2**(-1022))).  */
 static void
-norm (const mp_no *x, double *y, int p)
+norm (const mp_no *x, double *y, int p2)
 {
 #define R  RADIXI
-  int i;
+  long i;
   double c;
   long a, z[5];
+  long p = p2;
 
   if (p < 5)
     {
@@ -162,11 +164,12 @@ norm (const mp_no *x, double *y, int p)
 /* Convert a multiple precision number *X into a double precision
    number *Y, Denormal case  (|x| < 2**(-1022))).  */
 static void
-denorm (const mp_no *x, double *y, int p)
+denorm (const mp_no *x, double *y, int p2)
 {
-  int i, k;
+  long i, k;
   double c;
   long z[5];
+  long p = p2;
 
 #define R  RADIXI
   if (EX < -44 || (EX == -44 && X[1] < TWOPOW(5)))
@@ -289,9 +292,9 @@ __mp_dbl (const mp_no *x, double *y, int p)
    small, the result is truncated.  */
 void
 SECTION
-__dbl_mp (double x, mp_no *y, int p)
+__dbl_mp (double x, mp_no *y, int p2)
 {
-  int i, n;
+  long i, n, p = p2;
 
   /* Sign.  */
   if (x == ZERO)
@@ -330,9 +333,9 @@ __dbl_mp (double x, mp_no *y, int p)
    truncated.  */
 static void
 SECTION
-add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
+add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p2)
 {
-  int i, j, k;
+  long i, j, k, p = p2;
 
   EZ = EX;
 
@@ -377,9 +380,9 @@ add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
    ULP.  */
 static void
 SECTION
-sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
+sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p2)
 {
-  int i, j, k;
+  long i, j, k, p = p2;
 
   EZ = EX;
 
@@ -441,8 +444,9 @@ sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
    ULP.  */
 void
 SECTION
-__add (const mp_no *x, const mp_no *y, mp_no *z, int p)
+__add (const mp_no *x, const mp_no *y, mp_no *z, int p2)
 {
+  long p = p2;
   if (X[0] == 0)
     {
       __cpy (y, z, p);
@@ -454,7 +458,7 @@ __add (const mp_no *x, const mp_no *y, mp_no *z, int p)
       return;
     }
 
-  int n = __acr (x, y, p);
+  long n = __acr (x, y, p);
 
   if (X[0] == Y[0])
     {
@@ -491,8 +495,9 @@ __add (const mp_no *x, const mp_no *y, mp_no *z, int p)
    one ULP.  */
 void
 SECTION
-__sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
+__sub (const mp_no *x, const mp_no *y, mp_no *z, int p2)
 {
+  long p = p2;
   if (X[0] == 0)
     {
       __cpy (y, z, p);
@@ -505,7 +510,7 @@ __sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
       return;
     }
 
-  int n = __acr (x, y, p);
+  long n = __acr (x, y, p);
 
   if (X[0] != Y[0])
     {
@@ -542,9 +547,9 @@ __sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
    digits.  In case P > 3 the error is bounded by 1.001 ULP.  */
 void
 SECTION
-__mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
+__mul (const mp_no *x, const mp_no *y, mp_no *z, int p2)
 {
-  int i, j, k, ip, ip2;
+  long i, j, k, ip, ip2, p = p2;
   int64_t zk;
   int64_t *diag;
 
@@ -659,9 +664,9 @@ __mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
    *X = 0 is not permissible.  */
 static void
 SECTION
-__inv (const mp_no *x, mp_no *y, int p)
+__inv (const mp_no *x, mp_no *y, int p2)
 {
-  int i;
+  long i, p = p2;
   double t;
   mp_no z, w;
   static const int np1[] =
diff --git a/sysdeps/ieee754/dbl-64/mpa.h b/sysdeps/ieee754/dbl-64/mpa.h
index f92bcc1..3185299 100644
--- a/sysdeps/ieee754/dbl-64/mpa.h
+++ b/sysdeps/ieee754/dbl-64/mpa.h
@@ -111,7 +111,7 @@ extern const mp_no mptwo;
 #define  MHALF     -0x1.0p-1		/* -1/2 */
 #define  HALFRAD   0x1.0p23		/* 2^23 */
 
-int __acr (const mp_no *, const mp_no *, int);
+long __acr (const mp_no *, const mp_no *, int);
 void __cpy (const mp_no *, mp_no *, int);
 void __mp_dbl (const mp_no *, double *, int);
 void __dbl_mp (double, mp_no *, int);

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1451e90dd1e118836eda158a551c2e3646b7add0

commit 1451e90dd1e118836eda158a551c2e3646b7add0
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Sat Jan 19 00:28:41 2013 +0530

    Use __glibc_unlikely

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index daf6acd..8f3412b 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -247,7 +247,7 @@ denorm (const mp_no *x, double *y, int p)
     }
 
   /* z[3] is a multiple of 2^5.  */
-  if (__builtin_expect ((z[3] & (TWOPOW(5) - 1)) == 0, 0))
+  if (__glibc_unlikely ((z[3] & (TWOPOW(5) - 1)) == 0))
     {
       for (i = k + 1; i <= p; i++)
 	{

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8a89625f30c49731ba7a7875c280941872f44431

commit 8a89625f30c49731ba7a7875c280941872f44431
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Sat Jan 19 00:27:39 2013 +0530

    Eliminate mcr

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 9fd866e..daf6acd 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -55,34 +55,24 @@ const mp_no mptwo = {1, {1, 2}};
 #endif
 
 #ifndef NO___ACR
-/* Compare mantissa of two multiple precision numbers regardless of the sign
-   and exponent of the numbers.  */
-static int
-mcr (const mp_no *x, const mp_no *y, int p)
-{
-  int i;
-  for (i = 1; i <= p; i++)
-    {
-      if (X[i] == Y[i])
-	continue;
-      else if (X[i] > Y[i])
-	return 1;
-      else
-	return -1;
-    }
-  return 0;
-}
-
 /* Compare the absolute values of two multiple precision numbers.  */
 int
 __acr (const mp_no *x, const mp_no *y, int p)
 {
+  int i;
+
   if (X[0] == 0 || Y[0] == 0)
     return X[0] - Y[0];
   else if (EX != EY)
     return EX - EY;
   else
-    return mcr (x, y, p);
+    for (i = 1; i <= p; i++)
+      {
+        if (X[i] != Y[i])
+          return (X[i] - Y[i]);
+      }
+
+  return 0;
 }
 #endif
 

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b328d82785e0cb7cc11053385a310d33fe881d05

commit b328d82785e0cb7cc11053385a310d33fe881d05
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Sat Jan 19 00:19:00 2013 +0530

    Clean up __acr

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index cde571f..9fd866e 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -77,28 +77,12 @@ mcr (const mp_no *x, const mp_no *y, int p)
 int
 __acr (const mp_no *x, const mp_no *y, int p)
 {
-  int i;
-
-  if (X[0] == 0)
-    {
-      if (Y[0] == 0)
-	i = 0;
-      else
-	i = -1;
-    }
-  else if (Y[0] == 0)
-    i = 1;
+  if (X[0] == 0 || Y[0] == 0)
+    return X[0] - Y[0];
+  else if (EX != EY)
+    return EX - EY;
   else
-    {
-      if (EX > EY)
-	i = 1;
-      else if (EX < EY)
-	i = -1;
-      else
-	i = mcr (x, y, p);
-    }
-
-  return i;
+    return mcr (x, y, p);
 }
 #endif
 
@@ -469,8 +453,6 @@ void
 SECTION
 __add (const mp_no *x, const mp_no *y, mp_no *z, int p)
 {
-  int n;
-
   if (X[0] == 0)
     {
       __cpy (y, z, p);
@@ -482,9 +464,11 @@ __add (const mp_no *x, const mp_no *y, mp_no *z, int p)
       return;
     }
 
+  int n = __acr (x, y, p);
+
   if (X[0] == Y[0])
     {
-      if (__acr (x, y, p) > 0)
+      if (n > 0)
 	{
 	  add_magnitudes (x, y, z, p);
 	  Z[0] = X[0];
@@ -497,12 +481,12 @@ __add (const mp_no *x, const mp_no *y, mp_no *z, int p)
     }
   else
     {
-      if ((n = __acr (x, y, p)) == 1)
+      if (n > 0)
 	{
 	  sub_magnitudes (x, y, z, p);
 	  Z[0] = X[0];
 	}
-      else if (n == -1)
+      else if (n < 0)
 	{
 	  sub_magnitudes (y, x, z, p);
 	  Z[0] = Y[0];
@@ -519,8 +503,6 @@ void
 SECTION
 __sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
 {
-  int n;
-
   if (X[0] == 0)
     {
       __cpy (y, z, p);
@@ -533,9 +515,11 @@ __sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
       return;
     }
 
+  int n = __acr (x, y, p);
+
   if (X[0] != Y[0])
     {
-      if (__acr (x, y, p) > 0)
+      if (n > 0)
 	{
 	  add_magnitudes (x, y, z, p);
 	  Z[0] = X[0];
@@ -548,12 +532,12 @@ __sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
     }
   else
     {
-      if ((n = __acr (x, y, p)) == 1)
+      if (n > 0)
 	{
 	  sub_magnitudes (x, y, z, p);
 	  Z[0] = X[0];
 	}
-      else if (n == -1)
+      else if (n < 0)
 	{
 	  sub_magnitudes (y, x, z, p);
 	  Z[0] = -Y[0];

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1cadc64a0d093c85cc924df6d275264cdd0b2e3b

commit 1cadc64a0d093c85cc924df6d275264cdd0b2e3b
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Sat Jan 19 00:07:02 2013 +0530

    Make intermediates long
    
    Avoids moves from larger to smaller registers or the other way around.

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index d4abeee..cde571f 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -123,7 +123,7 @@ norm (const mp_no *x, double *y, int p)
 #define R  RADIXI
   int i;
   double c;
-  int a, z[5];
+  long a, z[5];
 
   if (p < 5)
     {
@@ -192,7 +192,7 @@ denorm (const mp_no *x, double *y, int p)
 {
   int i, k;
   double c;
-  int z[5];
+  long z[5];
 
 #define R  RADIXI
   if (EX < -44 || (EX == -44 && X[1] < TWOPOW(5)))
@@ -376,14 +376,14 @@ add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
 
   for (; j > 0; i--, j--)
     {
-      int tmp = Z[k] + X[i] + Y[j];
+      long tmp = Z[k] + X[i] + Y[j];
       Z[k] = tmp % I_RADIX;
       Z[--k] = tmp / I_RADIX;
     }
 
   for (; i > 0; i--)
     {
-      int tmp = Z[k] + X[i];
+      long tmp = Z[k] + X[i];
       Z[k] = tmp % I_RADIX;
       Z[--k] = tmp / I_RADIX;
     }
@@ -424,7 +424,7 @@ sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
 	}
       else
 	{
-	  int tmp;
+	  long tmp;
 
 	  i = p;
 	  j = p + 1 - j;
@@ -439,7 +439,7 @@ sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
 
   for (; j > 0; i--, j--)
     {
-      int tmp = I_RADIX + Z[k] + X[i] - Y[j];
+      long tmp = I_RADIX + Z[k] + X[i] - Y[j];
 
       Z[k] = tmp % I_RADIX;
       Z[--k] = tmp / I_RADIX - 1;
@@ -447,7 +447,7 @@ sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
 
   for (; i > 0; i--)
     {
-      int tmp = I_RADIX + Z[k] + X[i];
+      long tmp = I_RADIX + Z[k] + X[i];
 
       Z[k] = tmp % I_RADIX;
       Z[--k] = tmp / I_RADIX - 1;

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0b11c10442d9e650066015a46ac85aac22b79ca0

commit 0b11c10442d9e650066015a46ac85aac22b79ca0
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:58:51 2013 +0530

    Fix constants

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 6377ee9..d4abeee 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -50,8 +50,8 @@
 #endif
 
 #ifndef NO__CONST
-const mp_no mpone = {1, {1.0, 1.0}};
-const mp_no mptwo = {1, {1.0, 2.0}};
+const mp_no mpone = {1, {1, 1}};
+const mp_no mptwo = {1, {1, 2}};
 #endif
 
 #ifndef NO___ACR

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bea815025b96c0e5e10a12348e735c746a886d79

commit bea815025b96c0e5e10a12348e735c746a886d79
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:58:02 2013 +0530

    denorm is now all-integer

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 6613bd2..6377ee9 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -191,10 +191,11 @@ static void
 denorm (const mp_no *x, double *y, int p)
 {
   int i, k;
-  double c, u, z[5];
+  double c;
+  int z[5];
 
 #define R  RADIXI
-  if (EX < -44 || (EX == -44 && X[1] < TWO5))
+  if (EX < -44 || (EX == -44 && X[1] < TWOPOW(5)))
     {
       *y = ZERO;
       return;
@@ -204,22 +205,22 @@ denorm (const mp_no *x, double *y, int p)
     {
       if (EX == -42)
 	{
-	  z[1] = X[1] + TWO10;
-	  z[2] = ZERO;
-	  z[3] = ZERO;
+	  z[1] = X[1] + TWOPOW(10);
+	  z[2] = 0;
+	  z[3] = 0;
 	  k = 3;
 	}
       else if (EX == -43)
 	{
-	  z[1] = TWO10;
+	  z[1] = TWOPOW(10);
 	  z[2] = X[1];
-	  z[3] = ZERO;
+	  z[3] = 0;
 	  k = 2;
 	}
       else
 	{
-	  z[1] = TWO10;
-	  z[2] = ZERO;
+	  z[1] = TWOPOW(10);
+	  z[2] = 0;
 	  z[3] = X[1];
 	  k = 1;
 	}
@@ -228,22 +229,22 @@ denorm (const mp_no *x, double *y, int p)
     {
       if (EX == -42)
 	{
-	  z[1] = X[1] + TWO10;
+	  z[1] = X[1] + TWOPOW(10);
 	  z[2] = X[2];
-	  z[3] = ZERO;
+	  z[3] = 0;
 	  k = 3;
 	}
       else if (EX == -43)
 	{
-	  z[1] = TWO10;
+	  z[1] = TWOPOW(10);
 	  z[2] = X[1];
 	  z[3] = X[2];
 	  k = 2;
 	}
       else
 	{
-	  z[1] = TWO10;
-	  z[2] = ZERO;
+	  z[1] = TWOPOW(10);
+	  z[2] = 0;
 	  z[3] = X[1];
 	  k = 1;
 	}
@@ -252,44 +253,41 @@ denorm (const mp_no *x, double *y, int p)
     {
       if (EX == -42)
 	{
-	  z[1] = X[1] + TWO10;
+	  z[1] = X[1] + TWOPOW(10);
 	  z[2] = X[2];
 	  k = 3;
 	}
       else if (EX == -43)
 	{
-	  z[1] = TWO10;
+	  z[1] = TWOPOW(10);
 	  z[2] = X[1];
 	  k = 2;
 	}
       else
 	{
-	  z[1] = TWO10;
-	  z[2] = ZERO;
+	  z[1] = TWOPOW(10);
+	  z[2] = 0;
 	  k = 1;
 	}
       z[3] = X[k];
     }
 
-  u = (z[3] + TWO57) - TWO57;
-  if (u > z[3])
-    u -= TWO5;
-
-  if (u == z[3])
+  /* z[3] is a multiple of 2^5.  */
+  if (__builtin_expect ((z[3] & (TWOPOW(5) - 1)) == 0, 0))
     {
       for (i = k + 1; i <= p; i++)
 	{
-	  if (X[i] == ZERO)
+	  if (X[i] == 0)
 	    continue;
 	  else
 	    {
-	      z[3] += ONE;
+	      z[3]++;
 	      break;
 	    }
 	}
     }
 
-  c = X[0] * ((z[1] + R * (z[2] + R * z[3])) - TWO10);
+  c = X[0] * ((z[1] + R * (z[2] + R * z[3])) - TWOPOW(10));
 
   *y = c * TWOM1032;
 #undef R

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0fd266b1cb2bd279cf54eb0f594fd3819303ec9e

commit 0fd266b1cb2bd279cf54eb0f594fd3819303ec9e
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:57:20 2013 +0530

    norm is all-integer until it needs to convert to double

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 31e00b5..6613bd2 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -122,7 +122,9 @@ norm (const mp_no *x, double *y, int p)
 {
 #define R  RADIXI
   int i;
-  double a, c, u, v, z[5];
+  double c;
+  int a, z[5];
+
   if (p < 5)
     {
       if (p == 1)
@@ -136,44 +138,37 @@ norm (const mp_no *x, double *y, int p)
     }
   else
     {
-      for (a = ONE, z[1] = X[1]; z[1] < TWO23;)
+      for (a = 1, z[1] = X[1]; z[1] < TWOPOW(23); )
 	{
-	  a *= TWO;
-	  z[1] *= TWO;
+	  a *= 2;
+	  z[1] *= 2;
 	}
 
       for (i = 2; i < 5; i++)
 	{
-	  z[i] = X[i] * a;
-	  u = (z[i] + CUTTER) - CUTTER;
-	  if (u > z[i])
-	    u -= RADIX;
-	  z[i] -= u;
-	  z[i - 1] += u * RADIXI;
-	}
+	  int64_t tmp = (int64_t) X[i] * a;
 
-      u = (z[3] + TWO71) - TWO71;
-      if (u > z[3])
-	u -= TWO19;
-      v = z[3] - u;
+	  z[i] = tmp % I_RADIX;
+	  z[i-1] += tmp / I_RADIX;
+	}
 
-      if (v == TWO18)
+      if (__glibc_unlikely ((z[3] & (TWOPOW(18) - 1)) == 0))
 	{
-	  if (z[4] == ZERO)
+	  if (z[4] == 0)
 	    {
 	      for (i = 5; i <= p; i++)
 		{
-		  if (X[i] == ZERO)
+		  if (X[i] == 0)
 		    continue;
 		  else
 		    {
-		      z[3] += ONE;
+		      z[3]++;
 		      break;
 		    }
 		}
 	    }
 	  else
-	    z[3] += ONE;
+	    z[3]++;
 	}
 
       c = (z[1] + R * (z[2] + R * z[3])) / a;

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4e6714feb958ef0315cecaa5958a2f17bed7c8a9

commit 4e6714feb958ef0315cecaa5958a2f17bed7c8a9
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:55:02 2013 +0530

    Make __mul all-integer

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 7dc4d62..31e00b5 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -582,21 +582,21 @@ __mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
   int64_t *diag;
 
   /* Is z=0?  */
-  if (__glibc_unlikely (X[0] * Y[0] == ZERO))
+  if (__glibc_unlikely (X[0] * Y[0] == 0))
     {
-      Z[0] = ZERO;
+      Z[0] = 0;
       return;
     }
 
   /* We need not iterate through all X's and Y's since it's pointless to
      multiply zeroes.  Here, both are zero...  */
   for (ip2 = p; ip2 > 0; ip2--)
-    if (X[ip2] != ZERO || Y[ip2] != ZERO)
+    if (X[ip2] | Y[ip2])
       break;
 
   /* ... and here, at least one of them is still zero.  */
   for (ip = ip2; ip > 0; ip--)
-    if (X[ip] * Y[ip] != ZERO)
+    if (X[ip] * Y[ip])
       break;
 
   /* Multiply, add and carry.  */
@@ -607,9 +607,9 @@ __mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
      only for values of K <= IP + IP2.  Note that we go from 1..K-1, which is
      why we come down to IP + IP2 + 1 and not just IP + IP2.  */
   while (k > ip + ip2 + 1)
-    Z[k--] = ZERO;
+    Z[k--] = 0;
 
-  zk = Z[k] = ZERO;
+  zk = Z[k] = 0;
 
   /* This gives us additional precision if required.  This is only executed
      when P < IP1 + IP2 + 1, i.e. at least one of the numbers have precision
@@ -628,7 +628,7 @@ __mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
   /* Precompute sums of diagonal elements so that we can directly use them
      later.  See the next comment to know we why need them.  */
   diag = alloca (k * sizeof (int64_t));
-  diag[0] = ZERO;
+  diag[0] = 0;
   for (i = 1; i <= ip; i++)
     {
       diag[i] = X[i] * Y[i];
@@ -674,7 +674,7 @@ __mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
 
   EZ = EX + EY;
   /* Is there a carry beyond the most significant digit?  */
-  if (__glibc_unlikely (Z[1] == ZERO))
+  if (__glibc_unlikely (Z[1] == 0))
     {
       for (i = 1; i <= p; i++)
 	Z[i] = Z[i + 1];

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=071c5de261c47662623e1682d814642bd1b774db

commit 071c5de261c47662623e1682d814642bd1b774db
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:34:36 2013 +0530

    Make __add and __sub all-integer

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index fc98955..7dc4d62 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -478,12 +478,12 @@ __add (const mp_no *x, const mp_no *y, mp_no *z, int p)
 {
   int n;
 
-  if (X[0] == ZERO)
+  if (X[0] == 0)
     {
       __cpy (y, z, p);
       return;
     }
-  else if (Y[0] == ZERO)
+  else if (Y[0] == 0)
     {
       __cpy (x, z, p);
       return;
@@ -515,7 +515,7 @@ __add (const mp_no *x, const mp_no *y, mp_no *z, int p)
 	  Z[0] = Y[0];
 	}
       else
-	Z[0] = ZERO;
+	Z[0] = 0;
     }
 }
 
@@ -528,13 +528,13 @@ __sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
 {
   int n;
 
-  if (X[0] == ZERO)
+  if (X[0] == 0)
     {
       __cpy (y, z, p);
       Z[0] = -Z[0];
       return;
     }
-  else if (Y[0] == ZERO)
+  else if (Y[0] == 0)
     {
       __cpy (x, z, p);
       return;
@@ -566,7 +566,7 @@ __sub (const mp_no *x, const mp_no *y, mp_no *z, int p)
 	  Z[0] = -Y[0];
 	}
       else
-	Z[0] = ZERO;
+	Z[0] = 0;
     }
 }
 

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b44b6186b92ed29bbee8d42e2c065f33fa4965fe

commit b44b6186b92ed29bbee8d42e2c065f33fa4965fe
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:33:23 2013 +0530

    Make sub_magnitudes all-integer

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 9051f88..fc98955 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -419,7 +419,7 @@ sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
   if (EX == EY)
     {
       i = j = k = p;
-      Z[k] = Z[k + 1] = ZERO;
+      Z[k] = Z[k + 1] = 0;
     }
   else
     {
@@ -431,53 +431,42 @@ sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
 	}
       else
 	{
+	  int tmp;
+
 	  i = p;
 	  j = p + 1 - j;
 	  k = p;
-	  if (Y[j] > ZERO)
-	    {
-	      Z[k + 1] = RADIX - Y[j--];
-	      Z[k] = MONE;
-	    }
-	  else
-	    {
-	      Z[k + 1] = ZERO;
-	      Z[k] = ZERO;
-	      j--;
-	    }
+
+	  tmp = I_RADIX - Y[j];
+	  Z[k + 1] = tmp % I_RADIX;
+	  Z[k] = tmp / I_RADIX - 1;
+	  j--;
 	}
     }
 
   for (; j > 0; i--, j--)
     {
-      Z[k] += (X[i] - Y[j]);
-      if (Z[k] < ZERO)
-	{
-	  Z[k] += RADIX;
-	  Z[--k] = MONE;
-	}
-      else
-	Z[--k] = ZERO;
+      int tmp = I_RADIX + Z[k] + X[i] - Y[j];
+
+      Z[k] = tmp % I_RADIX;
+      Z[--k] = tmp / I_RADIX - 1;
     }
 
   for (; i > 0; i--)
     {
-      Z[k] += X[i];
-      if (Z[k] < ZERO)
-	{
-	  Z[k] += RADIX;
-	  Z[--k] = MONE;
-	}
-      else
-	Z[--k] = ZERO;
+      int tmp = I_RADIX + Z[k] + X[i];
+
+      Z[k] = tmp % I_RADIX;
+      Z[--k] = tmp / I_RADIX - 1;
     }
 
-  for (i = 1; Z[i] == ZERO; i++);
+  for (i = 1; Z[i] == 0; i++);
+
   EZ = EZ - i + 1;
   for (k = 1; i <= p + 1;)
     Z[k++] = Z[i++];
   for (; k <= p;)
-    Z[k++] = ZERO;
+    Z[k++] = 0;
 }
 
 /* Add *X and *Y and store the result in *Z.  X and Y may overlap, but not X

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3885365d55a88fcd2f7041320f3f3bab2f895fe5

commit 3885365d55a88fcd2f7041320f3f3bab2f895fe5
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:32:18 2013 +0530

    define TWOPOW

diff --git a/sysdeps/ieee754/dbl-64/mpa.h b/sysdeps/ieee754/dbl-64/mpa.h
index 6f8efb3..f92bcc1 100644
--- a/sysdeps/ieee754/dbl-64/mpa.h
+++ b/sysdeps/ieee754/dbl-64/mpa.h
@@ -81,6 +81,7 @@ extern const mp_no mptwo;
 #define  EZ  z->e
 
 #define ABS(x)   ((x) <  0  ? -(x) : (x))
+#define TWOPOW(x)  (1 << x)
 
 #define I_RADIX    (1 << 24)		/* 2^24 */
 

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=59920cc4272b8edc472996760e2122077c43b07c

commit 59920cc4272b8edc472996760e2122077c43b07c
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:30:52 2013 +0530

    Make add_magnitudes an all-integer operation

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 5b68c01..9051f88 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -79,14 +79,14 @@ __acr (const mp_no *x, const mp_no *y, int p)
 {
   int i;
 
-  if (X[0] == ZERO)
+  if (X[0] == 0)
     {
-      if (Y[0] == ZERO)
+      if (Y[0] == 0)
 	i = 0;
       else
 	i = -1;
     }
-  else if (Y[0] == ZERO)
+  else if (Y[0] == 0)
     i = 1;
   else
     {
@@ -379,39 +379,29 @@ add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p)
       return;
     }
   else
-    Z[k] = ZERO;
+    Z[k] = 0;
 
   for (; j > 0; i--, j--)
     {
-      Z[k] += X[i] + Y[j];
-      if (Z[k] >= RADIX)
-	{
-	  Z[k] -= RADIX;
-	  Z[--k] = ONE;
-	}
-      else
-	Z[--k] = ZERO;
+      int tmp = Z[k] + X[i] + Y[j];
+      Z[k] = tmp % I_RADIX;
+      Z[--k] = tmp / I_RADIX;
     }
 
   for (; i > 0; i--)
     {
-      Z[k] += X[i];
-      if (Z[k] >= RADIX)
-	{
-	  Z[k] -= RADIX;
-	  Z[--k] = ONE;
-	}
-      else
-	Z[--k] = ZERO;
+      int tmp = Z[k] + X[i];
+      Z[k] = tmp % I_RADIX;
+      Z[--k] = tmp / I_RADIX;
     }
 
-  if (Z[1] == ZERO)
+  if (Z[1] == 0)
     {
       for (i = 1; i <= p; i++)
 	Z[i] = Z[i + 1];
     }
   else
-    EZ += ONE;
+    EZ++;
 }
 
 /* Subtract the magnitudes of *X and *Y assuming that abs (*x) > abs (*y) > 0.

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5d07a8cb50946512ae2d7e7bb50274b6544a8442

commit 5d07a8cb50946512ae2d7e7bb50274b6544a8442
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:29:32 2013 +0530

    Make __dvd integer-only

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index c4e7351..5b68c01 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -752,8 +752,8 @@ __dvd (const mp_no *x, const mp_no *y, mp_no *z, int p)
 {
   mp_no w;
 
-  if (X[0] == ZERO)
-    Z[0] = ZERO;
+  if (X[0] == 0)
+    Z[0] = 0;
   else
     {
       __inv (y, &w, p);

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=25ed1319b49c50c644984a8963c3eddc7d2587aa

commit 25ed1319b49c50c644984a8963c3eddc7d2587aa
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:28:44 2013 +0530

    Make __mp_dbl integer-only

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 21403d9..c4e7351 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -305,13 +305,13 @@ denorm (const mp_no *x, double *y, int p)
 void
 __mp_dbl (const mp_no *x, double *y, int p)
 {
-  if (X[0] == ZERO)
+  if (X[0] == 0)
     {
       *y = ZERO;
       return;
     }
 
-  if (__glibc_likely (EX > -42 || (EX == -42 && X[1] >= TWO10)))
+  if (__glibc_likely (EX > -42 || (EX == -42 && X[1] >= TWOPOW(10))))
     norm (x, y, p);
   else
     denorm (x, y, p);

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=604e904da2925507d71eb909b5129c0d0d31e028

commit 604e904da2925507d71eb909b5129c0d0d31e028
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jan 18 23:26:38 2013 +0530

    Simplify __dbl_mp

diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index f9fe941..21403d9 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -325,41 +325,36 @@ SECTION
 __dbl_mp (double x, mp_no *y, int p)
 {
   int i, n;
-  double u;
 
   /* Sign.  */
   if (x == ZERO)
     {
-      Y[0] = ZERO;
+      Y[0] = 0;
       return;
     }
   else if (x > ZERO)
-    Y[0] = ONE;
+    Y[0] = 1;
   else
     {
-      Y[0] = MONE;
+      Y[0] = -1;
       x = -x;
     }
 
   /* Exponent.  */
-  for (EY = ONE; x >= RADIX; EY += ONE)
+  for (EY = 1; x >= RADIX; EY++)
     x *= RADIXI;
-  for (; x < ONE; EY -= ONE)
+  for (; x < ONE; EY--)
     x *= RADIX;
 
   /* Digits.  */
   n = MIN (p, 4);
   for (i = 1; i <= n; i++)
     {
-      u = (x + TWO52) - TWO52;
-      if (u > x)
-	u -= ONE;
-      Y[i] = u;
-      x -= u;
-      x *= RADIX;
+      Y[i] = x;
+      x = (x - Y[i]) * RADIX;
     }
   for (; i <= p; i++)
-    Y[i] = ZERO;
+    Y[i] = 0;
 }
 
 /* Add magnitudes of *X and *Y assuming that abs (*X) >= abs (*Y) > 0.  The

-----------------------------------------------------------------------

Summary of changes:
 sysdeps/ieee754/dbl-64/mpa.c |  334 ++++++++++++++++++------------------------
 sysdeps/ieee754/dbl-64/mpa.h |    3 +-
 2 files changed, 142 insertions(+), 195 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]