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

mercurial at gmplib.org mercurial at gmplib.org
Mon Dec 14 20:16:09 CET 2009


details:   /home/hgfiles/gmp/rev/4a1071462bf4
changeset: 13075:4a1071462bf4
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Dec 14 20:00:36 2009 +0100
description:
Retune.

details:   /home/hgfiles/gmp/rev/9f43674c7499
changeset: 13076:9f43674c7499
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Dec 14 20:16:04 2009 +0100
description:
Remove BINV_MULMOD_BNM1_THRESHOLD again.

diffstat:

 ChangeLog                             |   7 +++++++
 gmp-impl.h                            |   4 ----
 mpn/alpha/ev6/gmp-mparam.h            |   1 -
 mpn/generic/binvert.c                 |  19 +++++--------------
 mpn/sparc64/gmp-mparam.h              |   2 +-
 mpn/sparc64/ultrasparc34/gmp-mparam.h |   1 -
 mpn/x86_64/gmp-mparam.h               |   2 +-
 tune/tuneup.c                         |  16 +++-------------
 8 files changed, 17 insertions(+), 35 deletions(-)

diffs (158 lines):

diff -r 47b27ccf9a34 -r 9f43674c7499 ChangeLog
--- a/ChangeLog	Mon Dec 14 17:31:58 2009 +0100
+++ b/ChangeLog	Mon Dec 14 20:16:04 2009 +0100
@@ -1,3 +1,10 @@
+2009-12-14  Torbjorn Granlund  <tege at gmplib.org>
+
+	* tune/tuneup.c (tune_binvert): Remove BINV_MULMOD_BNM1_THRESHOLD
+	tuning, it was always zero and caused BINV_NEWTON_THRESHOLD to be
+	wrong (as pointed out by Marco).
+	* (BINV_MULMOD_BNM1_THRESHOLD): Clean from other files too.
+
 2009-12-14  Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpn/generic/invert.c: Improved comments.
diff -r 47b27ccf9a34 -r 9f43674c7499 gmp-impl.h
--- a/gmp-impl.h	Mon Dec 14 17:31:58 2009 +0100
+++ b/gmp-impl.h	Mon Dec 14 20:16:04 2009 +0100
@@ -4216,10 +4216,6 @@
 #define INV_APPR_THRESHOLD           inv_appr_threshold
 extern mp_size_t                     inv_appr_threshold;
 
-#undef  BINV_MULMOD_BNM1_THRESHOLD
-#define BINV_MULMOD_BNM1_THRESHOLD   binv_mulmod_bnm1_threshold
-extern mp_size_t                     binv_mulmod_bnm1_threshold;
-
 #undef  BINV_NEWTON_THRESHOLD
 #define BINV_NEWTON_THRESHOLD        binv_newton_threshold
 extern mp_size_t                     binv_newton_threshold;
diff -r 47b27ccf9a34 -r 9f43674c7499 mpn/alpha/ev6/gmp-mparam.h
--- a/mpn/alpha/ev6/gmp-mparam.h	Mon Dec 14 17:31:58 2009 +0100
+++ b/mpn/alpha/ev6/gmp-mparam.h	Mon Dec 14 20:16:04 2009 +0100
@@ -55,7 +55,6 @@
 #define DC_BDIV_QR_THRESHOLD            110
 #define DC_BDIV_Q_THRESHOLD             315
 #define BINV_NEWTON_THRESHOLD          1160
-#define BINV_MULMOD_BNM1_THRESHOLD        0  /* always when newton */
 #define REDC_1_TO_REDC_N_THRESHOLD      110
 
 #define MATRIX22_STRASSEN_THRESHOLD      16
diff -r 47b27ccf9a34 -r 9f43674c7499 mpn/generic/binvert.c
--- a/mpn/generic/binvert.c	Mon Dec 14 17:31:58 2009 +0100
+++ b/mpn/generic/binvert.c	Mon Dec 14 20:16:04 2009 +0100
@@ -44,9 +44,6 @@
 #define NPOWS \
  ((sizeof(mp_size_t) > 6 ? 48 : 8*sizeof(mp_size_t)))
 #else
-#ifndef BINV_MULMOD_BNM1_THRESHOLD
-#define BINV_MULMOD_BNM1_THRESHOLD 0 /* presumably always 0 */
-#endif
 #define NPOWS \
  ((sizeof(mp_size_t) > 6 ? 48 : 8*sizeof(mp_size_t)) - LOG2C (BINV_NEWTON_THRESHOLD))
 #endif
