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

mercurial at gmplib.org mercurial at gmplib.org
Sun Dec 13 16:34:22 CET 2009


details:   /home/hgfiles/gmp/rev/1c84df4e2987
changeset: 13052:1c84df4e2987
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Dec 13 10:29:49 2009 +0100
description:
Retune.

details:   /home/hgfiles/gmp/rev/38ff0568a371
changeset: 13053:38ff0568a371
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Dec 13 16:29:56 2009 +0100
description:
Trivial merge.

details:   /home/hgfiles/gmp/rev/e8751e087864
changeset: 13054:e8751e087864
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Dec 13 16:31:20 2009 +0100
description:
Rework buffer handling.

details:   /home/hgfiles/gmp/rev/f3afc6947316
changeset: 13055:f3afc6947316
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Dec 13 16:34:18 2009 +0100
description:
Trivial merge.

diffstat:

 ChangeLog               |  10 ++++++++++
 mpn/x86/k7/gmp-mparam.h |   2 +-
 mpz/powm.c              |  19 ++++++++++++++++---
 tests/mpn/t-toom33.c    |   2 +-
 tests/mpn/t-toom42.c    |   2 --
 tests/mpn/t-toom43.c    |   2 --
 tests/mpn/t-toom44.c    |   2 +-
 tests/mpn/toom-shared.h |   4 ++--
 8 files changed, 31 insertions(+), 12 deletions(-)

diffs (129 lines):

diff -r 424d2d643665 -r f3afc6947316 ChangeLog
--- a/ChangeLog	Sun Dec 13 03:00:59 2009 +0100
+++ b/ChangeLog	Sun Dec 13 16:34:18 2009 +0100
@@ -1,3 +1,13 @@
+2009-12-13  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpz/powm.c: Rework buffer handling.
+
+2009-12-13  Niels Möller  <nisse at lysator.liu.se>
+
+	* tests/mpn/toom-shared.h (main): Use refmpn_mul_basecase to check
+	results (slow!). Iteration counts of all toom tests reduced
+	considerably.
+
 2009-12-12  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/generic/mu_bdiv_qr.c (mpn_mu_bdiv_qr_itch): Rewrite.
diff -r 424d2d643665 -r f3afc6947316 mpn/x86/k7/gmp-mparam.h
--- a/mpn/x86/k7/gmp-mparam.h	Sun Dec 13 03:00:59 2009 +0100
+++ b/mpn/x86/k7/gmp-mparam.h	Sun Dec 13 16:34:18 2009 +0100
@@ -49,7 +49,7 @@
 
 #define MULMOD_BNM1_THRESHOLD            18
 
-#define DC_DIV_QR_THRESHOLD              98
+#define DC_DIV_QR_THRESHOLD              66
 #define DC_DIVAPPR_Q_THRESHOLD          357
 #define DC_BDIV_QR_THRESHOLD             71
 #define DC_BDIV_Q_THRESHOLD             260
diff -r 424d2d643665 -r f3afc6947316 mpz/powm.c
--- a/mpz/powm.c	Sun Dec 13 03:00:59 2009 +0100
+++ b/mpz/powm.c	Sun Dec 13 16:34:18 2009 +0100
@@ -62,7 +62,7 @@
   int cnt;
   mp_ptr rp, tp;
   mp_srcptr bp, ep, mp;
-  mp_size_t rn, bn, es, en;
+  mp_size_t rn, bn, es, en, itch;
   TMP_DECL;
 
   n = ABSIZ(m);
@@ -166,9 +166,22 @@
       ncnt++;
     }
 
-  rp = TMP_ALLOC_LIMBS (n + 1);
+  if (ncnt != 0)
+    {
+      /* rp needs n, mpn_powlo needs 4n, the 2 mpn_binvert might need more */
+      mp_size_t n_largest_binvert = MAX (ncnt, nodd);
+      mp_size_t itch_binvert = mpn_binvert_itch (n_largest_binvert);
+      itch = 3 * n + MAX (itch_binvert, 2 * n);
+    }
+  else
+    {
+      mp_size_t itch_binvert = mpn_binvert_itch (nodd);
+      itch = n + MAX (itch_binvert, 2 * n);
+    }
+  tp = TMP_ALLOC_LIMBS (itch);
 
