[Gmp-commit] /home/hgfiles/gmp: 2 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Fri May 7 00:41:28 CEST 2010


details:   /home/hgfiles/gmp/rev/ac687a0c7bb2
changeset: 13611:ac687a0c7bb2
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri May 07 00:34:09 2010 +0200
description:
Rewrite Itanium mpn_divrem_2.

details:   /home/hgfiles/gmp/rev/4016f37871e8
changeset: 13612:4016f37871e8
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri May 07 00:41:24 2010 +0200
description:
Clean up some spacing.

diffstat:

 ChangeLog                            |    4 +
 gen-jacobitab.c                      |   10 +-
 gmp-impl.h                           |    6 +-
 mpn/generic/gcd.c                    |    2 +-
 mpn/generic/gcd_subdiv_step.c        |    8 +-
 mpn/generic/gcdext.c                 |    4 +-
 mpn/generic/gcdext_lehmer.c          |   14 +-
 mpn/generic/jacbase.c                |   22 +-
 mpn/generic/jacobi_lehmer.c          |   24 +-
 mpn/ia64/divrem_2.asm                |  422 +++++++++++++++++-----------------
 mpn/pa32/gmp-mparam.h                |    4 +-
 mpn/powerpc64/mode64/invert_limb.asm |    2 +-
 mpz/jacobi.c                         |   96 +++---
 tests/mpz/t-jac.c                    |    8 +-
 tests/refmpz.c                       |    2 +-
 tune/README                          |    2 +-
 16 files changed, 319 insertions(+), 311 deletions(-)

diffs (truncated from 1202 to 300 lines):

diff -r 96bb4ff88d86 -r 4016f37871e8 ChangeLog
--- a/ChangeLog	Thu May 06 17:27:16 2010 +0200
+++ b/ChangeLog	Fri May 07 00:41:24 2010 +0200
@@ -1,3 +1,7 @@
+2010-05-07  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpn/ia64/divrem_2.asm: Complete rewrite.
+
 2010-05-06  Torbjorn Granlund  <tege at gmplib.org>
 
 	* tune/tuneup.c (all): Don't call tune_divrem_2.
diff -r 96bb4ff88d86 -r 4016f37871e8 gen-jacobitab.c
--- a/gen-jacobitab.c	Thu May 06 17:27:16 2010 +0200
+++ b/gen-jacobitab.c	Fri May 07 00:41:24 2010 +0200
@@ -44,7 +44,7 @@
   /* 10 */ { 3, 0 },
   /* 11 */ { 3, 2 },
   /* 12 */ { 3, 3 }, /* d = 0 */
-  
+
 };
 #define JACOBI_A(bits) (decode_table[(bits)>>1].a)
 #define JACOBI_B(bits) (decode_table[(bits)>>1].b)
@@ -56,7 +56,7 @@
 encode (unsigned a, unsigned b, unsigned d)
 {
   unsigned i;
-  
+
   assert (d < 2);
   assert (a < 4);
   assert (b < 4);
@@ -87,7 +87,7 @@
 
       q = bits & 3;
       d = (bits >> 2) & 1;
-      
+
       e = JACOBI_E (bits >> 3);
       a = JACOBI_A (bits >> 3);
       b = JACOBI_B (bits >> 3);
@@ -108,10 +108,10 @@
 	    e ^= (q & (b >> 1)) ^ (q >> 1);
 	  b = (b - q * a) & 3;
 	}
-      
+
       printf("%2d,", (encode (a, b, d) << 1) | e);
     }
   printf("\n");
-  
+
   return 0;
 }
diff -r 96bb4ff88d86 -r 4016f37871e8 gmp-impl.h
--- a/gmp-impl.h	Thu May 06 17:27:16 2010 +0200
+++ b/gmp-impl.h	Fri May 07 00:41:24 2010 +0200
@@ -2835,7 +2835,7 @@
 
 /* This selection may seem backwards.  The reason mpn_mod_1 typically takes
    over for larger sizes is that it uses the mod_1_1 function.  */
-#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse)       	\
+#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse)		\
   (BELOW_THRESHOLD (size, PREINV_MOD_1_TO_MOD_1_THRESHOLD)		\
    ? mpn_preinv_mod_1 (src, size, divisor, inverse)			\
    : mpn_mod_1 (src, size, divisor))