@@ -87,20 +84,14 @@
   /* Use Newton iterations to get the desired precision.  */
   for (; rn < n; rn = newrn)
     {
+      mp_size_t m;
       newrn = *--sizp;
 
       /* X <- UR. */
-      if (ABOVE_THRESHOLD (newrn, BINV_MULMOD_BNM1_THRESHOLD))
-	{
-	  mp_size_t m;
-	  m = mpn_mulmod_bnm1_next_size (newrn);
-	  mpn_mulmod_bnm1 (xp, m, up, newrn, rp, rn, xp + m);
-	  mpn_sub_1 (xp + m, xp, rn - (m - newrn), 1);
-	}
-      else
-	{
-	  mpn_mul (xp, up, newrn, rp, rn);
-	}
+      m = mpn_mulmod_bnm1_next_size (newrn);
+      mpn_mulmod_bnm1 (xp, m, up, newrn, rp, rn, xp + m);
+      mpn_sub_1 (xp + m, xp, rn - (m - newrn), 1);
+
       /* R = R(X/B^rn) */
       mpn_mullo_n (rp + rn, rp, xp + rn, newrn - rn);
       mpn_neg_n (rp + rn, rp + rn, newrn - rn);
diff -r 47b27ccf9a34 -r 9f43674c7499 mpn/sparc64/gmp-mparam.h
--- a/mpn/sparc64/gmp-mparam.h	Mon Dec 14 17:31:58 2009 +0100
+++ b/mpn/sparc64/gmp-mparam.h	Mon Dec 14 20:16:04 2009 +0100
@@ -48,7 +48,7 @@
 
 #define MULMOD_BNM1_THRESHOLD            16
 
-#define DC_DIV_QR_THRESHOLD              26
+#define DC_DIV_QR_THRESHOLD              20
 #define DC_DIVAPPR_Q_THRESHOLD           77
 #define DC_BDIV_QR_THRESHOLD             38
 #define DC_BDIV_Q_THRESHOLD             120
diff -r 47b27ccf9a34 -r 9f43674c7499 mpn/sparc64/ultrasparc34/gmp-mparam.h
--- a/mpn/sparc64/ultrasparc34/gmp-mparam.h	Mon Dec 14 17:31:58 2009 +0100
+++ b/mpn/sparc64/ultrasparc34/gmp-mparam.h	Mon Dec 14 20:16:04 2009 +0100
@@ -53,7 +53,6 @@
 #define DC_BDIV_QR_THRESHOLD             29
 #define DC_BDIV_Q_THRESHOLD             106
 #define BINV_NEWTON_THRESHOLD           348
-#define BINV_MULMOD_BNM1_THRESHOLD        0  /* always when newton */
 #define REDC_1_TO_REDC_2_THRESHOLD       10
 #define REDC_2_TO_REDC_N_THRESHOLD      117
 
diff -r 47b27ccf9a34 -r 9f43674c7499 mpn/x86_64/gmp-mparam.h
--- a/mpn/x86_64/gmp-mparam.h	Mon Dec 14 17:31:58 2009 +0100
+++ b/mpn/x86_64/gmp-mparam.h	Mon Dec 14 20:16:04 2009 +0100
@@ -73,7 +73,7 @@
 #define MODEXACT_1_ODD_THRESHOLD          0  /* always (native) */
 
 #define GET_STR_DC_THRESHOLD             17
-#define GET_STR_PRECOMPUTE_THRESHOLD     32
+#define GET_STR_PRECOMPUTE_THRESHOLD     28
 #define SET_STR_DC_THRESHOLD            266
 #define SET_STR_PRECOMPUTE_THRESHOLD   1787
 
diff -r 47b27ccf9a34 -r 9f43674c7499 tune/tuneup.c
--- a/tune/tuneup.c	Mon Dec 14 17:31:58 2009 +0100
+++ b/tune/tuneup.c	Mon Dec 14 20:16:04 2009 +0100
@@ -171,7 +171,6 @@
 mp_size_t  inv_mulmod_bnm1_threshold    = MP_SIZE_T_MAX;
 mp_size_t  inv_newton_threshold         = MP_SIZE_T_MAX;
 mp_size_t  inv_appr_threshold           = MP_SIZE_T_MAX;
-mp_size_t  binv_mulmod_bnm1_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;
 mp_size_t  redc_1_to_redc_n_threshold   = MP_SIZE_T_MAX;
@@ -1060,8 +1059,8 @@
 tune_invert (void)
 {
   static struct param_t  param;
+
   param.function = speed_mpn_invert;
-
   param.name = "INV_APPR_THRESHOLD";
   param.min_size = 3;
   param.max_size = 5000;
@@ -1072,21 +1071,12 @@
 tune_binvert (void)
 {
   static struct param_t  param;
+
   param.function = speed_mpn_binvert;
-
   param.name = "BINV_NEWTON_THRESHOLD";
+  param.min_size = 8;		/* pointless with smaller operands */
   param.max_size = 5000;
   one (&binv_newton_threshold, &param);
-
-  param.name = "BINV_MULMOD_BNM1_THRESHOLD";
-  param.noprint = 1;
-  param.min_size = binv_newton_threshold;
-  param.max_size = 500;
-  one (&binv_mulmod_bnm1_threshold, &param);
-  if (binv_mulmod_bnm1_threshold <= binv_newton_threshold)
-    print_define_remark (param.name, 0, "always when newton");
-  else
-    print_define (param.name, binv_mulmod_bnm1_threshold);
 }
 
 void


More information about the gmp-commit mailing list