summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-11-15 07:20:51 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-11-15 07:20:51 +0000
commit7e32c08e488be74f4dfd66b45df252648307df5d (patch)
treeef6303f30360eb70c7b37b6c7289003a51897763
parent4e1dd3b1c59e94e9e09358f4edf1d35ebdbfd194 (diff)
gmp-6.2.1
git-svn-id: svn://tug.org/texlive/trunk@56937 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/libs/README2
-rw-r--r--Build/source/libs/gmp/ChangeLog5
-rw-r--r--Build/source/libs/gmp/README2
-rw-r--r--Build/source/libs/gmp/TLpatches/ChangeLog4
-rw-r--r--Build/source/libs/gmp/TLpatches/TL-Changes2
-rwxr-xr-xBuild/source/libs/gmp/configure20
-rw-r--r--Build/source/libs/gmp/gmp-src/ChangeLog201
-rw-r--r--Build/source/libs/gmp/gmp-src/Makefile.am9
-rw-r--r--Build/source/libs/gmp/gmp-src/NEWS25
-rwxr-xr-xBuild/source/libs/gmp/gmp-src/configgmp.guess12
-rw-r--r--Build/source/libs/gmp/gmp-src/configure.ac25
-rw-r--r--Build/source/libs/gmp/gmp-src/gmp-h.in2
-rw-r--r--Build/source/libs/gmp/gmp-src/gmp-impl.h14
-rw-r--r--Build/source/libs/gmp/gmp-src/longlong.h47
-rw-r--r--Build/source/libs/gmp/gmp-src/mini-gmp/ChangeLog673
-rw-r--r--Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c10
-rw-r--r--Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h5
-rw-r--r--Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.c10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/arm64-defs.m453
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_q_1.asm12
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/darwin.m450
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/invert_limb.asm4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/lshift.asm31
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/lshiftc.asm31
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/rshift.asm31
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/compute_powtab.c24
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_q.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/gcd_22.c2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/get_d.c2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/get_str.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2.c24
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_1.c2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mul_fft.c9
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/set_str.c6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/strongfibo.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_12pts.c58
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_16pts.c34
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_2.asm31
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_2.asm31
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/fat/fat.c35
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_22.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/skylake/gmp-mparam.h19
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/x86_64-defs.m418
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen2/gmp-mparam.h21
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/cmp.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cmp.c12
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/millerrabin.c12
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/mul.c16
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/n_pow_ui.c24
-rw-r--r--Build/source/libs/gmp/version.ac2
51 files changed, 1449 insertions, 234 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README
index 772b78a1331..ea505ecc8f4 100644
--- a/Build/source/libs/README
+++ b/Build/source/libs/README
@@ -18,7 +18,7 @@ freetype2 2.10.4 - checked 21oct20
gd 2.3.0 - checked 10apr20
https://github.com/libgd/libgd/releases
-gmp 6.2.0 - checked 20jan20
+gmp 6.2.1 - checked 15nov20
http://ftp.gnu.org/gnu/gmp/
graphite2 1.3.14 - checked 10apr20
diff --git a/Build/source/libs/gmp/ChangeLog b/Build/source/libs/gmp/ChangeLog
index a4a47dcbe36..410d40c906d 100644
--- a/Build/source/libs/gmp/ChangeLog
+++ b/Build/source/libs/gmp/ChangeLog
@@ -1,3 +1,8 @@
+2020-11-15 Akira Kakuto <kakuto@w32tex.org>
+
+ Import gmp-6.2.1.
+ * version.ac: Update for 6.2.1.
+
2020-07-12 Akira Kakuto <kakuto@w32tex.org>
* Makefile.am: Add mpz/set_si.c for mpfr-4.1.0.
diff --git a/Build/source/libs/gmp/README b/Build/source/libs/gmp/README
index 4358a3de8b5..1c572c5c1ac 100644
--- a/Build/source/libs/gmp/README
+++ b/Build/source/libs/gmp/README
@@ -15,4 +15,4 @@ At the moment there is a wrapper Makefile.am and configure.ac.
=============================
2014-03-31 Taco Hoekwater <taco@metatex.org>
-2020-01-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+2020-11-15 Akira Kakuto <kakuto@w32tex.org>
diff --git a/Build/source/libs/gmp/TLpatches/ChangeLog b/Build/source/libs/gmp/TLpatches/ChangeLog
index c162f9107be..6323ca71f5c 100644
--- a/Build/source/libs/gmp/TLpatches/ChangeLog
+++ b/Build/source/libs/gmp/TLpatches/ChangeLog
@@ -1,3 +1,7 @@
+2020-11-15 Akira Kakuto <kakuto@w32tex.org>
+
+ * Import 6.2.1.
+
2020-01-20 Akira Kakuto <kakuto@w32tex.org>
* Import 6.2.0.
diff --git a/Build/source/libs/gmp/TLpatches/TL-Changes b/Build/source/libs/gmp/TLpatches/TL-Changes
index c64fdd61022..3cec0c06bd7 100644
--- a/Build/source/libs/gmp/TLpatches/TL-Changes
+++ b/Build/source/libs/gmp/TLpatches/TL-Changes
@@ -1,4 +1,4 @@
-Changes applied to the gmp-6.2.0/ tree as obtained from:
+Changes applied to the gmp-6.2.1/ tree as obtained from:
http://ftp.gnu.org/gnu/gmp/
Removed:
diff --git a/Build/source/libs/gmp/configure b/Build/source/libs/gmp/configure
index cea5b418932..782f47fb860 100755
--- a/Build/source/libs/gmp/configure
+++ b/Build/source/libs/gmp/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gmp (TeX Live) 6.2.0.
+# Generated by GNU Autoconf 2.69 for gmp (TeX Live) 6.2.1.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gmp (TeX Live)'
PACKAGE_TARNAME='gmp--tex-live-'
-PACKAGE_VERSION='6.2.0'
-PACKAGE_STRING='gmp (TeX Live) 6.2.0'
+PACKAGE_VERSION='6.2.1'
+PACKAGE_STRING='gmp (TeX Live) 6.2.1'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
@@ -1294,7 +1294,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gmp (TeX Live) 6.2.0 to adapt to many kinds of systems.
+\`configure' configures gmp (TeX Live) 6.2.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1364,7 +1364,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gmp (TeX Live) 6.2.0:";;
+ short | recursive ) echo "Configuration of gmp (TeX Live) 6.2.1:";;
esac
cat <<\_ACEOF
@@ -1461,7 +1461,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gmp (TeX Live) configure 6.2.0
+gmp (TeX Live) configure 6.2.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1976,7 +1976,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gmp (TeX Live) $as_me 6.2.0, which was
+It was created by gmp (TeX Live) $as_me 6.2.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3900,7 +3900,7 @@ fi
# Define the identity of the package.
PACKAGE='gmp--tex-live-'
- VERSION='6.2.0'
+ VERSION='6.2.1'
cat >>confdefs.h <<_ACEOF
@@ -7004,7 +7004,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gmp (TeX Live) $as_me 6.2.0, which was
+This file was extended by gmp (TeX Live) $as_me 6.2.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7070,7 +7070,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gmp (TeX Live) config.status 6.2.0
+gmp (TeX Live) config.status 6.2.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/libs/gmp/gmp-src/ChangeLog b/Build/source/libs/gmp/gmp-src/ChangeLog
index 0689b881618..a06dea1a6c5 100644
--- a/Build/source/libs/gmp/gmp-src/ChangeLog
+++ b/Build/source/libs/gmp/gmp-src/ChangeLog
@@ -1,3 +1,204 @@
+2020-11-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * Version 6.2.1 released.
+
+ * gmp-h.in (__GNU_MP_VERSION_PATCHLEVEL): Bump version info.
+ * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump revision info.
+
+2020-11-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * configure.ac (fat_path): Add bd1, goldmont,silvermont for CPUVEC.
+ * mpn/x86_64/fat/fat.c: Add more CPUs.
+ * mpn/x86/fat/fat.c: Add more CPUs.
+
+2020-11-01 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * configure.ac: X86_{,64_}PATTERN: GMP_ASM_COFF_TYPE for all ABIs;
+ * mpn/x86_64/x86_64-defs.m4 (COFF_TYPE): Copy from mpn/x86/x86-defs.m4
+ as suggested by Jeremy Drake.
+
+ * tests/misc/t-locale.c (nl_langinfo): No redefine on __TERMUX__,
+ spotted by Sanselme and Glisse.
+ * configure.ac: Consider *-*-msys as *-*-mingw* (except on arm* |
+ aarch64*), as suggested by Ralph Peterson.
+ * Makefile.am (EXTRA_DIST): Add mini-gmp/ChangeLog.
+
+2020-10-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/mpf/t-get_d_2exp.c: Test also the case zero.
+ * tests/mpz/t-get_d.c: Likewise.
+ * tests/mpf/t-trunc.c: Use mpf_size.
+
+ * tests/mpf/t-conv.c: Some more tests on zero.
+
+2020-10-25 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * configfsf.guess: Updated to version 2020-10-22, from gnulib.
+
+2020-10-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/devel/Makefile.am: Remove redundancies.
+
+ * tests/mpz/io.c: Test out-of-range bases for mpz_out_str.
+
+2020-10-15 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac: Recognise zen3.
+ * config.guess: Recognise zen3.
+
+2020-10-14 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * doc/gmp.texi (Number sequences): Remove redundancy. (spotted: TonyMcC)
+
+ * configfsf.sub: Updated to version 2020-10-13, from gnulib.
+ * configfsf.guess: Updated to version 2020-09-19, from gnulib.
+
+2020-10-06 Niels Möller <nisse@lysator.liu.se>
+
+ * Makefile.am: Better support for make check-mini-gmp on wine or cygwin.
+
+2020-09-22 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/mpz/t-mul.c: Print GMP_CHECK_FFT.
+
+ * longlong.h (x86 umul_ppmm): Fix typo.
+
+2020-09-21 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpz/n_pow_ui.c: Detect and report overflow.
+
+2020-07-04 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm64/bdiv_q_1.asm: Use LEA_HI/LEA_LO
+ * mpn/arm64/invert_limb.asm: Likewise.
+
+ * mpn/arm64/arm64-defs.m4: New file.
+ * mpn/arm64/darwin.m4: New file.
+ * configure.ac: Use arm64/arm64-defs.m4 and arm64/darwin.m4.
+
+2020-06-20 Torbjörn Granlund <tg@gmplib.org>
+
+ * longlong.h (add_sssaaaa arm32/arm64): Generalise allowed operands
+ when using adds for sub and subs for add, while disallowing 0.
+ (sub_ddmmss ppc64): Disallow 0 when using addic. Also disallow
+ constants for register-only middle addic operand.
+ (C add_sssaaaa and sub_ddmmss): Use more temps to make operation more
+ well-defined.
+
+2020-06-18 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/devel/gen-test-longlong_h.c: New file.
+ * tests/devel/Makefile.am: Compile and use gen-test-longlong_h.c.
+
+2020-06-10 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac: Recognise armcortexa55.
+
+2020-05-25 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/cxx/t-assign.cc: Use reference parameter for 'catch'.
+ * tests/cxx/t-constr.cc: Likewise.
+ * tests/cxx/t-ops2z.cc: Likewise.
+ * tests/cxx/t-rand.cc: Likewise.
+ * tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc: Likewise.
+
+ * tune/speed.c: Undo 2020-05-24 _POSIX_C_SOURCE change, it breaks on
+ many broken systems.
+ * tune/freq.c: Likewise.
+ * tune/time.c: Likewise.
+ * tune/tuneup.c: Likewise.
+
+ * tests/devel/try.c: Revert 2020-05-24 changes.
+
+2020-05-21 Torbjörn Granlund <tg@gmplib.org>
+
+ * tune/freq.c (_POSIX_C_SOURCE): Define.
+
+ * tune/tuneup.c (print_define_with_speedup): Fall back from snprintf to
+ sprintf for C90.
+ (_POSIX_C_SOURCE): Define.
+ (max_opsize): Set by #define instead of const size_t to please C90.
+ (n_measurements): Likewise.
+ (speed_mpn_pre_set_str): Adhere to C90 declaration rules.
+
+ * tune/tune-gcd-p.c: Back out 2020-01-10 change to comply to C90.
+
+ * tune/time.c (speed_endtime): Cast printf args to right type.
+ (_POSIX_C_SOURCE): Define.
+
+ * tune/speed.h (CACHE_LINE_SIZE): Do #undef before defining.
+ (SPEED_ROUTINE_MPN_GCD_1): Provide dummy first argument for standard
+ compliance.
+ (SPEED_ROUTINE_MPN_HGCD2): Adhere to C90 declaration rules.
+
+ * tune/speed.c (main): Cast printf args to right type.
+ (_POSIX_C_SOURCE): Define.
+
+ * tests/mpz/reuse.c: Avoid using non-standard function fileno().
+ * tests/spinner.c: Likewise.
+
+ * tests/mpz/convert.c (str_casecmp): New function.
+ (main): Use it instead of non-standard strcasecmp.
+
+ * tests/misc.c (tests_start): Fall back from snprintf to sprintf for
+ C90.
+
+ * tests/devel/try.c: Avoid getpagesize and use POSIX sysconf instead.
+ (_POSIX_C_SOURCE): Define.
+
+ * mpn/generic/mod_1_1.c: Don't use C++ comments.
+
+ * mpn/generic/get_d.c: Add clarifying parens.
+
+2020-05-18 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/toom_interpolate_12pts.c (DO_mpn_addlsh_n): Define only
+ when needed.
+ * mpn/generic/toom_interpolate_16pts.c: Likewise.
+
+2020-05-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/cmp.c: Avoid overflow on int even for huge sizes.
+ * mpq/cmp.c: Likewise.
+
+ * mpn/generic/mul_fft.c (mpn_fft_mul_modF_K):
+ Fully handle carry propagation in basecase multiplication.
+
+2020-05-16 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/hgcd2.c (tabp): Combine several undefined tabp
+ variable definitions with a macro.
+
+ * mpn/generic/gcd_22.c: Avoid C99 constructs.
+
+2020-05-12 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/compute_powtab.c: Avoid C99 constructs.
+ * mpn/generic/get_str.c: Likewise.
+ * mpn/generic/set_str.c: Likewise.
+
+ * gmp-impl.h (memset): Move ASSERT to before decls.
+ * tests/refmpn.c: Likewise.
+
+ * mpn/generic/hgcd2.c (tabp): Combine several undefined tabp variable
+ definitions with a macro.
+
+ * mpn/generic/strongfibo.c: Avoid defining helper function when unused.
+
+ * mpn/generic/dcpi1_bdiv_q.c (mpn_dcpi1_bdiv_q_n_itch): Disable unused
+ static function.
+
+ * mpz/mul.c: Add some {} to suppress warning.
+
+ * tests/mpn/t-gcd_11.c: Exit main() properly.
+ * tests/mpn/t-gcd_22.c: Likewise.
+ * tests/mpn/t-gcdext_1.c: Likewise.
+
+2020-04-28 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/mpz/reuse.c (realloc_if_reducing): New function.
+ (INVOKE_RRS, etc): Use realloc_if_reducing.
+
2020-01-17 Torbjörn Granlund <tg@gmplib.org>
* Version 6.2.0 released.
diff --git a/Build/source/libs/gmp/gmp-src/Makefile.am b/Build/source/libs/gmp/gmp-src/Makefile.am
index 0b9eb85a10c..1c24694e7b8 100644
--- a/Build/source/libs/gmp/gmp-src/Makefile.am
+++ b/Build/source/libs/gmp/gmp-src/Makefile.am
@@ -90,6 +90,7 @@
# 6.1.1 13:1:3 9:1:5 -
# 6.1.2 13:2:3 9:2:5 -
# 6.2.0 14:0:4 10:0:6 -
+# 6.2.1 14:1:4 10:1:6 -
#
# Starting at 3:0:0 is a slight abuse of the versioning system, but it
# ensures we're past soname libgmp.so.2, which was used on Debian GNU/Linux
@@ -103,11 +104,11 @@
# libgmpxx.so.3.0.4) incrementing, to make it clear which GMP it's from.
LIBGMP_LT_CURRENT = 14
-LIBGMP_LT_REVISION = 0
+LIBGMP_LT_REVISION = 1
LIBGMP_LT_AGE = 4
LIBGMPXX_LT_CURRENT = 10
-LIBGMPXX_LT_REVISION = 0
+LIBGMPXX_LT_REVISION = 1
LIBGMPXX_LT_AGE = 6
@@ -412,7 +413,7 @@ EXTRA_DIST += gen-psqr.c
# Distribute mini-gmp. Test sources copied by dist-hook.
EXTRA_DIST += mini-gmp/README mini-gmp/mini-gmp.c mini-gmp/mini-gmp.h \
- mini-gmp/mini-mpq.c mini-gmp/mini-mpq.h \
+ mini-gmp/ChangeLog mini-gmp/mini-mpq.c mini-gmp/mini-mpq.h \
mini-gmp/tests/Makefile mini-gmp/tests/run-tests
# Avoid: CVS - cvs directories
@@ -436,7 +437,7 @@ check-mini-gmp:
abs_srcdir="`cd $(srcdir) && pwd`" ; \
$(MKDIR_P) mini-gmp/tests \
&& cd mini-gmp/tests \
- && TEST_LIBRARY_PATH="../../.libs" \
+ && TEST_SHLIB_DIR="${abs_top_builddir}/.libs" \
$(MAKE) -f "$$abs_srcdir/mini-gmp/tests/Makefile" \
VPATH="$$abs_srcdir/mini-gmp/tests" \
srcdir="$$abs_srcdir/mini-gmp/tests" \
diff --git a/Build/source/libs/gmp/gmp-src/NEWS b/Build/source/libs/gmp/gmp-src/NEWS
index d83556ab3a7..6fc3ae425bc 100644
--- a/Build/source/libs/gmp/gmp-src/NEWS
+++ b/Build/source/libs/gmp/gmp-src/NEWS
@@ -3,6 +3,31 @@ Copyright 1996, 1999-2016, 2018-2020 Free Software Foundation, Inc.
Verbatim copying and distribution of this entire article is permitted in any
medium, provided this notice is preserved.
+Changes between GMP version 6.2.0 and 6.2.1
+
+ BUGS FIXED
+ * A possible overflow of type int is avoided for mpz_cmp on huge operands.
+
+ * Overflows are more carefully detected and reported for mpz_pow_ui.
+
+ * A bug in longlong.h for aarch64 sub_ddmmss, not affecting GMP, was healed.
+
+ * mini-gmp: mpz_out_str and mpq_out_str now correctly handle out of
+ range bases.
+
+ FEATURES
+ * C90 compliance.
+
+ * Initial support for Darwin on arm64, and improved portability.
+
+ * Support for more processors.
+
+ SPEEDUPS
+ * None, except indirectly through recognition of new CPUs.
+
+ MISC
+ * None.
+
Changes between GMP version 6.1.* and 6.2.0
BUGS FIXED
diff --git a/Build/source/libs/gmp/gmp-src/configgmp.guess b/Build/source/libs/gmp/gmp-src/configgmp.guess
index 663148895f8..2d2680315ed 100755
--- a/Build/source/libs/gmp/gmp-src/configgmp.guess
+++ b/Build/source/libs/gmp/gmp-src/configgmp.guess
@@ -992,9 +992,19 @@ main ()
default:
modelstr = "zen2";
break;
- }
+ }
+ break;
+ case 25: /* Zen 3 */
+ cpu_64bit = 1, cpu_avx = 1;
+ modelstr = "zen3";
+ break;
}
}
+ else if (strcmp (vendor_string, "HygonGenuine") == 0)
+ {
+ cpu_64bit = 1, cpu_avx = 1;
+ modelstr = "zen";
+ }
else if (strcmp (vendor_string, "CyrixInstead") == 0)
{
/* Should recognize Cyrix' processors too. */
diff --git a/Build/source/libs/gmp/gmp-src/configure.ac b/Build/source/libs/gmp/gmp-src/configure.ac
index 024cacb6b8c..cafdb3c7161 100644
--- a/Build/source/libs/gmp/gmp-src/configure.ac
+++ b/Build/source/libs/gmp/gmp-src/configure.ac
@@ -722,7 +722,7 @@ case $host in
gcc_cflags_neon="-mfpu=neon"
gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
;;
- armcortexa53 | armcortexa53neon)
+ armcortexa53 | armcortexa53neon | armcortexa55 | armcortexa55neon)
abilist="64 32"
path="arm/neon arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm"
path_64="arm64/cora53 arm64"
@@ -1889,7 +1889,7 @@ case $host in
x86_have_mulx=yes
path_64="x86_64/zen x86_64"
;;
- zen2 | zen2noavx)
+ zen2 | zen2noavx | zen3 | zen3noavx)
gcc_cflags_cpu="-mtune=znver2 -mtune=znver1 -mtune=amdfam10 -mtune=k8"
gcc_cflags_arch="-march=znver2 -march=znver1 -march=amdfam10 -march=k8"
path="x86/k7/mmx x86/k7 x86/mmx x86"
@@ -2011,7 +2011,7 @@ case $host in
# Sun cc.
cc_64_cflags="-xO3 -m64"
;;
- *-*-mingw* | *-*-cygwin)
+ *-*-mingw* | *-*-msys | *-*-cygwin)
limb_64=longlong
CALLING_CONVENTIONS_OBJS_64=""
AC_DEFINE(HOST_DOS64,1,[Define to 1 for Windos/64])
@@ -2037,7 +2037,7 @@ esac
# x86s, but allow any CPU here so as to catch "none" too.
#
case $host in
- *-*-mingw*)
+ *-*-mingw* | *-*-msys)
gcc_cflags_optlist="$gcc_cflags_optlist nocygwin"
gcc_cflags_nocygwin="-mno-cygwin"
;;
@@ -2291,11 +2291,12 @@ case $host in
fat_path="x86 x86/fat x86/i486
x86/k6 x86/k6/mmx x86/k6/k62mmx
x86/k7 x86/k7/mmx
- x86/k8 x86/k10 x86/bt1
+ x86/k8 x86/k10 x86/bt1 x86/bd1
x86/pentium x86/pentium/mmx
x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2
x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2
x86/core2 x86/coreinhm x86/coreisbr
+ x86/goldmont x86/silvermont
x86/atom x86/atom/mmx x86/atom/sse2 x86/nano"
fi
@@ -2664,7 +2665,7 @@ AC_LIBTOOL_WIN32_DLL
AC_SUBST(LIBGMP_DLL,0)
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ *-*-cygwin* | *-*-mingw* | *-*-msys | *-*-pw32* | *-*-os2*)
# By default, build only static.
if test -z "$enable_shared"; then
enable_shared=no
@@ -3699,6 +3700,14 @@ if test "$gmp_asm_syntax_testing" != no; then
case $ABI in
32)
GMP_INCLUDE_MPN(arm/arm-defs.m4) ;;
+ 64)
+ case $host in
+ *-*-darwin*)
+ GMP_INCLUDE_MPN(arm64/darwin.m4) ;;
+ *)
+ GMP_INCLUDE_MPN(arm64/arm64-defs.m4) ;;
+ esac
+ ;;
esac
;;
hppa*-*-*)
@@ -3774,11 +3783,11 @@ yes
if test "$x86_have_mulx" = yes; then
GMP_ASM_X86_MULX
fi
+ GMP_ASM_COFF_TYPE
case $ABI in
32)
GMP_INCLUDE_MPN(x86/x86-defs.m4)
AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86)
- GMP_ASM_COFF_TYPE
GMP_ASM_X86_GOT_UNDERSCORE
GMP_ASM_X86_SHLDL_CL
case $enable_profiling in
@@ -3795,7 +3804,7 @@ yes
case $host in
*-*-darwin*)
GMP_INCLUDE_MPN(x86_64/darwin.m4) ;;
- *-*-mingw* | *-*-cygwin)
+ *-*-mingw* | *-*-msys | *-*-cygwin)
GMP_INCLUDE_MPN(x86_64/dos64.m4) ;;
*-openbsd*)
GMP_DEFINE_RAW(["define(<OPENBSD>,1)"]) ;;
diff --git a/Build/source/libs/gmp/gmp-src/gmp-h.in b/Build/source/libs/gmp/gmp-src/gmp-h.in
index d8ce7fdb6de..3d449d427b5 100644
--- a/Build/source/libs/gmp/gmp-src/gmp-h.in
+++ b/Build/source/libs/gmp/gmp-src/gmp-h.in
@@ -2329,7 +2329,7 @@ enum
/* Major version number is the value of __GNU_MP__ too, above. */
#define __GNU_MP_VERSION 6
#define __GNU_MP_VERSION_MINOR 2
-#define __GNU_MP_VERSION_PATCHLEVEL 0
+#define __GNU_MP_VERSION_PATCHLEVEL 1
#define __GNU_MP_RELEASE (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL)
#define __GMP_H__
diff --git a/Build/source/libs/gmp/gmp-src/gmp-impl.h b/Build/source/libs/gmp/gmp-src/gmp-impl.h
index 8192dac2177..2e5906906ae 100644
--- a/Build/source/libs/gmp/gmp-src/gmp-impl.h
+++ b/Build/source/libs/gmp/gmp-src/gmp-impl.h
@@ -289,13 +289,13 @@ typedef struct {mp_limb_t inv21, inv32, inv53;} gmp_pi2_t;
#endif
#if ! HAVE_MEMSET
-#define memset(p, c, n) \
- do { \
- ASSERT ((n) >= 0); \
- char *__memset__p = (p); \
- int __i; \
- for (__i = 0; __i < (n); __i++) \
- __memset__p[__i] = (c); \
+#define memset(p, c, n) \
+ do { \
+ unsigned char *__memset__p = (unsigned char *) (p); \
+ int __i; \
+ ASSERT ((n) >= 0); \
+ for (__i = 0; __i < (n); __i++) \
+ __memset__p[__i] = (c); \
} while (0)
#endif
diff --git a/Build/source/libs/gmp/gmp-src/longlong.h b/Build/source/libs/gmp/gmp-src/longlong.h
index bc3fc81cb0a..edbaf568e92 100644
--- a/Build/source/libs/gmp/gmp-src/longlong.h
+++ b/Build/source/libs/gmp/gmp-src/longlong.h
@@ -436,7 +436,7 @@ long __MPN(count_leading_zeros) (UDItype);
&& W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
do { \
- if (__builtin_constant_p (bl) && -(USItype)(bl) < 0x100) \
+ if (__builtin_constant_p (bl) && -(USItype)(bl) < (USItype)(bl)) \
__asm__ ("subs\t%1, %4, %5\n\tadc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "rI" (bh), \
@@ -447,8 +447,8 @@ long __MPN(count_leading_zeros) (UDItype);
: "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC); \
} while (0)
/* FIXME: Extend the immediate range for the low word by using both ADDS and
- SUBS, since they set carry in the same way. Note: We need separate
- definitions for thumb and non-thumb to to th absense of RSC under thumb. */
+ SUBS, since they set carry in the same way. We need separate definitions
+ for thumb and non-thumb since thumb lacks RSC. */
#if defined (__thumb__)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
@@ -504,7 +504,7 @@ long __MPN(count_leading_zeros) (UDItype);
__asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
- else /* only bh might be a constant */ \
+ else \
__asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
@@ -560,11 +560,9 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#endif /* __arm__ */
#if defined (__aarch64__) && W_TYPE_SIZE == 64
-/* FIXME: Extend the immediate range for the low word by using both
- ADDS and SUBS, since they set carry in the same way. */
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
do { \
- if (__builtin_constant_p (bl) && -(UDItype)(bl) < 0x1000) \
+ if (__builtin_constant_p (bl) && ~(UDItype)(bl) <= (UDItype)(bl)) \
__asm__ ("subs\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \
: "=r" (sh), "=&r" (sl) \
: "rZ" ((UDItype)(ah)), "rZ" ((UDItype)(bh)), \
@@ -577,7 +575,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
} while (0)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
- if (__builtin_constant_p (bl) && -(UDItype)(bl) < 0x1000) \
+ if (__builtin_constant_p (bl) && ~(UDItype)(bl) <= (UDItype)(bl)) \
__asm__ ("adds\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \
: "=r,r" (sh), "=&r,&r" (sl) \
: "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)), \
@@ -1056,7 +1054,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
&& (HAVE_HOST_CPU_haswell || HAVE_HOST_CPU_broadwell \
|| HAVE_HOST_CPU_skylake || HAVE_HOST_CPU_bd4 || HAVE_HOST_CPU_zen)
#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("mulx\t%3, %0, %1" \
+ __asm__ ("mulx\t%3, %q0, %q1" \
: "=r" (w0), "=r" (w1) \
: "%d" ((UDItype)(u)), "rm" ((UDItype)(v)))
#else
@@ -1494,36 +1492,37 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
This might seem strange, but gcc folds away the dead code late. */
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
- if (__builtin_constant_p (bl) && bl > -0x8000 && bl <= 0x8000) { \
+ if (__builtin_constant_p (bl) \
+ && (bl) > -0x8000 && (bl) <= 0x8000 && (bl) != 0) { \
if (__builtin_constant_p (ah) && (ah) == 0) \
__asm__ ("addic %1,%3,%4\n\tsubfze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
__CLOBBER_CC); \
else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
__asm__ ("addic %1,%3,%4\n\tsubfme %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
__CLOBBER_CC); \
else if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("addic %1,%3,%4\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) \
- : "r" ((UDItype)(ah)), \
- "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ : "r" ((UDItype)(ah)), \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
__CLOBBER_CC); \
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("addic %1,%3,%4\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) \
- : "r" ((UDItype)(ah)), \
- "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ : "r" ((UDItype)(ah)), \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
__CLOBBER_CC); \
else \
__asm__ ("addic %1,%4,%5\n\tsubfe %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
- : "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ : "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
__CLOBBER_CC); \
} else { \
if (__builtin_constant_p (ah) && (ah) == 0) \
@@ -2056,8 +2055,10 @@ extern __longlong_h_C UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *)
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
do { \
UWtype __x; \
- __x = (al) + (bl); \
- (sh) = (ah) + (bh) + (__x < (al)); \
+ UWtype __al = (al); \
+ UWtype __bl = (bl); \
+ __x = __al + __bl; \
+ (sh) = (ah) + (bh) + (__x < __al); \
(sl) = __x; \
} while (0)
#endif
@@ -2066,8 +2067,10 @@ extern __longlong_h_C UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
UWtype __x; \
- __x = (al) - (bl); \
- (sh) = (ah) - (bh) - ((al) < (bl)); \
+ UWtype __al = (al); \
+ UWtype __bl = (bl); \
+ __x = __al - __bl; \
+ (sh) = (ah) - (bh) - (__al < __bl); \
(sl) = __x; \
} while (0)
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mini-gmp/ChangeLog b/Build/source/libs/gmp/gmp-src/mini-gmp/ChangeLog
new file mode 100644
index 00000000000..449241f148e
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mini-gmp/ChangeLog
@@ -0,0 +1,673 @@
+2020-11-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/run-tests: Update WINEPATH, instead of overwriting it.
+
+2020-10-25 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-mpq.c (mpq_canonical_sign): Use the correct type for size.
+
+2020-10-18 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-mpq.c (mpq_out_str): Return 0 when base is out of range.
+ * mini-gmp.c (mpz_out_str): Likewise. (spotted by Paul Eggert)
+
+ * tests/t-str.c: Test out-of-range bases for mpz_out_str.
+ * tests/t-mpq_str.c: Likewise, for mpq_out_str.
+
+2020-10-06 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/run-tests: Better support for make check on wine or cygwin.
+
+2020-09-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-mpq_double.c (mpq_get_d_exact_p): Cleanup.
+
+ * mini-gmp.h: Update FILE tests from gmp-h (tx Vincent Lefèvre).
+
+2020-05-21 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/t-mpq_muldiv_2exp.c (testmain): Cast printf args to right type.
+
+ * tests/t-double.c: Provide default M_PI definition.
+
+2020-05-19 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/hex-random.h (enum hex_random_op): Remove final ",".
+
+2019-12-04 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp/mini-gmp.c (mpn_invert_3by2): Remove shortcuts.
+
+2019-11-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp/mini-gmp.c (mpn_invert_3by2): Shortcut for short limbs.
+
+2019-11-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp/mini-gmp.c (gmp_clz, gmp_popcount_limb, mpz_export):
+ Avoid undefined behaviour with small limb sizes.
+
+2019-09-30 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-gcd.c (gcdext_valid_p): Stricter checks for gcdext
+ corner cases.
+
+2018-12-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp/mini-gmp.c: Support for micro-gmp.
+
+2018-11-07 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp/mini-gmp.c: Silence a couple of warnings.
+
+2018-10-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_probab_prime_p): BPSW test for primality.
+
+ * tests/hex-random.c (hex_random_lucm_op): New function.
+ * tests/hex-random.h: Declare it.
+ * tests/mini-random.c (mini_random_lucm_op): New function.
+ * tests/mini-random.h: Declare it.
+ * mini-gmp/tests/t-lucm.c: New test
+ * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Add t-lucm.
+
+2018-09-07 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-div.c (testmain): Add missing const declarations.
+
+2018-05-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_get_d): Convert a fixed number of
+ bits (GMP_DBL_MANT_BITS) to avoid rounding.
+
+ * mini-mpq.c (mpq_mul): Use mpq_nan_init.
+
+ * tests/t-double.c (test_matissa): Tests converted bits.
+
+2018-04-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-mpq.c: New file, mini-implementation of mpq_t.
+ * mini-mpq.h: New file, definitions for mpq_t.
+ * tests/t-mpq_addsub: New tests for mpq_add and sub.
+ * tests/t-mpq_muldiv: New tests for mpq_mul and div.
+ * tests/t-mpq_muldiv_2exp: New tests for mpq_*_2exp.
+
+2018-03-11 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (mpn_div_qr_2_preinv): Drop separate rp argument.
+ Clobber input np, and store remainder in np[0] and np[1]. This is
+ all the current caller needs, and it eliminates one allocation in
+ the common case of un-normalized d.
+ (mpn_div_qr_2): Delete #if:ed out function.
+ (mpn_div_qr_preinv): Update the only call site for
+ mpn_div_qr_2_preinv.
+
+2018-02-10 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (mpn_div_qr_1_preinv): When qp is non-NULL, reuse
+ area for shifted input, to avoid an allocation.
+
+2018-01-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (gmp_popcount_limb): Micro-optimisations.
+ * tests/t-comb.c (checkWilson): Check also mpz_2fac_ui.
+
+2017-12-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_mfac_ui, mpz_2fac_ui): New functions.
+ * mini-gmp.h: Declare them.
+ * mini-gmp.c (mpz_fac_ui): Use mpz_mfac_ui.
+
+2017-07-23 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (GMP_MPN_OVERLAP_P): New macro, copy of
+ MPN_OVERLAP_P, from gmp-impl.h.
+ (mpn_mul): Assert that output area doesn't overlap with the input.
+
+2017-02-03 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_sizeinbase, mpz_get_str, mpz_set_str): Support
+ bases up to 62.
+ * tests/t-str.c: Update tests accordingly.
+
+2016-11-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_get_si): fewer branches, safer forumla for negatives.
+
+ * tests/t-signed.c: Removed a typo
+
+2016-11-24 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/hex-random.c (mkseed): Produce a 48-bit mpz_t value,
+ regardless of word size.
+ (hex_random_init): Use gmp_randseed instead of gmp_randseed_ui,
+ and support seeds exceeding an unsigned long.
+
+ * tests/hex-random.c (mkseed): New function, using /dev/urandom
+ for random seed when available.
+ (hex_random_init): Use it.
+
+2016-11-23 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (GMP_CMP): New macro.
+ (mpz_sgn, mpz_cmp_si, mpz_cmp_ui, mpz_cmpabs_ui): Use it.
+
+2016-11-22 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-invert.c (test_3by2, test_2by1): New functions,
+ extracted from testmain.
+ (testmain): Add test with inputs which triggered the
+ mpn_invert_3by2 bug (see 2016-11-16 entry).
+
+2016-11-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-signed.c: compare different signs, and after overflow.
+
+2016-11-20 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-signed.c: Reorganize testcase, to avoid undefined
+ behaviour with signed overflow.
+
+2016-11-19 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/run-tests: Set up LD_LIBRARY_PATH and DYLD_LIBRARY_PATH
+ for tests only, based on TEST_LIBRARY_PATH.
+
+ * tests/mini-random.h: Use name "../mini-gmp.h" for include, so we
+ don't need any -I options to the compiler.
+
+ * tests/Makefile: Pass CFLAGS to the linker, as
+ recommended by the GNU coding standard.
+ (CPPFLAGS): New variable, with empty default value.
+ (CFLAGS): Remove the -I flag involving MINI_GMP_DIR, to leave free
+ for overriding on make command line.
+ (EXTRA_CFLAGS): Deleted variable, no longer needed.
+
+2016-11-18 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/Makefile: Pass EXTRA_CFLAGS to linker as a intermediate fix.
+
+2016-11-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-str.c: free a pointer to avoid memory leaks.
+
+2016-11-16 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (mpn_invert_3by2): Fix arithmetic overflow
+ bug, and improve documentation of the algorithm.
+
+2016-11-15 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-limbs.c (testmain): Skip tests with zero product.
+
+ * tests/hex-random.c (hex_random_init): Added fflush call.
+
+2016-11-15 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/Makefile (TESTS): New variable, allowing separation of
+ compilation and running of tests.
+ * tests/run-tests: Allow empty tests list.
+
+2016-11-14 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-str.c: Some more test cases.
+ * tests/t-pprime_p.c: Use shorter operands, with different sizes.
+
+2016-11-01 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/hex-random.c: Reinstate gmp.h inclusion.
+
+2016-08-22 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (mpn_set_str_other): Always return size >= 1, with
+ unnormalized result in the case the input digits are all zero.
+ Fixes crash on a large number of leading zeros, reported by Axel
+ Miller.
+ (mpz_set_str): Normalize as needed, after above change. Return
+ failure for inputs string with no digits, i.e., empty except for
+ optional sign, base prefix and white space.
+
+2016-01-01 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c: Silence warnings due to (un)signed types.
+ * tests/testutils.c: Likewise.
+ * tests/t-logops.c: Likewise.
+ * tests/t-cmp_d.c: Likewise.
+ * tests/t-reuse.c: Likewise.
+ * tests/t-cong.c: Likewise.
+
+2015-11-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c: Lazy allocation for mpz_t.
+ (mpz_rootrem): Exploit lazy allocation to avoid init2.
+
+2015-11-06 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpn_com, mpn_neg): New functions.
+ * mini-gmp.h: Declare them.
+ * mini-gmp.c (mpz_div_r_2exp): Use mpn_neg.
+
+2015-10-29 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c: Removed a typo (spotted by Paul Zimmermann).
+
+2015-05-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.h: Declare mpn_zero_p.
+ * mini-gmp.c: Define mpn_zero_p as a function, not a macro.
+
+2014-08-27 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (mpz_abs_sub_bit): Do full normalization,
+ needed if mpz_clrbit clears the most significant one bit.
+
+2014-07-28 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c: Remove some useless variables.
+
+2014-05-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c: +1 in the init2 argument before setbit.
+
+2014-05-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c: Micro-optimisations.
+
+2014-03-12 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_probab_prime_p): Micro-optimisation.
+
+2014-03-06 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (gmp_millerrabin): New internal function.
+ (mpz_probab_prime_p): New function.
+ * mini-gmp.h (mpz_probab_prime_p): Declare it.
+ * tests/t-pprime_p.c: New test program.
+ * tests/Makefile (CHECK_PROGRAMS): Added t-pprime_p.
+
+2014-03-03 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (mpz_congruent_p): New function.
+ * mini-gmp.h: Declare it.
+ * tests/t-cong.c: New file, based on tests/mpz/t-cong.c.
+ * tests/Makefile (CHECK_PROGRAMS): Added t-cong.
+
+ * tests/testutils.c (dump): New function. Deleted static
+ functions in other files.
+ (mpz_set_str_or_abort): Moved function here, from...
+ * tests/t-cmp_d.c: ... old location.
+
+ * tests/t-reuse.c (dump3): Renamed, from ...
+ (dump): ...old name.
+
+2014-02-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpn_sqrtrem): New function.
+ * mini-gmp.h: Declare it.
+ * tests/t-sqrt.c: Test it.
+
+2014-02-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_div_qr): init + set = init_set .
+
+2014-02-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-limbs.c: New test for mpz_limbs_*.
+ * tests/Makefile (CHECK_PROGRAMS): Add it.
+
+2014-02-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_realloc2, mpz_limbs_read, mpz_limbs_modify
+ mpz_limbs_write, mpz_limbs_finish, mpz_roinit_n): New functions.
+ (mpn_perfect_square_p): New function.
+ * mini-gmp.h: Declare them.
+
+ * tests/t-mul.c: Use roinit and limbs_read to test mpn.
+ * tests/t-sqrt.c: Test also mpn_perfect_square_p.
+
+2014-02-03 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpn_rootrem): Allow NULL argument.
+
+ * mini-gmp.c (mpn_zero): New function.
+ (mpz_perfect_square_p): New function.
+ * mini-gmp.h: Declare them.
+
+ * tests/t-sqrt.c: Test mpz_perfect_square_p.
+ * tests/t-root.c: Test also 1-th root, allow perfect powers.
+
+2014-01-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-aorsmul.c: New file, test for mpz_{add,sub}mul{,_ui}
+ * tests/Makefile: Add t-aorsmul.
+
+2014-01-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpn_popcount): New function.
+ (mpz_popcount): Use it.
+ (mpz_addmul_ui, mpz_addmul, mpz_submul_ui, mpz_submul): Added.
+ * mini-gmp.h: Declare them.
+
+2014-01-16 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (mp_bits_per_limb): New const value.
+ * mini-gmp.h: Declare it.
+
+2013-03-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c: Write loops in a cleaner way.
+
+2013-02-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_div_q_2exp): Adjust only if needed.
+ (mpn_common_scan): New service function to unify scan loops.
+ (mpz_scan0, mpz_scan1): Simplify by using mpn_common_scan.
+ (mpz_make_odd): Simplify, assume in-place operation on positive.
+ (mpn_scan0, mpn_scan1): New functions.
+ * mini-gmp.h (mpn_scan0, mpn_scan1): New declarations.
+ * tests/t-scan.c: Test also mpn_scan0 and mpn_scan1.
+
+2013-02-25 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-double.c (testmain): Declare double variables as
+ volatile, to drop extended precision.
+
+ * tests/testutils.c (testfree): New function. Use it everywhere
+ where test programs deallocate storage allocated via the mini-gmp
+ allocation functions, including uses of mpz_get_str for various
+ test failure messages.
+
+2013-02-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c: Move asserts to work-around a compiler bug.
+ (mpz_export): Reorder branches.
+ (mpz_mul_ui): Avoid temporary allocation (mpn_mul_1 can work in-place).
+
+ * tests/t-reuse.c: Fix typo causing the same negation condition to
+ be applied to all operands. (See 2013-02-03, Torbjorn)
+
+2013-02-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_mul): Read sizes just once.
+ (mpn_set_str_other): Remove a redundant variable.
+ (mpz_abs_add): Use SWAP once, to order sizes.
+ (mpz_mul_ui): Micro-optimisation.
+ (mpz_rootrem): Use _init2 before _setbit.
+ (mpz_set_str): Optimise-out a variable.
+ (mpz_import): Normalise only if needed.
+ (mpn_div_qr_1): Speed-up the d=1 case, delaying a branch.
+
+2013-02-12 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (fac_ui, bin_uiui): Use shorter and faster code.
+
+ * mini-gmp.c: Reduce branches.
+
+2013-01-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_cmpabs_d, mpz_cmp_d): Simplify.
+ (mpz_set_str): Behaviour more adherent to the real GMP.
+
+ * tests/t-str.c: Cast size_t to unsigned long, for printf.
+ * tests/t-import.c: Likewise.
+ * tests/t-comb.c: Remove an unused var.
+ * tests/t-div.c: Remove unused args passed to fprintf.
+ * tests/t-double.c: Use float immediates with float vars.
+
+2013-01-22 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (mpz_cmp_d): Simplified, just sort out signs, then
+ call mpz_cmpabs_d.
+
+ * tests/testutils.h: Include stdio.h and stdlib.h.
+ (numberof): New define.
+
+ * tests/t-cmp_d.c: New file, copied from tests/mpz/t-cmp_d.c with
+ minor changes.
+ * tests/Makefile (CHECK_PROGRAMS): Added t-cmp_d,
+
+ * mini-gmp.c (mpz_cmpabs_d): New function.
+ * mini-gmp.h: Declare it.
+
+2013-01-21 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-str.c (testmain): Test mpz_out_str, using
+ the tmpfile function for i/o.
+
+2013-01-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/testutils.c (testhalves): New function, test default
+ memory functions.
+ * tests/testutils.h (testhalves): Declare it
+ * tests/t-logops.c: Use testhalves.
+
+ * mini-gmp.c (mpz_init_set_str): New function.
+ * mini-gmp.h (mpz_init_set_str): Declare it.
+ * tests/t-str.c: Test mpz_init_set_str.
+
+2013-01-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-double.c (testmain): Get the current free
+ function using mp_get_memory_functions.
+ * tests/t-str.c (testmain): Likewise.
+
+ * tests/testutils.h (tu_free): Remove declaration.
+
+ * tests/testutils.c (block_check, tu_free): Mark static.
+
+2013-01-18 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-str.c (test_small): New function, exercising
+ parsing of whitespace and base prefixes.
+ (testmain): Call it.
+
+ * tests/t-gcd.c (gcdext_valid_p): Fixed memory leak.
+
+ * tests/t-double.c (testmain): Call tu_free rather than
+ free, for storage allocated by mpz_get_str.
+ * tests/t-str.c (testmain): Likewise.
+
+ * tests/testutils.c (block_init, block_check): New functions.
+ (tu_alloc, tu_realloc, tu_free): New functions.
+ (main): Use mp_set_memory_functions.
+ * tests/testutils.h (tu_free): Declare.
+
+ * tests/testutils.h: New file, declarations for test programs.
+
+ * tests/testutils.c (main): New file, with shared main
+ function for all the test programs. Also includes mini-gmp.c.
+ Calls testmain after initialization. All other test programs
+ updated to define testmain rather than main.
+
+2013-01-18 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-signed.c: Slightly larger coverage.
+ * tests/t-double.c: Test also mpz_init_set_d.
+
+2013-01-18 Torbjorn Granlund <tege@gmplib.org>
+
+ * tests/t-div.c: Test mpz_divisible_p and mpz_divisible_ui_p.
+
+ * tests/t-div.c: Test also mpz_mod, mpz_mod_ui. Compare
+ mpz_divisible_p just to ceil, to save time.
+
+ * mini-gmp.c: Prefix some names with GMP_.
+
+2013-01-16 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-double.c: Test mpz_cmp_d.
+ * mini-gmp.c (mpz_cmp_d): Correct multiword comparison.
+
+ * mini-gmp.c (mpz_set_str): Handle the empty string.
+ * tests/t-str.c: Test base <= 0.
+
+2013-01-15 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-str.c (main): Use x->_mp_d rather than x[0]._mp_d.
+ * tests/t-invert.c (main): Likewise.
+
+ * tests/t-mul.c (main): Test mpn_mul_n and mpn_sqr.
+
+ * tests/hex-random.h (enum hex_random_op): New value OP_SQR.
+
+ * tests/mini-random.c (mini_random_op3): Renamed, from...
+ (mini_random_op): ... old name. Updated callers.
+ (mini_random_op2): New function.
+
+ * tests/hex-random.c (hex_random_op3): Renamed, from...
+ (hex_random_op): ... old name. Updated callers.
+ (hex_random_op2): New function.
+
+2013-01-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-logops.c: Improve popcount/hamdist testing.
+ * tests/t-signed.c: Test more cases.
+
+2013-01-14 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-str.c (main): Added tests for mpn_get_str and
+ mpn_set_str.
+
+2013-01-11 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-comb.c: New test program, testing both
+ mpz_fac_ui and mpz_bin_uiui.
+ * tests/Makefile (CHECK_PROGRAMS): Added t-comb.
+
+ * mini-gmp.c (mpz_mul_si): Simplify.
+ (mpz_mul_ui, mpz_mul, mpz_div_qr): Replace init+REALLOC with init2.
+
+ * mini-gmp.c (NEG_CAST): New macro.
+ (mpz_mul_si, mpz_set_si, mpz_cmp_si): Use NEG_CAST.
+
+ * mini-gmp.c (mpz_set_si, mpz_cmp_si): Simplify by using
+ the _ui variant.
+
+ * tests/t-root.c: Use mpz_ui_pow_ui, when base fits an ui.
+
+ * tests/t-mul.c: Test also mpz_mul_si.
+ * tests/t-sub.c: Test also mpz_ui_sub.
+
+ * mini-gmp.c (mpz_fits_slong_p): Correct range.
+ * tests/t-signed.c: New test program, for get/set/cmp_si.
+ * tests/Makefile (CHECK_PROGRAMS): Added t-signed.
+
+ * mini-gmp.c (mpz_hamdist): Handle different sizes.
+ * tests/t-logops.c: Test also popcount and hamdist.
+
+2013-01-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_export, mpz_import): Less restrictive ASSERTs.
+ * tests/t-import.c: Test also size=0 or count=0.
+
+2013-01-10 Torbjorn Granlund <tege@gmplib.org>
+
+ * tests/t-import.c (main): Don't drop off function end.
+
+2013-01-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_export): Support op=0 countp=NULL.
+
+2013-01-08 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/t-import.c: New test program, testing both
+ mpz_import and mpz_export.
+ * tests/Makefile (CHECK_PROGRAMS): Added t-import.
+
+ * tests/mini-random.c (mini_rrandomb_export): New function.
+ * tests/mini-random.h: Declare it.
+ * tests/hex-random.c (hex_rrandomb_export): New function.
+ * tests/hex-random.h: Declare it.
+
+ * mini-gmp.c (mpz_export): Compute accurate word count up
+ front, to avoid generating any high zero words.
+
+2013-01-07 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * README: Document base limitation for conversions.
+ * mini-gmp.c (mpz_set_str): Remove goto.
+ (mpz_import, mpz_export): Correctly use order/endianness.
+
+2013-01-04 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ From shuax:
+ * mini-gmp.c (mpz_import): Reset limb after storing it.
+
+2012-11-22 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/run-tests: Copied latest version from GNU Nettle.
+ Minor fix to the use of $EMULATOR, and proper copyright notice.
+
+2012-06-24 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_div_r_2exp, mpz_div_q_2exp): Improve
+ adjustment condition.
+
+2012-06-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_realloc): remove a branch.
+
+2012-05-25 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/t-div.c: Test all _qr, _q, _r variants.
+ * tests/t-lcm.c: Test the _ui variant.
+
+ * mini-gmp.c (mpz_mod, mpz_mod_ui): New functions.
+ * mini-gmp.h (mpz_mod, mpz_mod_ui): Prototypes.
+
+2012-05-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c: merge mpz_rootrem and mpz_sqrtrem.
+
+2012-04-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.h (mpz_fac_ui, mpz_bin_uiui): New definitions.
+ * mini-gmp.c (mpz_fac_ui, mpz_bin_uiui): Trivial implementation.
+
+2012-04-11 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.h (mpz_root, mpz_rootrem): define (correctly).
+ * mini-gmp.c (mpz_rootrem): Extended code from _root.
+ (mpz_root): Use mpz_rootrem.
+ (mpz_mul_ui): Correctly handle negative operands.
+
+ * tests/Makefile (CHECK_PROGRAMS): add t-root.
+ * tests/t-root.c: New file.
+ * tests/t-reuse.c: Enable root{,rem} tests.
+
+2012-04-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mini-gmp.c (mpz_root): New, support negative operands.
+ * mini-gmp.h (mpz_root): define.
+ (mpz_out_str): Test also __STDIO_LOADED (for VMS).
+ * mpz/2fac_ui.c: Cosmetic change.
+
+ * tests/t-reuse.c: New test case, based on tests/mpz/reuse.c.
+
+ * mini-gmp.c (mpz_cdiv_r_ui): New function.
+ (mpz_fdiv_r_ui): New function.
+ (mpz_tdiv_r_ui): New function.
+ (mpz_powm_ui): New function.
+ (mpz_pow_ui): New function.
+ (mpz_ui_pow_ui): Use mpz_pow_ui.
+ (mpz_gcdext): Fixed input/output overlap, for the case of one
+ input being zero.
+ (mpz_sqrtrem): Fix for the case r NULL, U zero.
+
+2012-02-28 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/Makefile (srcdir, MINI_GMP_DIR): New make variables. These
+ can be overridden when using a separate build directory.
+ (EXTRA_CFLAGS): Renamed, was OPTFLAGS.
+
+ * mini-gmp.c (mpz_abs_add): Don't cache limb pointers
+ over MPZ_REALLOC, since that breaks in-place operation. Bug
+ spotted by Torbjörn.
+ (mpz_and, mpz_ior, mpz_xor): Likewise.
+ (mpz_cmp): Fixed comparison of negative numbers.
+
+2012-02-26 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp: New subdirectory. For use by GMP bootstrap, and as a
+ fallback for applications needing bignums but not high
+ performance.
diff --git a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c
index 78cd1034473..48ce1072ba2 100644
--- a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c
+++ b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c
@@ -32,7 +32,7 @@ see https://www.gnu.org/licenses/. */
/* NOTE: All functions in this file which are not declared in
mini-gmp.h are internal, and are not intended to be compatible
- neither with GMP nor with future versions of mini-gmp. */
+ with GMP or with future versions of mini-gmp. */
/* Much of the material copied from GMP files, including: gmp-impl.h,
longlong.h, mpn/generic/add_n.c, mpn/generic/addmul_1.c,
@@ -790,7 +790,7 @@ mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
qh' = floor( (b^3 - 1) / u) - b = floor ((b^3 - b u - 1) / u
= floor( (b (~u) + b-1) / u),
-
+
and the remainder
r = b (~u) + b-1 - qh (b uh + ul)
@@ -3418,7 +3418,7 @@ gmp_lucas_mod (mpz_t V, mpz_t Qk, long Q,
gmp_lucas_step_k_2k (V, Qk, n);
/* A step k->k+1 is performed if the bit in $n$ is 1 */
- /* mpz_tstbit(n,bs) or the the bit is 0 in $n$ but */
+ /* mpz_tstbit(n,bs) or the bit is 0 in $n$ but */
/* should be 1 in $n+1$ (bs == b0) */
if (b0 == bs || mpz_tstbit (n, bs))
{
@@ -4381,6 +4381,8 @@ mpz_out_str (FILE *stream, int base, const mpz_t x)
size_t len;
str = mpz_get_str (NULL, base, x);
+ if (!str)
+ return 0;
len = strlen (str);
len = fwrite (str, 1, len, stream);
gmp_free (str);
@@ -4488,7 +4490,7 @@ mpz_export (void *r, size_t *countp, int order, size_t size, int endian,
ptrdiff_t word_step;
/* The current (partial) limb. */
mp_limb_t limb;
- /* The number of bytes left to to in this limb. */
+ /* The number of bytes left to do in this limb. */
size_t bytes;
/* The index where the limb was read. */
mp_size_t i;
diff --git a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h
index 7cce3f7a328..d575f7d132e 100644
--- a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h
+++ b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h
@@ -1,6 +1,6 @@
/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
-Copyright 2011-2015, 2017, 2019 Free Software Foundation, Inc.
+Copyright 2011-2015, 2017, 2019-2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -291,7 +291,8 @@ int mpz_init_set_str (mpz_t, const char *, int);
|| defined (_MSL_STDIO_H) /* Metrowerks */ \
|| defined (_STDIO_H_INCLUDED) /* QNX4 */ \
|| defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \
- || defined (__STDIO_LOADED) /* VMS */
+ || defined (__STDIO_LOADED) /* VMS */ \
+ || defined (__DEFINED_FILE) /* musl */
size_t mpz_out_str (FILE *, int, const mpz_t);
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.c b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.c
index fd9b4399070..6fed03dc6d7 100644
--- a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.c
+++ b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.c
@@ -5,7 +5,7 @@
Acknowledgment: special thanks to Bradley Lucier for his comments
to the preliminary version of this code.
-Copyright 2018, 2019 Free Software Foundation, Inc.
+Copyright 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -107,10 +107,10 @@ mpq_clear (mpq_t x)
static void
mpq_canonical_sign (mpq_t r)
{
- int cmp = mpq_denref (r)->_mp_size;
- if (cmp <= 0)
+ mp_size_t ds = mpq_denref (r)->_mp_size;
+ if (ds <= 0)
{
- if (cmp == 0)
+ if (ds == 0)
gmp_die("mpq: Fraction with zero denominator.");
mpz_neg (mpq_denref (r), mpq_denref (r));
mpz_neg (mpq_numref (r), mpq_numref (r));
@@ -515,6 +515,8 @@ mpq_out_str (FILE *stream, int base, const mpq_t x)
void (*gmp_free_func) (void *, size_t);
str = mpq_get_str (NULL, base, x);
+ if (!str)
+ return 0;
len = strlen (str);
len = fwrite (str, 1, len, stream);
mp_get_memory_functions (NULL, NULL, &gmp_free_func);
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/arm64-defs.m4 b/Build/source/libs/gmp/gmp-src/mpn/arm64/arm64-defs.m4
new file mode 100644
index 00000000000..46149f7bfdb
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/arm64-defs.m4
@@ -0,0 +1,53 @@
+divert(-1)
+
+dnl m4 macros for ARM64 ELF assembler.
+
+dnl Copyright 2020 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+dnl
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of either:
+dnl
+dnl * the GNU Lesser General Public License as published by the Free
+dnl Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl or
+dnl
+dnl * the GNU General Public License as published by the Free Software
+dnl Foundation; either version 2 of the License, or (at your option) any
+dnl later version.
+dnl
+dnl or both in parallel, as here.
+dnl
+dnl The GNU MP Library is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received copies of the GNU General Public License and the
+dnl GNU Lesser General Public License along with the GNU MP Library. If not,
+dnl see https://www.gnu.org/licenses/.
+
+
+dnl Standard commenting is with @, the default m4 # is for constants and we
+dnl don't want to disable macro expansions in or after them.
+
+changecom
+
+
+dnl LEA_HI(reg,gmp_symbol), LEA_LO(reg,gmp_symbol)
+dnl
+dnl Load the address of gmp_symbol into a register. We split this into two
+dnl parts to allow separation for manual insn scheduling.
+
+ifdef(`PIC',`dnl
+define(`LEA_HI', `adrp $1, :got:$2')dnl
+define(`LEA_LO', `ldr $1, [$1, #:got_lo12:$2]')dnl
+',`dnl
+define(`LEA_HI', `adrp $1, $2')dnl
+define(`LEA_LO', `add $1, $1, :lo12:$2')dnl
+')dnl
+
+divert`'dnl
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_q_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_q_1.asm
index 2e189b884b2..7fffc9369c8 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_q_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_q_1.asm
@@ -61,15 +61,9 @@ PROLOGUE(mpn_bdiv_q_1)
clz cnt, x6
lsr d, d, cnt
-ifdef(`PIC',`
- adrp x7, :got:__gmp_binvert_limb_table
+ LEA_HI( x7, binvert_limb_table)
ubfx x6, d, 1, 7
- ldr x7, [x7, #:got_lo12:__gmp_binvert_limb_table]
-',`
- adrp x7, __gmp_binvert_limb_table
- ubfx x6, d, 1, 7
- add x7, x7, :lo12:__gmp_binvert_limb_table
-')
+ LEA_LO( x7, binvert_limb_table)
ldrb w6, [x7, x6]
ubfiz x7, x6, 1, 8
umull x6, w6, w6
@@ -81,7 +75,7 @@ ifdef(`PIC',`
mul x6, x6, x6
msub di, x6, d, x7
- b mpn_pi1_bdiv_q_1
+ b GSYM_PREFIX`'mpn_pi1_bdiv_q_1
EPILOGUE()
PROLOGUE(mpn_pi1_bdiv_q_1)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/darwin.m4 b/Build/source/libs/gmp/gmp-src/mpn/arm64/darwin.m4
new file mode 100644
index 00000000000..36e72fe45e2
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/darwin.m4
@@ -0,0 +1,50 @@
+divert(-1)
+
+dnl m4 macros for ARM64 Darwin assembler.
+
+dnl Copyright 2020 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+dnl
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of either:
+dnl
+dnl * the GNU Lesser General Public License as published by the Free
+dnl Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl or
+dnl
+dnl * the GNU General Public License as published by the Free Software
+dnl Foundation; either version 2 of the License, or (at your option) any
+dnl later version.
+dnl
+dnl or both in parallel, as here.
+dnl
+dnl The GNU MP Library is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received copies of the GNU General Public License and the
+dnl GNU Lesser General Public License along with the GNU MP Library. If not,
+dnl see https://www.gnu.org/licenses/.
+
+
+dnl Standard commenting is with @, the default m4 # is for constants and we
+dnl don't want to disable macro expansions in or after them.
+
+changecom
+
+
+dnl LEA_HI(reg,gmp_symbol), LEA_LO(reg,gmp_symbol)
+dnl
+dnl Load the address of gmp_symbol into a register. We split this into two
+dnl parts to allow separation for manual insn scheduling. TODO: Darwin allows
+dnl for relaxing these two insns into an adr and a nop, but that requires the
+dnl .loh pseudo for connecting them.
+
+define(`LEA_HI',`adrp $1, $2@GOTPAGE')dnl
+define(`LEA_LO',`ldr $1, [$1, $2@GOTPAGEOFF]')dnl
+
+divert`'dnl
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/invert_limb.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/invert_limb.asm
index a94b0e96118..6a99bf00288 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/invert_limb.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/invert_limb.asm
@@ -41,9 +41,9 @@ C Compiler generated, mildly edited. Could surely be further optimised.
ASM_START()
PROLOGUE(mpn_invert_limb)
lsr x2, x0, #54
- adrp x1, approx_tab
+ LEA_HI( x1, approx_tab)
and x2, x2, #0x1fe
- add x1, x1, :lo12:approx_tab
+ LEA_LO( x1, approx_tab)
ldrh w3, [x1,x2]
lsr x4, x0, #24
add x4, x4, #1
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/lshift.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/lshift.asm
index 472b7ec00ea..eaafaa442a1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/lshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/lshift.asm
@@ -3,19 +3,30 @@ dnl ARM64 mpn_lshift.
dnl Copyright 2013, 2014, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
-
+dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU Lesser General Public License as published
-dnl by the Free Software Foundation; either version 3 of the License, or (at
-dnl your option) any later version.
-
+dnl it under the terms of either:
+dnl
+dnl * the GNU Lesser General Public License as published by the Free
+dnl Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl or
+dnl
+dnl * the GNU General Public License as published by the Free Software
+dnl Foundation; either version 2 of the License, or (at your option) any
+dnl later version.
+dnl
+dnl or both in parallel, as here.
+dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-dnl License for more details.
-
-dnl You should have received a copy of the GNU Lesser General Public License
-dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received copies of the GNU General Public License and the
+dnl GNU Lesser General Public License along with the GNU MP Library. If not,
+dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/lshiftc.asm
index dd4c4ce3353..7c93a3d775d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/lshiftc.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/lshiftc.asm
@@ -3,19 +3,30 @@ dnl ARM64 mpn_lshiftc.
dnl Copyright 2013, 2014, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
-
+dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU Lesser General Public License as published
-dnl by the Free Software Foundation; either version 3 of the License, or (at
-dnl your option) any later version.
-
+dnl it under the terms of either:
+dnl
+dnl * the GNU Lesser General Public License as published by the Free
+dnl Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl or
+dnl
+dnl * the GNU General Public License as published by the Free Software
+dnl Foundation; either version 2 of the License, or (at your option) any
+dnl later version.
+dnl
+dnl or both in parallel, as here.
+dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-dnl License for more details.
-
-dnl You should have received a copy of the GNU Lesser General Public License
-dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received copies of the GNU General Public License and the
+dnl GNU Lesser General Public License along with the GNU MP Library. If not,
+dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/rshift.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/rshift.asm
index 78ae9602b3d..acee714b279 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/rshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/rshift.asm
@@ -3,19 +3,30 @@ dnl ARM64 mpn_rshift.
dnl Copyright 2013, 2014, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
-
+dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU Lesser General Public License as published
-dnl by the Free Software Foundation; either version 3 of the License, or (at
-dnl your option) any later version.
-
+dnl it under the terms of either:
+dnl
+dnl * the GNU Lesser General Public License as published by the Free
+dnl Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl or
+dnl
+dnl * the GNU General Public License as published by the Free Software
+dnl Foundation; either version 2 of the License, or (at your option) any
+dnl later version.
+dnl
+dnl or both in parallel, as here.
+dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-dnl License for more details.
-
-dnl You should have received a copy of the GNU Lesser General Public License
-dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received copies of the GNU General Public License and the
+dnl GNU Lesser General Public License along with the GNU MP Library. If not,
+dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/compute_powtab.c b/Build/source/libs/gmp/gmp-src/mpn/generic/compute_powtab.c
index f4fbc64790f..41d3a2d3b13 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/compute_powtab.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/compute_powtab.c
@@ -70,6 +70,8 @@ mpn_compute_powtab_mul (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un,
mp_limb_t cy;
long start_idx;
int c;
+ mp_size_t shift;
+ long pi;
mp_limb_t big_base = mp_bases[base].big_base;
int chars_per_limb = mp_bases[base].chars_per_limb;
@@ -97,7 +99,7 @@ mpn_compute_powtab_mul (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un,
c = t[0] == 0;
t += c;
n -= c;
- mp_size_t shift = c;
+ shift = c;
SET_powers_t (pt[0], t, n, digits_in_base, base, shift);
p = t;
@@ -139,7 +141,7 @@ mpn_compute_powtab_mul (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un,
start_idx = n_pows - 3;
}
- for (long pi = start_idx; pi >= 0; pi--)
+ for (pi = start_idx; pi >= 0; pi--)
{
t = powtab_mem_ptr;
powtab_mem_ptr += 2 * n + 2;
@@ -214,6 +216,10 @@ mpn_compute_powtab_div (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un,
powers_t *pt = powtab;
+ mp_size_t n = 1;
+ mp_size_t shift = 0;
+ long pi;
+
p = powtab_mem_ptr;
powtab_mem_ptr += 1;
p[0] = big_base;
@@ -221,9 +227,7 @@ mpn_compute_powtab_div (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un,
SET_powers_t (pt[0], p, 1, digits_in_base, base, 0);
pt++;
- mp_size_t n = 1;
- mp_size_t shift = 0;
- for (long pi = n_pows - 1; pi >= 0; pi--)
+ for (pi = n_pows - 1; pi >= 0; pi--)
{
t = powtab_mem_ptr;
powtab_mem_ptr += 2 * n;
@@ -271,7 +275,7 @@ mpn_compute_powtab_div (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un,
/* Strip any remaining low zero limbs. */
pt -= n_pows + 1;
- for (long pi = n_pows; pi >= 0; pi--)
+ for (pi = n_pows; pi >= 0; pi--)
{
mp_ptr t = pt[pi].p;
mp_size_t shift = pt[pi].shift;
@@ -293,7 +297,8 @@ powtab_decide (size_t *exptab, size_t un, int base)
{
int chars_per_limb = mp_bases[base].chars_per_limb;
long n_pows = 0;
- for (size_t pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
+ size_t pn;
+ for (pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
{
exptab[n_pows] = pn * chars_per_limb;
n_pows++;
@@ -301,11 +306,13 @@ powtab_decide (size_t *exptab, size_t un, int base)
exptab[n_pows] = chars_per_limb;
#if HAVE_mpn_compute_powtab_mul && HAVE_mpn_compute_powtab_div
+ {
size_t pn = un - 1;
size_t xn = (un + 1) >> 1;
unsigned mcost = 1;
unsigned dcost = 1;
- for (long i = n_pows - 2; i >= 0; i--)
+ long i;
+ for (i = n_pows - 2; i >= 0; i--)
{
size_t pow = (pn >> (i + 1)) + 1;
@@ -332,6 +339,7 @@ powtab_decide (size_t *exptab, size_t un, int base)
return n_pows;
else
return -n_pows;
+ }
#elif HAVE_mpn_compute_powtab_mul
return n_pows;
#elif HAVE_mpn_compute_powtab_div
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_q.c
index 1a4bd2a9e54..eb1c42721b4 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_q.c
@@ -37,13 +37,14 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
-
+#if 0 /* unused, so leave out for now */
static mp_size_t
mpn_dcpi1_bdiv_q_n_itch (mp_size_t n)
{
/* NOTE: Depends on mullo_n and mpn_dcpi1_bdiv_qr_n interface */
return n;
}
+#endif
/* Computes Q = - N / D mod B^n, destroys N.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_22.c b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_22.c
index d97f0968277..05a4338a4c1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_22.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_22.c
@@ -56,13 +56,13 @@ mpn_gcd_22 (mp_limb_t u1, mp_limb_t u0, mp_limb_t v1, mp_limb_t v0)
if (UNLIKELY (t0 == 0))
{
+ int c;
if (t1 == 0)
{
g.d1 = (u1 << 1) | (u0 >> (GMP_LIMB_BITS - 1));
g.d0 = (u0 << 1) | 1;
return g;
}
- int c;
count_trailing_zeros (c, t1);
/* v1 = min (u1, v1) */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/get_d.c b/Build/source/libs/gmp/gmp-src/mpn/generic/get_d.c
index 9784f215444..8bef128108a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/get_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/get_d.c
@@ -226,7 +226,7 @@ mpn_get_d (mp_srcptr up, mp_size_t size, mp_size_t sign, long exp)
x <<= GMP_NAIL_BITS;
mhi |= x >> nbits >> 11;
- mlo = x << GMP_LIMB_BITS - nbits - 11;
+ mlo = x << (GMP_LIMB_BITS - nbits - 11);
nbits = nbits + 11 - GMP_NAIL_BITS;
}
else
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/get_str.c b/Build/source/libs/gmp/gmp-src/mpn/generic/get_str.c
index 19cc581aecb..d4d3a132c29 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/get_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/get_str.c
@@ -369,6 +369,8 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
int pi;
size_t out_len;
mp_ptr tmp;
+ size_t ndig;
+ mp_size_t xn;
TMP_DECL;
/* Special case zero, as the code below doesn't handle it. */
@@ -435,8 +437,6 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
powtab_mem = TMP_BALLOC_LIMBS (mpn_str_powtab_alloc (un));
/* Compute a table of powers, were the largest power is >= sqrt(U). */
- size_t ndig;
- mp_size_t xn;
DIGITS_IN_BASE_PER_LIMB (ndig, un, base);
xn = 1 + ndig / mp_bases[base].chars_per_limb; /* FIXME: scalar integer division */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2.c
index 3fa40122e42..19214700d21 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2.c
@@ -256,7 +256,15 @@ static const unsigned char tab[2048] = {
#error No table for provided NBITS
#endif
-static const unsigned char *tabp = tab - (1 << (NBITS - 1) << NBITS);
+/* Doing tabp with a #define makes compiler warnings about pointing outside an
+ object go away. We used to define this as a variable. It is not clear if
+ e.g. (vector[100] - 10) + 10 is well- defined as per the C standard;
+ (vector[100] + 10) - 10 surely is and there is no sequence point so the
+ expressions should be equivalent. To make this safe, we might want to
+ define tabp as a macro with the index as an argument. Depending on the
+ platform, relocs might allow for assembly-time or linker-time resolution to
+ take place. */
+#define tabp (tab - (1 << (NBITS - 1) << NBITS))
static inline mp_double_limb_t
div1 (mp_limb_t n0, mp_limb_t d0)
@@ -314,14 +322,12 @@ div1 (mp_limb_t n0, mp_limb_t d0)
static const unsigned char tab[16] = {
63, 59, 55, 52, 50, 47, 45, 43, 41, 39, 38, 36, 35, 34, 33, 32
};
-static const unsigned char *tabp = tab - (1 << (NBITS - 1));
#elif NBITS == 6
/* This needs full division about 0.93% of the time. */
static const unsigned char tab[32] = {
127,123,119,116,112,109,106,104,101, 98, 96, 94, 92, 90, 88, 86,
84, 82, 80, 79, 77, 76, 74, 73, 72, 70, 69, 68, 67, 66, 65, 64
};
-static const unsigned char *tabp = tab - (1 << (NBITS - 1));
#elif NBITS == 7
/* This needs full division about 0.49% of the time. */
static const unsigned char tab[64] = {
@@ -330,7 +336,6 @@ static const unsigned char tab[64] = {
169,167,166,164,162,161,159,158,156,155,153,152,150,149,147,146,
145,143,142,141,140,139,137,136,135,134,133,132,131,130,129,128
};
-static const unsigned char *tabp = tab - (1 << (NBITS - 1));
#elif NBITS == 8
/* This needs full division about 0.26% of the time. */
static const unsigned short tab[128] = {
@@ -343,11 +348,20 @@ static const unsigned short tab[128] = {
291,290,288,287,286,285,283,282,281,280,279,277,276,275,274,273,
272,270,269,268,267,266,265,264,263,262,261,260,259,258,257,256
};
-static const unsigned short *tabp = tab - (1 << (NBITS - 1));
#else
#error No table for provided NBITS
#endif
+/* Doing tabp with a #define makes compiler warnings about pointing outside an
+ object go away. We used to define this as a variable. It is not clear if
+ e.g. (vector[100] - 10) + 10 is well- defined as per the C standard;
+ (vector[100] + 10) - 10 surely is and there is no sequence point so the
+ expressions should be equivalent. To make this safe, we might want to
+ define tabp as a macro with the index as an argument. Depending on the
+ platform, relocs might allow for assembly-time or linker-time resolution to
+ take place. */
+#define tabp (tab - (1 << (NBITS - 1)))
+
static inline mp_double_limb_t
div1 (mp_limb_t n0, mp_limb_t d0)
{
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_1.c
index f6342d68167..1fada117fb1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_1.c
@@ -256,7 +256,7 @@ mpn_mod_1_1p_cps (mp_limb_t cps[4], mp_limb_t b)
cps[2] = B1modb >> cnt;
}
B2modb = - b * bi;
- ASSERT (B2modb <= b); // NB: equality iff b = B/2
+ ASSERT (B2modb <= b); /* NB: equality iff b = B/2 */
cps[3] = B2modb;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mul_fft.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mul_fft.c
index df8ee63a5fc..a896ff19fe1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mul_fft.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mul_fft.c
@@ -6,7 +6,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 1998-2010, 2012, 2013, 2018 Free Software Foundation, Inc.
+Copyright 1998-2010, 2012, 2013, 2018, 2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -553,9 +553,12 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, mp_size_t K)
cc += mpn_add_n (tpn, tpn, a, n) + a[n];
if (cc != 0)
{
- /* FIXME: use MPN_INCR_U here, since carry is not expected. */
cc = mpn_add_1 (tp, tp, n2, cc);
- ASSERT (cc == 0);
+ /* If mpn_add_1 give a carry (cc != 0),
+ the result (tp) is at most GMP_NUMB_MAX - 1,
+ so the following addition can't overflow.
+ */
+ tp[0] += cc;
}
a[n] = mpn_sub_n (a, tp, tpn, n) && mpn_add_1 (a, a, n, CNST_LIMB(1));
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/set_str.c b/Build/source/libs/gmp/gmp-src/mpn/generic/set_str.c
index 2bd584c0b36..33fc29cbcb7 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/set_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/set_str.c
@@ -109,6 +109,8 @@ mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
mp_ptr powtab_mem, tp;
powers_t powtab[GMP_LIMB_BITS];
int chars_per_limb;
+ powers_t *pt;
+ size_t n_pows;
mp_size_t size;
mp_size_t un;
TMP_DECL;
@@ -122,8 +124,8 @@ mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
/* Allocate one large block for the powers of big_base. */
powtab_mem = TMP_BALLOC_LIMBS (mpn_str_powtab_alloc (un));
- size_t n_pows = mpn_compute_powtab (powtab, powtab_mem, un, base);
- powers_t *pt = powtab + n_pows;
+ n_pows = mpn_compute_powtab (powtab, powtab_mem, un, base);
+ pt = powtab + n_pows;
tp = TMP_BALLOC_LIMBS (mpn_dc_set_str_itch (un));
size = mpn_dc_set_str (rp, str, str_len, pt, tp);
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/strongfibo.c b/Build/source/libs/gmp/gmp-src/mpn/generic/strongfibo.c
index ffd038a2b7b..210647b31dd 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/strongfibo.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/strongfibo.c
@@ -37,6 +37,9 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include "gmp-impl.h"
+
+#if HAVE_NATIVE_mpn_rsblsh1_n || HAVE_NATIVE_mpn_sublsh1_n
+#else
/* Stores |{ap,n}-{bp,n}| in {rp,n},
returns the sign of {ap,n}-{bp,n}. */
static int
@@ -65,6 +68,7 @@ abs_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
}
return 0;
}
+#endif
/* Computes at most count terms of the sequence needed by the
Lucas-Lehmer-Riesel test, indexing backward:
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_12pts.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_12pts.c
index 347e3410da2..627346613a2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_12pts.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_12pts.c
@@ -6,7 +6,7 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2009, 2010, 2012, 2015 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012, 2015, 2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -38,6 +38,34 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
+#if GMP_NUMB_BITS < 21
+#error Not implemented: Both sublsh_n(,,,20) should be corrected.
+#endif
+
+#if GMP_NUMB_BITS < 16
+#error Not implemented: divexact_by42525 needs splitting.
+#endif
+
+#if GMP_NUMB_BITS < 12
+#error Not implemented: Hard to adapt...
+#endif
+
+
+/* FIXME: tuneup should decide the best variant */
+#ifndef AORSMUL_FASTER_AORS_AORSLSH
+#define AORSMUL_FASTER_AORS_AORSLSH 1
+#endif
+#ifndef AORSMUL_FASTER_AORS_2AORSLSH
+#define AORSMUL_FASTER_AORS_2AORSLSH 1
+#endif
+#ifndef AORSMUL_FASTER_2AORSLSH
+#define AORSMUL_FASTER_2AORSLSH 1
+#endif
+#ifndef AORSMUL_FASTER_3AORSLSH
+#define AORSMUL_FASTER_3AORSLSH 1
+#endif
+
+
#if HAVE_NATIVE_mpn_sublsh_n
#define DO_mpn_sublsh_n(dst,src,n,s,ws) mpn_sublsh_n(dst,dst,src,n,s)
#else
@@ -57,6 +85,7 @@ DO_mpn_sublsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr w
#if HAVE_NATIVE_mpn_addlsh_n
#define DO_mpn_addlsh_n(dst,src,n,s,ws) mpn_addlsh_n(dst,dst,src,n,s)
#else
+#if !defined (AORSMUL_FASTER_2AORSLSH) && !defined (AORSMUL_FASTER_AORS_2AORSLSH)
static mp_limb_t
DO_mpn_addlsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws)
{
@@ -69,6 +98,7 @@ DO_mpn_addlsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr w
#endif
}
#endif
+#endif
#if HAVE_NATIVE_mpn_subrsh
#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) mpn_subrsh(dst,nd,src,ns,s)
@@ -84,32 +114,6 @@ do { \
#endif
-#if GMP_NUMB_BITS < 21
-#error Not implemented: Both sublsh_n(,,,20) should be corrected.
-#endif
-
-#if GMP_NUMB_BITS < 16
-#error Not implemented: divexact_by42525 needs splitting.
-#endif
-
-#if GMP_NUMB_BITS < 12
-#error Not implemented: Hard to adapt...
-#endif
-
-/* FIXME: tuneup should decide the best variant */
-#ifndef AORSMUL_FASTER_AORS_AORSLSH
-#define AORSMUL_FASTER_AORS_AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_AORS_2AORSLSH
-#define AORSMUL_FASTER_AORS_2AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_2AORSLSH
-#define AORSMUL_FASTER_2AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_3AORSLSH
-#define AORSMUL_FASTER_3AORSLSH 1
-#endif
-
#define BINVERT_9 \
((((GMP_NUMB_MAX / 9) << (6 - GMP_NUMB_BITS % 6)) * 8 & GMP_NUMB_MAX) | 0x39)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_16pts.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_16pts.c
index 5d76bba8c21..c1457be643f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_16pts.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_16pts.c
@@ -6,7 +6,7 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2009, 2010, 2012, 2015 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012, 2015, 2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -37,6 +37,7 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
+
#if GMP_NUMB_BITS < 29
#error Not implemented: Both sublsh_n(,,,28) should be corrected; r2 and r5 need one more LIMB.
#endif
@@ -46,6 +47,21 @@ see https://www.gnu.org/licenses/. */
#endif
+/* FIXME: tuneup should decide the best variant */
+#ifndef AORSMUL_FASTER_AORS_AORSLSH
+#define AORSMUL_FASTER_AORS_AORSLSH 1
+#endif
+#ifndef AORSMUL_FASTER_AORS_2AORSLSH
+#define AORSMUL_FASTER_AORS_2AORSLSH 1
+#endif
+#ifndef AORSMUL_FASTER_2AORSLSH
+#define AORSMUL_FASTER_2AORSLSH 1
+#endif
+#ifndef AORSMUL_FASTER_3AORSLSH
+#define AORSMUL_FASTER_3AORSLSH 1
+#endif
+
+
#if HAVE_NATIVE_mpn_sublsh_n
#define DO_mpn_sublsh_n(dst,src,n,s,ws) mpn_sublsh_n(dst,dst,src,n,s)
#else
@@ -65,6 +81,7 @@ DO_mpn_sublsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr w
#if HAVE_NATIVE_mpn_addlsh_n
#define DO_mpn_addlsh_n(dst,src,n,s,ws) mpn_addlsh_n(dst,dst,src,n,s)
#else
+#if !defined (AORSMUL_FASTER_2AORSLSH) && !defined (AORSMUL_FASTER_AORS_2AORSLSH)
static mp_limb_t
DO_mpn_addlsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws)
{
@@ -77,6 +94,7 @@ DO_mpn_addlsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr w
#endif
}
#endif
+#endif
#if HAVE_NATIVE_mpn_subrsh
#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) mpn_subrsh(dst,nd,src,ns,s)
@@ -92,20 +110,6 @@ do { \
#endif
-/* FIXME: tuneup should decide the best variant */
-#ifndef AORSMUL_FASTER_AORS_AORSLSH
-#define AORSMUL_FASTER_AORS_AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_AORS_2AORSLSH
-#define AORSMUL_FASTER_AORS_2AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_2AORSLSH
-#define AORSMUL_FASTER_2AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_3AORSLSH
-#define AORSMUL_FASTER_3AORSLSH 1
-#endif
-
#if GMP_NUMB_BITS < 43
#define BIT_CORRECTION 1
#define CORRECTION_BITS GMP_NUMB_BITS
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_2.asm
index 1dd59ea5b63..846a894bb29 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_2.asm
@@ -5,19 +5,30 @@ dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 2018 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
-
+dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU Lesser General Public License as published
-dnl by the Free Software Foundation; either version 3 of the License, or (at
-dnl your option) any later version.
-
+dnl it under the terms of either:
+dnl
+dnl * the GNU Lesser General Public License as published by the Free
+dnl Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl or
+dnl
+dnl * the GNU General Public License as published by the Free Software
+dnl Foundation; either version 2 of the License, or (at your option) any
+dnl later version.
+dnl
+dnl or both in parallel, as here.
+dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-dnl License for more details.
-
-dnl You should have received a copy of the GNU Lesser General Public License
-dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received copies of the GNU General Public License and the
+dnl GNU Lesser General Public License along with the GNU MP Library. If not,
+dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_2.asm
index 632b6cbc9a7..01b50a38dd7 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_2.asm
@@ -5,19 +5,30 @@ dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 2018 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
-
+dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU Lesser General Public License as published
-dnl by the Free Software Foundation; either version 3 of the License, or (at
-dnl your option) any later version.
-
+dnl it under the terms of either:
+dnl
+dnl * the GNU Lesser General Public License as published by the Free
+dnl Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl or
+dnl
+dnl * the GNU General Public License as published by the Free Software
+dnl Foundation; either version 2 of the License, or (at your option) any
+dnl later version.
+dnl
+dnl or both in parallel, as here.
+dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-dnl License for more details.
-
-dnl You should have received a copy of the GNU Lesser General Public License
-dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received copies of the GNU General Public License and the
+dnl GNU Lesser General Public License along with the GNU MP Library. If not,
+dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/fat/fat.c b/Build/source/libs/gmp/gmp-src/mpn/x86/fat/fat.c
index 18be05a395c..4c8cf3c23b0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/fat/fat.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/fat/fat.c
@@ -105,6 +105,7 @@ static struct {
{ "steamroller","AuthenticAMD", MAKE_FMS (21, 0x30) },
{ "excavator", "AuthenticAMD", MAKE_FMS (21, 0x60) },
{ "jaguar", "AuthenticAMD", MAKE_FMS (22, 1) },
+ { "zen", "AuthenticAMD", MAKE_FMS (23, 1) },
{ "viac3", "CentaurHauls", MAKE_FMS (6, 0) },
{ "viac32", "CentaurHauls", MAKE_FMS (6, 9) },
@@ -335,6 +336,28 @@ __gmpn_cpuvec_init (void)
CPUVEC_SETUP_atom_sse2;
break;
+ case 0x37: /* Silvermont */
+ case 0x4a: /* Silvermont */
+ case 0x4c: /* Airmont */
+ case 0x4d: /* Silvermont/Avoton */
+ case 0x5a: /* Silvermont */
+ TRACE (printf (" silvermont\n"));
+ CPUVEC_SETUP_atom;
+ CPUVEC_SETUP_atom_mmx;
+ CPUVEC_SETUP_atom_sse2;
+ CPUVEC_SETUP_silvermont;
+ break;
+
+ case 0x5c: /* Goldmont */
+ case 0x5f: /* Goldmont */
+ case 0x7a: /* Goldmont Plus */
+ TRACE (printf (" goldmont\n"));
+ CPUVEC_SETUP_atom;
+ CPUVEC_SETUP_atom_mmx;
+ CPUVEC_SETUP_atom_sse2;
+ CPUVEC_SETUP_goldmont;
+ break;
+
case 0x1a: /* NHM Gainestown */
case 0x1b:
case 0x1e: /* NHM Lynnfield/Jasper */
@@ -362,6 +385,7 @@ __gmpn_cpuvec_init (void)
case 0x2a: /* SBR */
case 0x2d: /* SBR-EP */
case 0x3a: /* IBR */
+ case 0x3e: /* IBR Ivytown */
case 0x3c: /* Haswell client */
case 0x3f: /* Haswell server */
case 0x45: /* Haswell ULT */
@@ -428,8 +452,6 @@ __gmpn_cpuvec_init (void)
case 0x0f: /* k8 */
case 0x11: /* "fam 11h", mix of k8 and k10 */
case 0x13: /* unknown, conservatively assume k8 */
- case 0x16: /* unknown, conservatively assume k8 */
- case 0x17: /* unknown, conservatively assume k8 */
TRACE (printf (" k8\n"));
CPUVEC_SETUP_k7;
CPUVEC_SETUP_k7_mmx;
@@ -444,6 +466,7 @@ __gmpn_cpuvec_init (void)
break;
case 0x14: /* bobcat */
+ case 0x16: /* jaguar */
TRACE (printf (" bobcat\n"));
CPUVEC_SETUP_k7;
CPUVEC_SETUP_k7_mmx;
@@ -454,6 +477,14 @@ __gmpn_cpuvec_init (void)
TRACE (printf (" bulldozer\n"));
CPUVEC_SETUP_k7;
CPUVEC_SETUP_k7_mmx;
+ CPUVEC_SETUP_bd1;
+ break;
+
+ case 0x17: /* zen */
+ case 0x19: /* zen3 */
+ TRACE (printf (" zen\n"));
+ CPUVEC_SETUP_k7;
+ CPUVEC_SETUP_k7_mmx;
break;
}
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_22.asm
index a4f30eadda9..070cb3e2652 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_22.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_22.asm
@@ -35,7 +35,7 @@ C cycles/bit
C AMD K8,K9 12.3
C AMD K10 8.0
C AMD bd1 10.0
-C AMD bd2 7.2
+C AMD bd2 7.2
C AMD bd3 ?
C AMD bd4 6.7
C AMD bt1 13.6
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat.c b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat.c
index b7446a395f3..cc35afa46d5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat.c
@@ -433,13 +433,14 @@ __gmpn_cpuvec_init (void)
CPUVEC_SETUP_bt2;
break;
- case 0x15: /* bulldozer, piledriver, steamroller, excavator */
+ case 0x15: /* bulldozer, piledriver, steamroller, excavator */
CPUVEC_SETUP_k8;
CPUVEC_SETUP_k10;
CPUVEC_SETUP_bd1;
break;
- case 0x17: /* zen */
+ case 0x17: /* zen */
+ case 0x19: /* zen3 */
CPUVEC_SETUP_zen;
break;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/skylake/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/skylake/gmp-mparam.h
index a899ea167e4..e8018117bdf 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/skylake/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/skylake/gmp-mparam.h
@@ -38,6 +38,7 @@ see https://www.gnu.org/licenses/. */
/* 3600-4000 MHz Intel Xeon E3-1270v5 Skylake */
/* FFT tuning limit = 465,990,371 */
/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
+/* FFT_TABLEs merged with a new run, 2020-09-25, fft_max_size 1000000000 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
@@ -135,10 +136,13 @@ see https://www.gnu.org/licenses/. */
{ 3071,15}, { 6911,16}, { 3583,15}, { 7679,14}, \
{ 15359,15}, { 7935,17}, { 2047,16}, { 4095,15}, \
{ 8703,16}, { 4607,15}, { 9983,14}, { 19967,16}, \
- { 5631,15}, { 11775,17}, { 3071,16}, { 65536,17}, \
- { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
- {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 227
+ { 5631,15}, { 11775,17}, { 3071,16}, \
+ { 7679,15}, { 15359,18}, { 2047,17}, { 4095,16}, \
+ { 9727,15}, { 19967,17}, { 5119,16}, { 11775,15}, \
+ { 24063,17}, { 6143,16}, { 12799,17}, { 7167,16}, \
+ { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+ {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 239
#define MUL_FFT_THRESHOLD 6272
#define SQR_FFT_MODF_THRESHOLD 400 /* k = 5 */
@@ -192,10 +196,13 @@ see https://www.gnu.org/licenses/. */
{ 6911,16}, { 3583,15}, { 7679,14}, { 15359,17}, \
{ 2047,16}, { 4095,15}, { 8191,16}, { 4607,15}, \
{ 9983,14}, { 19967,16}, { 5631,15}, { 11775,17}, \
- { 3071,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 3071,16}, { 7679,15}, { 15359,18}, { 2047,17}, \
+ { 4095,16}, { 9727,15}, { 19967,17}, { 5119,16}, \
+ { 11775,15}, { 23551,17}, { 6143,16}, { 12799,17}, \
+ { 7167,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
{ 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
{8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 205
+#define SQR_FFT_TABLE3_SIZE 217
#define SQR_FFT_THRESHOLD 4224
#define MULLO_BASECASE_THRESHOLD 0 /* always */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/x86_64-defs.m4 b/Build/source/libs/gmp/gmp-src/mpn/x86_64/x86_64-defs.m4
index 64e3729801f..4e08f2a06c8 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/x86_64-defs.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/x86_64-defs.m4
@@ -93,10 +93,28 @@ define(`PROLOGUE_cpu',
m4_assert_numargs(1)
` GLOBL $1
TYPE($1,`function')
+ COFF_TYPE($1)
$1:
')
+dnl Usage: COFF_TYPE(GSYM_PREFIX`'foo)
+dnl
+dnl Emit COFF style ".def ... .endef" type information for a function, when
+dnl supported. The argument should include any GSYM_PREFIX.
+dnl
+dnl See autoconf macro GMP_ASM_COFF_TYPE for HAVE_COFF_TYPE.
+
+define(COFF_TYPE,
+m4_assert_numargs(1)
+m4_assert_defined(`HAVE_COFF_TYPE')
+`ifelse(HAVE_COFF_TYPE,yes,
+ `.def $1
+ .scl 2
+ .type 32
+ .endef')')
+
+
dnl Usage: ASSERT([cond][,instructions])
dnl
dnl If WANT_ASSERT is 1, output the given instructions and expect the given
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen2/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen2/gmp-mparam.h
index 3748c5f580a..0d8eb80e1f4 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen2/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen2/gmp-mparam.h
@@ -38,6 +38,7 @@ see https://www.gnu.org/licenses/. */
/* 3600-4400 MHz Matisse */
/* FFT tuning limit = 703,392,483 */
/* Generated by tuneup.c, 2019-10-19, gcc 8.3 */
+/* FFT_TABLEs merged with a new run, 2020-09-24, fft_max_size 2000000000 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
@@ -147,10 +148,14 @@ see https://www.gnu.org/licenses/. */
{ 4095,15}, { 8959,16}, { 4607,15}, { 9983,14}, \
{ 19967,16}, { 5631,15}, { 11775,17}, { 3071,16}, \
{ 7679,15}, { 15871,18}, { 2047,17}, { 4095,16}, \
- { 9727,15}, { 19967,17}, { 5119,16}, { 65536,17}, \
+ { 9727,15}, { 19967,17}, \
+ { 5119,16}, { 11775,15}, { 24063,17}, { 6143,16}, \
+ { 12799,17}, { 7167,16}, { 15871,15}, { 31743,18}, \
+ { 4095,17}, { 8191,16}, { 16895,17}, { 9215,16}, \
+ { 19967,17}, { 11263,16}, { 24063,18}, { 6143,17}, \
{ 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
{2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 275
+#define MUL_FFT_TABLE3_SIZE 289
#define MUL_FFT_THRESHOLD 4736
#define SQR_FFT_MODF_THRESHOLD 396 /* k = 5 */
@@ -223,10 +228,14 @@ see https://www.gnu.org/licenses/. */
{ 9983,14}, { 19967,16}, { 5119,15}, { 10239,16}, \
{ 5631,15}, { 11775,17}, { 3071,16}, { 7679,15}, \
{ 15359,18}, { 2047,17}, { 4095,16}, { 9727,15}, \
- { 19967,17}, { 5119,16}, { 65536,17}, { 131072,18}, \
- { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
- {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 282
+ { 19967,17}, \
+ { 5119,16}, { 11775,15}, { 23551,17}, { 6143,16}, \
+ { 12799,17}, { 7167,16}, { 15871,15}, { 31743,18}, \
+ { 4095,17}, { 8191,16}, { 16895,17}, { 9215,16}, \
+ { 19967,17}, { 11263,16}, { 24063,18}, { 6143,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 296
#define SQR_FFT_THRESHOLD 3264
#define MULLO_BASECASE_THRESHOLD 0 /* always */
diff --git a/Build/source/libs/gmp/gmp-src/mpq/cmp.c b/Build/source/libs/gmp/gmp-src/mpq/cmp.c
index d3eefe20f87..495e77e017d 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/cmp.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/cmp.c
@@ -70,8 +70,9 @@ mpq_cmp_numden (mpq_srcptr op1, mpz_srcptr num_op2, mpz_srcptr den_op2)
{
int cmp;
+ /* Cannot use num1_sign - num2_size, may overflow an "int" */
if (num1_sign != num2_size)
- return num1_sign - num2_size;
+ return (num1_sign > num2_size) ? 1 : -1;
cmp = mpn_cmp (PTR(NUM(op1)), PTR(num_op2), num1_size);
return (num1_sign > 0 ? cmp : -cmp);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cmp.c b/Build/source/libs/gmp/gmp-src/mpz/cmp.c
index a97b0043a3f..ba4c023e92c 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cmp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cmp.c
@@ -1,8 +1,8 @@
/* mpz_cmp(u,v) -- Compare U, V. Return positive, zero, or negative
based on if U > V, U == V, or U < V.
-Copyright 1991, 1993, 1994, 1996, 2001, 2002, 2011 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 2001, 2002, 2011, 2020 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,15 +35,15 @@ see https://www.gnu.org/licenses/. */
int
mpz_cmp (mpz_srcptr u, mpz_srcptr v) __GMP_NOTHROW
{
- mp_size_t usize, vsize, dsize, asize;
+ mp_size_t usize, vsize, asize;
mp_srcptr up, vp;
int cmp;
usize = SIZ(u);
vsize = SIZ(v);
- dsize = usize - vsize;
- if (dsize != 0)
- return dsize;
+ /* Cannot use usize - vsize, may overflow an "int" */
+ if (usize != vsize)
+ return (usize > vsize) ? 1 : -1;
asize = ABS (usize);
up = PTR(u);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/millerrabin.c b/Build/source/libs/gmp/gmp-src/mpz/millerrabin.c
index 1f5d482605b..ee4eb1ae89e 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/millerrabin.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/millerrabin.c
@@ -8,7 +8,7 @@
With the current implementation, the first 24 MR-tests are substituted by a
Baillie-PSW probable prime test.
- This implementation the Baillie-PSW test was checked up to 19*2^46,
+ This implementation the Baillie-PSW test was checked up to 31*2^46,
for smaller values no MR-test is performed, regardless of reps, and
2 ("surely prime") is returned if the number was not proved composite.
@@ -101,11 +101,11 @@ mpz_millerrabin (mpz_srcptr n, int reps)
|| SIZ (n) - 64 / GMP_NUMB_BITS == (PTR (n) [64 / GMP_NUMB_BITS] < CNST_LIMB(1) << 64 % GMP_NUMB_BITS)
#endif
#else
- /* Consider numbers up to 19*2^46 that pass the BPSW test as primes.
- This implementation was tested up to 19*2^46 = 2^50+2^47+2^46 */
- /* 2^4 < 19 = 0b10011 < 2^5 */
-#define GMP_BPSW_LIMB_CONST CNST_LIMB(19)
-#define GMP_BPSW_BITS_CONST (LOG2C(19) - 1)
+ /* Consider numbers up to 31*2^46 that pass the BPSW test as primes.
+ This implementation was tested up to 31*2^46 */
+ /* 2^4 < 31 = 0b11111 < 2^5 */
+#define GMP_BPSW_LIMB_CONST CNST_LIMB(31)
+#define GMP_BPSW_BITS_CONST (LOG2C(31) - 1)
#define GMP_BPSW_BITS_LIMIT (46 + GMP_BPSW_BITS_CONST)
#define GMP_BPSW_LIMBS_LIMIT (GMP_BPSW_BITS_LIMIT / GMP_NUMB_BITS)
diff --git a/Build/source/libs/gmp/gmp-src/mpz/mul.c b/Build/source/libs/gmp/gmp-src/mpz/mul.c
index d72c93e177d..a70df9ffa0c 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/mul.c
@@ -104,13 +104,15 @@ mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
if (ALLOC (w) < wsize)
{
if (ALLOC (w) != 0)
- if (wp == up || wp == vp)
- {
- free_me = wp;
- free_me_size = ALLOC (w);
- }
- else
- (*__gmp_free_func) (wp, (size_t) ALLOC (w) * GMP_LIMB_BYTES);
+ {
+ if (wp == up || wp == vp)
+ {
+ free_me = wp;
+ free_me_size = ALLOC (w);
+ }
+ else
+ (*__gmp_free_func) (wp, (size_t) ALLOC (w) * GMP_LIMB_BYTES);
+ }
ALLOC (w) = wsize;
wp = __GMP_ALLOCATE_FUNC_LIMBS (wsize);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/n_pow_ui.c b/Build/source/libs/gmp/gmp-src/mpz/n_pow_ui.c
index cf293f5405f..69fdd12925a 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/n_pow_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/n_pow_ui.c
@@ -4,7 +4,7 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001, 2002, 2005, 2012, 2015 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2005, 2012, 2015, 2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,6 +32,8 @@ You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
+#include <stdlib.h>
+#include <stdio.h>
#include "gmp-impl.h"
#include "longlong.h"
@@ -170,6 +172,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
#else
mp_limb_t b_twolimbs[2];
#endif
+ mp_limb_t ovfl;
TMP_DECL;
TRACE (printf ("mpz_n_pow_ui rp=0x%lX bp=0x%lX bsize=%ld e=%lu (0x%lX)\n",
@@ -213,7 +216,14 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
/* Strip low zero bits from b. */
count_trailing_zeros (btwos, blimb);
blimb >>= btwos;
- rtwos_bits = e * btwos;
+
+ umul_ppmm (ovfl, rtwos_bits, e, btwos);
+ if (ovfl)
+ {
+ fprintf (stderr, "gmp: overflow in mpz type\n");
+ abort ();
+ }
+
rtwos_limbs += rtwos_bits / GMP_NUMB_BITS;
rtwos_bits %= GMP_NUMB_BITS;
TRACE (printf ("trailing zero btwos=%d rtwos_limbs=%ld rtwos_bits=%lu\n",
@@ -368,7 +378,15 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
ASSERT (blimb != 0);
count_leading_zeros (cnt, blimb);
- ralloc = (bsize*GMP_NUMB_BITS - cnt + GMP_NAIL_BITS) * e / GMP_NUMB_BITS + 5;
+
+ umul_ppmm (ovfl, ralloc, (bsize*GMP_NUMB_BITS - cnt + GMP_NAIL_BITS), e);
+ if (ovfl)
+ {
+ fprintf (stderr, "gmp: overflow in mpz type\n");
+ abort ();
+ }
+ ralloc = ralloc / GMP_NUMB_BITS + 5;
+
TRACE (printf ("ralloc %ld, from bsize=%ld blimb=0x%lX cnt=%d\n",
ralloc, bsize, blimb, cnt));
rp = MPZ_NEWALLOC (r, ralloc + rtwos_limbs);
diff --git a/Build/source/libs/gmp/version.ac b/Build/source/libs/gmp/version.ac
index a4b4c605ab7..68afc86862c 100644
--- a/Build/source/libs/gmp/version.ac
+++ b/Build/source/libs/gmp/version.ac
@@ -8,4 +8,4 @@ dnl
dnl --------------------------------------------------------
dnl
dnl m4-include this file to define the current gmp version
-m4_define([gmp_version], [6.2.0])
+m4_define([gmp_version], [6.2.1])