[Gmp-commit] /home/hgfiles/gmp: Move division/mod-by-1 first, before toom. F...

mercurial at gmplib.org mercurial at gmplib.org
Sun Dec 27 13:41:49 CET 2009


details:   /home/hgfiles/gmp/rev/2f273162e8bd
changeset: 13235:2f273162e8bd
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Dec 27 13:32:31 2009 +0100
description:
Move division/mod-by-1 first, before toom.  Fix mod_1 tuning.

diffstat:

 ChangeLog     |   3 +++
 tune/tuneup.c |  39 ++++++++++++++++++++-------------------
 2 files changed, 23 insertions(+), 19 deletions(-)

diffs (89 lines):

diff -r 36d1f7594af9 -r 2f273162e8bd ChangeLog
--- a/ChangeLog	Sun Dec 27 03:25:36 2009 +0100
+++ b/ChangeLog	Sun Dec 27 13:32:31 2009 +0100
@@ -8,6 +8,9 @@
 	* tune/tuneup.c (tune_modexact_1_odd): Tune BMOD_1_TO_MOD_1_THRESHOLD;
 	Do not assume native mpn_modexact_1_odd is faster than mpn_mod_1.
 	(tuned_speed_mpn_mod_1): Remove variable.
+	(tune_mod_1): Fix thinkos.  Suppress printing of "always" etc.
+	(all): Measure for divrem_1, mod_1, divexact_1, etc first, since Toom
+	depends on some of them.
 
 	* mpn/generic/toom22_mul.c (TOOM22_MUL_REC): New name for
 	TOOM22_MUL_MN_REC.
diff -r 36d1f7594af9 -r 2f273162e8bd tune/tuneup.c
--- a/tune/tuneup.c	Sun Dec 27 03:25:36 2009 +0100
+++ b/tune/tuneup.c	Sun Dec 27 13:32:31 2009 +0100
@@ -1398,14 +1398,15 @@
 
     if (mod_1u_to_mod_1_1_threshold + 2 >= mod_1_1_to_mod_1_2_threshold)
       {
-	/* Disable mod_1_1 for these smaller moduli, mod_1_2 is always faster.
-	   Measure when to switch (from mod_1_unnorm) to mod_1_2.  */
-	mod_1u_to_mod_1_1_threshold = 0;
+	/* Disable mod_1_1, mod_1_2 is always faster.  Measure when to switch
+	   (from mod_1_unnorm) to mod_1_2.  */
+	mod_1_1_to_mod_1_2_threshold = 0;
 
+	/* This really measures mod_1u -> mod_1_2 */
 	param.min_size = 1;
-	one (&mod_1_1_to_mod_1_2_threshold, &param);
+	one (&mod_1u_to_mod_1_1_threshold, &param);
       }
-    print_define ("MOD_1U_TO_MOD_1_1_THRESHOLD", mod_1u_to_mod_1_1_threshold);
+    print_define_remark ("MOD_1U_TO_MOD_1_1_THRESHOLD", mod_1u_to_mod_1_1_threshold, NULL);
 
     param.name = "MOD_1_2_TO_MOD_1_4_THRESHOLD";
     param.min_size = mod_1_1_to_mod_1_2_threshold;
@@ -1413,15 +1414,15 @@
 
     if (mod_1_1_to_mod_1_2_threshold + 2 >= mod_1_2_to_mod_1_4_threshold)
       {
-	/* Disable mod_1_2 for these smaller moduli, mod_1_4 is always faster.
-	   Measure when to switch (from mod_1_unnorm or mod_1_1) to mod_1_4.  */
-	mod_1_1_to_mod_1_2_threshold = 0;
+	/* Disable mod_1_2, mod_1_4 is always faster.  Measure when to switch
+	   (from mod_1_unnorm or mod_1_1) to mod_1_4.  */
+	mod_1_2_to_mod_1_4_threshold = 0;
 
 	param.min_size = 1;
-	one (&mod_1_2_to_mod_1_4_threshold, &param);
+	one (&mod_1_1_to_mod_1_2_threshold, &param);
       }
-    print_define ("MOD_1_1_TO_MOD_1_2_THRESHOLD", mod_1_1_to_mod_1_2_threshold);
-    print_define ("MOD_1_2_TO_MOD_1_4_THRESHOLD", mod_1_2_to_mod_1_4_threshold);
+    print_define_remark ("MOD_1_1_TO_MOD_1_2_THRESHOLD", mod_1_1_to_mod_1_2_threshold, NULL);
+    print_define_remark ("MOD_1_2_TO_MOD_1_4_THRESHOLD", mod_1_2_to_mod_1_4_threshold, NULL);
   }
 
   {
@@ -1951,6 +1952,14 @@
   }
   printf ("\n");
 
+  tune_divrem_1 ();
+  tune_mod_1 ();
+  tune_preinv_divrem_1 ();
+  tune_divrem_2 ();
+  tune_divexact_1 ();
+  tune_modexact_1_odd ();
+  printf("\n");
+
   tune_mul_n ();
   printf("\n");
 
@@ -1992,14 +2001,6 @@
   tune_jacobi_base ();
   printf("\n");
 
-  tune_divrem_1 ();
-  tune_mod_1 ();
-  tune_preinv_divrem_1 ();
-  tune_divrem_2 ();
-  tune_divexact_1 ();
-  tune_modexact_1_odd ();
-  printf("\n");
-
   tune_get_str ();
   tune_set_str ();
   printf("\n");


More information about the gmp-commit mailing list