-  tp = TMP_ALLOC_LIMBS (4 * n + 1);	/* this much is needed for powlo */
+  rp = tp;  tp += n;
+
   bp = PTR(b);
   mpn_powm (rp, bp, bn, ep, en, mp, nodd, tp);
 
diff -r 424d2d643665 -r f3afc6947316 tests/mpn/t-toom33.c
--- a/tests/mpn/t-toom33.c	Sun Dec 13 03:00:59 2009 +0100
+++ b/tests/mpn/t-toom33.c	Sun Dec 13 16:34:18 2009 +0100
@@ -6,6 +6,6 @@
 #define MIN_AN MUL_TOOM33_THRESHOLD
 #define MIN_BN(an) (1 + 2*(((an)+2)/(size_t) 3))
 
-#define COUNT 3000
+#define COUNT 100
 
 #include "toom-shared.h"
diff -r 424d2d643665 -r f3afc6947316 tests/mpn/t-toom42.c
--- a/tests/mpn/t-toom42.c	Sun Dec 13 03:00:59 2009 +0100
+++ b/tests/mpn/t-toom42.c	Sun Dec 13 16:34:18 2009 +0100
@@ -5,6 +5,4 @@
 #define MIN_BN(an) (((an) + 7) >> 2)
 #define MAX_BN(an) ((2*(an)-5) / (size_t) 3)
 
-#define COUNT 2000
-
 #include "toom-shared.h"
diff -r 424d2d643665 -r f3afc6947316 tests/mpn/t-toom43.c
--- a/tests/mpn/t-toom43.c	Sun Dec 13 03:00:59 2009 +0100
+++ b/tests/mpn/t-toom43.c	Sun Dec 13 16:34:18 2009 +0100
@@ -5,6 +5,4 @@
 #define MIN_BN(an) (1 + 2*(((an)+3) >> 2))
 #define MAX_BN(an) ((an)-3)
 
-#define COUNT 2000
-
 #include "toom-shared.h"
diff -r 424d2d643665 -r f3afc6947316 tests/mpn/t-toom44.c
--- a/tests/mpn/t-toom44.c	Sun Dec 13 03:00:59 2009 +0100
+++ b/tests/mpn/t-toom44.c	Sun Dec 13 16:34:18 2009 +0100
@@ -4,6 +4,6 @@
 #define MIN_AN MUL_TOOM44_THRESHOLD
 #define MIN_BN(an) (1 + 3*(((an)+3)>>2))
 
-#define COUNT 2000
+#define COUNT 100
 
 #include "toom-shared.h"
diff -r 424d2d643665 -r f3afc6947316 tests/mpn/toom-shared.h
--- a/tests/mpn/toom-shared.h	Sun Dec 13 03:00:59 2009 +0100
+++ b/tests/mpn/toom-shared.h	Sun Dec 13 16:34:18 2009 +0100
@@ -35,7 +35,7 @@
 #endif
 
 #ifndef COUNT
-#define COUNT 5000
+#define COUNT 300
 #endif
 
 #define MAX_AN (1L << SIZE_LOG)
@@ -116,7 +116,7 @@
       s_after = scratch[itch];
 
       mpn_toomMN_mul (pp, ap, an, bp, bn, scratch);
-      mpn_mul (refp, ap, an, bp, bn);
+      refmpn_mul_basecase (refp, ap, an, bp, bn);
       if (pp[-1] != p_before || pp[an + bn] != p_after
 	  || scratch[-1] != s_before || scratch[itch] != s_after
 	  || mpn_cmp (refp, pp, an + bn) != 0)


More information about the gmp-commit mailing list