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

mercurial at gmplib.org mercurial at gmplib.org
Fri Dec 11 18:53:21 CET 2009


details:   /home/hgfiles/gmp/rev/2fea315ddf3e
changeset: 13032:2fea315ddf3e
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Dec 11 17:32:26 2009 +0100
description:
Whitespace cleanup.

details:   /home/hgfiles/gmp/rev/db3be551ff8f
changeset: 13033:db3be551ff8f
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Dec 11 18:52:11 2009 +0100
description:
Tune INV_MULMOD_BNM1_THRESHOLD.

details:   /home/hgfiles/gmp/rev/75e6a9ad2a72
changeset: 13034:75e6a9ad2a72
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Dec 11 18:53:04 2009 +0100
description:
Whitespace cleanup.

diffstat:

 ChangeLog              |   3 +++
 gmp-impl.h             |   4 ++++
 mpn/generic/divexact.c |   2 +-
 mpn/generic/gcdext_1.c |  40 ++++++++++++++++++++--------------------
 tests/mpn/t-bdiv.c     |   2 +-
 tune/tuneup.c          |  36 +++++++++++++++++++-----------------
 6 files changed, 48 insertions(+), 39 deletions(-)

diffs (211 lines):

diff -r 011d123ac389 -r 75e6a9ad2a72 ChangeLog
--- a/ChangeLog	Fri Dec 11 10:29:47 2009 +0100
+++ b/ChangeLog	Fri Dec 11 18:53:04 2009 +0100
@@ -1,5 +1,8 @@
 2009-12-11  Torbjorn Granlund  <tege at gmplib.org>
 
+	* tune/tuneup.c (tune_invert): Tune INV_MULMOD_BNM1_THRESHOLD.
+	* gmp-impl.h: Provide declarations for corresponding threshold var.
+
 	* tests/mpn/t-mulmod_bnm1.c: Avoid a division by zero.
 
 	* configure.in: Set up different paths for different 64-bit sparc
diff -r 011d123ac389 -r 75e6a9ad2a72 gmp-impl.h
--- a/gmp-impl.h	Fri Dec 11 10:29:47 2009 +0100
+++ b/gmp-impl.h	Fri Dec 11 18:53:04 2009 +0100
@@ -4166,6 +4166,10 @@
 #define DC_BDIV_QR_THRESHOLD         dc_bdiv_qr_threshold
 extern mp_size_t                     dc_bdiv_qr_threshold;
 
+#undef  INV_MULMOD_BNM1_THRESHOLD
+#define INV_MULMOD_BNM1_THRESHOLD    inv_mulmod_bnm1_threshold
+extern mp_size_t                     inv_mulmod_bnm1_threshold;
+
 #undef  INV_NEWTON_THRESHOLD
 #define INV_NEWTON_THRESHOLD         inv_newton_threshold
 extern mp_size_t                     inv_newton_threshold;
diff -r 011d123ac389 -r 75e6a9ad2a72 mpn/generic/divexact.c
--- a/mpn/generic/divexact.c	Fri Dec 11 10:29:47 2009 +0100
+++ b/mpn/generic/divexact.c	Fri Dec 11 18:53:04 2009 +0100
@@ -87,7 +87,7 @@
 
   tp = TMP_ALLOC_LIMBS (mpn_bdiv_q_itch (nn, dn));
   mpn_bdiv_q (qp, np, nn, dp, dn, tp);
-  TMP_FREE;  
+  TMP_FREE;
 }
 
 #else
diff -r 011d123ac389 -r 75e6a9ad2a72 mpn/generic/gcdext_1.c
--- a/mpn/generic/gcdext_1.c	Fri Dec 11 10:29:47 2009 +0100
+++ b/mpn/generic/gcdext_1.c	Fri Dec 11 18:53:04 2009 +0100
@@ -71,10 +71,10 @@
 #if GCDEXT_1_BINARY_METHOD == 2
   mp_limb_t det_sign;
 #endif
-  
+
   ASSERT (u > 0);
   ASSERT (v > 0);
-  
+
   count_trailing_zeros (zero_bits, u | v);
   u >>= zero_bits;
   v >>= zero_bits;
@@ -99,8 +99,8 @@
     {
       unsigned count;
       if (u > v)
-        {
-          u -= v;
+	{
+	  u -= v;
 #if USE_ZEROTAB
 	  count = zerotab [u & 0x3f];
 	  u >>= count;
@@ -116,15 +116,15 @@
 	      while (c == 6);
 	    }
 #else
-          count_trailing_zeros (count, u);
-          u >>= count;
+	  count_trailing_zeros (count, u);
+	  u >>= count;
 #endif
-          t0 += t1; t1 <<= count;
-          s0 += s1; s1 <<= count;
-        }
+	  t0 += t1; t1 <<= count;
+	  s0 += s1; s1 <<= count;
+	}
       else
