[Gmp-commit] /home/hgfiles/gmp: 3 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sun Dec 27 20:36:59 CET 2009
details: /home/hgfiles/gmp/rev/2e81e73ba463
changeset: 13240:2e81e73ba463
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Dec 27 19:41:46 2009 +0100
description:
Tune MU division parameters.
details: /home/hgfiles/gmp/rev/78169a3f33b3
changeset: 13241:78169a3f33b3
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Dec 27 19:45:38 2009 +0100
description:
Misc tuneup trimming.
details: /home/hgfiles/gmp/rev/052c56e76bcd
changeset: 13242:052c56e76bcd
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Dec 27 20:30:53 2009 +0100
description:
(mpn_sqr): New name for mpn_sqr_n.
diffstat:
ChangeLog | 17 ++++
NEWS | 2 +-
configure.in | 2 +-
doc/gmp.texi | 4 +-
gmp-h.in | 3 +
gmp-impl.h | 8 +-
mpf/get_str.c | 2 +-
mpf/set_str.c | 2 +-
mpn/asm-defs.m4 | 4 -
mpn/generic/fib2_ui.c | 4 +-
mpn/generic/get_str.c | 2 +-
mpn/generic/mul.c | 2 +-
mpn/generic/mul_fft.c | 2 +-
mpn/generic/perfpow.c | 2 +-
mpn/generic/pow_1.c | 8 +-
mpn/generic/powlo.c | 6 +-
mpn/generic/powm.c | 52 ++++++------
mpn/generic/powm_sec.c | 6 +-
mpn/generic/remove.c | 2 +-
mpn/generic/set_str.c | 2 +-
mpn/generic/sqr.c | 88 ++++++++++++++++++++++
mpn/generic/sqr_n.c | 88 ----------------------
mpn/generic/sqrmod_bnm1.c | 8 +-
mpn/generic/sqrtrem.c | 2 +-
mpn/generic/toom2_sqr.c | 8 +-
mpn/generic/toom3_sqr.c | 16 ++--
mpn/generic/toom4_sqr.c | 16 ++--
mpn/x86/fat/gmp-mparam.h | 2 +-
mpn/x86_64/fat/gmp-mparam.h | 2 +-
mpz/lucnum_ui.c | 2 +-
mpz/n_pow_ui.c | 12 +-
mpz/powm_ui.c | 2 +-
tests/devel/try.c | 2 +-
tune/Makefile.am | 53 +-------------
tune/common.c | 29 ++++++-
tune/speed.c | 2 +-
tune/speed.h | 172 ++++++++++++++++++++++++++++++++++++++++++-
tune/tuneup.c | 76 ++++++++++++++++---
38 files changed, 457 insertions(+), 255 deletions(-)
diffs (truncated from 1538 to 300 lines):
diff -r f5b773f89d5b -r 052c56e76bcd ChangeLog
--- a/ChangeLog Sun Dec 27 18:36:43 2009 +0100
+++ b/ChangeLog Sun Dec 27 20:30:53 2009 +0100
@@ -6,6 +6,23 @@
2009-12-27 Torbjorn Granlund <tege at gmplib.org>
+ * (mpn_sqr): New name for mpn_sqr_n. Many files affected.
+
+ * tune/tuneup.c (tune_mullo): Up step_factor for MULLO_MUL_N_THRESHOLD.
+ (tune_invertappr, tune_invert, tune_binvert): Let max_size default.
+
+ * tune/tuneup.c (tune_mu_div, tune_mu_bdiv) New functions.
+ * tune/speed.h (SPEED_ROUTINE_MPN_MU_DIV_Q): New macro.
+ (SPEED_ROUTINE_MPN_MU_DIV_QR): Likewise.
+ (SPEED_ROUTINE_MPN_MU_BDIV_Q): Likewise.
+ (SPEED_ROUTINE_MPN_MU_BDIV_QR): Likewise.
+ * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add bdiv_q.c and bdiv_qr.c.
+ * tune/common.c (speed_mpn_mu_div_qr): New function.
+ (speed_mpn_mu_divappr_q): Likewise.
+ (speed_mpn_mu_div_q): Likewise.
+ (speed_mpn_mu_bdiv_q): Likewise.
+ (speed_mpn_mu_bdiv_qr): Likewise.
+
* mpn/*/gmp-mparam.h: Fix incorrect MOD_1U_TO_MOD_1_1_THRESHOLD 0
values.
diff -r f5b773f89d5b -r 052c56e76bcd NEWS
--- a/NEWS Sun Dec 27 18:36:43 2009 +0100
+++ b/NEWS Sun Dec 27 20:30:53 2009 +0100
@@ -40,7 +40,7 @@
average, where Q is the quotient.
Features:
- * New mpn functions: mpn_sqr_n, mpn_and_n, mpn_ior_n, mpn_xor_n,
+ * New mpn functions: mpn_sqr, mpn_and_n, mpn_ior_n, mpn_xor_n,
mpn_nand_n, mpn_nior_n, mpn_xnor_n, mpn_andn_n, mpn_iorn_n.
* Support for fat binaries for 64-bit x86 processors.
* New type, mp_bitcnt_t for bignum bit counts.
diff -r f5b773f89d5b -r 052c56e76bcd configure.in
--- a/configure.in Sun Dec 27 18:36:43 2009 +0100
+++ b/configure.in Sun Dec 27 20:30:53 2009 +0100
@@ -2495,7 +2495,7 @@
submul_1 lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \
fib2_ui mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \
mod_1_1 mod_1_2 mod_1_3 mod_1_4 \
- mul mul_fft mul_n sqr_n mul_basecase sqr_basecase nussbaumer_mul \
+ mul mul_fft mul_n sqr mul_basecase sqr_basecase nussbaumer_mul \
random random2 pow_1 \
rootrem sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp \
perfsqr perfpow \
diff -r f5b773f89d5b -r 052c56e76bcd doc/gmp.texi
--- a/doc/gmp.texi Sun Dec 27 18:36:43 2009 +0100
+++ b/doc/gmp.texi Sun Dec 27 20:30:53 2009 +0100
@@ -5175,7 +5175,7 @@
most significant limb is zero. No overlap is permitted between the
destination and either source.
-If the two input operands are the same, use @code{mpn_sqr_n}.
+If the two input operands are the same, use @code{mpn_sqr}.
@end deftypefun
@deftypefun mp_limb_t mpn_mul (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, mp_size_t @var{s1n}, const mp_limb_t *@var{s2p}, mp_size_t @var{s2n})
@@ -5190,7 +5190,7 @@
This function requires that @var{s1n} is greater than or equal to @var{s2n}.
@end deftypefun
- at deftypefun void mpn_sqr_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, mp_size_t @var{n})
+ at deftypefun void mpn_sqr (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, mp_size_t @var{n})
Compute the square of @{@var{s1p}, @var{n}@} and write the 2*@var{n}-limb
result to @var{rp}.
diff -r f5b773f89d5b -r 052c56e76bcd gmp-h.in
--- a/gmp-h.in Sun Dec 27 18:36:43 2009 +0100
+++ b/gmp-h.in Sun Dec 27 20:30:53 2009 +0100
@@ -1568,6 +1568,9 @@
#define mpn_mul_n __MPN(mul_n)
__GMP_DECLSPEC void mpn_mul_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#define mpn_sqr __MPN(sqr)
+__GMP_DECLSPEC void mpn_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
+
#define mpn_neg_n __MPN(neg_n)
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg_n)
__GMP_DECLSPEC mp_limb_t mpn_neg_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
diff -r f5b773f89d5b -r 052c56e76bcd gmp-impl.h
--- a/gmp-impl.h Sun Dec 27 18:36:43 2009 +0100
+++ b/gmp-impl.h Sun Dec 27 20:30:53 2009 +0100
@@ -908,8 +908,8 @@
#define mpn_mullo_basecase __MPN(mullo_basecase)
__GMP_DECLSPEC void mpn_mullo_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
-#define mpn_sqr_n __MPN(sqr_n)
-__GMP_DECLSPEC void mpn_sqr_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
+#define mpn_sqr __MPN(sqr)
+__GMP_DECLSPEC void mpn_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
#ifndef mpn_sqr_basecase /* if not done with cpuvec in a fat binary */
#define mpn_sqr_basecase __MPN(sqr_basecase)
@@ -1799,11 +1799,11 @@
#endif
#ifndef MU_BDIV_Q_THRESHOLD
-#define MU_BDIV_Q_THRESHOLD 1000
+#define MU_BDIV_Q_THRESHOLD 2000
#endif
#ifndef MU_BDIV_QR_THRESHOLD
-#define MU_BDIV_QR_THRESHOLD 1000
+#define MU_BDIV_QR_THRESHOLD 2000
#endif
#ifndef MULMOD_BNM1_THRESHOLD
diff -r f5b773f89d5b -r 052c56e76bcd mpf/get_str.c
--- a/mpf/get_str.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpf/get_str.c Sun Dec 27 20:30:53 2009 +0100
@@ -67,7 +67,7 @@
count_leading_zeros (cnt, exp);
for (i = GMP_LIMB_BITS - cnt - 2; i >= 0; i--)
{
- mpn_sqr_n (tp, rp + off, rn);
+ mpn_sqr (tp, rp + off, rn);
rn = 2 * rn;
rn -= tp[rn - 1] == 0;
ign <<= 1;
diff -r f5b773f89d5b -r 052c56e76bcd mpf/set_str.c
--- a/mpf/set_str.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpf/set_str.c Sun Dec 27 20:30:53 2009 +0100
@@ -72,7 +72,7 @@
count_leading_zeros (cnt, exp);
for (i = GMP_LIMB_BITS - cnt - 2; i >= 0; i--)
{
- mpn_sqr_n (tp, rp + off, rn);
+ mpn_sqr (tp, rp + off, rn);
rn = 2 * rn;
rn -= tp[rn - 1] == 0;
ign <<= 1;
diff -r f5b773f89d5b -r 052c56e76bcd mpn/asm-defs.m4
--- a/mpn/asm-defs.m4 Sun Dec 27 18:36:43 2009 +0100
+++ b/mpn/asm-defs.m4 Sun Dec 27 20:30:53 2009 +0100
@@ -1347,8 +1347,6 @@
define_mpn(invert_limb)
define_mpn(ior_n)
define_mpn(iorn_n)
-define_mpn(kara_mul_n)
-define_mpn(kara_sqr_n)
define_mpn(lshift)
define_mpn(lshiftc)
define_mpn(mod_1_1p)
@@ -1410,8 +1408,6 @@
define_mpn(sub_nc)
define_mpn(submul_1)
define_mpn(submul_1c)
-define_mpn(toom3_mul_n)
-define_mpn(toom3_sqr_n)
define_mpn(umul_ppmm)
define_mpn(umul_ppmm_r)
define_mpn(udiv_qrnnd)
diff -r f5b773f89d5b -r 052c56e76bcd mpn/generic/fib2_ui.c
--- a/mpn/generic/fib2_ui.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpn/generic/fib2_ui.c Sun Dec 27 20:30:53 2009 +0100
@@ -105,8 +105,8 @@
/* f1p[size-1] might be zero, but this occurs rarely, so it's not
worth bothering checking for it */
ASSERT (alloc >= 2*size);
- mpn_sqr_n (xp, fp, size);
- mpn_sqr_n (fp, f1p, size);
+ mpn_sqr (xp, fp, size);
+ mpn_sqr (fp, f1p, size);
size *= 2;
/* Shrink if possible. Since fp was normalized there'll be at
diff -r f5b773f89d5b -r 052c56e76bcd mpn/generic/get_str.c
--- a/mpn/generic/get_str.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpn/generic/get_str.c Sun Dec 27 20:30:53 2009 +0100
@@ -473,7 +473,7 @@
ASSERT_ALWAYS (powtab_mem_ptr < powtab_mem + mpn_dc_get_str_powtab_alloc (un));
- mpn_sqr_n (t, p, n);
+ mpn_sqr (t, p, n);
digits_in_base *= 2;
n *= 2; n -= t[n - 1] == 0;
diff -r f5b773f89d5b -r 052c56e76bcd mpn/generic/mul.c
--- a/mpn/generic/mul.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpn/generic/mul.c Sun Dec 27 20:30:53 2009 +0100
@@ -84,7 +84,7 @@
if (un == vn)
{
if (up == vp)
- mpn_sqr_n (prodp, up, un);
+ mpn_sqr (prodp, up, un);
else
mpn_mul_n (prodp, up, vp, un);
}
diff -r f5b773f89d5b -r 052c56e76bcd mpn/generic/mul_fft.c
--- a/mpn/generic/mul_fft.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpn/generic/mul_fft.c Sun Dec 27 20:30:53 2009 +0100
@@ -529,7 +529,7 @@
a = *ap++;
b = *bp++;
if (sqr)
- mpn_sqr_n (tp, a, n);
+ mpn_sqr (tp, a, n);
else
mpn_mul_n (tp, b, a, n);
if (a[n] != 0)
diff -r f5b773f89d5b -r 052c56e76bcd mpn/generic/perfpow.c
--- a/mpn/generic/perfpow.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpn/generic/perfpow.c Sun Dec 27 20:30:53 2009 +0100
@@ -405,7 +405,7 @@
exp = 1;
while (2 * pn - 1 <= ncn)
{
- mpn_sqr_n (next, prev, pn);
+ mpn_sqr (next, prev, pn);
xn = 2 * pn;
xn -= (next[xn - 1] == 0);
diff -r f5b773f89d5b -r 052c56e76bcd mpn/generic/pow_1.c
--- a/mpn/generic/pow_1.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpn/generic/pow_1.c Sun Dec 27 20:30:53 2009 +0100
@@ -71,7 +71,7 @@
if ((cnt & 1) != 0)
MP_PTR_SWAP (rp, tp);
- mpn_sqr_n (rp, bp, bn);
+ mpn_sqr (rp, bp, bn);
rn = 2 * bn; rn -= rp[rn - 1] == 0;
for (i = GMP_LIMB_BITS - cnt - 1;;)
@@ -86,7 +86,7 @@
if (--i == 0)
break;
- mpn_sqr_n (tp, rp, rn);
+ mpn_sqr (tp, rp, rn);
rn = 2 * rn; rn -= tp[rn - 1] == 0;
MP_PTR_SWAP (rp, tp);
}
@@ -96,7 +96,7 @@
if (((par ^ cnt) & 1) == 0)
MP_PTR_SWAP (rp, tp);
- mpn_sqr_n (rp, bp, bn);
+ mpn_sqr (rp, bp, bn);
rn = 2 * bn; rn -= rp[rn - 1] == 0;
for (i = GMP_LIMB_BITS - cnt - 1;;)
@@ -111,7 +111,7 @@
if (--i == 0)
break;
- mpn_sqr_n (tp, rp, rn);
+ mpn_sqr (tp, rp, rn);
rn = 2 * rn; rn -= tp[rn - 1] == 0;
MP_PTR_SWAP (rp, tp);
}
diff -r f5b773f89d5b -r 052c56e76bcd mpn/generic/powlo.c
--- a/mpn/generic/powlo.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpn/generic/powlo.c Sun Dec 27 20:30:53 2009 +0100
@@ -95,7 +95,7 @@
b2p = tp + 2*n;
/* Store b^2 in b2. */
- mpn_sqr_n (tp, bp, n); /* FIXME: Use "mpn_sqrlo" */
+ mpn_sqr (tp, bp, n); /* FIXME: Use "mpn_sqrlo" */
MPN_COPY (b2p, tp, n);
/* Precompute odd powers of b and put them in the temporary area at pp. */
@@ -122,7 +122,7 @@
{
while (getbit (ep, ebi) == 0)
{
- mpn_sqr_n (tp, rp, n); /* FIXME: Use "mpn_sqrlo" */
+ mpn_sqr (tp, rp, n); /* FIXME: Use "mpn_sqrlo" */
MPN_COPY (rp, tp, n);
ebi--;
if (ebi == 0)
@@ -149,7 +149,7 @@
do
{
- mpn_sqr_n (tp, rp, n);
+ mpn_sqr (tp, rp, n);
MPN_COPY (rp, tp, n);
this_windowsize--;
}
diff -r f5b773f89d5b -r 052c56e76bcd mpn/generic/powm.c
--- a/mpn/generic/powm.c Sun Dec 27 18:36:43 2009 +0100
+++ b/mpn/generic/powm.c Sun Dec 27 20:30:53 2009 +0100
@@ -166,7 +166,7 @@
until the result is greater than the mod argument. */
for (;;)
{
- mpn_sqr_n (tp, this_pp, tn);
+ mpn_sqr (tp, this_pp, tn);
tn = tn * 2 - 1, tn += tp[tn] != 0;
if (getbit (ep, ebi) != 0)
More information about the gmp-commit
mailing list