[Gmp-commit] /home/hgfiles/gmp: 4 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Fri Feb 5 23:57:57 CET 2010
details: /home/hgfiles/gmp/rev/91939d480b65
changeset: 13418:91939d480b65
user: Torbjorn Granlund <tege at gmplib.org>
date: Fri Feb 05 23:30:14 2010 +0100
description:
Remove always true #if.
details: /home/hgfiles/gmp/rev/678ed9f08d1a
changeset: 13419:678ed9f08d1a
user: Torbjorn Granlund <tege at gmplib.org>
date: Fri Feb 05 23:32:46 2010 +0100
description:
(mpn_binvert_itch): Enable more economical mpn_mulmod_bnm1_itch call.
details: /home/hgfiles/gmp/rev/e8609f82f2b9
changeset: 13420:e8609f82f2b9
user: Torbjorn Granlund <tege at gmplib.org>
date: Fri Feb 05 23:33:29 2010 +0100
description:
Add a FIXME about sloppy scratch alloc.
details: /home/hgfiles/gmp/rev/131005cc271b
changeset: 13421:131005cc271b
user: Torbjorn Granlund <tege at gmplib.org>
date: Fri Feb 05 23:43:40 2010 +0100
description:
Use less scratch in mpn_powm.
diffstat:
ChangeLog | 15 +++++++++++++--
mpn/generic/binvert.c | 5 -----
mpn/generic/mu_bdiv_q.c | 10 ----------
mpn/generic/mu_bdiv_qr.c | 10 ----------
mpn/generic/mu_div_qr.c | 6 ------
mpn/generic/mu_divappr_q.c | 7 -------
mpn/generic/perfpow.c | 2 +-
mpn/generic/powm.c | 17 +++++++----------
8 files changed, 21 insertions(+), 51 deletions(-)
diffs (212 lines):
diff -r 4289f85f924e -r 131005cc271b ChangeLog
--- a/ChangeLog Fri Feb 05 11:28:40 2010 +0100
+++ b/ChangeLog Fri Feb 05 23:43:40 2010 +0100
@@ -2,6 +2,17 @@
* Version 5.0.1 released.
+ * mpn/generic/powm.c: Use rp target area for power table computation in
+ order to use less scratch.
+
+ * mpn/generic/binvert.c (mpn_binvert_itch): Enable more economical
+ mpn_mulmod_bnm1_itch call.
+
+ * mpn/generic/mu_div_qr.c: Remove always true #if.
+ * mpn/generic/mu_divappr_q.c: Likewise.
+ * mpn/generic/mu_bdiv_q.c: Likewise.
+ * mpn/generic/mu_bdiv_qr.c: Likewise.
+
2010-02-01 Torbjorn Granlund <tege at gmplib.org>
* Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*, LIBMP_LT_*):
@@ -1700,7 +1711,7 @@
(mpn_mul_fft_internal): Likewise.
* mpn/generic/mulmod_bnm1.c: New file, by Niels Möller.
- * configure.in (gmp_mpn_functions): Add mulmod_bnm1.
+ * configure.in (gmp_mpn_functions): Add mulmod_bnm1.
* gmp-impl.h: Add related declarations.
* tune/tuneup.c: Tune MULMOD_BNM1_THRESHOLD.
* tune/speed.h (SPEED_ROUTINE_MPN_MULMOD_BNM1): New macro.
@@ -6142,7 +6153,7 @@
* tune/common.c (speed_mpn_hgcd_lehmer): Disabled function.
* mpn/generic/hgcd.c (mpn_hgcd_lehmer_itch, mpn_hgcd_lehmer)
- (mpn_hgcd_equal): Deleted functions.
+ (mpn_hgcd_equal): Deleted functions.
* mpn/generic/gcd.c (hgcd_start_row_p): Deleted function.
(gcd_schoenhage): Deleted assertion code using mpn_hgcd_lehmer.
diff -r 4289f85f924e -r 131005cc271b mpn/generic/binvert.c
--- a/mpn/generic/binvert.c Fri Feb 05 11:28:40 2010 +0100
+++ b/mpn/generic/binvert.c Fri Feb 05 23:43:40 2010 +0100
@@ -52,12 +52,7 @@
mpn_binvert_itch (mp_size_t n)
{
mp_size_t itch_local = mpn_mulmod_bnm1_next_size (n);
- /* FIXME: check for the correct estimate and remove #if */
-#if 0
mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, n, (n + 1) >> 1);
-#else
- mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, itch_local, itch_local);
-#endif
return itch_local + itch_out;
}
diff -r 4289f85f924e -r 131005cc271b mpn/generic/mu_bdiv_q.c
--- a/mpn/generic/mu_bdiv_q.c Fri Feb 05 11:28:40 2010 +0100
+++ b/mpn/generic/mu_bdiv_q.c Fri Feb 05 23:43:40 2010 +0100
@@ -234,12 +234,7 @@
else
{
tn = mpn_mulmod_bnm1_next_size (dn);
- /* FIXME: check for the correct estimate and remove #if */
-#if 1
itch_out = mpn_mulmod_bnm1_itch (tn, dn, in);
-#else
- itch_out = mpn_mulmod_bnm1_itch (tn, tn, tn);
-#endif
}
itch_binvert = mpn_binvert_itch (in);
itches = dn + tn + itch_out;
@@ -256,12 +251,7 @@
else
{
tn = mpn_mulmod_bnm1_next_size (qn);
- /* FIXME: check for the correct estimate and remove #if */
-#if 1
itch_out = mpn_mulmod_bnm1_itch (tn, qn, in);
-#else
- itch_out = mpn_mulmod_bnm1_itch (tn, tn, tn);
-#endif
}
itch_binvert = mpn_binvert_itch (in);
itches = tn + itch_out;
diff -r 4289f85f924e -r 131005cc271b mpn/generic/mu_bdiv_qr.c
--- a/mpn/generic/mu_bdiv_qr.c Fri Feb 05 11:28:40 2010 +0100
+++ b/mpn/generic/mu_bdiv_qr.c Fri Feb 05 23:43:40 2010 +0100
@@ -254,12 +254,7 @@
else
{
tn = mpn_mulmod_bnm1_next_size (dn);
- /* FIXME: check for the correct estimate and remove #if */
-#if 1
itch_out = mpn_mulmod_bnm1_itch (tn, dn, in);
-#else
- itch_out = mpn_mulmod_bnm1_itch (tn, tn, tn);
-#endif
}
itch_binvert = mpn_binvert_itch (in);
itches = tn + itch_out;
@@ -276,12 +271,7 @@
else
{
tn = mpn_mulmod_bnm1_next_size (dn);
- /* FIXME: check for the correct estimate and remove #if */
-#if 1
itch_out = mpn_mulmod_bnm1_itch (tn, dn, in);
-#else
- itch_out = mpn_mulmod_bnm1_itch (tn, tn, tn);
-#endif
}
}
itch_binvert = mpn_binvert_itch (in);
diff -r 4289f85f924e -r 131005cc271b mpn/generic/mu_div_qr.c
--- a/mpn/generic/mu_div_qr.c Fri Feb 05 11:28:40 2010 +0100
+++ b/mpn/generic/mu_div_qr.c Fri Feb 05 23:43:40 2010 +0100
@@ -390,13 +390,7 @@
{
mp_size_t itch_local = mpn_mulmod_bnm1_next_size (dn + 1);
mp_size_t in = mpn_mu_div_qr_choose_in (nn - dn, dn, mua_k);
- /* FIXME: check for the correct estimate and remove #if */
-#if 1
mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, dn, in);
-#else
- mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, itch_local, itch_local);
-#endif
- ASSERT_ALWAYS (mpn_mulmod_bnm1_itch (itch_local, dn, in) <= itch_out);
return in + itch_local + itch_out;
}
diff -r 4289f85f924e -r 131005cc271b mpn/generic/mu_divappr_q.c
--- a/mpn/generic/mu_divappr_q.c Fri Feb 05 11:28:40 2010 +0100
+++ b/mpn/generic/mu_divappr_q.c Fri Feb 05 23:43:40 2010 +0100
@@ -347,13 +347,6 @@
in = mpn_mu_divappr_q_choose_in (qn, dn, mua_k);
itch_local = mpn_mulmod_bnm1_next_size (dn + 1);
-
- /* FIXME: check for the correct estimate and remove #if */
-#if 1
itch_out = mpn_mulmod_bnm1_itch (itch_local, dn, in);
-#else
- itch_out = mpn_mulmod_bnm1_itch (itch_local, itch_local, itch_local);
-#endif
-
return in + dn + itch_local + itch_out;
}
diff -r 4289f85f924e -r 131005cc271b mpn/generic/perfpow.c
--- a/mpn/generic/perfpow.c Fri Feb 05 11:28:40 2010 +0100
+++ b/mpn/generic/perfpow.c Fri Feb 05 23:43:40 2010 +0100
@@ -271,7 +271,7 @@
yp = TMP_ALLOC_LIMBS (nn);
rp1 = TMP_ALLOC_LIMBS (nn);
- tp = TMP_ALLOC_LIMBS (5 * nn);
+ tp = TMP_ALLOC_LIMBS (5 * nn); /* FIXME */
MPN_ZERO (rp1, nn);
mpn_binvert (yp, np, 1 + (b - 1) / GMP_LIMB_BITS, tp);
diff -r 4289f85f924e -r 131005cc271b mpn/generic/powm.c
--- a/mpn/generic/powm.c Fri Feb 05 11:28:40 2010 +0100
+++ b/mpn/generic/powm.c Fri Feb 05 23:43:40 2010 +0100
@@ -135,7 +135,7 @@
/* rp[n-1..0] = bp[bn-1..0] ^ ep[en-1..0] mod mp[n-1..0]
Requires that mp[n-1..0] is odd.
Requires that ep[en-1..0] is > 1.
- Uses scratch space at tp of MAX(mpn_binvert_itch(n),3n+1) limbs. */
+ Uses scratch space at tp of MAX(mpn_binvert_itch(n),2n) limbs. */
void
mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
mp_srcptr ep, mp_size_t en,
@@ -147,7 +147,6 @@
int windowsize, this_windowsize;
mp_limb_t expbits;
mp_ptr pp, this_pp;
- mp_ptr b2p;
long i;
TMP_DECL;
@@ -209,26 +208,24 @@
this_pp = pp;
redcify (this_pp, bp, bn, mp, n);
- b2p = tp + 2*n;
-
- /* Store b^2 in b2. */
+ /* Store b^2 at rp. */
mpn_sqr (tp, this_pp, n);
#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
- mpn_redc_1 (b2p, tp, mp, n, mip[0]);
+ mpn_redc_1 (rp, tp, mp, n, mip[0]);
else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD))
- mpn_redc_2 (b2p, tp, mp, n, mip);
+ mpn_redc_2 (rp, tp, mp, n, mip);
#else
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD))
- mpn_redc_1 (b2p, tp, mp, n, mip[0]);
+ mpn_redc_1 (rp, tp, mp, n, mip[0]);
#endif
else
- mpn_redc_n (b2p, tp, mp, n, mip);
+ mpn_redc_n (rp, tp, mp, n, mip);
/* Precompute odd powers of b and put them in the temporary area at pp. */
for (i = (1 << (windowsize - 1)) - 1; i > 0; i--)
{
- mpn_mul_n (tp, this_pp, b2p, n);
+ mpn_mul_n (tp, this_pp, rp, n);
this_pp += n;
#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
More information about the gmp-commit
mailing list