[Gmp-commit] /var/hg/gmp: 7 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Wed Feb 8 08:38:31 UTC 2017
details: /var/hg/gmp/rev/5f0590fd6c6d
changeset: 17235:5f0590fd6c6d
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Wed Feb 08 07:31:09 2017 +0100
description:
-typos
details: /var/hg/gmp/rev/374168f0848a
changeset: 17236:374168f0848a
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Wed Feb 08 09:22:52 2017 +0100
description:
Copyright years
details: /var/hg/gmp/rev/a25c8e0222a2
changeset: 17237:a25c8e0222a2
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Wed Feb 08 09:24:46 2017 +0100
description:
mpf/set_str.c: Use TMP_ALLOC_LIMBS_2
details: /var/hg/gmp/rev/16028726e8de
changeset: 17238:16028726e8de
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Wed Feb 08 09:28:25 2017 +0100
description:
mp[fz]/get_str.c, mpz/out_str.c: Save a string and a branch.
details: /var/hg/gmp/rev/32495926e743
changeset: 17239:32495926e743
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Wed Feb 08 09:29:33 2017 +0100
description:
mpz/{set,inp}_str.c: Mark misuse as UNLIKELY.
details: /var/hg/gmp/rev/37b446d2da4a
changeset: 17240:37b446d2da4a
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Wed Feb 08 09:33:59 2017 +0100
description:
Copyright year
details: /var/hg/gmp/rev/d300ea27b301
changeset: 17241:d300ea27b301
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Wed Feb 08 09:38:28 2017 +0100
description:
Trivial merge
diffstat:
ChangeLog | 29 +++++++++++++++++++++++++++++
gen-bases.c | 20 ++++++++++++++++++++
gen-trialdivtab.c | 2 +-
gmp-h.in | 2 +-
mini-gmp/mini-gmp.c | 2 +-
mpf/get_str.c | 27 ++++++++++++---------------
mpf/set_str.c | 3 +--
mpn/generic/bdiv_q_1.c | 7 ++++---
mpn/generic/compute_powtab.c | 15 ++++++++++++++-
mpn/generic/divrem.c | 2 +-
mpn/generic/powlo.c | 2 +-
mpn/generic/sqrlo_basecase.c | 4 ++--
mpn/generic/toom_interpolate_12pts.c | 2 +-
mpn/generic/toom_interpolate_16pts.c | 2 +-
mpn/x86/p6/mmx/gmp-mparam.h | 2 +-
mpz/gcd.c | 4 ++--
mpz/get_str.c | 29 +++++++++++++----------------
mpz/inp_str.c | 2 +-
mpz/out_str.c | 27 ++++++++++++---------------
mpz/pprime_p.c | 2 +-
mpz/set_str.c | 4 ++--
tune/tuneup.c | 29 +++++++++++++++++++++--------
22 files changed, 142 insertions(+), 76 deletions(-)
diffs (truncated from 556 to 300 lines):
diff -r 5a6706c3817f -r d300ea27b301 ChangeLog
--- a/ChangeLog Fri Feb 03 18:56:09 2017 +0100
+++ b/ChangeLog Wed Feb 08 09:38:28 2017 +0100
@@ -1,3 +1,27 @@
+2017-02-08 Torbjörn Granlund <tg at gmplib.org>
+
+ * mpn/generic/compute_powtab.c: Choose mpn_pi1_bdiv_q_1 vs
+ mpn_divexact_1 more wisely (spotted by Marco).
+
+2017-02-07 Torbjörn Granlund <tg at gmplib.org>
+
+ * tune/tuneup.c (relspeed_div_1_vs_mul_1): Prefer mpn_pi1_bdiv_q_1.
+
+ * mpn/generic/compute_powtab.c: Use mpn_pi1_bdiv_q_1/mpn_bdiv_q_1
+ instead of mpn_divexact_1.
+
+ * gen-bases.c (binvert): New function, computing modular inverse and
+ low zero count.
+ (header): Print MP_BASES_BIG_BASE_CTZ_10 and
+ MP_BASES_BIG_BASE_BINVERTED_10.
+
+2017-02-06 Torbjörn Granlund <tg at gmplib.org>
+
+ * mpn/generic/bdiv_q_1.c: Make return value consistent.
+
+ * mpn/x86/p6/mmx/gmp-mparam.h (SQR_TOOM2_THRESHOLD): Revert to bogus
+ value to accomodate p6/sqr_basecase.asm fragility.
+
2017-01-29 Marco Bodrato <bodrato at mail.dm.unipi.it>
* mpz/and.c: Simplify branches.
@@ -6,6 +30,11 @@
* gen-bases.c: In generated file, include just gmp-impl.h, not gmp.h
+2017-01-29 Torbjörn Granlund <tg at gmplib.org>
+
+ * configure.ac: Don't check if we got a C99 compiler for now (partially
+ revert 2017-01-24 change as C++ compilers become rejected).
+
2017-01-24 Torbjörn Granlund <tg at gmplib.org>
* mpn/generic/compute_powtab.c: New file, providing mpn_compute_powtab
diff -r 5a6706c3817f -r d300ea27b301 gen-bases.c
--- a/gen-bases.c Fri Feb 03 18:56:09 2017 +0100
+++ b/gen-bases.c Wed Feb 08 09:38:28 2017 +0100
@@ -33,9 +33,11 @@
int chars_per_limb;
+int big_base_ctz;
mpz_t big_base;
int normalization_steps;
mpz_t big_base_inverted;
+mpz_t big_base_binverted;
mpz_t t;
@@ -51,6 +53,17 @@
}
void
+binvert (int numb_bits)
+{
+ int i;
+ mpz_t bbo;
+
+ mpz_init_set (bbo, big_base);
+ big_base_ctz = mpz_make_odd (bbo);
+ mpz_invert_2exp (big_base_binverted, bbo, numb_bits);
+}
+
+void
generate (int limb_bits, int nail_bits, int base)
{
int numb_bits = limb_bits - nail_bits;
@@ -73,6 +86,8 @@
mpz_mul_2exp (t, t, 2*limb_bits - normalization_steps);
mpz_tdiv_q (big_base_inverted, t, big_base);
mpz_clrbit (big_base_inverted, limb_bits);
+
+ binvert (numb_bits);
}
void
@@ -90,12 +105,16 @@
printf ("\n");
printf ("/* mp_bases[10] data, as literal values */\n");
printf ("#define MP_BASES_CHARS_PER_LIMB_10 %d\n", chars_per_limb);
+ printf ("#define MP_BASES_BIG_BASE_CTZ_10 %d\n", big_base_ctz);
printf ("#define MP_BASES_BIG_BASE_10 CNST_LIMB(0x");
mpz_out_str (stdout, 16, big_base);
printf (")\n");
printf ("#define MP_BASES_BIG_BASE_INVERTED_10 CNST_LIMB(0x");
mpz_out_str (stdout, 16, big_base_inverted);
printf (")\n");
+ printf ("#define MP_BASES_BIG_BASE_BINVERTED_10 CNST_LIMB(0x");
+ mpz_out_str (stdout, 16, big_base_binverted);
+ printf (")\n");
printf ("#define MP_BASES_NORMALIZATION_STEPS_10 %d\n", normalization_steps);
}
@@ -212,6 +231,7 @@
mpz_init (big_base);
mpz_init (big_base_inverted);
+ mpz_init (big_base_binverted);
mpz_init (t);
if (argc != 4)
diff -r 5a6706c3817f -r d300ea27b301 gen-trialdivtab.c
--- a/gen-trialdivtab.c Fri Feb 03 18:56:09 2017 +0100
+++ b/gen-trialdivtab.c Wed Feb 08 09:38:28 2017 +0100
@@ -2,7 +2,7 @@
Contributed to the GNU project by Torbjorn Granlund.
-Copyright 2009, 2012, 2013 Free Software Foundation, Inc.
+Copyright 2009, 2012, 2013, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
diff -r 5a6706c3817f -r d300ea27b301 gmp-h.in
--- a/gmp-h.in Fri Feb 03 18:56:09 2017 +0100
+++ b/gmp-h.in Wed Feb 08 09:38:28 2017 +0100
@@ -1,6 +1,6 @@
/* Definitions for GNU multiple precision functions. -*- mode: c -*-
-Copyright 1991, 1993-1997, 1999-2015 Free Software Foundation, Inc.
+Copyright 1991, 1993-1997, 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
diff -r 5a6706c3817f -r d300ea27b301 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c Fri Feb 03 18:56:09 2017 +0100
+++ b/mini-gmp/mini-gmp.c Wed Feb 08 09:38:28 2017 +0100
@@ -2,7 +2,7 @@
Contributed to the GNU project by Niels Möller
-Copyright 1991-1997, 1999-2016 Free Software Foundation, Inc.
+Copyright 1991-1997, 1999-2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
diff -r 5a6706c3817f -r d300ea27b301 mpf/get_str.c
--- a/mpf/get_str.c Fri Feb 03 18:56:09 2017 +0100
+++ b/mpf/get_str.c Wed Feb 08 09:38:28 2017 +0100
@@ -4,8 +4,8 @@
example, the number 3.1416 would be returned as "31416" in DIGIT_PTR and
1 in EXP.
-Copyright 1993-1997, 2000-2003, 2005, 2006, 2011, 2015 Free Software
-Foundation, Inc.
+Copyright 1993-1997, 2000-2003, 2005, 2006, 2011, 2015, 2017 Free
+Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -138,26 +138,23 @@
un = ABSIZ(u);
ue = EXP(u);
- if (base >= 0)
+ num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ if (base > 1)
{
- num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
- if (base <= 1)
- base = 10;
- else if (base > 36)
- {
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- if (base > 62)
+ if (base <= 36)
+ num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
+ else if (UNLIKELY (base > 62))
return NULL;
- }
+ }
+ else if (base > -2)
+ {
+ base = 10;
}
else
{
base = -base;
- if (base <= 1)
- base = 10;
- else if (base > 36)
+ if (UNLIKELY (base > 36))
return NULL;
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
MPF_SIGNIFICANT_DIGITS (max_digits, base, PREC(u));
diff -r 5a6706c3817f -r d300ea27b301 mpf/set_str.c
--- a/mpf/set_str.c Fri Feb 03 18:56:09 2017 +0100
+++ b/mpf/set_str.c Wed Feb 08 09:38:28 2017 +0100
@@ -324,8 +324,7 @@
}
ra = 2 * (prec + 1);
- rp = TMP_ALLOC_LIMBS (ra);
- tp = TMP_ALLOC_LIMBS (ra);
+ TMP_ALLOC_LIMBS_2 (rp, ra, tp, ra);
rn = mpn_pow_1_highpart (rp, &radj, (mp_limb_t) base, exp_in_base, prec, tp);
if (divflag)
diff -r 5a6706c3817f -r d300ea27b301 mpn/generic/bdiv_q_1.c
--- a/mpn/generic/bdiv_q_1.c Fri Feb 03 18:56:09 2017 +0100
+++ b/mpn/generic/bdiv_q_1.c Wed Feb 08 09:38:28 2017 +0100
@@ -5,7 +5,7 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2000-2003, 2005, 2009 Free Software Foundation, Inc.
+Copyright 2000-2003, 2005, 2009, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -73,9 +73,10 @@
}
u = u >> shift;
- l = u - c;
+ SUBC_LIMB (c, l, u, c);
+
l = (l * di) & GMP_NUMB_MASK;
- rp[i] = l;
+ rp[n] = l;
}
else
{
diff -r 5a6706c3817f -r d300ea27b301 mpn/generic/compute_powtab.c
--- a/mpn/generic/compute_powtab.c Fri Feb 03 18:56:09 2017 +0100
+++ b/mpn/generic/compute_powtab.c Wed Feb 08 09:38:28 2017 +0100
@@ -236,7 +236,20 @@
if (digits_in_base != exptab[pi]) /* if ((((un - 1) >> pi) & 2) == 0) */
{
- mpn_divexact_1 (t, t, n, big_base);
+#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 || ! HAVE_NATIVE_mpn_divexact_1
+ if (__GMP_LIKELY (base == 10))
+ mpn_pi1_bdiv_q_1 (t, t, n, big_base >> MP_BASES_BIG_BASE_CTZ_10,
+ MP_BASES_BIG_BASE_BINVERTED_10,
+ MP_BASES_BIG_BASE_CTZ_10);
+ else
+#endif
+ /* FIXME: We could use _pi1 here if we add big_base_binverted and
+ big_base_ctz fields to struct bases. That would add about 2 KiB
+ to mp_bases.c.
+ FIXME: Use mpn_bdiv_q_1 here when mpn_divexact_1 is converted to
+ mpn_bdiv_q_1 for more machines. */
+ mpn_divexact_1 (t, t, n, big_base);
+
n -= t[n - 1] == 0;
digits_in_base -= chars_per_limb;
}
diff -r 5a6706c3817f -r d300ea27b301 mpn/generic/divrem.c
--- a/mpn/generic/divrem.c Fri Feb 03 18:56:09 2017 +0100
+++ b/mpn/generic/divrem.c Wed Feb 08 09:38:28 2017 +0100
@@ -1,7 +1,7 @@
/* mpn_divrem -- Divide natural numbers, producing both remainder and
quotient. This is now just a middle layer calling mpn_tdiv_qr.
-Copyright 1993-1997, 1999-2002, 2005 Free Software Foundation, Inc.
+Copyright 1993-1997, 1999-2002, 2005, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
diff -r 5a6706c3817f -r d300ea27b301 mpn/generic/powlo.c
--- a/mpn/generic/powlo.c Fri Feb 03 18:56:09 2017 +0100
+++ b/mpn/generic/powlo.c Wed Feb 08 09:38:28 2017 +0100
@@ -1,6 +1,6 @@
/* mpn_powlo -- Compute R = U^E mod B^n, where B is the limb base.
-Copyright 2007-2009, 2012, 2015 Free Software Foundation, Inc.
+Copyright 2007-2009, 2012, 2015, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
diff -r 5a6706c3817f -r d300ea27b301 mpn/generic/sqrlo_basecase.c
--- a/mpn/generic/sqrlo_basecase.c Fri Feb 03 18:56:09 2017 +0100
+++ b/mpn/generic/sqrlo_basecase.c Wed Feb 08 09:38:28 2017 +0100
@@ -5,8 +5,8 @@
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-Copyright 1991-1994, 1996, 1997, 2000-2005, 2008, 2010, 2011, 2015
-Free Software Foundation, Inc.
+Copyright 1991-1994, 1996, 1997, 2000-2005, 2008, 2010, 2011, 2015,
+2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
diff -r 5a6706c3817f -r d300ea27b301 mpn/generic/toom_interpolate_12pts.c
--- a/mpn/generic/toom_interpolate_12pts.c Fri Feb 03 18:56:09 2017 +0100
+++ b/mpn/generic/toom_interpolate_12pts.c Wed Feb 08 09:38:28 2017 +0100
@@ -169,7 +169,7 @@
More information about the gmp-commit
mailing list