-        {
-          v -= u;
+	{
+	  v -= u;
 #if USE_ZEROTAB
 	  count = zerotab [v & 0x3f];
 	  v >>= count;
@@ -140,12 +140,12 @@
 	      while (c == 6);
 	    }
 #else
-          count_trailing_zeros (count, v);
-          v >>= count;
+	  count_trailing_zeros (count, v);
+	  v >>= count;
 #endif
-          t1 += t0; t0 <<= count;
-          s1 += s0; s0 <<= count;
-        }
+	  t1 += t0; t0 <<= count;
+	  s1 += s0; s0 <<= count;
+	}
       shift += count;
     }
 #else
@@ -203,8 +203,8 @@
       det_sign ^= vgtu;
 
       tx = vgtu & (t0 - t1);
-      sx = vgtu & (s0 - s1); 
-      t0 += t1; 
+      sx = vgtu & (s0 - s1);
+      t0 += t1;
       s0 += s1;
       t1 += tx;
       s1 += sx;
@@ -222,14 +222,14 @@
 #endif
 
   /* Now u = v = g = gcd (u,v). Compute U/g and V/g */
-  ug = t0 + t1; 
+  ug = t0 + t1;
   vg = s0 + s1;
 
   ugh = ug/2 + (ug & 1);
   vgh = vg/2 + (vg & 1);
 
   /* Now ±2^{shift} g = s0 U - t0 V. Get rid of the power of two, using
-     s0 U - t0 V = (s0 + V/g) U - (t0 + U/g) V. */ 
+     s0 U - t0 V = (s0 + V/g) U - (t0 + U/g) V. */
   for (i = 0; i < shift; i++)
     {
       mp_limb_t mask = - ( (s0 | t0) & 1);
diff -r 011d123ac389 -r 75e6a9ad2a72 tests/mpn/t-bdiv.c
--- a/tests/mpn/t-bdiv.c	Fri Dec 11 10:29:47 2009 +0100
+++ b/tests/mpn/t-bdiv.c	Fri Dec 11 18:53:04 2009 +0100
@@ -113,7 +113,7 @@
      FIXME: This probably isn't the right way. */
   itch = mpn_bdiv_qr_itch (MAX_NN + MAX_DN, MAX_DN);
   scratch = TMP_ALLOC_LIMBS (itch);
-			     
+
   for (test = 0; test < count; test++)
     {
       unsigned size_range;
diff -r 011d123ac389 -r 75e6a9ad2a72 tune/tuneup.c
--- a/tune/tuneup.c	Fri Dec 11 10:29:47 2009 +0100
+++ b/tune/tuneup.c	Fri Dec 11 18:53:04 2009 +0100
@@ -168,6 +168,7 @@
 mp_size_t  dc_divappr_q_threshold       = MP_SIZE_T_MAX;
 mp_size_t  dc_bdiv_qr_threshold         = MP_SIZE_T_MAX;
 mp_size_t  dc_bdiv_q_threshold          = MP_SIZE_T_MAX;
+mp_size_t  inv_mulmod_bnm1_threshold    = MP_SIZE_T_MAX;
 mp_size_t  inv_newton_threshold         = MP_SIZE_T_MAX;
 mp_size_t  binv_newton_threshold        = MP_SIZE_T_MAX;
 mp_size_t  redc_1_to_redc_2_threshold   = MP_SIZE_T_MAX;
@@ -1038,27 +1039,28 @@
 void
 tune_invert (void)
 {
-  {
-    static struct param_t  param;
-    param.name = "INV_NEWTON_THRESHOLD";
-    param.function = speed_mpn_invert;
-    param.step_factor = 0.02;
-    param.max_size = 5000;
-    one (&inv_newton_threshold, &param);
-  }
+  static struct param_t  param;
+  param.function = speed_mpn_invert;
+
+  param.name = "INV_NEWTON_THRESHOLD";
+  param.max_size = 500;
+  one (&inv_newton_threshold, &param);
+
+  param.name = "INV_MULMOD_BNM1_THRESHOLD";
+  param.min_size = inv_newton_threshold;
+  param.max_size = 500;
+  one (&inv_mulmod_bnm1_threshold, &param);
 }
 
 void
 tune_binvert (void)
 {
-  {
-    static struct param_t  param;
-    param.name = "BINV_NEWTON_THRESHOLD";
-    param.function = speed_mpn_binvert;
-    param.step_factor = 0.02;
-    param.max_size = 5000;
-    one (&binv_newton_threshold, &param);
-  }
+  static struct param_t  param;
+  param.name = "BINV_NEWTON_THRESHOLD";
+  param.function = speed_mpn_binvert;
+  param.step_factor = 0.02;
+  param.max_size = 5000;
+  one (&binv_newton_threshold, &param);
 }
 
 void
@@ -1906,7 +1908,7 @@
 
   tune_dc_div ();
   tune_dc_bdiv ();
-#if 0
+#if 0				/* enable with new invert.c */
   tune_invert ();
 #endif
   tune_binvert ();


More information about the gmp-commit mailing list