@@ -3770,7 +3770,7 @@
      With constant denominator, the below table lookup is compiled to
 
        C Constant q = 1, constant denominator = 1
-       movzbl table+5(%eax,8), %eax       
+       movzbl table+5(%eax,8), %eax
 
      or
 
@@ -3780,7 +3780,7 @@
      One could maintain the state preshifted 3 bits, to save a shift
      here, but at least on x86, that's no real saving.
   */
-  return bits = jacobi_table[(bits << 3) + (denominator << 2) + q];  
+  return bits = jacobi_table[(bits << 3) + (denominator << 2) + q];
 }
 
 /* Matrix multiplication */
diff -r 96bb4ff88d86 -r 4016f37871e8 mpn/generic/gcd.c
--- a/mpn/generic/gcd.c	Thu May 06 17:27:16 2010 +0200
+++ b/mpn/generic/gcd.c	Fri May 07 00:41:24 2010 +0200
@@ -65,7 +65,7 @@
   MPN_COPY (ctx->gp, gp, gn);
   ctx->gn = gn;
 }
-  
+
 #if GMP_NAIL_BITS > 0
 /* Nail supports should be easy, replacing the sub_ddmmss with nails
  * logic. */
diff -r 96bb4ff88d86 -r 4016f37871e8 mpn/generic/gcd_subdiv_step.c
--- a/mpn/generic/gcd_subdiv_step.c	Thu May 06 17:27:16 2010 +0200
+++ b/mpn/generic/gcd_subdiv_step.c	Fri May 07 00:41:24 2010 +0200
@@ -45,9 +45,9 @@
 
    Otherwise, if d = 0 we have just subtracted a multiple of A from B,
    and if d = 1 we have subtracted a multiple of B from A.
-   
+
    + If A == B after subtraction, G is the gcd, Q is NULL.
-   
+
    + If we get a zero remainder after division, G is the gcd, Q is the
      quotient.
 
@@ -117,9 +117,9 @@
       if (UNLIKELY (c == 0))
 	{
 	  hook (ctx, bp, bn, NULL, 0, swapped);
-	  return 0;	  
+	  return 0;
 	}
-      
+
       hook (ctx, NULL, 0, &one, 1, swapped);
 
       if (c > 0)
diff -r 96bb4ff88d86 -r 4016f37871e8 mpn/generic/gcdext.c
--- a/mpn/generic/gcdext.c	Thu May 06 17:27:16 2010 +0200
+++ b/mpn/generic/gcdext.c	Fri May 07 00:41:24 2010 +0200
@@ -276,7 +276,7 @@
   ctx.gp = gp;
   ctx.up = up;
   ctx.usize = usizep;
-  
+
   {
     /* For the first hgcd call, there are no u updates, and it makes
        some sense to use a different choice for p. */
@@ -370,7 +370,7 @@
 	  ctx.u0 = u0;
 	  ctx.u1 = u1;
 	  ctx.tp = tp + n; /* ualloc */
- 	  ctx.un = un;
+	  ctx.un = un;
 
 	  /* Temporary storage n */
 	  n = mpn_gcd_subdiv_step (ap, bp, n, mpn_gcdext_hook, &ctx, tp);
diff -r 96bb4ff88d86 -r 4016f37871e8 mpn/generic/gcdext_lehmer.c
--- a/mpn/generic/gcdext_lehmer.c	Thu May 06 17:27:16 2010 +0200
+++ b/mpn/generic/gcdext_lehmer.c	Fri May 07 00:41:24 2010 +0200
@@ -37,11 +37,11 @@
 
       MPN_COPY (ctx->gp, gp, gn);
       ctx->gn = gn;
-      
+
       if (d < 0)
 	{
 	  int c;
-      
+
 	  /* Must return the smallest cofactor, +u1 or -u0 */
 	  MPN_CMP (c, ctx->u0, ctx->u1, un);
 	  ASSERT (c != 0 || (un == 1 && ctx->u0[0] == 1 && ctx->u1[0] == 1));
@@ -63,10 +63,10 @@
       mp_ptr u1 = ctx->u1;
 
       ASSERT (d >= 0);
-  
+
       if (d)
 	MP_PTR_SWAP (u0, u1);
-      
+
       qn -= (qp[qn-1] == 0);
 
       /* Update u0 += q  * u1 */
@@ -92,7 +92,7 @@
 	    return;
 
 	  tp = ctx->tp;
-      
+
 	  if (qn > u1n)
 	    mpn_mul (tp, qp, qn, u1, u1n);
 	  else
@@ -105,7 +105,7 @@
 	    cy = mpn_add (u0, tp, u1n, u0, un);
 	  else
 	    cy = mpn_add (u0, u0, un, tp, u1n);
-      
+
 	  un = u1n;
 	}
       u0[un] = cy;
@@ -157,7 +157,7 @@
   ctx.gp = gp;
   ctx.up = up;
   ctx.usize = usize;
-  
+
   /* FIXME: Handle n == 2 differently, after the loop? */
   while (n >= 2)
     {
diff -r 96bb4ff88d86 -r 4016f37871e8 mpn/generic/jacbase.c
--- a/mpn/generic/jacbase.c	Thu May 06 17:27:16 2010 +0200
+++ b/mpn/generic/jacbase.c	Fri May 07 00:41:24 2010 +0200
@@ -72,15 +72,15 @@
 #define PROCESS_TWOS_EVEN               \
   {                                     \
     int  two, mask, shift;              \
-                                        \
+					\
     two = JACOBI_TWO_U_BIT1 (b);        \
     mask = (~a & 2);                    \
     a >>= 1;                            \
-                                        \
+					\
     shift = (~a & 1);                   \
     a >>= shift;                        \
     result_bit1 ^= two ^ (two & mask);  \
-                                        \
+					\
     while ((a & 1) == 0)                \
       {                                 \
 	a >>= 1;                        \
@@ -91,14 +91,14 @@
 #define PROCESS_TWOS_ANY                \
   {                                     \
     int  two, mask, shift;              \
-                                        \
+					\
     two = JACOBI_TWO_U_BIT1 (b);        \
     shift = (~a & 1);                   \
     a >>= shift;                        \
-                                        \
+					\
     mask = shift << 1;                  \
     result_bit1 ^= (two & mask);        \
-                                        \
+					\
     while ((a & 1) == 0)                \
       {                                 \
 	a >>= 1;                        \
@@ -139,7 +139,7 @@
 
   if (a >= b)
     goto a_gt_b;
-      
+
   for (;;)
     {
       result_bit1 ^= JACOBI_RECIP_UU_BIT1 (a, b);
@@ -200,7 +200,7 @@
   a >>= c;
   a >>= 1;
 
-  do 
+  do
     {
       mp_limb_t t = a - b;
       mp_limb_t bgta = LIMB_HIGHBIT_TO_MASK (t);
@@ -210,7 +210,7 @@
 
       /* If b > a, invoke reciprocity */
       bit ^= (bgta & a & b);
-      
+
       /* b <-- min (a, b) */
       b += (bgta & t);
 
@@ -224,9 +224,9 @@
       /* (2/b) = -1 if b = 3 or 5 mod 8 */
       bit ^= c & (b ^ (b >> 1));
       a >>= c;
-    }    
+    }
   while (b > 0);
 
   return 1-2*(bit & 1);
-}  
+}
 #endif /* JACOBI_BASE_METHOD == 4 */
diff -r 96bb4ff88d86 -r 4016f37871e8 mpn/generic/jacobi_lehmer.c
--- a/mpn/generic/jacobi_lehmer.c	Thu May 06 17:27:16 2010 +0200
+++ b/mpn/generic/jacobi_lehmer.c	Fri May 07 00:41:24 2010 +0200
@@ -259,7 +259,7 @@
 
   if ( (bh | bl) == 0)
     return 1 - 2*(bit & 1);
-  
+
   if ( (ah | al) == 0)
     return 0;
 
@@ -271,7 +271,7 @@
     }
   count_trailing_zeros (c, al);
   bit ^= c & (bl ^ (bl >> 1));
-  
+
   c++;
   if (UNLIKELY (c == GMP_NUMB_BITS))


More information about the gmp-commit mailing list