summaryrefslogtreecommitdiff
path: root/Build/source/libs/gmp
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-01-19 23:36:31 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-01-19 23:36:31 +0000
commit1d4eda0d2362c7404a81bb0e1e308565b8a4b8f9 (patch)
treeda5a6b2829fa072fe1ae806b45f6b5cc70a3e313 /Build/source/libs/gmp
parentd2777035be2644c9649530be7f9fa31c8abaaf63 (diff)
gmp-6.2.0
git-svn-id: svn://tug.org/texlive/trunk@53461 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/gmp')
-rw-r--r--Build/source/libs/gmp/ChangeLog5
-rw-r--r--Build/source/libs/gmp/Makefile.am8
-rw-r--r--Build/source/libs/gmp/Makefile.in24
-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/AUTHORS12
-rw-r--r--Build/source/libs/gmp/gmp-src/ChangeLog2183
-rw-r--r--Build/source/libs/gmp/gmp-src/Makefile.am37
-rw-r--r--Build/source/libs/gmp/gmp-src/NEWS63
-rw-r--r--Build/source/libs/gmp/gmp-src/acinclude.m487
-rw-r--r--Build/source/libs/gmp/gmp-src/asl.h127
-rw-r--r--Build/source/libs/gmp/gmp-src/assert.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/bootstrap.c16
-rw-r--r--Build/source/libs/gmp/gmp-src/compat.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/config.in28
-rwxr-xr-xBuild/source/libs/gmp/gmp-src/configgmp.guess98
-rwxr-xr-xBuild/source/libs/gmp/gmp-src/configgmp.sub6
-rw-r--r--Build/source/libs/gmp/gmp-src/configure.ac232
-rw-r--r--Build/source/libs/gmp/gmp-src/errno.c18
-rw-r--r--Build/source/libs/gmp/gmp-src/extract-dbl.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/gen-bases.c44
-rw-r--r--Build/source/libs/gmp/gmp-src/gen-fac.c16
-rw-r--r--Build/source/libs/gmp/gmp-src/gen-trialdivtab.c13
-rw-r--r--Build/source/libs/gmp/gmp-src/gmp-h.in19
-rw-r--r--Build/source/libs/gmp/gmp-src/gmp-impl.h360
-rw-r--r--Build/source/libs/gmp/gmp-src/gmp.pc.in11
-rw-r--r--Build/source/libs/gmp/gmp-src/gmpxx.h311
-rw-r--r--Build/source/libs/gmp/gmp-src/gmpxx.pc.in12
-rw-r--r--Build/source/libs/gmp/gmp-src/invalid.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/longlong.h301
-rw-r--r--Build/source/libs/gmp/gmp-src/memory.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mini-gmp/README28
-rw-r--r--Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c901
-rw-r--r--Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h10
-rw-r--r--Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.c554
-rw-r--r--Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.h114
-rw-r--r--Build/source/libs/gmp/gmp-src/mp_bpl.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mp_clz_tab.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mp_dv_tab.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mp_get_fns.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mp_minv_tab.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mp_set_fns.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/abs.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/add.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/add_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/ceilfloor.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/clear.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/clears.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/cmp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/cmp_d.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/cmp_si.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/cmp_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/cmp_z.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/div.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/div_2exp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/div_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/dump.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/eq.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/fits_s.h3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/fits_u.h1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/get_d.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/get_d_2exp.c15
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/get_dfl_prec.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/get_prc.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/get_si.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/get_str.c30
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/get_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/init.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/init2.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/inits.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/inp_str.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/int_p.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/iset.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/iset_d.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/iset_si.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/iset_str.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/iset_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/mul.c135
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/mul_2exp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/mul_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/neg.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/out_str.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/pow_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/random2.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/reldiff.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set_d.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set_dfl_prec.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set_prc.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set_prc_raw.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set_q.c77
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set_si.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set_str.c40
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/set_z.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/size.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/sqrt.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/sqrt_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/sub.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/sub_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/swap.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/trunc.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/ui_div.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/ui_sub.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpf/urandomb.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/Makefile.am2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/alpha/dive_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/alpha/ev5/gmp-mparam.h86
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/alpha/ev67/gcd_11.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/alpha/ev67/gcd_1.asm)80
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/aorslsh1_n.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/arm-defs.m428
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/bdiv_dbm1c.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/bdiv_q_1.asm162
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/cnd_aors_n.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/com.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/copyd.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/copyi.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/dive_1.asm14
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/invert_limb.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/logops_n.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/lshift.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/lshiftc.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/mod_34lsub1.asm11
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/mode1o.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/neon/lorrshift.asm6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/neon/lshiftc.asm47
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/rsh1aors_n.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/rshift.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/sec_tabselect.asm4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/udiv.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v5/gcd_1.asm120
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v5/gcd_11.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_1.asm)93
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_2.asm7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_3.asm7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v6/gmp-mparam.h215
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v6/mul_2.asm7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_11.asm65
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_22.asm113
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/bdiv_q_1.asm36
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/gmp-mparam.h243
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/addmul_1.asm34
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/gmp-mparam.h233
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/mod_34lsub1.asm121
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/mul_1.asm34
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/submul_1.asm34
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora5/gmp-mparam.h205
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora7/gmp-mparam.h190
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora8/bdiv_q_1.asm158
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora8/gmp-mparam.h214
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora9/bdiv_q_1.asm36
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora9/gmp-mparam.h2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/aors_n.asm101
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/aorsmul_1.asm66
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlsh1_n.asm43
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlsh2_n.asm43
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlshC_n.asm139
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_dbm1c.asm5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_q_1.asm128
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/cnd_aors_n.asm90
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/com.asm7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/copyd.asm10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/copyi.asm15
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/cora53/cnd_aors_n.asm99
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/cora53/gmp-mparam.h242
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/cora57/gmp-mparam.h187
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/cora72/gmp-mparam.h242
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/cora73/gmp-mparam.h225
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_1.asm125
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_11.asm70
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_22.asm112
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/gmp-mparam.h325
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/hamdist.asm7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/logops_n.asm91
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/lshift.asm111
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/lshiftc.asm130
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/mod_34lsub1.asm9
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/mul_1.asm139
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/popcount.asm7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/rsh1aors_n.asm168
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/rshift.asm124
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/sec_tabselect.asm7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/sqr_diag_addlsh1.asm102
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/arm64/xgene1/gmp-mparam.h181
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/asm-defs.m45
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/add_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/cfp/addmul_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/cfp/mul_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/cfp/submul_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/gmp-mparam.h5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/hamdist.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/ieee/addmul_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/ieee/invert_limb.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_basecase.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/ieee/sqr_basecase.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/ieee/submul_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/lshift.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/mulww.f14
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/popcount.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/rshift.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/cray/sub_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/add.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/add_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/add_err1_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/add_err2_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/add_err3_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/add_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/add_n_sub_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/addmul_1.c94
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_dbm1c.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q_1.c17
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_qr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/binvert.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/broot.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/brootinv.c75
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/bsqrt.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/bsqrtinv.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/cmp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/cnd_add_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/cnd_sub_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/cnd_swap.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/com.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/comb_tables.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/compute_powtab.c373
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/copyd.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/copyi.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_q.c23
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_qr.c19
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_q.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_qr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_divappr_q.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/div_q.c22
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi1.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi2.c22
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1u_pi2.c19
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2.c70
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2n_pi1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2u_pi1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/dive_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/diveby3.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/divexact.c6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/divis.c25
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/divrem.c17
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/divrem_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/divrem_2.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/dump.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/fib2_ui.c29
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/fib2m.c252
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/gcd.c130
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/gcd_1.c142
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/gcd_11.c74
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/gcd_22.c131
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/gcd_subdiv_step.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/gcdext.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_1.c75
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_lehmer.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/get_d.c48
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/get_str.c144
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/hgcd.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2.c547
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2_jacobi.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_appr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_jacobi.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_matrix.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_reduce.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_step.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/invert.c9
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/invertappr.c11
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/jacbase.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/jacobi.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/jacobi_2.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/logops_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/lshift.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/lshiftc.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul1_inverse_vector.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mod_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_1.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_2.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_3.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_4.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mod_34lsub1.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mode1o.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_q.c18
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_qr.c48
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_q.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_qr.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mu_divappr_q.c8
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mul.c22
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mul_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mul_basecase.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mul_fft.c33
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mul_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mullo_basecase.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mullo_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mulmid.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_basecase.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/mulmod_bnm1.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/neg.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/nussbaumer_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/perfpow.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/perfsqr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/popham.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/pow_1.c13
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/powlo.c98
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/powm.c60
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/pre_divrem_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/pre_mod_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/random.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/random2.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/redc_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/redc_2.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/redc_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/remove.c17
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/rootrem.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/rshift.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_q.c78
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_qr.c85
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_r.c79
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_q.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_qr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_divappr_q.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/scan0.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/scan1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sec_aors_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sec_div.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sec_invert.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sec_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sec_pi1_div.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sec_powm.c129
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sec_sqr.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sec_tabselect.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/set_str.c110
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sizeinbase.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sqr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sqr_basecase.c58
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo_basecase.c21
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sqrmod_bnm1.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sqrtrem.c116
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/strongfibo.c216
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sub.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sub_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sub_err1_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sub_err2_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sub_err3_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/sub_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/submul_1.c81
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/tdiv_qr.c13
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom22_mul.c28
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom2_sqr.c23
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom32_mul.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom33_mul.c11
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom3_sqr.c11
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mulmid.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom43_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom44_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom4_sqr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom52_mul.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom53_mul.c15
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom54_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom62_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom63_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom6_sqr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom6h_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom8_sqr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom8h_mul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_couple_handling.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm2.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2exp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2rexp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_12pts.c15
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_16pts.c20
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_5pts.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_6pts.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_7pts.c9
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_8pts.c11
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/trialdiv.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/udiv_w_sdiv.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/zero.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/generic/zero_p.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/ia64/gcd_1.asm238
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/ia64/gcd_11.asm110
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/ia64/gmp-mparam.h262
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/lisp/gmpasm-mode.el14
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/addmul_1.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/mips64/addmul_1.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/mul_1.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/mips64/mul_1.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/sqr_diagonal.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/mips64/sqr_diagonal.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/submul_1.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/mips64/submul_1.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/umul.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/mips64/umul.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/pa64/umul.asm1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc32/divrem_2.asm6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc32/p4/gmp-mparam.h21
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc32/p7/gmp-mparam.h185
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc32/powerpc-defs.m419
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/aix.m42
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/darwin.m413
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/p4/gmp-mparam.h195
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/submul_1.asm1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/bdiv_q_1.asm146
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/dive_1.asm19
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/divrem_2.asm4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/gcd_11.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/gcd_1.asm)92
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p4/gmp-mparam.h2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_11.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_1.asm)79
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_22.asm146
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gmp-mparam.h281
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p8/gmp-mparam.h170
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p8/invert_limb.asm4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/add_n_sub_n.asm112
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_1.asm130
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_2.asm182
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/aorsmul_1.asm179
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gcd_11.asm64
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gcd_22.asm143
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gmp-mparam.h253
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_1.asm126
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_2.asm170
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_basecase.asm415
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/sqr_basecase.asm555
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/hamdist.asm12
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/popcount.asm16
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/riscv/64/aors_n.asm89
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/riscv/64/aorsmul_1.asm75
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/riscv/64/mul_1.asm58
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/gmp-mparam.h272
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/sqr_basecase.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/s390_64/README2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/s390_64/gmp-mparam.h258
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc32/sparc-defs.m424
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/dive_1.c19
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/divrem_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/gcd_11.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/sparc64/gcd_1.asm)79
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1_4.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/mode1o.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/sparc64.h2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/bdiv_q_1.asm137
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/cnd_aors_n.asm8
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct45/gmp-mparam.h173
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/atom/gmp-mparam.h221
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/bd1/gmp-mparam.h275
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/bd2/gmp-mparam.h269
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/bd4/gmp-mparam.h225
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/bobcat/gmp-mparam.h197
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/bt1/gmp-mparam.h218
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/bt2/gmp-mparam.h214
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/core2/gmp-mparam.h250
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/coreibwl/gmp-mparam.h216
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/coreihwl/gmp-mparam.h295
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/coreinhm/gmp-mparam.h291
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/coreisbr/gmp-mparam.h282
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/fat/fat.c24
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/gcd_11.asm126
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/goldmont/gmp-mparam.h219
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/k10/gmp-mparam.h283
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/k6/gcd_1.asm359
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/k7/addlsh1_n.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/k7/gcd_1.asm193
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/k7/gcd_11.asm107
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/k7/gmp-mparam.h337
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/k7/sublsh1_n.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/k8/gmp-mparam.h249
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/p6/gcd_11.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86/p6/gcd_1.asm)100
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/p6/mmx/gmp-mparam.h100
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/p6/sse2/submul_1.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/pentium/mul_basecase.asm1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/gmp-mparam.h297
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/popcount.asm8
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/silvermont/gmp-mparam.h222
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/skylake/gmp-mparam.h211
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/x86-defs.m42
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/zn1/gmp-mparam.h220
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86/zn2/gmp-mparam.h226
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/aorrlshC_n.asm20
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/aors_n.asm19
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/aorsmul_1.asm26
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aors_n.asm99
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aorsmul_1.asm34
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/cnd_add_n.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/cnd_sub_n.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/gmp-mparam.h244
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_1.asm34
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_2.asm32
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/addmul_2.asm235
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aorrlsh_n.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aors_n.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aorsmul_1.asm29
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gcd_11.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/nano/gcd_1.asm)6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gmp-mparam.h318
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/hamdist.asm176
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_1.asm29
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_2.asm43
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/popcount.asm161
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_11.asm96
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_22.asm142
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gmp-mparam.h345
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/aorrlsh_n.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gcd_11.asm96
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gcd_22.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gmp-mparam.h266
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bdiv_q_1.asm124
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/gmp-mparam.h219
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/aors_n.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/aors_n.asm)31
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/aorsmul_1.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/aorsmul_1.asm)138
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/copyd.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/copyd.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/copyi.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/copyi.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gcd_11.asm119
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gcd_22.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gmp-mparam.h230
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/mul_1.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/mul_1.asm)216
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/mul_basecase.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/mul_basecase.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/redc_1.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/redc_1.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/sqr_basecase.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/sqr_basecase.asm)0
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/com.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/copyd.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/copyi.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gcd_11.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gcd_1.asm)6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gcd_22.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gmp-mparam.h240
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aors_n.asm17
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aorsmul_1.asm46
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/com.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyd.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyi.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_1.asm146
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_11.asm93
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_22.asm137
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gmp-mparam.h275
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/hamdist.asm210
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/logops_n.asm285
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshift.asm130
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshiftc.asm152
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/popcount.asm158
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/rshift.asm132
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/sublshC_n.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/addmul_1.asm27
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/gmp-mparam.h305
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_1.asm36
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_basecase.asm18
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mullo_basecase.asm395
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/sqr_basecase.asm439
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/addmul_2.asm9
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aorrlsh_n.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aors_n.asm261
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aorsmul_1.asm33
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/gcd_22.asm138
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/gmp-mparam.h319
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_1.asm36
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_2.asm35
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mullo_basecase.asm4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/aorsmul_1.asm33
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/gmp-mparam.h291
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/hamdist.asm164
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/popcount.asm150
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorrlsh2_n.asm4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aors_n.asm41
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorsmul_1.asm33
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/cnd_add_n.asm174
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/cnd_sub_n.asm200
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/gcd_11.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/gmp-mparam.h262
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_1.asm190
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_2.asm32
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/popcount.asm118
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/darwin.m43
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/div_qr_1n_pi1.asm6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/divrem_2.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/dos64.m41
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com-palignr.asm63
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com.asm10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyd.asm12
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi-palignr.asm18
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi.asm12
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshift.asm6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshiftc.asm22
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/sec_tabselect.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/addmul_2.c (renamed from Build/source/libs/gmp/gmp-src/mpn/x86/fat/gcd_1.c)12
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat.c34
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat_entry.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_1.asm165
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_11.asm114
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_22.asm163
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aorrlsh_n.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aors_n.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aorsmul_1.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/gmp-mparam.h264
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/mul_1.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/redc_1.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/invert_limb.asm7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_11.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_22.asm142
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gmp-mparam.h257
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/hamdist.asm42
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshift.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshiftc.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/rshift.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/addmul_2.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/addmul_2.asm)23
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/bdiv_q_1.asm179
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/div_qr_1n_pi1.asm6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/gmp-mparam.h275
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/logops_n.asm212
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/lshift.asm81
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_1.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_2.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_4.asm2
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_34lsub1.asm10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_1.asm29
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_2.asm28
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/adx/addmul_1.asm10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/nano/gcd_11.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/addmul_2.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/aorsmul_1.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/gmp-mparam.h318
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshift.asm137
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshiftc.asm150
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_1.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_2.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_basecase.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mullo_basecase.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/redc_1.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/sqr_basecase.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/popham.asm68
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorrlsh1_n.asm50
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorrlsh2_n.asm50
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aors_n.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorsmul_1.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/gmp-mparam.h252
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/hamdist.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/lshift.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/lshiftc.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mul_1.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mul_basecase.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mullo_basecase.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/popcount.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/rshift.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/sqr_basecase.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/skylake/gmp-mparam.h268
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/sqr_diag_addlsh1.asm4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/x86_64-defs.m4111
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorrlsh1_n.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorrlsh_n.asm226
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorsmul_1.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/aorsmul_1.asm)58
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/com.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/copyd.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/copyi.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gcd_11.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_1.asm)6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gcd_22.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gmp-mparam.h280
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/hamdist.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/lshift.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/lshiftc.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mul_1.asm (renamed from Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/mul_1.asm)59
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mul_basecase.asm455
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mullo_basecase.asm299
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/popcount.asm38
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/rshift.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sbpi1_bdiv_r.asm507
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sqr_basecase.asm482
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sublsh1_n.asm37
-rw-r--r--Build/source/libs/gmp/gmp-src/mpn/x86_64/zen2/gmp-mparam.h276
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/abs.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/aors.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/canonicalize.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/clear.c10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/clears.c12
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/cmp.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/cmp_si.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/cmp_ui.c16
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/div.c13
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/equal.c13
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/get_d.c57
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/get_den.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/get_num.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/get_str.c16
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/init.c14
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/inits.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/inp_str.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/inv.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/md_2exp.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/mul.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/neg.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/out_str.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/set.c8
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/set_d.c8
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/set_den.c6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/set_f.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/set_num.c6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/set_si.c11
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/set_str.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/set_ui.c9
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/set_z.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpq/swap.c43
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/2fac_ui.c10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/Makefile.am5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/abs.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/and.c284
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/aors.h1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/aors_ui.h7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/aorsmul.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/aorsmul_i.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/array_init.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/bin_ui.c414
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/bin_uiui.c193
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cdiv_q.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cdiv_q_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cdiv_qr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cdiv_qr_ui.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cdiv_r.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cdiv_r_ui.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cdiv_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cfdiv_q_2exp.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cfdiv_r_2exp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/clear.c4
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/clears.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/clrbit.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cmp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cmp_d.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cmp_si.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cmp_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cmpabs.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cmpabs_d.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cmpabs_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/com.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/combit.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cong.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cong_2exp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/cong_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/dive_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/divegcd.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/divexact.c6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/divis.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/divis_2exp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/divis_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/dump.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/export.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fac_ui.c6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fdiv_q.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fdiv_q_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fdiv_qr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fdiv_qr_ui.c10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fdiv_r.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fdiv_r_ui.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fdiv_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fib2_ui.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fib_ui.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fits_s.h1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fits_uint.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fits_ulong.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/fits_ushort.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/gcd.c61
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/gcd_ui.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/gcdext.c57
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/get_d.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/get_d_2exp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/get_si.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/get_str.c32
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/get_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/getlimbn.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/hamdist.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/import.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/init.c16
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/init2.c6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/inits.c16
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/inp_raw.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/inp_str.c9
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/invert.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/ior.c224
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/iset.c11
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/iset_d.c9
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/iset_si.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/iset_str.c11
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/iset_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/jacobi.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/kronsz.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/kronuz.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/kronzs.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/kronzu.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/lcm.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/lcm_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/limbs_finish.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/limbs_modify.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/limbs_read.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/limbs_write.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/lucmod.c127
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/lucnum2_ui.c16
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/lucnum_ui.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/mfac_uiui.c10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/millerrabin.c168
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/mod.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/mul.c20
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/mul_2exp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/mul_i.h3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/n_pow_ui.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/neg.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/nextprime.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/oddfac_1.c77
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/out_raw.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/out_str.c28
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/perfpow.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/perfsqr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/popcount.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/pow_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/powm.c15
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/powm_sec.c14
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/powm_ui.c67
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/pprime_p.c22
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/primorial_ui.c28
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/prodlimbs.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/random.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/random2.c6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/realloc.c25
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/realloc2.c23
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/remove.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/roinit_n.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/root.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/rootrem.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/rrandomb.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/scan0.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/scan1.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/set.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/set_d.c8
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/set_f.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/set_q.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/set_si.c6
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/set_str.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/set_ui.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/setbit.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/size.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/sizeinbase.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/sqrt.c7
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/sqrtrem.c10
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/stronglucas.c178
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/swap.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tdiv_q.c18
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tdiv_q_2exp.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tdiv_q_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tdiv_qr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tdiv_qr_ui.c11
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tdiv_r.c13
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tdiv_r_2exp.c14
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tdiv_r_ui.c13
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tdiv_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/tstbit.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/ui_pow_ui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/ui_sub.c22
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/urandomb.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/urandomm.c25
-rw-r--r--Build/source/libs/gmp/gmp-src/mpz/xor.c176
-rw-r--r--Build/source/libs/gmp/gmp-src/nextprime.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/primesieve.c329
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/asprintf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/asprntffuns.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/doprnt.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/doprntf.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/doprnti.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/fprintf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/obprintf.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/obprntffuns.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/obvprintf.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/printf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/printffuns.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/repl-vsnprintf.c14
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/snprintf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/snprntffuns.c15
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/sprintf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/sprintffuns.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/vasprintf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/vfprintf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/vprintf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/vsnprintf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/printf/vsprintf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/rand.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randbui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randclr.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randdef.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randiset.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randlc2s.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randlc2x.c5
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randmt.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randmts.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randmui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/rands.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randsd.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/rand/randsdui.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/scanf/doscan.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/scanf/fscanf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/scanf/fscanffuns.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/scanf/scanf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/scanf/sscanf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/scanf/sscanffuns.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/scanf/vfscanf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/scanf/vscanf.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/scanf/vsscanf.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/tal-debug.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/tal-notreent.c1
-rw-r--r--Build/source/libs/gmp/gmp-src/tal-reent.c3
-rw-r--r--Build/source/libs/gmp/gmp-src/version.c1
-rw-r--r--Build/source/libs/gmp/version.ac2
910 files changed, 35211 insertions, 13673 deletions
diff --git a/Build/source/libs/gmp/ChangeLog b/Build/source/libs/gmp/ChangeLog
index 4f78f743929..45247f79864 100644
--- a/Build/source/libs/gmp/ChangeLog
+++ b/Build/source/libs/gmp/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-20 Akira Kakuto <kakuto@w32tex.org>
+
+ Import gmp-6.2.0.
+ * Makefile.am, version.ac: Updated for 6.2.0.
+
2017-12-27 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
Makefile.am: Move several files from unused to used
diff --git a/Build/source/libs/gmp/Makefile.am b/Build/source/libs/gmp/Makefile.am
index 321ace15288..fea1f1cf6c1 100644
--- a/Build/source/libs/gmp/Makefile.am
+++ b/Build/source/libs/gmp/Makefile.am
@@ -86,9 +86,11 @@ mpn_sources = \
@GMP_TREE@/mpn/generic/addmul_1.c \
@GMP_TREE@/mpn/generic/bdiv_dbm1c.c \
@GMP_TREE@/mpn/generic/bdiv_q.c \
+ @GMP_TREE@/mpn/generic/bdiv_q_1.c \
@GMP_TREE@/mpn/generic/binvert.c \
@GMP_TREE@/mpn/generic/cmp.c \
@GMP_TREE@/mpn/generic/com.c \
+ @GMP_TREE@/mpn/generic/compute_powtab.c \
@GMP_TREE@/mpn/generic/copyd.c \
@GMP_TREE@/mpn/generic/copyi.c \
@GMP_TREE@/mpn/generic/dcpi1_bdiv_q.c \
@@ -199,7 +201,6 @@ mpn_unused = \
@GMP_TREE@/mpn/generic/add_err2_n.c \
@GMP_TREE@/mpn/generic/add_err3_n.c \
@GMP_TREE@/mpn/generic/add_n_sub_n.c \
- @GMP_TREE@/mpn/generic/bdiv_q_1.c \
@GMP_TREE@/mpn/generic/bdiv_qr.c \
@GMP_TREE@/mpn/generic/broot.c \
@GMP_TREE@/mpn/generic/brootinv.c \
@@ -216,8 +217,11 @@ mpn_unused = \
@GMP_TREE@/mpn/generic/divis.c \
@GMP_TREE@/mpn/generic/dump.c \
@GMP_TREE@/mpn/generic/fib2_ui.c \
+ @GMP_TREE@/mpn/generic/fib2m.c \
@GMP_TREE@/mpn/generic/gcd.c \
@GMP_TREE@/mpn/generic/gcd_1.c \
+ @GMP_TREE@/mpn/generic/gcd_11.c \
+ @GMP_TREE@/mpn/generic/gcd_22.c \
@GMP_TREE@/mpn/generic/get_d.c \
@GMP_TREE@/mpn/generic/hgcd2_jacobi.c \
@GMP_TREE@/mpn/generic/hgcd_jacobi.c \
@@ -245,6 +249,7 @@ mpn_unused = \
@GMP_TREE@/mpn/generic/redc_2.c \
@GMP_TREE@/mpn/generic/remove.c \
@GMP_TREE@/mpn/generic/rootrem.c \
+ @GMP_TREE@/mpn/generic/sbpi1_bdiv_r.c \
@GMP_TREE@/mpn/generic/scan0.c \
@GMP_TREE@/mpn/generic/sec_invert.c \
@GMP_TREE@/mpn/generic/sec_mul.c \
@@ -252,6 +257,7 @@ mpn_unused = \
@GMP_TREE@/mpn/generic/sec_sqr.c \
@GMP_TREE@/mpn/generic/sec_tabselect.c \
@GMP_TREE@/mpn/generic/sizeinbase.c \
+ @GMP_TREE@/mpn/generic/strongfibo.c \
@GMP_TREE@/mpn/generic/sub_err1_n.c \
@GMP_TREE@/mpn/generic/sub_err2_n.c \
@GMP_TREE@/mpn/generic/sub_err3_n.c \
diff --git a/Build/source/libs/gmp/Makefile.in b/Build/source/libs/gmp/Makefile.in
index 4585f512afb..585127f43ce 100644
--- a/Build/source/libs/gmp/Makefile.in
+++ b/Build/source/libs/gmp/Makefile.in
@@ -137,9 +137,11 @@ am__objects_2 = mp_bases.$(OBJEXT) popcount.$(OBJEXT) \
@GMP_TREE@/mpn/generic/addmul_1.$(OBJEXT) \
@GMP_TREE@/mpn/generic/bdiv_dbm1c.$(OBJEXT) \
@GMP_TREE@/mpn/generic/bdiv_q.$(OBJEXT) \
+ @GMP_TREE@/mpn/generic/bdiv_q_1.$(OBJEXT) \
@GMP_TREE@/mpn/generic/binvert.$(OBJEXT) \
@GMP_TREE@/mpn/generic/cmp.$(OBJEXT) \
@GMP_TREE@/mpn/generic/com.$(OBJEXT) \
+ @GMP_TREE@/mpn/generic/compute_powtab.$(OBJEXT) \
@GMP_TREE@/mpn/generic/copyd.$(OBJEXT) \
@GMP_TREE@/mpn/generic/copyi.$(OBJEXT) \
@GMP_TREE@/mpn/generic/dcpi1_bdiv_q.$(OBJEXT) \
@@ -322,9 +324,11 @@ am__depfiles_remade = ./$(DEPDIR)/gmptest-gmptest.Po \
@GMP_TREE@/mpn/generic/$(DEPDIR)/addmul_1.Po \
@GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_dbm1c.Po \
@GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_q.Po \
+ @GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_q_1.Po \
@GMP_TREE@/mpn/generic/$(DEPDIR)/binvert.Po \
@GMP_TREE@/mpn/generic/$(DEPDIR)/cmp.Po \
@GMP_TREE@/mpn/generic/$(DEPDIR)/com.Po \
+ @GMP_TREE@/mpn/generic/$(DEPDIR)/compute_powtab.Po \
@GMP_TREE@/mpn/generic/$(DEPDIR)/copyd.Po \
@GMP_TREE@/mpn/generic/$(DEPDIR)/copyi.Po \
@GMP_TREE@/mpn/generic/$(DEPDIR)/dcpi1_bdiv_q.Po \
@@ -956,9 +960,11 @@ mpn_sources = \
@GMP_TREE@/mpn/generic/addmul_1.c \
@GMP_TREE@/mpn/generic/bdiv_dbm1c.c \
@GMP_TREE@/mpn/generic/bdiv_q.c \
+ @GMP_TREE@/mpn/generic/bdiv_q_1.c \
@GMP_TREE@/mpn/generic/binvert.c \
@GMP_TREE@/mpn/generic/cmp.c \
@GMP_TREE@/mpn/generic/com.c \
+ @GMP_TREE@/mpn/generic/compute_powtab.c \
@GMP_TREE@/mpn/generic/copyd.c \
@GMP_TREE@/mpn/generic/copyi.c \
@GMP_TREE@/mpn/generic/dcpi1_bdiv_q.c \
@@ -1069,7 +1075,6 @@ mpn_unused = \
@GMP_TREE@/mpn/generic/add_err2_n.c \
@GMP_TREE@/mpn/generic/add_err3_n.c \
@GMP_TREE@/mpn/generic/add_n_sub_n.c \
- @GMP_TREE@/mpn/generic/bdiv_q_1.c \
@GMP_TREE@/mpn/generic/bdiv_qr.c \
@GMP_TREE@/mpn/generic/broot.c \
@GMP_TREE@/mpn/generic/brootinv.c \
@@ -1086,8 +1091,11 @@ mpn_unused = \
@GMP_TREE@/mpn/generic/divis.c \
@GMP_TREE@/mpn/generic/dump.c \
@GMP_TREE@/mpn/generic/fib2_ui.c \
+ @GMP_TREE@/mpn/generic/fib2m.c \
@GMP_TREE@/mpn/generic/gcd.c \
@GMP_TREE@/mpn/generic/gcd_1.c \
+ @GMP_TREE@/mpn/generic/gcd_11.c \
+ @GMP_TREE@/mpn/generic/gcd_22.c \
@GMP_TREE@/mpn/generic/get_d.c \
@GMP_TREE@/mpn/generic/hgcd2_jacobi.c \
@GMP_TREE@/mpn/generic/hgcd_jacobi.c \
@@ -1115,6 +1123,7 @@ mpn_unused = \
@GMP_TREE@/mpn/generic/redc_2.c \
@GMP_TREE@/mpn/generic/remove.c \
@GMP_TREE@/mpn/generic/rootrem.c \
+ @GMP_TREE@/mpn/generic/sbpi1_bdiv_r.c \
@GMP_TREE@/mpn/generic/scan0.c \
@GMP_TREE@/mpn/generic/sec_invert.c \
@GMP_TREE@/mpn/generic/sec_mul.c \
@@ -1122,6 +1131,7 @@ mpn_unused = \
@GMP_TREE@/mpn/generic/sec_sqr.c \
@GMP_TREE@/mpn/generic/sec_tabselect.c \
@GMP_TREE@/mpn/generic/sizeinbase.c \
+ @GMP_TREE@/mpn/generic/strongfibo.c \
@GMP_TREE@/mpn/generic/sub_err1_n.c \
@GMP_TREE@/mpn/generic/sub_err2_n.c \
@GMP_TREE@/mpn/generic/sub_err3_n.c \
@@ -1432,6 +1442,9 @@ clean-noinstLIBRARIES:
@GMP_TREE@/mpn/generic/bdiv_q.$(OBJEXT): \
@GMP_TREE@/mpn/generic/$(am__dirstamp) \
@GMP_TREE@/mpn/generic/$(DEPDIR)/$(am__dirstamp)
+@GMP_TREE@/mpn/generic/bdiv_q_1.$(OBJEXT): \
+ @GMP_TREE@/mpn/generic/$(am__dirstamp) \
+ @GMP_TREE@/mpn/generic/$(DEPDIR)/$(am__dirstamp)
@GMP_TREE@/mpn/generic/binvert.$(OBJEXT): \
@GMP_TREE@/mpn/generic/$(am__dirstamp) \
@GMP_TREE@/mpn/generic/$(DEPDIR)/$(am__dirstamp)
@@ -1441,6 +1454,9 @@ clean-noinstLIBRARIES:
@GMP_TREE@/mpn/generic/com.$(OBJEXT): \
@GMP_TREE@/mpn/generic/$(am__dirstamp) \
@GMP_TREE@/mpn/generic/$(DEPDIR)/$(am__dirstamp)
+@GMP_TREE@/mpn/generic/compute_powtab.$(OBJEXT): \
+ @GMP_TREE@/mpn/generic/$(am__dirstamp) \
+ @GMP_TREE@/mpn/generic/$(DEPDIR)/$(am__dirstamp)
@GMP_TREE@/mpn/generic/copyd.$(OBJEXT): \
@GMP_TREE@/mpn/generic/$(am__dirstamp) \
@GMP_TREE@/mpn/generic/$(DEPDIR)/$(am__dirstamp)
@@ -1887,9 +1903,11 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/addmul_1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_dbm1c.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_q.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_q_1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/binvert.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/cmp.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/com.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/compute_powtab.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/copyd.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/copyi.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@GMP_TREE@/mpn/generic/$(DEPDIR)/dcpi1_bdiv_q.Po@am__quote@ # am--include-marker
@@ -2613,9 +2631,11 @@ distclean: distclean-recursive
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/addmul_1.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_dbm1c.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_q.Po
+ -rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_q_1.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/binvert.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/cmp.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/com.Po
+ -rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/compute_powtab.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/copyd.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/copyi.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/dcpi1_bdiv_q.Po
@@ -2837,9 +2857,11 @@ maintainer-clean: maintainer-clean-recursive
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/addmul_1.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_dbm1c.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_q.Po
+ -rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/bdiv_q_1.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/binvert.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/cmp.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/com.Po
+ -rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/compute_powtab.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/copyd.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/copyi.Po
-rm -f @GMP_TREE@/mpn/generic/$(DEPDIR)/dcpi1_bdiv_q.Po
diff --git a/Build/source/libs/gmp/README b/Build/source/libs/gmp/README
index a793ac7ef05..4358a3de8b5 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>
-2015-12-28 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+2020-01-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
diff --git a/Build/source/libs/gmp/TLpatches/ChangeLog b/Build/source/libs/gmp/TLpatches/ChangeLog
index e1f2fae0d7d..c162f9107be 100644
--- a/Build/source/libs/gmp/TLpatches/ChangeLog
+++ b/Build/source/libs/gmp/TLpatches/ChangeLog
@@ -1,3 +1,7 @@
+2020-01-20 Akira Kakuto <kakuto@w32tex.org>
+
+ * Import 6.2.0.
+
2016-12-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* Import 6.1.2.
diff --git a/Build/source/libs/gmp/TLpatches/TL-Changes b/Build/source/libs/gmp/TLpatches/TL-Changes
index 94a5f87ca3d..c64fdd61022 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.1.2/ tree as obtained from:
+Changes applied to the gmp-6.2.0/ 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 707ca82cd22..f9821edeb0a 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.1.2.
+# Generated by GNU Autoconf 2.69 for gmp (TeX Live) 6.2.0.
#
# 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.1.2'
-PACKAGE_STRING='gmp (TeX Live) 6.1.2'
+PACKAGE_VERSION='6.2.0'
+PACKAGE_STRING='gmp (TeX Live) 6.2.0'
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.1.2 to adapt to many kinds of systems.
+\`configure' configures gmp (TeX Live) 6.2.0 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.1.2:";;
+ short | recursive ) echo "Configuration of gmp (TeX Live) 6.2.0:";;
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.1.2
+gmp (TeX Live) configure 6.2.0
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.1.2, which was
+It was created by gmp (TeX Live) $as_me 6.2.0, 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.1.2'
+ VERSION='6.2.0'
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.1.2, which was
+This file was extended by gmp (TeX Live) $as_me 6.2.0, 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.1.2
+gmp (TeX Live) config.status 6.2.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/libs/gmp/gmp-src/AUTHORS b/Build/source/libs/gmp/gmp-src/AUTHORS
index c8ddb90ebcf..3c38ef3de12 100644
--- a/Build/source/libs/gmp/gmp-src/AUTHORS
+++ b/Build/source/libs/gmp/gmp-src/AUTHORS
@@ -33,10 +33,10 @@ Jason Moxham Previous versions of mpz/fac_ui.c and gen-fac_ui.c
Niels Möller gen-jacobitab.c,
mpn/generic/hgcd2.c, hgcd.c, hgcd_step.c,
hgcd_appr.c, hgcd_matrix.c, hgcd_reduce.c,
- gcd.c, gcdext.c, matrix22_mul.c,
+ gcd.c, gcd_11.c, gcd_22.c, gcdext.c, matrix22_mul.c,
gcdext_1.c, gcd_subdiv_step.c, gcd_lehmer.c,
gcdext_subdiv_step.c, gcdext_lehmer.c,
- jacobi_2.c, jacbase.c, hgcd_jacobi.c, hgcd2_jacobi.c
+ jacobi_2.c, jacbase.c, hgcd_jacobi.c, hgcd2_jacobi.c,
matrix22_mul1_inverse_vector.c,
toom_interpolate_7pts, mulmod_bnm1.c, dcpi1_bdiv_qr.c,
dcpi1_bdiv_q.c, sbpi1_bdiv_qr.c, sbpi1_bdiv_q.c,
@@ -62,9 +62,15 @@ Marco Bodrato mpn/generic/toom44_mul.c, toom4_sqr.c, toom53_mul.c,
toom8h_mul.c, toom8_sqr.c, toom_interpolate_16pts.c,
mulmod_bnm1.c, sqrmod_bnm1.c, nussbaumer_mul.c,
toom_eval_pm2.c, toom_eval_pm2rexp.c,
+ fib2m.c, strongfibo.c,
mullo_n.c, sqrlo.c, invert.c, invertappr.c;
+ mpn/x86/atom/aors_n.asm, aorslshC_n.asm,
+ aorrlsh{1,2,C}_n.asm, aorsmul_1.asm, logops_n.asm,
+ sublsh2_n.asm, rshift.asm; primesieve.c;
mpz/fac_ui.c, 2fac_ui.c, mfac_uiui.c, oddfac_1.c,
- primorial_ui.c, prodlimbs.c, goetgheluck_bin_uiui.c.
+ primorial_ui.c, prodlimbs.c, bin_ui.c,
+ lucmod.c, stronglucas.c,
+ goetgheluck_bin_uiui.c; mini-gmp/mini-mpq.c.
David Harvey mpn/generic/add_err1_n.c, add_err2_n.c,
add_err3_n.c, sub_err1_n.c, sub_err2_n.c,
diff --git a/Build/source/libs/gmp/gmp-src/ChangeLog b/Build/source/libs/gmp/gmp-src/ChangeLog
index 7956d943c47..0689b881618 100644
--- a/Build/source/libs/gmp/gmp-src/ChangeLog
+++ b/Build/source/libs/gmp/gmp-src/ChangeLog
@@ -1,52 +1,1515 @@
-2016-12-16 Torbjörn Granlund <tg@gmplib.org>
+2020-01-17 Torbjörn Granlund <tg@gmplib.org>
- * Version 6.1.2 released.
+ * Version 6.2.0 released.
-2016-12-13 Torbjörn Granlund <tg@gmplib.org>
+ * gmp-h.in (__GNU_MP__): Bump.
+ (__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL):
+ Bump version info.
+ * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*, LIBMP_LT_*):
+ Bump version info.
- * longlong.h: Test LONGLONG_STANDALONE in two more places.
+2020-01-15 Torbjörn Granlund <tg@gmplib.org>
-2016-12-07 Torbjörn Granlund <tg@gmplib.org>
+ * mpn/x86_64/bt1/gcd_11.asm: Add missing FUNC_EXIT.
- * gmp-h.in: Check yet another symbol for FILE.
+2020-01-10 Torbjörn Granlund <tg@gmplib.org>
-2016-12-02 Torbjörn Granlund <tg@gmplib.org>
+ * longlong.h (powerpc): Add clobbers, make formatting cleanups.
- Merge configure changes from before 6.1.1:
+ * configure.ac (HAVE_NATIVE): Add mpn_sbpi1_bdiv_r.
- 2016-03-25 Torbjörn Granlund <torbjorng@google.com>
+ * tune/tune-gcd-p.c (main): Use %zu for size_t printing.
- * config.guess: Prefix all arm CPUs with "arm" to accommodate our
- matchers.
- * configure.ac (arm): Match arm CPUs consistently.
+ * configfsf.guess: Update from upstream.
- 2016-03-21 Torbjörn Granlund <torbjorng@google.com>
+ * mpn/x86/pentium4/sse2/popcount.asm: For simplicity and correctness
+ use LEAL directly.
- * configure.ac: Support many arm64 processors.
+2020-01-03 Niels Möller <nisse@lysator.liu.se>
- 2016-03-20 Torbjörn Granlund <torbjorng@google.com>
+ * configure.ac: Delete suggestion to use TESTS_ENVIRONMENT to run
+ wine. It worked only with older versions of automake.
- * config.guess (arm*): Handle big.LITTLE CPUs by extracting the
- lexically largest id.
- * config.guess (arm*): Add many aarch64 CPUs.
- * config.guess (main): Corresponding changes.
+2019-12-23 Torbjörn Granlund <tg@gmplib.org>
- * configure.ac (arm*): Support cortex-a5 better.
+ * mpf/mul.c: Rewrite to invoke mpn_sqr when appropriate.
- 2016-01-15 Torbjörn Granlund <torbjorng@google.com>
+2019-12-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
- * config.guess (s390): Don't assume /proc/cpuinfo exists.
+ * mpz/powm.c: Full normalisation when e=1 & b<0.
+ * tests/mpz/t-powm.c: More tests for the e=1 case.
- 2016-01-13 Torbjörn Granlund <torbjorng@google.com>
+2019-12-02 Torbjörn Granlund <tg@gmplib.org>
- * config.guess: Reorder and generalise ppc code.
+ * mpn/generic/gcd_11.c: Remove check for NATIVE_ implementation.
-2016-12-01 Torbjörn Granlund <tg@gmplib.org>
+2019-11-24 Niels Möller <nisse@lysator.liu.se>
- * tests/misc.c (tests_rand_start): Make shift well-defined.
+ * mpn/generic/gcdext_1.c [USE_ZEROTAB]: Delete code variant for
+ USE_ZEROTAB != 0. Was used in the currently disabled binary
+ gcdext.
- * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
- * gmp-h.in: Bump version.
+2019-11-20 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/powm.c (MPN_REDC_1): Prefer mpn_sbpi1_bdiv_r when it is
+ provided.
+ * mpn/generic/sec_powm.c (MPN_REDC_1_SEC): Likewise.
+
+2019-11-17 Torbjörn Granlund <tg@gmplib.org>
+
+ * config.guess: Recognise zen2.
+ * configure.ac: Likewise.
+
+ * mpn/x86_64/bt1/aorsmul_1.asm: Rewrite.
+ * mpn/x86_64/bt1/mul_1.asm: Rewrite.
+
+ * mpn/arm/v6t2/gcd_11.asm: Increase alignment; update x/l table.
+
+2019-11-16 Seth Troisi <sethtroisi@google.com>
+
+ * tune/common.c (speed_mpn_perfect_power_p): New function.
+ (speed_mpn_perfect_power_p): New function.
+ * tune/speed.h: Declare both.
+ * tune/speed.c (routine): Add mpn_perfect_{power,square}_p.
+
+ * tune/common.c (speed_mpz_nextprime): New function.
+ * tune/speed.h: Declare it.
+ * tune/speed.c (routine): Add mpz_nextprime.
+
+2019-11-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tune/speed.c (routine_t): Add R flag to mpz_powm
+ * tune/speed.h (SPEED_ROUTINE_MPZ_POWM): Use R flag as the base.
+
+2019-10-02 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac: Make more path distinctions for the benefit of
+ gmp-mparam.h.
+
+2019-10-01 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (arm64): Let cortex-a7x look in a57 folder.
+
+2019-10-01 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/gcdext_1.c (mpn_gcdext_1) [GCDEXT_1_USE_BINARY]: Fix
+ canonicalization condition.
+
+2019-09-30 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/mpn/t-gcdext_1.c: New test.
+
+2019-09-23 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/hgcd2.c: Mark added div1 variants as static.
+
+ * tune/tuneup.c, tune/speed.c, tune/speed.h, tune/common.c,
+ tune/Makefile.am: Add measuring of mpn_hgcd2 method 4 and 5.
+ * tune/hgcd2-4.c, tune/hgcd2-5.c: New files.
+
+2019-09-23 Niels Möller <nisse@lysator.liu.se>
+
+ * gmp-impl.h (hgcd2_func_t) [TUNE_PROGRAM_BUILD]: New typedef.
+ (hgcd2_func) [TUNE_PROGRAM_BUILD]: New function pointer.
+
+ * tune/hgcd2.c (mpn_hgcd2): New file, with a redefined function to
+ invoke an implementation via the hgcd2_func function pointer.
+ Initially points to the default implementation in
+ mpn/generic/hgcd2.c.
+ * tune/Makefile.am (tuneup_SOURCES): Add hgcd2.c.
+
+ * tune/tuneup.c (one_method): Return index of selected function.
+ (tune_hgcd2): Set hgcd2_func to point to selected function. So
+ that the later tuning of mpn_hgcd and mpn_gcd uses the right
+ implementation of hgcd2.
+
+2019-09-23 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/hgcd2.c: Improve method 4 and 5 by using the division
+ free methods optimistically, detecting errors. Tweak table values.
+
+2019-09-22 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/hgcd2.c: Add a 4th and 5th div1 method.
+
+2019-09-18 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/hgcd2.c (div1, div2): Rearrange things to allow for asm.
+ (div2): Avoid out-of-specs shift.
+ (div2): Use same variable naming in all variants.
+
+2019-09-16 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/hgcd2.c (HGCD2_DIV2_METHOD): New define.
+ (div2): Replaced, since the old implementation had lots of poorly
+ predicted and expensive branches. Two new implementaions, selected
+ by HGCD2_DIV2_METHOD.
+ (div2) [HGCD2_DIV2_METHOD == 1]: Calls div1 on the high limbs,
+ with unlikely case handling large quotients.
+ (div2) [HGCD2_DIV2_METHOD == 2]: The previously #if:ed out
+ version. A bitwise division, relying on fast count_leading_zeros,
+ and with fewer branches than the previous code.
+
+2019-09-15 Torbjörn Granlund <tg@gmplib.org>
+
+ * acinclude.m4 (GMP_ASM_X86_ADX): Remove unused.
+
+ * configure.ac (x86): Amend last change.
+
+2019-09-14 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/hgcd2.c (HGCD2_DIV1_METHOD): Rename, and change
+ default to 3. Updated all usage.
+ (HGCD2_METHOD): ... the old name, deleted.
+
+2019-09-14 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac: Remove obsolete path-triggered invocation of
+ GMP_ASM_X86_ADX and GMP_ASM_X86_MULX.
+
+ * acinclude.m4 (GMP_ASM_X86_MULX): Set X86_ASM_MULX to config.h.
+ * configure.ac (x86): Set x86_have_mulx for relevant CPUs.
+ Use if to conditionally invoke GMP_ASM_X86_MULX.
+ * longlong.h (x86 umul_ppmm): Test also X86_ASM_MULX for when to use
+ mulx variant.
+
+2019-09-13 Niels Möller <nisse@lysator.liu.se>
+
+ * tune/tuneup.c (one_method): New helper function, to measure
+ several functions for a fix size.
+ (tune_hgcd2, tune_div_qr_1, tune_mod_1, tune_jacobi_base): Use it.
+
+2019-09-13 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (HAVE_HOST_CPU_1): Add many x86_64 CPU types.
+ * longlong.h (x86 umul_ppmm): Fix criterion for when to use mulx.
+ (count_leading_zeros): Use lzcnt for appropriate CPUs.
+ (count_trailing_zeros): Use tzcnt for appropriate CPUs.
+
+ * mpn/generic/hgcd2.c (HGCD2_METHOD=2 div1): Rewrite.
+
+2019-09-09 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/mul.c: Call mpn_mul_basecase early when in range. Never
+ call mpn_sqr.
+
+ * mpn/generic/gcd.c: Rewrite tail of function, for n <= 2.
+
+2019-09-08 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (arm): Select arch armv7ve for a7, a12, a15, and a17,
+ this enables the use of the udiv instruction.
+
+ * mpn/generic/hgcd2.c (disabled div2): Micro-optimise.
+
+2019-09-07 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/hgcd2.c (HGCD2_METHOD=3 div1): Micro-optimise.
+
+2019-09-07 Vincent Lefevre <vincent@vinc17.net>
+
+ * acinclude.m4 (GMP_C_DOUBLE_FORMAT): Append EXEEXT for executable.
+
+2019-09-05 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm64/gcd_22.asm: Rewrite to make better use of Arm conditional
+ execution.
+ * mpn/arm32/gcd_22.asm: Likewise.
+
+2019-09-05 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/hgcd2.c (div1): Return both r and q as a
+ mp_double_limb_t, replacing the DIV1 macro.
+ (div1) [HGCD2_METHOD == 3]: New implementation handling q <= 7
+ specially and without branches. Based on Torbjörn's mail to the
+ gmp-devel list.
+ * tune/speed.c, tune/speed.h, tune/common.c, tune/Makefile.am: Add
+ corresponding speed support.
+ * tune/hgcd2-3.c: New file.
+ * tune/tuneup.c (print_define_with_speedup): New function, to
+ output a comment with speedup compared to next-best method.
+ (tune_hgcd2): Update tuning.
+
+2019-09-04 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/hgcd2.c (HGCD2_METHOD): New parameter.
+ (DIV1): New macro, using either the div1 function or plain
+ division, depending on the value of HGCD2_METHOD.
+ (mpn_hgcd2): Use DIV1.
+ * tune/speed.c, tune/speed.h, tune/common.c, tune/Makefile.am: Add
+ measuring of mpn_hgcd2 methods.
+ * tune/hgcd2-1.c, tune/hgcd2-2.c: New files.
+ * tune/tuneup.c: Tune HGCD2_METHOD.
+
+ * tune/speed.h (SPEED_ROUTINE_MPN_HGCD2): New macro.
+ * tune/common.c (speed_mpn_hgcd2): New function.
+ * tune/speed.c (routine): Add mpn_hgcd2.
+
+2019-09-04 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm/v6t2/gcd_22.asm: New file.
+ * mpn/arm64/gcd_22.asm: New file.
+ * mpn/ia64/gcd_11.asm: New file.
+
+2019-09-01 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bt1/gcd_11.asm: Replace grabber with bt1 optimised code.
+
+2019-08-30 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bd4/gcd_22.asm: New grabber file.
+
+ * mpn/x86_64/zen/gcd_22.asm: Use coreihwl instead of bd2 gcd_22.
+
+ * mpn/x86_64/bd2/gcd_22.asm: Fix typo in FUNC_ENTRY (currently unused).
+ Avoid a register copy before return.
+ * mpn/x86_64/core2/gcd_22.asm: Likewise.
+ * mpn/x86_64/k10/gcd_22.asm: Likewise.
+ * mpn/x86_64/gcd_22.asm: Likewise.
+
+ * mpn/x86_64/coreihwl/gcd_22.asm: Optimise, now runs well on more CPUs.
+
+ * mpn/x86_64/gcd_11.asm: Remove PROTECT from symbols as they are
+ actually local.
+ * mpn/x86_64/gcd_22.asm: Likewise.
+
+2019-08-25 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bd2/gcd_22.asm: Repeat tzcnt for exceptional lowz case.
+ Remove dead code.
+
+ * mpn/powerpc64/mode64/p7/gcd_22.asm: Make logic for determining ABI
+ wrt struct return more robust.
+ * mpn/powerpc64/mode64/p9/gcd_22.asm: Likewise.
+
+2019-08-24 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bt1/gcd_11.asm: New grabber.
+ * mpn/x86_64/bt1/gcd_22.asm: New grabber.
+ * mpn/x86_64/bt2/gcd_22.asm: New grabber.
+
+ * mpn/x86_64/atom/gcd_22.asm: Remove stale grabber file.
+ * mpn/x86_64/zen/gcd_22.asm: Grab bd2 instead of hwl code.
+ * mpn/x86_64/bd2/gcd_22.asm: New file.
+ * mpn/x86_64/k8/gcd_22.asm: Remove, rely on top-level code instead.
+ * mpn/x86_64/bt1/gcd_22.asm: Remove.
+ * x86_64/gcd_22.asm: New file, improved version of removed bt1 code.
+
+2019-08-22 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/coreihwl/gcd_11.asm: Remove as it was never beneficial.
+
+ * mpn/x86_64/bd2/gcd_11.asm: Make sure rdx is zero on return to benefit
+ gcd_22's private calls. Make gcd_11 files more similar in register use.
+ * mpn/x86_64/bd4/gcd_11.asm: Likewise.
+ * mpn/x86_64/core2/gcd_11.asm: Likewise.
+ * mpn/x86_64/gcd_11.asm:: Likewise.
+
+2019-08-22 Niels Möller <nisse@lysator.liu.se>
+
+ From Hugh McMaster:
+ * gmp.pc.in, gmpxx.pc.in: New files.
+ * configure.ac: New output files gmp.pc and gmpxx.pc.
+ * Makefile.am (pkgconfigdir, pkgconfig_DATA): New automake
+ settings, to install gmp.pc and optionally gmpxx.pc for use with
+ pkg-config.
+
+2019-08-21 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/core2/gcd_22.asm: New file.
+ * mpn/x86_64/k8/gcd_22.asm: New file.
+ * mpn/x86_64/k10/gcd_22.asm: New file.
+ * mpn/x86_64/coreihwl/gcd_22.asm: New file.
+ * mpn/x86_64/bt1/gcd_22.asm: New file.
+ * mpn/x86_64/bd4/gcd_22.asm: New grabber.
+ * mpn/x86_64/zen/gcd_22.asm: New grabber.
+ * mpn/x86_64/atom/gcd_22.asm: New grabber.
+
+2019-08-19 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac: Check for ELFv1 ABI on PowerPC.
+
+2019-08-18 Torbjörn Granlund <tg@gmplib.org>
+
+ * longlong.h (arm32 sub_ddmmss): Define separately for thumb and
+ non-thumb as rsc instruction is missing for thumb.
+
+ * mpn/powerpc64/mode64/p7/gcd_22.asm: New file.
+ * mpn/powerpc64/mode64/p9/gcd_22.asm: New file.
+
+2019-08-17 Torbjörn Granlund <tg@gmplib.org>
+
+ * demos/expr/t-expr.c: #include gmp-impl.h as it includes tests.h.
+
+ * mpn/asm-defs.m4: Add gcd_22.
+
+ * tests/refmpn.c (refmpn_gcd_22): New function.
+ * tests/tests.h: Declare it.
+
+ * tests/t-constants.c: #include gmp-impl.h.
+ * tests/mpf/t-get_d.c: Likewise.
+
+2019-08-17 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/gcd_22.c (mpn_gcd_22): New implementation with less
+ branches.
+
+2019-08-16 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpn/generic/brootinv.c: Shorten computations, using even exponent.
+ * mpn/generic/powlo.c: Avoid copies with a flipflop.
+
+2019-08-16 Niels Möller <nisse@lysator.liu.se>
+
+ Speed support for gcd_22. Calls mpn_gcd_22(al, al, bl, bl), so
+ that B+1 is a common factor.
+ * tune/speed.h (SPEED_ROUTINE_MPN_GCD_22): New macro.
+ * tune/speed.c (routine): Add mpn_gcd_22.
+ * tune/common.c (speed_mpn_gcd_22): New function.
+
+ * mpn/generic/gcd.c (gcd_2): Moved to gcd_22.c below.
+ (mpn_gcd): Adapt for calling gcd_22.
+ * mpn/generic/gcd_22.c (mpn_gcd_22): New file and function.
+ * gmp-impl.h (mp_double_limb_t): New (typedef) struct.
+ * configure.ac (gmp_mpn_functions): Added gcd_22.
+
+ * tests/mpn/t-gcd_22.c: New test.
+ * tests/mpn/Makefile.am (check_PROGRAMS): Add t-gcd_22.
+ * tests/refmpz.c (refmpz_gcd): New function (plain binary gcd).
+
+2019-08-15 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/zen/gcd_11.asm: Use bd2 instead of bd4 code.
+
+2019-08-13 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64: Add more gcd_11 variants of of x86_64 gcd_11.asm and
+ tweak existing ones.
+
+2019-08-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ From Seth Troisi:
+ * doc/gmp.texi: Update mpz_millerrabin documentation.
+
+ * mpn/x86_64/bd2/gcd_11.asm: Micro-optimisation.
+ * doc/gmp.texi: Further update in mpz_millerrabin.
+ * tests/misc.c: Silence a warning.
+ * tests/mpz/t-pprime_p.c (const primes): One more prime in the list.
+ * mpz/millerrabin.c: Return 2 for surely prime numbers (BPSW checked).
+
+2019-08-08 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86/gcd_11.asm: New file.
+
+ * config.sub: Make arm cpu types match what config.guess returns.
+
+2019-08-08 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/refmpn.c (refmpn_gcd_11): New function, based on refmpn_gcd_1.
+ (refmpn_gcd_1): Use it.
+ * tests/mpn/t-gcd_11.c: New file, test mpn_gcd_11.
+ * tests/mpn/Makefile.am (check_PROGRAMS): Add t-gcd_11.
+
+2019-08-07 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/alpha/ev67/gcd_11.asm: New file, mostly extracted from gcd_1.asm.
+ * mpn/arm/v5/gcd_11.asm: Likewise.
+ * mpn/arm/v6t2/gcd_11.asm: Likewise.
+ * mpn/arm64/gcd_11.asm: Likewise.
+ * mpn/powerpc64/mode64/gcd_11.asm: Likewise.
+ * mpn/powerpc64/mode64/p7/gcd_11.asm: Likewise.
+ * mpn/powerpc64/mode64/p9/gcd_11.asm: Likewise.
+ * mpn/sparc64/gcd_11.asm: Likewise.
+ * mpn/x86/k7/gcd_11.asm: Likewise.
+ * mpn/x86/p6/gcd_11.asm: Likewise.
+ * mpn/x86_64/bd2/gcd_11.asm: Likewise.
+ * mpn/x86_64/core2/gcd_11.asm: Likewise.
+ * mpn/x86_64/gcd_11.asm: Likewise.
+ * mpn/asm-defs.m4: Add gcd_11.
+
+2019-08-06 Niels Möller <nisse@lysator.liu.se>
+
+ * tune/common.c (speed_mpn_gcd_11): New function.
+ * tune/speed.h (speed_mpn_gcd_11): Declare it.
+ (SPEED_ROUTINE_MPN_GCD_11): New macro.
+ * tune/speed.c (routine): Add mpn_gcd_11.
+
+ * configure.ac (gmp_mpn_functions): Added gcd_11. Also add
+ HAVE_NATIVE_mpn_gcd_11.
+ * mpn/generic/gcd_11.c (mpn_gcd_11): New file and function,
+ extracted from mpn_gcd_1.
+ * gmp-h.in (mpn_gcd_11): Declare it.
+ * mpn/generic/gcd_1.c (mpn_gcd_1): Adapted to call mpn_gcd_11.
+
+2019-08-04 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bt2/gcd_1.asm: New grabber file.
+ * mpn/x86_64/zen/gcd_1.asm: Grab from "bd2" directory, was "core2".
+
+2019-08-02 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bd2/gcd_1.asm: New file.
+
+2019-08-01 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/mpf/t-conv.c: Add several more fixed test cases.
+
+ * mpf/set_str.c: Ignore leading zeros including ones after radix point
+ to avoid invalid output formats.
+
+2019-07-30 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/mode64/p9/gcd_1.asm: New file.
+
+2019-07-30 Niels Möller <nisse@lysator.liu.se>
+
+ From Seth Troisi:
+ * doc/gmp.texi (Jacobi Symbol): Update algorithm documentation.
+ * tests/mpz/t-jac.c: Comment update.
+
+2019-07-13 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (arm): Generalise arm a72 pattern to match a73...a79.
+
+2019-07-08 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm/arm-defs.m4 (ASM_START): Rewrite (fix broken error handling).
+
+2019-07-02 Torbjörn Granlund <tg@gmplib.org>
+
+ * acinclude.m4 (GMP_C_DOUBLE_FORMAT): Compile conftest.c to executable
+ in order to trigger final compile in case of LTO.
+
+2019-06-17 Torbjörn Granlund <tg@gmplib.org>
+
+ * config.guess: Work around upstream configfsf.guess's regression wrt
+ mips vs mips64.
+
+2019-06-14 Torbjörn Granlund <tg@gmplib.org>
+
+ * longlong.h (mips64): Provide r6 asm code as default expression yields
+ libcall.
+
+ * configure.ac (mips64): Use separate paths for r6 and non-r6 as these
+ architectures are mutually incompatible.
+
+ * mpn/mips64/{addmul_1,mul_1,sqr_diagonal,submul_1,umul}.asm:
+ Move into hilo subdir.
+
+2019-05-28 Torbjörn Granlund <tg@gmplib.org>
+
+ * config.sub: Fixes to which cpu types end with a "*".
+
+2019-04-20 Niels Möller <nisse@lysator.liu.se>
+
+ * doc/gmp.texi (References): Link to paper on subquadratic GCD.
+
+2019-04-19 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bd1/hamdist.asm: Really make 2017-06-01 change: Use
+ 3-operand DEF_OBJECT.
+
+ * mpn/x86_64/invert_limb.asm: Simplify mpn_invert_limb_table ref.
+
+ * mpn/x86_64/x86_64-defs.m4 (LEA): Use rip addressing for non-PIC.
+
+2019-04-17 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/jacobi.c (mpn_jacobi_n): Use JACOBI_DC_THRESHOLD,
+ not GCD_DC_THRESHOLD. Inconsistency spotted by Seth Troisi.
+
+2019-04-02 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init):
+ Split out silvermont handling, add handling of goldmont.
+
+ * configure.ac: Setup distinct paths for silvermont and goldmont.
+ (fat_path): Add missing x86_64/goldmont.
+
+ * config.guess: Recognise "Goldmont Plus".
+
+2018-12-09 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/mul_fft.c (mpn_fft_add_sub_modF): New function.
+ (mpn_fft_fft, mpn_fft_fftinv): Use it.
+
+2018-11-30 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/mode64/p9/gmp-mparam.h: New file.
+
+ * mpn/powerpc64/mode64/p9/add_n_sub_n.asm: New file.
+
+2018-11-28 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/mode64/p9/sqr_basecase.asm: New file.
+ * mpn/powerpc64/mode64/p9/mul_1.asm: New file.
+
+2018-11-18 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/mode64/p9/mul_basecase.asm: New file.
+
+ * mpn/powerpc64/mode64/p9/addmul_1.asm: Optimise.
+
+2018-11-12 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/mode64/p9/aorsmul_1.asm: New file, providing fast
+ submul_1 (and redundant addmul_1).
+
+2018-11-11 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/mode64/p9/addmul_1.asm: Tweak for slightly better
+ speed.
+
+ * mpn/powerpc32/powerpc-defs.m4: Define addex.
+ * mpn/powerpc64/mode64/p9/mul_2.asm: Use it.
+ * mpn/powerpc64/mode64/p9/addmul_2.asm: Likewise.
+
+2018-11-08 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/devel/cnd_aors_n.c: New file.
+
+ * mpn/arm/neon/lorrshift.asm: Declare use of neon insns.
+ * mpn/arm/neon/lshiftc.asm: Likewise + cleanup.
+
+ * tests/devel/Makefile.am (EXTRA_PROGRAMS): Add missing files.
+
+ * mpn/powerpc64/mode64/p9/mul_2.asm: New file.
+ * mpn/powerpc64/mode64/p9/addmul_2.asm: New file.
+
+2018-11-07 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/lucnum2_ui.c: Use mpn_rsblsh1_n if available.
+ * tests/mpz/t-nextprime.c: Add one more interval.
+ * tests/mpz/t-pprime_p.c (check_fermat_mersenne): New tests.
+ * mpn/generic/mod_1_3.c: typo in a comment.
+ * mpz/nextprime.c: Use tdiv instead of fdiv.
+
+ * mpn/generic/fib2m.c: New file, Fibonacci numbers modulo.
+ * configure.ac (gmp_mpn_functions): Add it.
+ * gmp-impl.h: Declare mpn_fib2m.
+ * tests/mpn/t-fib2m.c: New file, tests for mpn_fib2m.
+ * tests/mpn/Makefile.am (check_PROGRAMS): Add t-fib2m.
+
+ * mpn/generic/mod_34lsub1.c: Initialise c[012] once.
+ * tests/mpz/t-pprime_p.c (check_primes): Two more primes.
+ * tests/mp?: Use TESTS_REPS in many files.
+
+ * mpn/generic/strongfibo.c: New file, Fibonacci primality test.
+ * configure.ac (gmp_mpn_functions): Add it.
+ * gmp-impl.h: Declare mpn_strongfibo.
+
+ * mpz/stronglucas.c: New file, strong Lucas primality test.
+ * Makefile.am (MPZ_OBJECTS): Add it.
+ * mpz/Makefile.am (libmpz_la_SOURCES): Add it.
+ * gmp-impl.h: Declare mpz_stronglucas.
+
+ * mpz/millerrabin.c: Implement BPSW test for primality.
+
+2018-11-07 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (arm): Support a12 and a17.
+ * config.sub: Generalise arm matching.
+ * config.guess: Recognise additional arm CPUs.
+
+ * mpn/arm/arm-defs.m4 (ASM_START): Provide local definition.
+
+2018-10-30 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm/v7a/cora17/mod_34lsub1.asm: New file.
+ * mpn/arm/v7a/cora17/gmp-mparam.h: New file.
+ * mpn/arm/v7a/cora17/mul_1.asm: New grabber file.
+ * mpn/arm/v7a/cora17/addmul_1.asm: Likewise.
+ * mpn/arm/v7a/cora17/submul_1.asm: Likewise.
+
+2018-10-18 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpn/generic/fib2_ui.c: Simplify the possible -2 case.
+
+2018-07-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/millerrabin.c (mod_eq_m1): New function, equality with -1.
+ * mpz/powm_ui.c: Small optimisations.
+
+2018-07-03 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/lshift.asm: Remove cnt = 1 special code.
+
+ * mpn/x86_64/silvermont/popcount.asm: Add missing ABI_SUPPORT decls.
+ * mpn/x86_64/silvermont/hamdist.asm: Likewise.
+ * mpn/x86_64/zen/mul_1.asm: Likewise.
+
+ * mpn/x86_64/fastsse/lshift.asm: Support DOS64.
+ * mpn/x86_64/fastsse/lshiftc.asm: Likewise.
+
+ * mpn/x86_64/pentium4/gmp-mparam.h: Retune.
+
+2018-07-01 Torbjörn Granlund <tg@gmplib.org>
+
+ * lshift.asm: Replace with grabber file.
+ * lshiftc.asm: Replace with grabber file.
+ * x86_64/pentium4/addmul_2.asm: New grabber file.
+ * x86_64/pentium4/aorsmul_1.asm: New grabber file.
+ * x86_64/pentium4/mul_1.asm: New grabber file.
+ * x86_64/pentium4/mul_2.asm: New grabber file.
+ * x86_64/pentium4/mul_basecase.asm: New grabber file.
+ * x86_64/pentium4/mullo_basecase.asm: New grabber file.
+ * x86_64/pentium4/redc_1.asm: New grabber file.
+ * x86_64/pentium4/sqr_basecase.asm: New grabber file.
+
+2018-06-13 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/gcd_1.c (mpn_gcd_1): Delete unused code variant for
+ GCD_1_METHOD == 1, and delete GCD_1_METHOD macro. Simplify the
+ structure of the remaining code variant, without gotos to the
+ mid-loop strip_u_maybe label.
+
+2018-05-30 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (x86): Provide goldmont specific path.
+
+ * mpn/x86_64/goldmont/gmp-mparam.h: New file.
+
+2018-05-29 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (x86): Pass more exact arch/tune options for nehalem.
+
+2018-05-28 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/gcd_1.c (mpn_gcd_1) [USE_ZEROTAB]: Delete unused code
+ variant for USE_ZEROTAB != 0.
+
+2018-05-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * bootstrap.c: Define DONT_USE_FLOAT_H before including mini-gmp.
+
+2018-05-14 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpn/generic/dcpi1_bdiv_q.c (mpn_dcpi1_bdiv_q_n): Decl. static.
+ (mpn_dcpi1_bdiv_q_n_itch): Declare static.
+ * mpn/generic/dcpi1_divappr_q.c (mpn_dcpi1_divappr_q_n): static.
+ * mpn/generic/matrix22_mul.c (mpn_matrix22_mul_strassen): static.
+ * mpn/generic/mu_div_qr.c (mpn_mu_div_qr_choose_in): static.
+ * mpn/generic/mu_divappr_q.c (mpn_preinv_mu_divappr_q): static.
+ (mpn_mu_divappr_q_choose_in): static.
+ * gmp-impl.h: Remove declaration of previous functions.
+
+ * mpn/generic/get_d.c: Enhance generic code using DBL_MANT_DIG.
+
+ * printf/repl-vsnprintf.c: Better handling floating-point
+ specifiers "EeGgFf" (Thanks Vincent Lefevre).
+
+2018-05-04 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * doc/gmp.texi (mpq_*_str): Document the full base allowed range.
+ * mpq/get_str.c: Make all bases either work or return an error.
+
+ * doc/gmp.texi (Integer Internals): Lazy allocation and read-only.
+
+2018-04-27 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/div_q.c (mpn_div_q): Replace dead code with ASSERT.
+ Spotted by Paul Zimmermann and Raphaël Rieu-Hleft.
+
+ * tests/mpn/t-div.c (main): Fill quotient area with junk before
+ calling mpn_div_q.
+
+2018-04-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * Makefile.am (EXTRA_DIST): Add mini-gmp/mini-mpq.[ch].
+
+2018-04-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpn/generic/toom2_sqr.c: Handle the cy=-1 branch slightly faster.
+ * mpn/generic/toom22_mul.c: Likewise. (Thanks Paul and Raphaël!)
+
+2018-04-22 Niels Möller <nisse@lysator.liu.se>
+
+ From Martin Storsjö:
+ * configure.ac (aarch64): Just as on windows/x86_64, "long" still
+ is 32 bit on aarch64. To distinguish between 32-bit and 64-bit
+ ABI, test sizeof(void*) instead of sizeof(long). Use long long for
+ mp_limb_t for mingw targets.
+ * acinclude.m4 (GMP_C_TEST_SIZEOF): Allow '*' in the type name,
+ e.g., void*.
+
+2018-04-18 Marc Glisse <marc.glisse@inria.fr>
+
+ * mpq/clear.c: Handle lazy numerator.
+ * mpq/clears.c: Likewise.
+ * mpq/init.c: Likewise.
+ * mpq/set_si.c: Likewise.
+ * mpq/set_ui.c: Likewise.
+
+ * tests/cxx/t-ops2z.cc: Add parentheses to quiet a warning.
+
+2018-03-28 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (mips): Recognise "mipsisa64*".
+
+2018-03-23 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/sec_powm.c: Remove unused macros.
+ Simplify code for choosing between redc_1 and redc_2.
+ Compute power table with squaring for even powers.
+
+2018-02-28 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * gmpxx.h (__gmp_binary_plus): Special case for mpq + 1.
+ (__gmp_binary_minus): Special case for mpq - 1.
+ (__gmp_binary_equal): Optimised comparison mpq == integer.
+ * tests/cxx/t-ops2qf.cc (checkqf): Some check for +/- 1, +/- 0.
+
+2018-02-18 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tune/Makefile.am: Disallow parallel make (thanks Vincent Lefevre).
+ * mpq/swap.c: Use *_SWAP_* macros.
+ * mpq/cmp_ui.c: One more little shortcut, comparing fractions to 1.
+ * mpq/get_d.c: Compare (zeros > 0) once, replace tdiv_qr with div_q.
+ * mpq/equal.c: Check size early.
+
+ * printf/obprintf.c: Adda dummy typedef to avoid empty unit.
+ * printf/obvprintf.c: Likewise.
+ * printf/obprntffuns.c: Likewise.
+ * printf/repl-vsnprintf.c: Move #ifdef after #include gmp-impl.h .
+
+2018-02-09 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm: Really revert 2018-01-04 changes.
+
+2018-02-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * printf/snprntffuns.c: Report -1 as an error.
+ * acinclude.m4 (GMP_FUNC_VSNPRINTF): Refuse -1 as return value.
+
+ * mpz/bin_uiui.c (mpz_smallk_bin_uiui): One more shortcut for small k.
+ * gmp-impl.h (popc_limb): Use fewer constants (GMP_LIMB_BITS == 16).
+ * mpz/divegcd.c (mpz_divexact_limb): Use MPN_DIVREM_OR_DIVEXACT_1.
+ * primesieve.c (fill_bitpattern): Use MPN_FILL.
+
+2018-02-01 Marc Glisse <marc.glisse@inria.fr>
+
+ * longlong.h (i586): Remove assert.
+
+2018-01-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/and.c: Rearrange the 3 cases, both <0, both >=0, one and one.
+ * mpz/ior.c: Likewise.
+ * mpz/xor.c: Likewise.
+
+ * mpz/bin_uiui.c (mul[4-8]): Reduce the number of multiplications.
+
+ * printf/doprnt.c: Use __GMP_FREE_FUNC_TYPE.
+ * printf/doprntf.c: Likewise.
+ * printf/snprntffuns.c: Likewise, and use size_t instead of int.
+
+2018-01-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/mpz/t-bin.c: Extended tests for bin_ui and uint border cases.
+
+2018-01-10 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86/fat/fat.c (__gmpn_cpuvec_init): Fix old pentium recog.
+ * config.guess: Likewise.
+
+ * mpn/x86/fat/fat.c (__gmpn_cpuvec_init): Add many 64-bit CPUs.
+
+2018-01-07 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm: Revert last change, it hides a symbol needed for testing.
+
+2018-01-04 Torbjörn Granlund <tg@gmplib.org>
+
+ * bdiv_q_1.asm (binvert_limb_table): Declare as ".hidden".
+ * v7a/cora8/bdiv_q_1.asm: Likewise.
+ * dive_1.asm: Likewise.
+ * v6/dive_1.asm: Likewise.
+
+ * mode1o.asm (binvert_limb_table): Remove ".protected", add ".hidden".
+ * v6/mode1o.asm: Likewise.
+
+2018-01-02 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/mode64/divrem_2.asm: Use different rlwinm variant (to
+ appease clang).
+
+2018-01-01 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc32/powerpc-defs.m4: Define maddld, maddhdu, popcntd, and
+ divdeu.
+ * mpn/powerpc64/mode64/p8/invert_limb.asm: Use new insn defs.
+ * mpn/powerpc64/mode64/p9/addmul_1.asm: Use new insn defs.
+ * mpn/powerpc64/p7/hamdist.asm: Use new insn defs.
+ * mpn/powerpc64/p7/popcount.asm: Use new insn defs.
+
+2017-12-31 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/mode64/p9/addmul_1.asm: Moved from
+ mpn/powerpc64/p9/addmul_1.asm.
+
+2017-12-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/bin_ui.c: Rewrite, using Fredrik Johansson's suggestions.
+
+2017-12-27 Niels Möller <nisse@lysator.liu.se>
+
+ * longlong.h (arm32/arm64): Leave COUNT_LEADING_ZEROS_0 undefined,
+ since we use gcc's __builtin_clzl, which doesn't allow zero inputs.
+
+2017-12-27 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/mode64/bdiv_q_1.asm: Use 64-bit cmp for sizes.
+
+ * mpn/powerpc64/p9/addmul_1.asm: New file.
+
+ * configure.ac: Separate handling of POWER8 and POWER9.
+
+ * config.guess: Recognise POWER9 and more variants of POWER8.
+ Reorder recog code to favour PVR over proc/cpuinfo.
+
+2017-12-14 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/fastsse/com.asm: Adhere to DOS64 xmm callee-saves rules.
+ * mpn/x86_64/fastsse/com-palignr.asm: Likewise.
+ * mpn/x86_64/fastsse/copyd.asm: Likewise.
+ * mpn/x86_64/fastsse/copyi.asm: Likewise.
+ * mpn/x86_64/fastsse/lshiftc.asm: Likewise.
+ * mpn/x86_64/fastsse/sec_tabselect.asm: Likewise.
+
+2017-12-11 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bd1/aorrlsh_n.asm: New grabber file.
+
+2017-12-10 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bd1/aors_n.asm: New grabber file.
+
+ * mpn/x86_64/bd4/aorrlsh_n.asm: New grabber file.
+
+2017-08-31 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/sparc32/sparc-defs.m4 (LEA64): Rewrite for both PIC and non-PIC.
+
+ * mpn/sparc64/ultrasparct3/cnd_aors_n.asm: Allow arbitrary cnd arg.
+
+2017-08-29 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/silvermont/gmp-mparam.h: Disable mul_2 and addmul_2.
+
+2017-08-28 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/sparc64: Revert 2017-07-23 PIC changes.
+
+ * mpn/powerpc32/divrem_2.asm: Avoid bc+ insn form to accommodate clang.
+
+ * mpn/generic/sbpi1_bdiv_qr.c: Correct ASSERT.
+ * mpn/generic/sbpi1_bdiv_q.c: Likewise.
+ * mpn/generic/sbpi1_bdiv_r.c: Likewise.
+
+2017-08-18 Torbjörn Granlund <tg@gmplib.org>
+
+ * acinclude.m4 (X86_64_PATTERN): Match zen*.
+
+ * configure.ac (x86): Support AVX challenged systems for Zen.
+
+2017-07-24 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/sbpi1_bdiv_q.c: Add ASSERT for inverse correctness.
+ * mpn/generic/sbpi1_bdiv_qr.c: Likewise.
+
+ * tests/mpn/t-bdiv.c (main): Amend last change.
+
+ * tests/devel/try.c (choice_array): Amend 2013-05-03 change to include
+ more functions.
+
+2017-07-23 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/sparc64/gcd_1.asm: Enforce PIC as GNU/Linux toolchain workaround.
+ * mpn/sparc64/ultrasparct3/bdiv_q_1.asm: Likewise.
+ * mpn/sparc64/ultrasparct3/dive_1.asm: Likewise.
+ * mpn/sparc64/ultrasparct3/invert_limb.asm: Likewise.
+ * mpn/sparc64/ultrasparct3/mode1o.asm: Likewise.
+
+ * gmp-impl.h: Reorganise foolshC_ip1 -> foolshC -> foolsh chain to make
+ it transitive.
+
+2017-07-23 Niels Möller <nisse@lysator.liu.se>
+
+ * longlong.h: Purge definitions of obsolete UMUL_TIME and
+ UDIV_TIME constants. Also mentioned (but unused) in
+ mpn/cray/gmp-mparam.h and tune/common.c.
+
+2017-07-21 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/mpn/t-bdiv.c (main): Test mpn_sbpi1_bdiv_r.
+
+ * tune/common.c (speed_mpn_sbpi1_bdiv_r): New function.
+ * tune/speed.h: Declare it.
+ (SPEED_ROUTINE_MPN_PI1_BDIV_R): New macro.
+ * tune/speed.c (routine): Add mpn_sbpi1_bdiv_r.
+
+2017-07-20 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (gmp_mpn_functions): Add sbpi1_bdiv_r.
+
+ * gmp-impl.h (mpn_sbpi1_bdiv_r): Declare.
+
+ * mpn/asm-defs.m4 (define_mpn): Add sbpi1_bdiv_q, sbpi1_bdiv_qr,
+ sbpi1_bdiv_r.
+
+ * mpn/generic/sbpi1_bdiv_r.c: New file.
+ * mpn/x86_64/zen/sbpi1_bdiv_r.asm: New file.
+
+2017-07-19 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86/p6/sse2/submul_1.asm: Get pentium4 code instead of k6 code
+ for better speed on modern Intel P6 cores.
+
+2017-07-02 Torbjörn Granlund <tg@gmplib.org>
+
+ * tune/tuneup.c (tune_mullo): For MULLO_BASECASE_THRESHOLD start at 2.
+ (tune_sqrlo): Likewise.
+
+2017-06-28 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/Makefile.am tests/*/Makefile.am tune/Makefile.am (AM_LDFLAGS):
+ Define. (Thanks to Emmanuel Thomé and Vincent Lefevre.)
+
+2017-06-27 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/zen/sqr_basecase.asm: Expand to use 4 addmul_1 loops.
+
+ * mpn/x86_64/x86_64-defs.m4 (sarx): New macro.
+
+2017-06-26 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/coreibwl/sqr_basecase.asm: Rewrite to do 2x and limb
+ squaring in main loop.
+
+2017-06-20 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/atom/cnd_add_n.asm: New grabber file.
+ * mpn/x86_64/atom/cnd_sub_n.asm: Likewise.
+
+ * mpn/x86_64/coreihwl/aorrlsh_n.asm: New grabber file.
+
+2017-06-16 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/zen/mul_basecase.asm: Do overlapped software pipelining.
+
+ * mpn/x86_64/silvermont/mul_basecase.asm: New grabber file.
+ * mpn/x86_64/silvermont/sqr_basecase.asm: Likewise.
+ * mpn/x86_64/silvermont/mullo_basecase.asm: Likewise.
+
+2017-06-14 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/zen/mullo_basecase.asm: New file.
+ * mpn/x86_64/coreibwl/mullo_basecase.asm: New file.
+
+2017-06-11 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/popham.asm: Crossjump for code size and mix lead-in insns
+ for lower overhead.
+
+2017-06-09 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac: Set GMP_NONSTD_ABI protecting against dots in the abi.
+ (hppa): Remove old GNU/Linux restriction to 32-bit ABI.
+
+2017-06-07 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bd1/addmul_2.asm: New file.
+
+2017-06-06 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/coreihwl/aors_n.asm: New file.
+
+ * mpn/x86_64/x86_64-defs.m4 (c4_helper): New macro.
+ (mulx, shlx, shrx): Use c4_helper.
+
+ * mpn/x86_64/zen/mul_basecase.asm: Use 8-bit imm operands for "test".
+
+ * mpn/x86_64/zen/aorrlsh1_n.asm: New grabber file.
+ * mpn/x86_64/zen/sublsh1_n.asm: Likewise.
+ * mpn/x86_64/zen/aorrlsh_n.asm: New file
+
+2017-06-04 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac: Use bt1/bt2 for bobcat and jaguar dirs.
+ (fat_path): Add x86_64/bt2.
+
+ * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init): Adapt to bt1/bt2 changes.
+ Make zen path correspond to non-fat path.
+ * mpn/x86/fat/fat.c (__gmpn_cpuvec_init): Adapt to bt1/bt2 changes.
+
+ * mpn/x86_64/bt2/copyi.asm: New grabber file.
+ * mpn/x86_64/bt2/copyd.asm: New grabber file.
+ * mpn/x86_64/bt2/com.asm: New grabber file.
+
+2017-06-03 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bd1/popcount.asm: Expand some instructions as .byte
+ sequences.
+ * mpn/x86_64/bd1/hamdist.asm: Likewise.
+
+2017-06-02 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/x86_64-defs.m4 (DEF_OBJECT): Fix quoting (amends recent
+ change).
+ (JUMPTABSECT): Get rid of spurious "w".
+
+2017-06-02 Marc Glisse <marc.glisse@inria.fr>
+
+ * gmpxx.h (mpf_class::operator bool): Use mpf_sgn to access _mp_size.
+
+2017-06-02 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/bd1/popcount.asm: Use both SSE and XOP trickery, and
+ plain popcnt insn.
+ * mpn/x86_64/bd1/hamdist.asm: Likewise.
+
+2017-06-01 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/x86_64-defs.m4 (DEF_OBJECT): Allow 3rd argument defining
+ section, while making alignment argument non-optional.
+
+ * mpn/x86_64/core2/popcount.asm: Use 3-operand DEF_OBJECT.
+ * mpn/x86_64/core2/hamdist.asm: Likewise.
+ * mpn/x86_64/bd1/popcount.asm: Likewise.
+ * mpn/x86_64/bd1/hamdist.asm: Likewise.
+
+ * configure.ac (GMP_AVX_NOT_REALLY_AVAILABLE): New m4 define.
+ * mpn/x86_64/bd1/popcount.asm: Use GMP_AVX_NOT_REALLY_AVAILABLE.
+ * mpn/x86_64/bd1/hamdist.asm: Likewise.
+
+ * mpn/x86_64/silvermont/popcount.asm: Reinstate, grabbing nehalem code.
+ * mpn/x86_64/silvermont/hamdist.asm: Replace with grabber.
+
+2017-05-31 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/silvermont/popcount.asm: Remove.
+
+ * mpn/x86_64/core2/logops_n.asm: New file.
+
+2017-05-30 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/coreisbr/popcount.asm: Remove.
+
+2017-05-29 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/coreinhm/popcount.asm: Replace grabber code with
+ implementation proper.
+ * mpn/x86_64/coreinhm/hamdist.asm: Likewise.
+ * mpn/x86_64/bd1/popcount.asm: Likewise.
+ * mpn/x86_64/bd1/hamdist.asm: Likewise.
+ * mpn/x86_64/core2/popcount.asm: Likewise.
+ * mpn/x86_64/core2/hamdist.asm: New file.
+
+2017-05-22 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/core2/com.asm: New grabber file.
+
+ * mpn/x86_64/core2/lshift.asm: Rewrite.
+ * mpn/x86_64/core2/rshift.asm: Rewrite.
+ * mpn/x86_64/core2/lshiftc.asm: Rewrite.
+
+2017-05-16 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/zen/mul_1.asm: Port to DOS64.
+ * mpn/x86_64/zen/aorsmul_1.asm: Likewise.
+ * mpn/x86_64/coreibwl/addmul_1.asm: Likewise.
+
+2017-05-16 Niels Möller <nisse@lysator.liu.se>
+
+ * mpn/generic/divis.c (mpn_divisible_p): Updated the divisibility
+ test; bdiv now returns R = D rather than R = 0 when D divides a
+ non-zero U.
+
+ * mpn/generic/binvert.c (mpn_binvert): Negate bdiv quotient.
+ * mpn/generic/divexact.c (mpn_divexact): Likewise.
+ * mpn/generic/remove.c (mpn_remove): Likewise.
+ * mpz/bin_uiui.c (mpz_bdiv_bin_uiui): Likewise.
+
+ * tests/mpn/t-bdiv.c (check_one): Updated to new convention,
+ B^{qn} R = U + QD.
+
+ * mpn/generic/sbpi1_bdiv_qr.c (mpn_sbpi1_bdiv_qr): Reimplemented,
+ for new bdiv convention.
+ * mpn/generic/sbpi1_bdiv_q.c (mpn_sbpi1_bdiv_q): Likewise.
+ * mpn/generic/dcpi1_bdiv_q.c (mpn_dcpi1_bdiv_q_n)
+ (mpn_dcpi1_bdiv_q): Adapted to new bdiv convention.
+ * mpn/generic/dcpi1_bdiv_qr.c (mpn_dcpi1_bdiv_qr_n)
+ (mpn_dcpi1_bdiv_qr): Likewise.
+ * mpn/generic/mu_bdiv_qr.c (mpn_mu_bdiv_qr): Adapted to new bdiv
+ convention, using a wrapper calling the old function.
+ * mpn/generic/mu_bdiv_q.c (mpn_mu_bdiv_q): Likewise.
+
+2017-05-03 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/coreisbr/cnd_aors_n.asm: New file.
+ * mpn/x86_64/coreisbr/cnd_add_n.asm: New file.
+
+ * mpn/x86_64/core2/aorsmul_1.asm: Tune.
+
+ * mpn/x86_64/silvermont/mul_1.asm: New file, grabbing another asm file.
+ * mpn/x86_64/silvermont/aorsmul_1.asm: Likewise.
+ * mpn/x86_64/silvermont/aorrlsh1_n.asm: Likewise.
+ * mpn/x86_64/silvermont/aorrlsh2_n.asm: Likewise.
+ * mpn/x86_64/silvermont/lshift.asm: Likewise.
+ * mpn/x86_64/silvermont/rshift.asm: Likewise.
+ * mpn/x86_64/silvermont/lshiftc.asm: Likewise.
+
+ * mpn/x86_64/zen/mul_basecase.asm: Split outer loop into 4 loops.
+
+2017-05-02 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/zen/sqr_basecase.asm: Use .byte for encoding all mulx.
+ Misc tuning.
+
+2017-04-27 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/zen/sqr_basecase.asm: Rewrite to do 2x and limb squaring
+ in main loop.
+
+2017-04-25 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/fat/fat_entry.asm: Allocate correct DOS64 frame.
+ * mpn/x86_64/divrem_2.asm: Likewise.
+ * mpn/x86_64/mod_1_2.asm: Likewise.
+ * mpn/x86_64/mod_1_4.asm: Likewise.
+ * mpn/x86_64/mod_1_1.asm: Likewise.
+
+2017-04-23 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/coreisbr/mul_1.asm: Rewrite feed-in code and add mul_1c
+ entry point.
+
+2017-04-17 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init): Amend last change.
+
+ * mpn/x86_64/zen/mul_basecase.asm: New file.
+ * mpn/x86_64/zen/sqr_basecase.asm: New file.
+
+2017-04-16 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/sqr_basecase.c (addmul_1 variant): Rewrite to compute
+ in-place and to avoid a re-computation.
+
+ * configure.ac: Remove k8, k10 from zen path.
+
+2017-04-15 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/zen/gmp-mparam.h: New file.
+
+ * mpn/x86_64/zen/com.asm: New file, grabbing another asm file.
+ * mpn/x86_64/zen/copyd.asm: Likewise.
+ * mpn/x86_64/zen/copyi.asm: Likewise.
+ * mpn/x86_64/zen/gcd_1.asm: Likewise.
+ * mpn/x86_64/zen/hamdist.asm: Likewise.
+ * mpn/x86_64/zen/lshift.asm: Likewise.
+ * mpn/x86_64/zen/lshiftc.asm: Likewise.
+ * mpn/x86_64/zen/popcount.asm: Likewise.
+ * mpn/x86_64/zen/rshift.asm: Likewise.
+
+ * config.guess: Recognise AMD zen.
+ * acinclude.m4 (X86_64_PATTERN): Add zen.
+ * config.sub: Corresponding changes.
+ * configure.ac: Corresponding changes.
+ * mpn/x86_64/fat/fat.c: Corresponding changes.
+
+2017-03-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/oddfac_1.c (limb_apprsqrt): Better approximation.
+ * mpz/bin_uiui.c (limb_apprsqrt): Likewise.
+
+2017-03-12 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/mpf/t-get_d_2exp.c (check_data): Rewrite of check_onebit.
+
+2017-03-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpn/generic/sqrtrem.c: Direct use of sqrtrem2 when n==2.
+ * mpn/generic/div_qr_2.c (udiv_qr_4by2): Replace add_csaac with add_sssaaaa.
+
+2017-03-07 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpf/get_d_2exp.c: Return negative value for negative input.
+
+2017-03-06 Torbjörn Granlund <tg@gmplib.org>
+
+ * longlong.h (aarch64): Provide asm-free umul_ppmm.
+ * longlong.h (powerpc64): Enable asm-free umul_ppmm.
+
+2017-03-04 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm64/sqr_diag_addlsh1.asm: Complete rewrite.
+
+2017-02-27 Torbjörn Granlund <tg@gmplib.org>
+
+ * longlong.h (arm32/arm64): Remove useless comparison to 0 introduced
+ in last change (spotted by Marco).
+
+2017-02-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpn/generic/pow_1.c: Use umul_ppmm for a single limb.
+
+2017-02-25 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac: Allow MP_SIZE_T_MAX for thresholds exported to
+ config.m4.
+
+ * mpn/x86_64/gcd_1.asm: Handle BMOD_1_TO_MOD_1_THRESHOLD=MP_SIZE_T_MAX.
+ Streamline non-reduction path.
+ * mpn/x86_64/core2/gcd_1.asm: Streamline small operands cases similarly
+ to top-level code.
+
+2017-02-24 Torbjörn Granlund <tg@gmplib.org>
+
+ * longlong.h (arm32/arm64 add_ssaaaa): Use "subs" for some immediates.
+ * longlong.h (arm32/arm64 sub_ddmmss): Use "adds" for some immediates.
+
+ * mpn/arm64/copyi.asm: Avoid branching on flags.
+ * mpn/arm64/copyd.asm: Likewise.
+
+ * mpn/generic/div_qr_2.c (aarch64 add_sssaaaa): New.
+ * mpn/generic/div_qr_1n_pi2.c: Same.
+ * mpn/generic/div_qr_1u_pi2.c: Same.
+
+ * mpn/generic/div_qr_2.c (powerpc add_sssaaaa): Fix typo.
+ * mpn/generic/div_qr_1n_pi2.c: Same.
+ * mpn/generic/div_qr_1u_pi2.c: Same.
+
+2017-02-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tests/devel/sqrtrem_1_2.c: New exhaustive test for sqrtrem_[12].
+ * tests/devel/Makefile.am (EXTRA_PROGRAMS): add it.
+
+2017-02-23 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/silvermont/gmp-mparam.h: New file.
+
+2017-02-22 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm64/aorsmul_1.asm: Rewrite.
+
+ * mpn/arm64/lshiftc.asm: New file.
+
+2017-02-21 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm64/lshift.asm: Rewrite.
+ * mpn/arm64/rshift.asm: Rewrite.
+
+ * mpn/arm64/rsh1aors_n.asm: New file.
+
+2017-02-19 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm64/mul_1.asm: Rewrite.
+ * mpn/arm64/xgene1/mul_1.asm: Remove.
+
+2017-02-17 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm64/cora53/cnd_aors_n.asm: Moved from "..".
+
+ * mpn/arm64/xgene1/cnd_aors_n.asm: Remove file since default code
+ performs better.
+
+ * mpn/arm64/cnd_aors_n.asm: Rewrite.
+
+ * mpn/arm64/logops_n.asm: Rewrite based on new aors_n.asm.
+
+2017-02-16 Pedro Gimeno <pggimeno@wanadoo.es>
+
+ * rand/randmt.c (__gmp_randiset_mt): Set generator functions from
+ source.
+
+2017-02-16 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm64/aorsorrlshC_n.asm: New file.
+ * mpn/arm64/aorsorrlsh2_n.asm: New file.
+ * mpn/arm64/aorsorrlsh1_n.asm: New file.
+
+ * mpn/arm64/xgene1/aors_n.asm: Remove file since default code now
+ performs similarly.
+
+ * mpn/arm64/aors_n.asm: Rewrite to use 4x unrolling.
+
+2017-02-15 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/silvermont/hamdist.asm: New file, based on k10 code.
+
+ * mpn/x86_64/silvermont/popcount.asm: Grab coreisbr/popcount.asm.
+
+2017-02-14 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/x86_64/silvermont/aors_n.asm: New file, grabbing coreisbr code.
+
+ * mpn/x86_64/atom/aors_n.asm: Replace coreisbr grabbing code with
+ code based on Marco's x64/atom/aors_n.asm.
+
+2017-02-12 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/powerpc64/aix.m4 (AIX): New define.
+
+ * mpn/powerpc64/mode64/bdiv_q_1.asm: For AIX, don't jump from
+ mpn_bdiv_q_1 to middle of mpn_pi1_bdiv_q_1. Streamline.
+
+ * mpn/powerpc64/darwin.m4 (LEA): Put code in lea_list instead of in
+ EPILOGUE_cpu.
+ (EPILOGUE_cpu): Output lea_list, the zap it.
+
+ * mpn/sparc64/ultrasparct3/bdiv_q_1.asm: New file, based on dive_1.asm.
+
+2017-02-11 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm/v7a/cora8/bdiv_q_1.asm: New file, based on v6/dive_1.asm.
+ * mpn/arm/v7a/cora9/bdiv_q_1.asm: New file, grabbing cora8 code.
+ * mpn/arm/v7a/cora15/bdiv_q_1.asm: Likewise.
+
+ * mpn/arm64/aors_n.asm: (SETCY, RETVAL): Shorten insn sequences.
+ * mpn/arm64/cnd_aors_n.asm: Likewise.
+ * mpn/arm64/xgene1/aors_n.asm: Likewise.
+ * mpn/arm64/xgene1/cnd_aors_n.asm: Likewise.
+
+ * mpn/arm/bdiv_q_1.asm: New file, based on dive_1.asm.
+
+ * mpn/generic/bdiv_q_1.c (mpn_bdiv_q_1): Remove odd d special case.
+
+ * mpn/powerpc64/mode64/bdiv_q_1.asm: New file.
+
+ * mpn/arm64/bdiv_q_1.asm: New file.
+
+2017-02-10 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/arm/arm-defs.m4 (EPILOGUE_cpu): Zap lea_list to avoid repetition.
+
+ * mpn/x86_64/bdiv_q_1.asm: Rewrite, base on atom/dive_1.asm.
+
+2017-02-08 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/compute_powtab.c: Choose mpn_pi1_bdiv_q_1 vs
+ mpn_divexact_1 more wisely (spotted by Marco).
+
+2017-02-07 Torbjörn Granlund <tg@gmplib.org>
+
+ * tune/tuneup.c (relspeed_div_1_vs_mul_1): Prefer mpn_pi1_bdiv_q_1.
+
+ * mpn/generic/compute_powtab.c: Use mpn_pi1_bdiv_q_1/mpn_bdiv_q_1
+ instead of mpn_divexact_1.
+
+ * gen-bases.c (binvert): New function, computing modular inverse and
+ low zero count.
+ (header): Print MP_BASES_BIG_BASE_CTZ_10 and
+ MP_BASES_BIG_BASE_BINVERTED_10.
+
+2017-02-06 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/bdiv_q_1.c: Make return value consistent.
+
+ * mpn/x86/p6/mmx/gmp-mparam.h (SQR_TOOM2_THRESHOLD): Revert to bogus
+ value to accommodate p6/sqr_basecase.asm fragility.
+
+2017-01-29 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/and.c: Simplify branches.
+ * mpz/ior.c: Likewise.
+ * mpz/xor.c: Likewise.
+
+ * gen-bases.c: In generated file, include just gmp-impl.h, not gmp.h
+
+2017-01-29 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac: Don't check if we got a C99 compiler for now (partially
+ revert 2017-01-24 change as C++ compilers become rejected).
+
+2017-01-24 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/generic/compute_powtab.c: New file, providing mpn_compute_powtab
+ for both get_str and set_str.
+
+ * gmp-impl.h (mpn_str_powtab_alloc): New macro.
+ (mpn_dc_set_str_powtab_alloc, mpn_dc_get_str_powtab_alloc): Remove.
+ (mpn_compute_powtab): Declare.
+
+ * mpn/generic/set_str.c: Use mpn_compute_powtab.
+ (mpn_set_str_compute_powtab): Remove.
+
+ * mpn/generic/get_str.c: Use mpn_compute_powtab.
+ (mpn_get_str_compute_powtab): Remove.
+ (mpn_bc_get_str): New name for mpn_sb_get_str.
+
+ * configure.ac (gmp_mpn_functions): Add compute_powtab.
+
+ * tune/tuneup.c (speed_mpn_pre_set_str): Call mpn_compute_powtab.
+ * tune/set_strb.c: Remove mpn_set_str_compute_powtab name mangling.
+ * tune/set_strs.c: Likewise.
+
+ * configure.ac: Invoke AC_PROG_CC_C99 instead of AC_PROG_CC_STDC.
+
+2017-01-03 Torbjörn Granlund <tg@gmplib.org>
+
+ * configure.ac (arm*-*-*): Properly point to cortex-a5 subdir.
+
+2016-12-31 Torbjörn Granlund <tg@gmplib.org>
+
+ * tune/tuneup.c (relspeed_div_1_vs_mul_1): New function.
+
+2016-12-28 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * tune/common.c (speed_mpz_mfac_uiui, speed_mpz_invert): New
+ functions.
+ * tune/speed.h: Declare them.
+ * tune/speed.c (routine): Add mpz_mfac_uiui, mpz_invert.
+
+ * tests/mpz/t-primorial_ui.c: Add randomization to the test.
+ * mpz/tdiv_r.c: Reduce allocation in some corner-case conditions.
+ * mpz/tdiv_r_2exp.c: Rearrange counting non-zero limbs.
+ * mpz/tdiv_q.c: Move common code out of some branches.
+ * mpz/and.c: Alloc only when needed.
+ * mpz/xor.c: Reorder branches.
+ * mpz/gcd.c: Reorder branches.
+ * mpz/pprime_p.c: Save the initial branch of a loop.
+ * mpn/generic/divrem.c: Save an allocation.
+
+2016-12-26 Torbjörn Granlund <tg@gmplib.org>
+
+ * longlong.h (x86_64 umul_ppmm): Add mulx variant (not automatically
+ used).
+
+2016-12-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/gcdext.c: Save an allocation if both cofactors are needed.
+ * mpz/oddfac_1.c: Revision of all ASSERTs.
+ * tests/mpz/t-invert.c: All elements are invertible in the zero ring.
+
+2016-12-13 Torbjörn Granlund <tg@gmplib.org>
+
+ * longlong.h: Test LONGLONG_STANDALONE in two more places.
+
+2016-12-07 Torbjörn Granlund <tg@gmplib.org>
+
+ * gmp-h.in: Check yet another symbol for FILE.
+
+2016-12-04 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/mpz/reuse.c: Use mpz_clobber. Split mpz_gcdext macros to avoid
+ spurious res3 dependency.
+
+ * tests/misc.c (mpz_clobber): New function.
+
+2016-12-03 Niels Möller <nisse@lysator.liu.se>
+
+ * doc/gmp.texi (Number Theoretic Functions): Tweak mpz_gcdext
+ documentation. The first and third argument may be NULL, but not
+ the second.
+
+2016-12-02 Niels Möller <nisse@lysator.liu.se>
+
+ * tests/mpz/reuse.c (main): Test additional cases of reuse for
+ mpz_gcd and mpz_gcdext.
+
+2016-12-01 Torbjörn Granlund <tg@gmplib.org>
+
+ * tests/misc.c (seed_from_tod): Make shift well-defined.
2016-11-29 Torbjörn Granlund <tg@gmplib.org>
@@ -56,15 +1519,28 @@
* mpz/kronsz.c: Use ABS_CAST to avoid undefined code.
+2016-11-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/gcd.c, mpz/gcdext.c: Use NEWALLOC.
+ * mpz/oddfac_1.c: Disable an ASSERT that needs a revision.
+
2016-11-27 Torbjörn Granlund <tg@gmplib.org>
+ * tests/mpz/reuse.c: Rewrite operand randomisation to use fixed ranges.
+
* tune/time.c (cgt_works_p): Add a missing verbosity check.
* configure.ac: Make udiv_w_sdiv use conditional on enable_assembly.
2016-11-25 Marc Glisse <marc.glisse@inria.fr>
- * tests/cxx/t-ops2.cc (checkz): Avoid left shift of negative number.
+ * mpz/gcdext.c (mpz_gcdext): Allow a first argument of NULL.
+ * doc/gmp.texi (Number Theoretic Functions): Document it.
+ * tests/mpz/t-gcd.c (main): Test it.
+
+2016-11-25 Marc Glisse <marc.glisse@inria.fr>
+
+ * tests/cxx/t-ops2z.cc (checkz): Avoid left shift of negative number.
2016-11-22 Torbjörn Granlund <tg@gmplib.org>
@@ -73,10 +1549,31 @@
2016-11-21 Torbjörn Granlund <tg@gmplib.org>
+ * configure.ac (powerpc): Never use -O3.
+
* acinclude.m4 (mpn_lshift_com optimization 2): Make it well-defined
also for 32-bit systems.
(mpn_lshift_com optimization 2): Free allocated memory.
+2016-11-19 Niels Möller <nisse@lysator.liu.se>
+
+ * Makefile.am (check-mini-gmp): Override CFLAGS and CPPFLAGS
+ instead of the deleted EXTRA_CFLAGS. Set TEST_LIBRARY_PATH,
+ instead of LD_LIBRARY_PATH and DYLD_LIBRARY_PATH, to avoid getting
+ gcc linked with an unexpected version of gmp.
+
+2016-11-18 Niels Möller <nisse@lysator.liu.se>
+
+ * Makefile.am (check-mini-gmp): Get CC and EXTRA_CFLAGS right.
+
+2016-11-17 Torbjörn Granlund <tg@gmplib.org>
+
+ * asl.h: Initial support for artificially small limbs.
+
+2016-11-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * pz/iset_str.c: Lazy allocation.
+
2016-11-01 Torbjörn Granlund <tg@gmplib.org>
* mpn/generic/dive_1.c: Remove a forgotten dummy while-loop. (Spotted
@@ -86,6 +1583,15 @@
* gmp-impl.h (x86_64 MPN_IORD_U): Use proper asm constraint.
+2016-10-30 Torbjörn Granlund <tg@gmplib.org>
+
+ * mpn/Makefile.am (TARG_DIST): Add riscv.
+
+2016-10-28 Marc Glisse <marc.glisse@inria.fr>
+
+ * gmpxx.h (__gmp_binary_divides): Let 1/q call mpq_inv.
+ * tests/cxx/t-ops.cc (check_mpq): Test it.
+
2016-10-24 Torbjörn Granlund <tg@gmplib.org>
* config.guess: Recognise Itanium Poulson.
@@ -96,9 +1602,30 @@
2016-10-14 Torbjörn Granlund <tg@gmplib.org>
- * configure.ac
+ * longlong.h (riscv umul_ppmm): New.
+
+ * mpn/riscv/64/aors_n.asm: New file.
+ * mpn/riscv/64/mul_1.asm: New file.
+ * mpn/riscv/64/aorsmul_1.asm: New file.
+
+ * mpn/generic/addmul_1.c: Rewrite for shallower recurrency.
+ * mpn/generic/submul_1.c: Likewise.
+
+ * configure.ac (riscv-*-*): New.
(arm*-*-*): Rewrite arm support to handle armv8 CPUs in 32-bit mode.
+2016-08-29 Torbjörn Granlund <tg@gmplib.org>
+
+ * All C files: Include just gmp-impl.h, make gmp-impl.h grab gmp.h.
+
+ * mpf/get_str.c: Use __GMP_ALLOCATE_FUNC_TYPE and friends.
+ * mpf/inp_str.c: Likewise.
+ * mpq/get_str.c: Likewise.
+ * mpz/get_str.c: Likewise.
+ * mpz/inp_str.c: Likewise.
+ * scanf/vsscanf.c: Likewise.
+ * tal-reent.c: Likewise.
+
2016-08-24 Vlad Zakharov <vzakhar@synopsys.com>
* longlong.h (arc add_ssaaaa, sub_ddmmss): Replace obsolete 'J'
@@ -109,30 +1636,107 @@
* longlong.h (umul_ppmm from __umulsidi3): Protect with do ...
while (0).
-2016-06-18 Torbjörn Granlund <tg@gmplib.org>
+2016-06-02 Torbjörn Granlund <tg@gmplib.org>
+ Vincent Lefevre <vincent@vinc17.net>
- * Version 6.1.1 released.
+ * doc/gmp.texi: Various clarifications about variable conventions.
-2015-03-20 Marc Glisse <marc.glisse@inria.fr>
+2016-04-07 Marc Glisse <marc.glisse@inria.fr>
+
+ * gmp-h.in (__GMP_NOTHROW): Prefer noexcept to throw().
+ (mpz_init, mpz_inits): Mark as __GMP_NOTHROW.
+ * mpz/init.c, mpz/inits.c: Likewise.
+ * gmpxx.h (mpz_class): Mark default and move constructors noexcept.
+ * tests/cxx/t-cxx11.cc: Check noexcept.
+
+2016-04-02 Torbjörn Granlund <torbjorng@google.com>
+
+ * mpf/set_q.c: Rewrite, mainly to use mpn_div_q.
+
+2016-03-29 Torbjörn Granlund <torbjorng@google.com>
+
+ * mpn/x86_64/fat/addmul_2.c: New file.
+
+2016-03-28 Torbjörn Granlund <torbjorng@google.com>
+
+ * mpn/x86_64/addmul_2.asm: Move from here...
+ * mpn/x86_64/k8/addmul_2.asm: ...to here.
+
+2016-03-26 Torbjörn Granlund <torbjorng@google.com>
+
+ * mpn/arm64/sqr_diag_addlsh1.asm: New file.
+
+2016-03-25 Torbjörn Granlund <torbjorng@google.com>
+
+ * mpn/arm64/xgene1/aors_n.asm: New file.
+ * mpn/arm64/xgene1/aorsmul_1.asm: New file.
+ * mpn/arm64/xgene1/cnd_aors_n.asm: New file.
+ * mpn/arm64/xgene1/gmp-mparam.h: New file.
+ * mpn/arm64/xgene1/mul_1.asm: New file.
+
+ * config.guess: Prefix all arm CPUs with "arm" to accommodate our
+ matchers.
+ * configure.ac (arm): Match arm CPUs consistently.
+
+2016-03-21 Torbjörn Granlund <torbjorng@google.com>
+
+ * configure.ac: Support many arm64 processors.
+
+2016-03-20 Marc Glisse <marc.glisse@inria.fr>
* configure.ac (WANT_ASSEMBLY): Remove.
(NO_ASM): Remove from CFLAGS, add to AC_DEFINE.
* tests/misc.c: Test NO_ASM instead of WANT_ASSEMBLY.
+2016-03-20 Torbjörn Granlund <torbjorng@google.com>
+
+ * config.guess (arm*): Handle big.LITTLE CPUs by extracting the
+ lexically largest id.
+ * config.guess (arm*): Add many aarch64 CPUs.
+ * config.guess (main): Corresponding changes.
+
+ * mpn/arm/v7a/cora5/gmp-mparam.h: New file.
+
+ * configure.ac (arm*): Support cortex-a5 better.
+
2016-02-25 Pavel Kopyl <p.kopyl@samsung.com>
* acinclude.m4 (GMP_ASM_UNDERSCORE): Tighten gurkmacka detection.
-2016-01-04 Marco Bodrato <bodrato@mail.dm.unipi.it>
+2016-01-27 Niels Möller <nisse@lysator.liu.se>
- * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
- * gmp-h.in: Bump version.
+ * errno.c (__gmp_exception): Use raise(SIGFPE) when available.
+
+2016-01-15 Torbjörn Granlund <torbjorng@google.com>
+
+ * config.guess (s390): Don't assume /proc/cpuinfo exists.
+
+2016-01-13 Torbjörn Granlund <torbjorng@google.com>
+
+ * config.guess: Reorder and generalise ppc code.
2016-01-01 Marco Bodrato <bodrato@mail.dm.unipi.it>
* tests/cxx/clocale.c: Do not re-define localeconv for mingw.
* tests/misc/t-locale.c: Likewise (Thanks Alexander).
+ * primesieve.c: Heal a speed regression on small values.
+ * mpz/bin_uiui.c (mpz_bdiv_bin_uiui): 2 factors all at once.
+ (mpz_goetgheluck_bin_uiui): Use STOP/CONT for loops on primesieve.
+ * mpz/oddfac_1.c: Likewise.
+ * mpz/primorial_ui.c (LOOP_ON_SIEVE_CONTINUE): Define prime locally.
+
+ * gen-fac.c: Use unsigned types for sizes.
+
+ * mpn/generic/invert.c: Use MPN_FILL macro.
+ * mpn/generic/invertappr.c: Likewise.
+ * mpn/generic/toom53_mul.c: Use _ip1 when available.
+
+2015-12-28 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpq/set_str.c: Use __GMP_FREE_FUNC_TYPE.
+ * tests/mpz/t-nextprime.c: Speedup using swap, and correct type.
+
2015-12-26 Torbjörn Granlund <torbjorng@google.com>
* tests/misc.c (tests_start): Assert library version.
@@ -150,6 +1754,8 @@
2015-12-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
+ * mpf/clears.c, mpf/inits.c, mpq/clears.c, mpq/inits.c,
+ * mpz/clears.c, mpz/inits.c: Stop supporting empty list.
* tests/arm32call.asm: bx->ret to support thumb-less chips
(thanks Martin Husemann).
@@ -164,6 +1770,11 @@
* tests/misc/t-printf.c: Test a sequence of '%'.
* printf/doprnt.c: Avoid buffer overread with long long limbs.
+ * mpn/generic/toom_interpolate_7.c: Use the rsh1 functions,
+ when available, also for negatives (clearing the carry).
+ * mpn/generic/toom_interpolate_12.c: Likewise.
+ * mpn/generic/toom_interpolate_16.c: Likewise.
+
2015-12-06 Torbjörn Granlund <torbjorng@google.com>
* configure.ac (arm*): Conditionally define NOTHUMB.
@@ -185,6 +1796,116 @@
* gmp-impl.h (MPN_TOOM22_MUL_MINSIZE): Consider ToomX2 limits
(thanks Paul).
* tests/mpn/t-toom22.c: Keep on testing small sizes.
+ * tests/mpz/t-primorial_ui.c: Test a single "large" number.
+
+ * tune/common.c (speed_mpz_primorial_ui): New function.
+ * tune/speed.h: Declare it.
+ * tune/speed.c (routine): Add mpz_primorial_ui.
+
+ * primesieve.c: Use two presieved patterns on 64-bits CPUs.
+
+2015-11-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpq/init.c: Remove conditional code for __CHECKER__.
+ * mpq/set.c: Shorten scope of local variables.
+ * mpq/set_den.c: Likewise.
+ * mpq/set_num.c: Likewise.
+ * mpq/set_z.c: Likewise.
+
+ * primesieve.c: Fill sieve with a presieved 70bits pattern.
+
+2015-11-12 Marc Glisse <marc.glisse@inria.fr>
+
+ * gmpxx.h (__gmp_fibonacci_function): New class.
+ (fibonacci, mpz_class::fibonacci): New functions.
+ (__gmp_fac_function, __gmp_primorial_function): Add braces.
+ * tests/cxx/t-ops2z.cc: Test fibonacci.
+ * doc/gmp.texi (C++ Interface Integers): Document fibonacci.
+ Warn about factorial and primorial of negative numbers.
+
+2015-11-10 Marc Glisse <marc.glisse@inria.fr>
+
+ * gmpxx.h (__gmp_primorial_function): Throw on negative operands.
+ * tests/cxx/t-ops2z.cc: Test it.
+
+2015-11-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz: Experimental, lazy allocation.
+
+2015-11-09 Marc Glisse <marc.glisse@inria.fr>
+
+ * tests/cxx/Makefile.am: Move EXTRA_DIST out of WANT_CXX.
+
+2015-11-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/urandomm.c: Use mpn_zero_p to shorten code.
+
+2015-11-08 Marc Glisse <marc.glisse@inria.fr>
+
+ * gmpxx.h (__gmp_fac_function, __gmp_primorial_function): New classes.
+ (__GMPP_DECLARE_UNARY_STATIC_MEMFUN,
+ __GMPNN_DECLARE_UNARY_STATIC_MEMFUN,
+ __GMPNS_DECLARE_UNARY_STATIC_MEMFUN,
+ __GMPNU_DECLARE_UNARY_STATIC_MEMFUN,
+ __GMPND_DECLARE_UNARY_STATIC_MEMFUN,
+ __GMPN_DECLARE_UNARY_STATIC_MEMFUN,
+ __GMP_DECLARE_UNARY_STATIC_MEMFUN, __GMPP_DEFINE_UNARY_STATIC_MEMFUN,
+ __GMPNN_DEFINE_UNARY_STATIC_MEMFUN,
+ __GMPNS_DEFINE_UNARY_STATIC_MEMFUN,
+ __GMPNU_DEFINE_UNARY_STATIC_MEMFUN,
+ __GMPND_DEFINE_UNARY_STATIC_MEMFUN, __GMPN_DEFINE_UNARY_STATIC_MEMFUN,
+ __GMP_DEFINE_UNARY_STATIC_MEMFUN): New macros.
+ (factorial, mpz_class::factorial, primorial, mpz_class::primorial):
+ New functions.
+ * tests/cxx/t-ops2.cc: Test factorial and primorial.
+ * tests/cxx/Makefile.am: Move t-ops2 after
+ t-do-exceptions-work-at-all-with-this-compiler.
+ * doc/gmp.texi: Document factorial and primorial.
+ * NEWS: Likewise.
+
+ * tests/cxx/t-ops2.cc: Remove and split into ...
+ * tests/cxx/t-ops2z.cc, tests/cxx/t-ops2qf.cc, tests/cxx/t-ops2f.cc,
+ tests/cxx/t-ops2.h: New files.
+ * tests/cxx/Makefile.am: Update for the split.
+
+2015-11-07 Marc Glisse <marc.glisse@inria.fr>
+
+ * gmpxx.h (__GMP_DEFINE_UNARY_FUNCTION_1,
+ __GMPP_DEFINE_BINARY_FUNCTION_1, __GMPNN_DEFINE_BINARY_FUNCTION_1,
+ __GMPNS_DEFINE_BINARY_FUNCTION_1, __GMPNU_DEFINE_BINARY_FUNCTION_1,
+ __GMPND_DEFINE_BINARY_FUNCTION_1, __GMPNLD_DEFINE_BINARY_FUNCTION_1,
+ __GMPN_DEFINE_BINARY_FUNCTION_1, __GMP_DEFINE_BINARY_FUNCTION_1):
+ New macros.
+ (operator~, trunc, floor, ceil, sqrt, operator%, operator&, operator|,
+ operator^, hypot, gcd, lcm): Use them.
+
+2015-11-06 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/and.c: Use MPZ_NEWALLOC.
+ * mpz/ior.c: Remove duplicated branches, add branch hints.
+ * mpz/xor.c: Likewise, and use NORMALIZE_NOT_ZERO.
+
+ * mpz/init.c: Remove conditional code for __CHECKER__.
+ * mpz/init2.c: Likewise.
+ * mpz/inits.c: Likewise.
+ * mpz/iset.c: Likewise.
+ * mpz/iset_str.c: Likewise.
+
+2015-11-04 Torbjörn Granlund <torbjorng@google.com>
+
+ * mpz/xor.c: Use MPZ_REALLOC.
+ * mpz/ior.c: Likewise
+
+2015-11-03 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpz/xor.c: Use the return value of _mpz_realloc.
+ * mpz/ior.c: Likewise.
+ * mpn/generic/sec_div.c: Remove unused var.
+
+2015-11-01 Torbjörn Granlund <torbjorng@google.com>
+
+ * tests/misc.c (seed_from_tod, seed_from_urandom): New functions.
+ (tests_rand_start): Use them.
2015-11-01 Marco Bodrato <bodrato@mail.dm.unipi.it>
@@ -206,7 +1927,6 @@
* demos/perl/GMP.xs: Likewise.
* tests/mpf/t-pow_ui.c: Use reference value to check the size.
- * mini-gmp/mini-gmp.c: Removed a typo (spotted by Paul Zimmermann).
* doc/gmp.texi (Floating-point): Remove "infinite precision" claim.
* gmp-h.in: Update version.
@@ -504,7 +2224,7 @@
2015-06-24 Torbjörn Granlund <torbjorng@google.com>
- * mpn/x86_64/fastsse/com.asm: Disalllow zero size operands.
+ * mpn/x86_64/fastsse/com.asm: Disallow zero size operands.
* mpn/x86_64/fastsse/copyi.asm: Suppress looping in basecase code.
@@ -592,9 +2312,6 @@
* tests/mpn/t-div.c: Likewise.
* tests/mpn/t-minvert.c: Likewise.
- * mini-gmp/mini-gmp.h: Declare mpn_zero_p.
- * mini-gmp/mini-gmp.c: Define mpn_zero_p as a function, not a macro.
-
2015-05-28 Niels Möller <nisse@lysator.liu.se>
* doc/gmp.texi (Low-level Functions): Document mpn_divexact_1 and
@@ -671,7 +2388,7 @@
(speed_mpn_add_1, speed_mpn_add_1_inplace): New functions.
(speed_mpn_sub_1, speed_mpn_sub_1_inplace): New functions.
* tune/speed.h: Declare them all.
- * tune/speed.c (routine): Added mpn_neg, mpn_add_1, mpn_sub_1,
+ * tune/speed.c (routine): Added mpn_neg, mpn_add_1, mpn_sub_1,
mpn_add_1_inplace, mpn_sub_1_inplace, and mpz_2fac_ui.
2015-04-25 Marco Bodrato <bodrato@mail.dm.unipi.it>
@@ -953,11 +2670,6 @@
* mpn/arm64/mod_34lsub1.asm: New file.
-2014-08-27 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/mini-gmp.c (mpz_abs_sub_bit): Do full normalization,
- needed if mpz_clrbit clears the most significant one bit.
-
2014-08-23 Torbjörn Granlund <tege@gmplib.org>
* mpn/arm64/bdiv_dbm1c.asm: New file.
@@ -994,8 +2706,6 @@
* tests/mpf/t-fits.c: use ui_sub instead of sub_ui+neg.
- * mini-gmp/mini-gmp.c: Remove some useless variables.
-
2014-07-27 Torbjörn Granlund <tege@gmplib.org>
* mpn/x86/k7/gcd_1.asm: Use LEAL.
@@ -1136,7 +2846,6 @@
* gen-fac.c: +1 in the init2 argument before setbit.
* gen-fib.c: Likewise. (Thanks Niels)
- * mini-gmp/mini-gmp.c: Likewise.
* rand/randmts.c: Likewise.
* mpn/generic/invert.c: Remove unused TMP_MARK.
@@ -1145,8 +2854,6 @@
2014-05-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
- * mini-gmp/mini-gmp.c: Micro-optimisations.
-
* gen-fib.c: Use mpz_setbit.
* gen-psqr.c: Skip even numbers when looking for primes.
@@ -1237,10 +2944,6 @@
* mpn/Makefile.am (TARG_DIST): Purge removed directories.
* doc/gmp.texi: Remove special mentions of removed architectures.
-2014-03-12 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.c (mpz_probab_prime_p): Micro-optimisation.
-
2014-03-12 Torbjorn Granlund <tege@gmplib.org>
* mpn/x86/bd2/gmp-mparam.h: New file.
@@ -1252,27 +2955,6 @@
(check_primes): New function.
(main): Call them. Also use TESTS_REPS.
- * mini-gmp/mini-gmp.c (gmp_millerrabin): New internal function.
- (mpz_probab_prime_p): New function.
- * mini-gmp/mini-gmp.h (mpz_probab_prime_p): Declare it.
- * mini-gmp/tests/t-pprime_p.c: New test program.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-pprime_p.
-
-2014-03-03 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/mini-gmp.c (mpz_congruent_p): New function.
- * mini-gmp/mini-gmp.h: Declare it.
- * mini-gmp/tests/t-cong.c: New file, based on tests/mpz/t-cong.c.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-cong.
-
- * mini-gmp/tests/testutils.c (dump): New function. Deleted static
- functions in other files.
- (mpz_set_str_or_abort): Moved function here, from...
- * mini-gmp/tests/t-cmp_d.c: ... old location.
-
- * mini-gmp/tests/t-reuse.c (dump3): Renamed, from ...
- (dump): ...old name.
-
2014-03-01 Niels Möller <nisse@lysator.liu.se>
* mpn/generic/sec_powm.c (mpn_sec_powm): Clarify comment and
@@ -1295,12 +2977,6 @@
(x86 cpuid, 2 variants): Zero ecx for the benefit of new BMI2 feature
test.
-2014-02-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.c (mpn_sqrtrem): New function.
- * mini-gmp/mini-gmp.h: Declare it.
- * mini-gmp/tests/t-sqrt.c: Test it.
-
2014-02-17 Niels Möller <nisse@lysator.liu.se>
* mpn/generic/div_qr_1.c (mpn_div_qr_1): Revert yesterday's fix.
@@ -1324,7 +3000,6 @@
* doc/gmp.texi (mpz_roinit_n, MPZ_ROINIT_N): Document that
at least a readable limb is required.
- * mini-gmp/mini-gmp.c (mpz_div_qr): init + set = init_set .
2014-02-14 Niels Möller <nisse@lysator.liu.se>
@@ -1349,11 +3024,6 @@
* tune/tuneup.c (tune_powm_sec): Likewise. Also deleted code
fiddling with the high exponent bits.
-2014-02-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/t-limbs.c: New test for mpz_limbs_*.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Add it.
-
2014-02-09 Niels Möller <nisse@lysator.liu.se>
* tune/tuneup.c (tune_powm_sec): Avoid timing of the nonsensical
@@ -1365,16 +3035,6 @@
(mpn_sec_powm): Deleted handling of winsize > initial ebi. For
now, replaced with an ASSERT_ALWAYS.
-2014-02-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/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/mini-gmp.h: Declare them.
-
- * mini-gmp/tests/t-mul.c: Use roinit and limbs_read to test mpn.
- * mini-gmp/tests/t-sqrt.c: Test also mpn_perfect_square_p.
-
2014-02-08 Niels Möller <nisse@lysator.liu.se>
* mpn/generic/sec_invert.c (mpn_cnd_neg_itch): #if:ed out unused
@@ -1390,17 +3050,6 @@
* doc/gmp.texi (Low-level Functions): Document mpn_sec_add_1 and
mpn_sec_sub_1.
-2014-02-03 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.c (mpn_rootrem): Allow NULL argument.
-
- * mini-gmp/mini-gmp.c (mpn_zero): New function.
- (mpz_perfect_square_p): New function.
- * mini-gmp/mini-gmp.h: Declare them.
-
- * mini-gmp/tests/t-sqrt.c: Test mpz_perfect_square_p.
- * mini-gmp/tests/t-root.c: Test also 1-th root, allow perfect powers.
-
2014-01-29 Torbjorn Granlund <tege@gmplib.org>
* doc/gmp.texi (Floating-point Functions): Revise.
@@ -1446,9 +3095,6 @@
* printf/repl-vsnprintf.c: Feed case 'z' in switch (type) with case 'z'
in switch (fchar).
- * mini-gmp/tests/t-aorsmul.c: New file, test for mpz_{add,sub}mul{,_ui}
- * mini-gmp/tests/Makefile: Add t-aorsmul.
-
2014-01-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
* acinclude.m4 (GMP_FUNC_VSNPRINTF): Get rid of varargs.
@@ -1506,13 +3152,6 @@
* mpz/clear.c: Add cast to avoid overflow of (later ignored) argument.
* mpf/clear.c: Likewise.
-2014-01-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.c (mpn_popcount): New function.
- (mpz_popcount): Use it.
- (mpz_addmul_ui, mpz_addmul, mpz_submul_ui, mpz_submul): Added.
- * mini-gmp/mini-gmp.h: Declare them.
-
2014-01-18 Niels Möller <nisse@lysator.liu.se>
* tests/mpn/t-aors_1.c: Test also mpn_sec_add_1 and mpn_sec_sub_1.
@@ -1548,9 +3187,6 @@
(SPEED_ROUTINE_MPN_SEC_MINVERT): New macro.
* tune/speed.c (routine): Added mpn_sec_minvert.
- * mini-gmp/mini-gmp.c (mp_bits_per_limb): New const value.
- * mini-gmp/mini-gmp.h: Declare it.
-
2014-01-12 Marc Glisse <marc.glisse@inria.fr>
* demos/expr/expr.h: Add extern "C" for C++.
@@ -2847,7 +4483,6 @@
2013-03-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
* mpz/cong_2exp.c: Write loops in a cleaner way.
- * mini-gmp/mini-gmp.c: Likewise.
* gmp-impl.h (mpz_zero_p): Likewise.
2013-03-12 Niels Möller <nisse@lysator.liu.se>
@@ -3014,16 +4649,6 @@
* tune/common.c (speed_measure): Increase repetition count if we
get a zero measurement.
-2013-02-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/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/mini-gmp.h (mpn_scan0, mpn_scan1): New declarations.
- * mini-gmp/tests/t-scan.c: Test also mpn_scan0 and mpn_scan1.
-
2013-02-26 Niels Möller <nisse@lysator.liu.se>
* tests/mpz/t-limbs.c (check_roinit): Test MPZ_ROINIT_N only if
@@ -3031,14 +4656,6 @@
2013-02-25 Niels Möller <nisse@lysator.liu.se>
- * mini-gmp/tests/t-double.c (testmain): Declare double variables
- as volatile, to drop extended precision.
-
- * mini-gmp/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.
-
* mpz/limbs_finish.c (mpz_limbs_finish): New file and function.
* mpz/limbs_modify.c (mpz_limbs_modify): New file and function.
* mpz/limbs_read.c (mpz_limbs_read): New file and function.
@@ -3072,33 +4689,12 @@
* tests/tests.h (TESTS_REPS): Keep count >= 1.
-2013-02-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/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).
-
- * mini-gmp/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>
* gmpxx.h (mpq_class, mpf_class) [init_ui, init_si, assign_si]:
Optimise _si using _ui for positive arguments.
(__gmp_hypot_function): Use _mul_ui to square an ui, abs for si.
- * mini-gmp/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.
-
- * rand/randmts.c: Use init2, as size of variables is known in advance.
- (mangle_seed): Get a single argument.
-
* mpz/remove.c: Delay allocation in the generic case; use swap
instead of set.
* mpn/generic/remove.c: Delay (possibly smaller) allocation.
@@ -3202,10 +4798,8 @@
* gmp-impl.h (MPZ_PROVOKE_REALLOC): Remove unused macro.
* gen-fac.c (gen_consts): Remove obsolete code, use swap instead of set.
- * mini-gmp/mini-gmp.c (fac_ui, bin_uiui): Use shorter and faster code.
* mpn/generic/mulmod_bnm1.c: Reorganise branches.
- * mini-gmp/mini-gmp.c: Reduce branches.
* mpz/bin_ui.c: Avoid a copy when n < 0.
* mpz/mfac_uiui.c: Reduce memory usage.
@@ -3286,17 +4880,6 @@
* tests/mpz/reuse.c: Fix typo in last change.
-2013-01-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.c (mpz_cmpabs_d, mpz_cmp_d): Simplify.
- (mpz_set_str): Behaviour more adherent to the real GMP.
-
- * mini-gmp/tests/t-str.c: Cast size_t to unsigned long, for printf.
- * mini-gmp/tests/t-import.c: Likewise.
- * mini-gmp/tests/t-comb.c: Remove an unused var.
- * mini-gmp/tests/t-div.c: Remove unused args passed to fprintf.
- * mini-gmp/tests/t-double.c: Use float immediates with float vars.
-
2013-01-22 Torbjorn Granlund <tege@gmplib.org>
* Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
@@ -3307,26 +4890,6 @@
* Makefile.am (check-mini-gmp): Fix typo in last change.
-2013-01-22 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/mini-gmp.c (mpz_cmp_d): Simplified, just sort out
- signs, then call mpz_cmpabs_d.
-
- * mini-gmp/tests/testutils.h: Include stdio.h and stdlib.h.
- (numberof): New define.
-
- * mini-gmp/tests/t-cmp_d.c: New file, copied from
- tests/mpz/t-cmp_d.c with minor changes.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-cmp_d,
-
- * mini-gmp/mini-gmp.c (mpz_cmpabs_d): New function.
- * mini-gmp/mini-gmp.h: Declare it.
-
-2013-01-21 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-str.c (testmain): Test mpz_out_str, using
- the tmpfile function for i/o.
-
2013-01-20 Torbjorn Granlund <tege@gmplib.org>
* Makefile.am (check-mini-gmp): Set also DYLD_LIBRARY_PATH for the
@@ -3342,121 +4905,28 @@
* tests/mpz/t-remove.c: Back out last change which left `divisor_size'
uninitialised; achieve change's aim with a parameter tweak.
-2013-01-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/testutils.c (testhalves): New function, test default
- memory functions.
- * mini-gmp/tests/testutils.h (testhalves): Declare it
- * mini-gmp/tests/t-logops.c: Use testhalves.
-
- * mini-gmp/mini-gmp.c (mpz_init_set_str): New function.
- * mini-gmp/mini-gmp.h (mpz_init_set_str): Declare it.
- * mini-gmp/tests/t-str.c: Test mpz_init_set_str.
-
2013-01-20 Torbjorn Granlund <tege@gmplib.org>
* tests/memory.c (PTRLIMB): New macro, used for conformant casting.
2013-01-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
- * mini-gmp/tests/t-double.c (testmain): Get the current free
- function using mp_get_memory_functions.
- * mini-gmp/tests/t-str.c (testmain): Likewise.
-
- * mini-gmp/tests/testutils.h (tu_free): Remove declaration.
-
- * mini-gmp/tests/testutils.c (block_check, tu_free): Mark static.
-
* tests/mpz/t-set_str.c: Check also failing conditions.
* tests/mpz/t-remove.c: Test removal of 1.
-2013-01-18 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-str.c (test_small): New function, exercising
- parsing of whitespace and base prefixes.
- (testmain): Call it.
-
- * mini-gmp/tests/t-gcd.c (gcdext_valid_p): Fixed memory leak.
-
- * mini-gmp/tests/t-double.c (testmain): Call tu_free rather than
- free, for storage allocated by mpz_get_str.
- * mini-gmp/tests/t-str.c (testmain): Likewise.
-
- * mini-gmp/tests/testutils.c (block_init, block_check): New
- functions.
- (tu_alloc, tu_realloc, tu_free): New functions.
- (main): Use mp_set_memory_functions.
- * mini-gmp/tests/testutils.h (tu_free): Declare.
-
- * mini-gmp/tests/testutils.h: New file, declarations for test
- programs.
-
- * mini-gmp/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>
-
- * mini-gmp/tests/t-signed.c: Slightly larger coverage.
- * mini-gmp/tests/t-double.c: Test also mpz_init_set_d.
-
2013-01-18 Torbjorn Granlund <tege@gmplib.org>
* mpn/generic/set_str.c (normalization_steps): Eliminate set-but-unused
variable.
- * mini-gmp/tests/t-div.c: Test mpz_divisible_p and mpz_divisible_ui_p.
-
* tests/tests.h (TESTS_REPS): Fix printf argument type clashes.
- * mini-gmp/tests/t-div.c: Test also mpz_mod, mpz_mod_ui. Compare
- mpz_divisible_p just to ceil, to save time.
-
- * mini-gmp/mini-gmp.c: Prefix some names with GMP_.
-
-2013-01-16 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/t-double.c: Test mpz_cmp_d.
- * mini-gmp/mini-gmp.c (mpz_cmp_d): Correct multiword comparison.
-
- * mini-gmp/mini-gmp.c (mpz_set_str): Handle the empty string.
- * mini-gmp/tests/t-str.c: Test base <= 0.
-
-2013-01-15 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-str.c (main): Use x->_mp_d rather than x[0]._mp_d.
- * mini-gmp/tests/t-invert.c (main): Likewise.
-
- * mini-gmp/tests/t-mul.c (main): Test mpn_mul_n and mpn_sqr.
-
- * mini-gmp/tests/hex-random.h (enum hex_random_op): New value
- OP_SQR.
-
- * mini-gmp/tests/mini-random.c (mini_random_op3): Renamed, from...
- (mini_random_op): ... old name. Updated callers.
- (mini_random_op2): New function.
-
- * mini-gmp/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>
-
- * mini-gmp/tests/t-logops.c: Improve popcount/hamdist testing.
- * mini-gmp/tests/t-signed.c: Test more cases.
-
2013-01-15 Torbjorn Granlund <tege@gmplib.org>
From Mike Frysinger:
* configure.ac: Add x32 ABI for x86_64.
-2013-01-14 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-str.c (main): Added tests for mpn_get_str and
- mpn_set_str.
-
2013-01-14 Marco Bodrato <bodrato@mail.dm.unipi.it>
* doc/gmp.texi (gmp_version): Remove "was used" repetition.
@@ -3467,80 +4937,19 @@
* doc/gmp.texi: Let mpn_sqrtrem reference mpn_perfect_square_p instead
of mpz_perfect_square_p.
-2013-01-11 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/t-comb.c: New test program, testing both
- mpz_fac_ui and mpz_bin_uiui.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-comb.
-
- * mini-gmp/mini-gmp.c (mpz_mul_si): Simplify.
- (mpz_mul_ui, mpz_mul, mpz_div_qr): Replace init+REALLOC with init2.
-
- * mini-gmp/mini-gmp.c (NEG_CAST): New macro.
- (mpz_mul_si, mpz_set_si, mpz_cmp_si): Use NEG_CAST.
-
- * mini-gmp/mini-gmp.c (mpz_set_si, mpz_cmp_si): Simplify by using
- the _ui variant.
-
- * mini-gmp/tests/t-root.c: Use mpz_ui_pow_ui, when base fits an ui.
-
- * mini-gmp/tests/t-mul.c: Test also mpz_mul_si.
- * mini-gmp/tests/t-sub.c: Test also mpz_ui_sub.
-
- * mini-gmp/mini-gmp.c (mpz_fits_slong_p): Correct range.
- * mini-gmp/tests/t-signed.c: New test program, for get/set/cmp_si.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-signed.
-
- * mini-gmp/mini-gmp.c (mpz_hamdist): Handle different sizes.
- * mini-gmp/tests/t-logops.c: Test also popcount and hamdist.
-
2013-01-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
* mpz/export.c: Less restrictive ASSERTs.
- * mini-gmp/mini-gmp.c (mpz_export, mpz_import): Likewise.
- * mini-gmp/tests/t-import.c: Test also size=0 or count=0.
2013-01-10 Torbjorn Granlund <tege@gmplib.org>
- * mini-gmp/tests/t-import.c (main): Don't drop off function end.
-
* Makefile.am (check-mini-gmp): Set LD_LIBRARY_PATH to allow testing
with dynamic main GMP build.
-2013-01-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.c (mpz_export): Support op=0 countp=NULL.
-
-2013-01-08 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-import.c: New test program, testing both
- mpz_import and mpz_export.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-import.
-
- * mini-gmp/tests/mini-random.c (mini_rrandomb_export): New
- function.
- * mini-gmp/tests/mini-random.h: Declare it.
- * mini-gmp/tests/hex-random.c (hex_rrandomb_export): New function.
- * mini-gmp/tests/hex-random.h: Declare it.
-
- * mini-gmp/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>
-
- * mini-gmp/README: Document base limitation for conversions.
- * mini-gmp/mini-gmp.c (mpz_set_str): Remove goto.
- (mpz_import, mpz_export): Correctly use order/endianness.
-
2013-01-05 Torbjorn Granlund <tege@gmplib.org>
* longlong.h (aarch64): Make add_ssaaaa and sub_ddmmss actually work.
-2013-01-04 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- From shuax:
- * mini-gmp/mini-gmp.c (mpz_import): Reset limb after storing it.
-
2013-01-04 Torbjorn Granlund <tege@gmplib.org>
From Marko Lindqvist:
@@ -3731,11 +5140,6 @@
* tests/mpn/t-get_d.c (check_onebit): Get vax bounds right.
(main): Switch off check_rand for vax.
-2012-11-22 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/run-tests: Copied latest version from GNU Nettle.
- Minor fix to the use of $EMULATOR, and proper copyright notice.
-
2012-11-16 Torbjorn Granlund <tege@gmplib.org>
* mpn/generic/powm_sec.c (redcify): Use mpn_sb_div_r_sec.
@@ -3896,9 +5300,6 @@
* mpn/generic/powlo.c: Likewise.
* mpn/generic/powm.c: Likewise.
- * mini-gmp/mini-gmp.c (mpz_div_r_2exp, mpz_div_q_2exp): Improve
- adjustment condition.
-
2012-06-23 Marc Glisse <marc.glisse@inria.fr>
* gmpxx.h (numeric_limits): Make content public.
@@ -3926,8 +5327,6 @@
* mpz/oddfac_1.c: Likewise.
* mpz/prodlimbs.c: Likewise.
- * mini-gmp/mini-gmp.c (mpz_realloc): remove a branch.
-
2012-06-04 Torbjorn Granlund <tege@gmplib.org>
* mpn/powerpc64/aix.m4 (ASM_START): Claim machine type "any".
@@ -4012,12 +5411,6 @@
2012-05-25 Marco Bodrato <bodrato@mail.dm.unipi.it>
- * mini-gmp/tests/t-div.c: Test all _qr, _q, _r variants.
- * mini-gmp/tests/t-lcm.c: Test the _ui variant.
-
- * mini-gmp/mini-gmp.c (mpz_mod, mpz_mod_ui): New functions.
- * mini-gmp/mini-gmp.h (mpz_mod, mpz_mod_ui): Prototypes.
-
* mpz/scan1.c: Simplify, and add a shortcut for scan1(z, 0).
2012-05-24 Torbjorn Granlund <tege@gmplib.org>
@@ -4111,8 +5504,6 @@
2012-05-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
- * mini-gmp/mini-gmp.c: merge mpz_rootrem and mpz_sqrtrem.
-
* mpn/generic/sqrtrem.c (invsqrttab): Reduce size removing common byte.
* mpz/bin_uiui.c (mul3, mul4, mul8): Remove unneeded shifts.
@@ -4425,10 +5816,6 @@
* mpz/bin_uiui.c: Rewrite (some parts are Torbjorn's).
* gen-fac_ui.c: Generate new constants for bin_uiui.
- * mini-gmp/mini-gmp.h (mpz_fac_ui, mpz_bin_uiui): New definitions.
- * mini-gmp/mini-gmp.c (mpz_fac_ui, mpz_bin_uiui): Trivial
- implementation.
-
* tests/mpz/t-fac_ui.c: Check Wilson's theorem on a big value.
* mpn/generic/invert.c: Remove support for scratch == NULL.
@@ -4466,24 +5853,14 @@
* Makefile.am (check-mini-gmp): Pass -I../.. in EXTRA_CFLAGS, to
locate gmp.h.
-2012-04-11 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.h (mpz_root, mpz_rootrem): define (correctly).
- * mini-gmp/mini-gmp.c (mpz_rootrem): Extended code from _root.
- (mpz_root): Use mpz_rootrem.
- (mpz_mul_ui): Correctly handle negative operands.
-
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): add t-root.
- * mini-gmp/tests/t-root.c: New file.
- * mini-gmp/tests/t-reuse.c: Enable root{,rem} tests.
-
2012-04-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
+ * Makefile.am (check-mini-gmp): Use $(MAKE).
+ (clean-mini-gmp): New target.
+ (clean-local, distclean-local): New automake targets. Depend on
+ clean-mini-gmp.
+
* gen-fac_ui.c (mpz_root): Remove.
- * mini-gmp/mini-gmp.c (mpz_root): New, support negative operands.
- * mini-gmp/mini-gmp.h (mpz_root): define.
- (mpz_out_str): Test also __STDIO_LOADED (for VMS).
- * mpz/2fac_ui.c: Cosmetic change.
2012-04-07 Torbjorn Granlund <tege@gmplib.org>
@@ -4735,19 +6112,6 @@
2012-02-29 Niels Möller <nisse@lysator.liu.se>
- * mini-gmp/tests/t-reuse.c: New test case, based on
- tests/mpz/reuse.c.
-
- * mini-gmp/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.
-
* Makefile.am (check-mini-gmp): Use $(MAKE).
(clean-mini-gmp): New target.
(clean-local, distclean-local): New automake targets. Depend on
@@ -4758,17 +6122,6 @@
* Makefile.am (check-mini-gmp): New target, for running the
mini-gmp testsuite.
- * mini-gmp/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/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-27 Torbjorn Granlund <tege@gmplib.org>
* mpn/x86_64/fastsse/lshiftc.asm: New file.
@@ -4804,10 +6157,6 @@
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.
-
* bootstrap.c: New file, replacing dumbmp.c. Uses mini-gmp for the
standard GMP functions, and then defines the few functions
particular for the bootstrap.
@@ -10049,7 +11398,7 @@
2009-10-29 Niels Möller <nisse@lysator.liu.se>
- * tune/speed.c: Added support for mpn_toom4_sqr,
+ * tune/speed.c: Added support for mpn_toom4_sqr.
* tune/speed.h (SPEED_ROUTINE_MPN_TOOM4_SQR): New macro.
(SPEED_ROUTINE_MPN_KARA_MUL_N): Deleted.
@@ -12406,7 +13755,7 @@
* demos/primes.c (find_primes): Increase mpz_probab_prime_p cnt to 10.
- * mpn/generic/addsub_n.c: Fix criteria form when to call _nc functions.
+ * mpn/generic/addsub_n.c: Fix criteria for when to call _nc functions.
2006-05-12 Torbjorn Granlund <tege@swox.com>
diff --git a/Build/source/libs/gmp/gmp-src/Makefile.am b/Build/source/libs/gmp/gmp-src/Makefile.am
index 0569c688c00..0b9eb85a10c 100644
--- a/Build/source/libs/gmp/gmp-src/Makefile.am
+++ b/Build/source/libs/gmp/gmp-src/Makefile.am
@@ -1,8 +1,8 @@
## Process this file with automake to generate Makefile.in
-# Copyright 1991, 1993, 1994, 1996, 1997, 1999-2004, 2006-2009, 2011-2016 Free
-# Software Foundation, Inc.
+# Copyright 1991, 1993, 1994, 1996, 1997, 1999-2004, 2006-2009, 2011-2016,
+# 2018, 2020 Free Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
#
@@ -89,6 +89,7 @@
# 6.1.0 13:0:3 9:0:5 -
# 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 -
#
# 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
@@ -101,13 +102,13 @@
# it's still good to get the shared library filename (like
# libgmpxx.so.3.0.4) incrementing, to make it clear which GMP it's from.
-LIBGMP_LT_CURRENT = 13
-LIBGMP_LT_REVISION = 2
-LIBGMP_LT_AGE = 3
+LIBGMP_LT_CURRENT = 14
+LIBGMP_LT_REVISION = 0
+LIBGMP_LT_AGE = 4
-LIBGMPXX_LT_CURRENT = 9
-LIBGMPXX_LT_REVISION = 2
-LIBGMPXX_LT_AGE = 5
+LIBGMPXX_LT_CURRENT = 10
+LIBGMPXX_LT_REVISION = 0
+LIBGMPXX_LT_AGE = 6
SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
@@ -115,15 +116,21 @@ SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
COPYING.LESSERv3 COPYINGv2 COPYINGv3
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gmp.pc
+
+# Put asl.h here for now.
+EXTRA_DIST += asl.h
if WANT_CXX
GMPXX_HEADERS_OPTION = gmpxx.h
+pkgconfig_DATA += gmpxx.pc
endif
EXTRA_DIST += gmpxx.h
-# gmp.h and mp.h are architecture dependent, mainly since they encode the
-# limb size used in libgmp. For that reason they belong under $exec_prefix
-# not $prefix, strictly speaking.
+# gmp.h is architecture dependent, mainly since it encodes the limb size used
+# in libgmp. For that reason it belongs under $exec_prefix not $prefix,
+# strictly speaking.
#
# $exec_prefix/include is not in the default include path for gcc built to
# the same $prefix and $exec_prefix, which might mean gmp.h is not found,
@@ -194,7 +201,7 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
mpz/kronuz$U.lo mpz/kronzs$U.lo mpz/kronzu$U.lo \
mpz/lcm$U.lo mpz/lcm_ui$U.lo mpz/limbs_finish$U.lo \
mpz/limbs_modify$U.lo mpz/limbs_read$U.lo mpz/limbs_write$U.lo \
- mpz/lucnum_ui$U.lo mpz/lucnum2_ui$U.lo \
+ mpz/lucmod$U.lo mpz/lucnum_ui$U.lo mpz/lucnum2_ui$U.lo \
mpz/millerrabin$U.lo mpz/mod$U.lo mpz/mul$U.lo mpz/mul_2exp$U.lo \
mpz/mul_si$U.lo mpz/mul_ui$U.lo \
mpz/n_pow_ui$U.lo mpz/neg$U.lo mpz/nextprime$U.lo \
@@ -208,7 +215,8 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
mpz/set_q$U.lo mpz/set_si$U.lo mpz/set_str$U.lo mpz/set_ui$U.lo \
mpz/setbit$U.lo \
mpz/size$U.lo mpz/sizeinbase$U.lo mpz/sqrt$U.lo \
- mpz/sqrtrem$U.lo mpz/sub$U.lo mpz/sub_ui$U.lo mpz/swap$U.lo \
+ mpz/sqrtrem$U.lo mpz/stronglucas$U.lo mpz/sub$U.lo \
+ mpz/sub_ui$U.lo mpz/swap$U.lo \
mpz/tdiv_ui$U.lo mpz/tdiv_q$U.lo mpz/tdiv_q_2exp$U.lo \
mpz/tdiv_q_ui$U.lo mpz/tdiv_qr$U.lo mpz/tdiv_qr_ui$U.lo \
mpz/tdiv_r$U.lo mpz/tdiv_r_2exp$U.lo mpz/tdiv_r_ui$U.lo \
@@ -404,6 +412,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/tests/Makefile mini-gmp/tests/run-tests
# Avoid: CVS - cvs directories
@@ -434,7 +443,7 @@ check-mini-gmp:
MINI_GMP_DIR="$$abs_srcdir/mini-gmp" \
LDFLAGS="-L../../.libs" \
LIBS="-lgmp -lm" \
- CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="-I../.." check
+ CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -I../.." check
clean-mini-gmp:
if [ -d mini-gmp/tests ] ; then \
diff --git a/Build/source/libs/gmp/gmp-src/NEWS b/Build/source/libs/gmp/gmp-src/NEWS
index 4999dc14f48..d83556ab3a7 100644
--- a/Build/source/libs/gmp/gmp-src/NEWS
+++ b/Build/source/libs/gmp/gmp-src/NEWS
@@ -1,8 +1,69 @@
-Copyright 1996, 1999-2016 Free Software Foundation, Inc.
+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.1.* and 6.2.0
+
+ BUGS FIXED
+ * gmp_snprintf now correctly reports an error (returns -1) when snprintf
+ does.
+
+ * Conversion to double is now more robust even if the configuration process
+ does not recognize the float format.
+
+ * mpz_powm could return a not completely normalised value, when the
+ exponent was 1 and the base < 0.
+
+ * mpf_set_str could create invalid mpf_t variables for input strings with
+ many leading zeros.
+
+ FEATURES
+ * New C++ functions factorial, primorial and fibonacci for mpz_class.
+
+ * Functions to detect primality now substitute the first 24 Miller-Rabin
+ iterations with the BPSW test.
+
+ * Mini-GMP: new functions mpz_2fac_ui and mpz_mfac_uiui.
+
+ * Mini-GMP: mpz_sizeinbase, mpz_get_str, and mpz_set_str now support bases up
+ to 62.
+
+ * Mini-GMP: added support for the mpq_t layer.
+
+ * MIPS r6 cores are now supported.
+
+ SPEEDUPS
+ * Major speedup for AMD Ryzen and Epyc thanks to an extensive set of assembly
+ code.
+
+ * Major speedup for IBM POWER9 thanks to assembly code making use of new madd
+ instruction.
+
+ * Speedup for 64-bit ARM CPUs thanks to new/improved assembly code.
+
+ * The n-over-k function mpz_bin_ui has been reimplemented for great speedups
+ for large operands.
+
+ * Speedup for the worst case of mpz_perfect_power_p.
+
+ * Speedup for gcd for small and medium size operands.
+
+ * Speedup for really huge multiplies thanks to much larger FFT tables.
+
+ MISC
+ * Internal representation of the mpz_t variables now supports lazy
+ allocation; memory is allocated only when a value is stored.
+
+ * Small improvements and better coverage for the test suite.
+
+ * The tune/speed program can measure some more functions.
+
+ * The low-level function mpn_mul no longer diverts to mpn_sqr, users should
+ call mpn_sqr directly when applicable.
+
+ * New installed files gmp.pc and gmpxx.pc, for use with pkg-config.
+ Contributed by Hugh McMaster.
Changes between GMP version 6.1.1 and 6.1.2
diff --git a/Build/source/libs/gmp/gmp-src/acinclude.m4 b/Build/source/libs/gmp/gmp-src/acinclude.m4
index 3c3ecf52890..86175ce42b1 100644
--- a/Build/source/libs/gmp/gmp-src/acinclude.m4
+++ b/Build/source/libs/gmp/gmp-src/acinclude.m4
@@ -1,7 +1,7 @@
dnl GMP specific autoconf macros
-dnl Copyright 2000-2006, 2009, 2011, 2013-2015 Free Software Foundation, Inc.
+dnl Copyright 2000-2006, 2009, 2011, 2013-2018 Free Software Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
@@ -63,7 +63,7 @@ define(X86_PATTERN,
[[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]])
define(X86_64_PATTERN,
-[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar*-*-* | bulldozer*-*-* | piledriver*-*-* | steamroller*-*-* | excavator*-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-* | nehalem*-*-* | westmere*-*-* | sandybridge*-*-* | ivybridge*-*-* | haswell*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-*]])
+[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar*-*-* | bulldozer*-*-* | piledriver*-*-* | steamroller*-*-* | excavator*-*-* | zen*-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-* | nehalem*-*-* | westmere*-*-* | sandybridge*-*-* | ivybridge*-*-* | haswell*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-*]])
dnl GMP_FAT_SUFFIX(DSTVAR, DIRECTORY)
dnl ---------------------------------
@@ -741,7 +741,7 @@ main ()
long i;
for (i = 0; i < 88 + 1; i++)
a[i] = ~0L;
- r = malloc (10000 * sizeof (unsigned long));
+ r = calloc (10000, sizeof (unsigned long));
r2 = r;
for (i = 0; i < 528; i += 23)
{
@@ -907,8 +907,8 @@ dnl a workaround for a HP compiler bug.
AC_DEFUN([GMP_C_TEST_SIZEOF],
[echo "configure: testlist $2" >&AC_FD_CC
-[gmp_sizeof_type=`echo "$2" | sed 's/sizeof-\([a-z]*\).*/\1/'`]
-[gmp_sizeof_want=`echo "$2" | sed 's/sizeof-[a-z]*-\([0-9]*\).*/\1/'`]
+[gmp_sizeof_type=`echo "$2" | sed 's/sizeof-\([a-z\*]*\).*/\1/'`]
+[gmp_sizeof_want=`echo "$2" | sed 's/sizeof-[a-z\*]*-\([0-9]*\).*/\1/'`]
AC_MSG_CHECKING([compiler $1 has sizeof($gmp_sizeof_type)==$gmp_sizeof_want])
cat >conftest.c <<EOF
[int
@@ -1803,8 +1803,8 @@ AC_REQUIRE([GMP_PROG_NM])
AC_CACHE_CHECK([if .align assembly directive is logarithmic],
gmp_cv_asm_align_log,
[GMP_TRY_ASSEMBLE(
-[ $gmp_cv_asm_data
- .align 4
+[ $gmp_cv_asm_data
+ .align 4
$gmp_cv_asm_globl foo
$gmp_cv_asm_byte 1
.align 4
@@ -1858,10 +1858,10 @@ AC_DEFUN([GMP_ASM_ALIGN_FILL_0x90],
AC_CACHE_CHECK([if the .align directive accepts an 0x90 fill in .text],
gmp_cv_asm_align_fill_0x90,
[GMP_TRY_ASSEMBLE(
-[ $gmp_cv_asm_text
- .align 4, 0x90
+[ $gmp_cv_asm_text
+ .align 4, 0x90
.byte 0
- .align 4, 0x90],
+ .align 4, 0x90],
[if grep "Warning: Fill parameter ignored for executable section" conftest.out >/dev/null; then
echo "Suppressing this warning by omitting 0x90" 1>&AC_FD_CC
gmp_cv_asm_align_fill_0x90=no
@@ -2659,6 +2659,8 @@ AC_DEFUN([GMP_ASM_X86_MULX],
])
case $gmp_cv_asm_x86_mulx in
yes)
+ AC_DEFINE(X86_ASM_MULX, 1,
+ [Define to 1 if the assembler understands the mulx instruction])
ifelse([$1],,:,[$1])
;;
*)
@@ -2676,45 +2678,6 @@ esac
])
-dnl GMP_ASM_X86_ADX([ACTION-IF-YES][,ACTION-IF-NO])
-dnl ------------------------------------------------
-dnl Determine whether the assembler supports the adcx and adox instructions
-dnl which debut with the Haswell shrink Broadwell.
-dnl
-dnl This macro is wanted before GMP_ASM_TEXT, so ".text" is hard coded
-dnl here. ".text" is believed to be correct on all x86 systems, certainly
-dnl it's all GMP_ASM_TEXT gives currently. Actually ".text" probably isn't
-dnl needed at all, at least for just checking instruction syntax.
-
-AC_DEFUN([GMP_ASM_X86_ADX],
-[AC_CACHE_CHECK([if the assembler knows about the adox instruction],
- gmp_cv_asm_x86_adx,
-[GMP_TRY_ASSEMBLE(
-[ .text
- adox %r8, %r9
- adcx %r8, %r9],
- [gmp_cv_asm_x86_adx=yes],
- [gmp_cv_asm_x86_adx=no])
-])
-case $gmp_cv_asm_x86_adx in
-yes)
- ifelse([$1],,:,[$1])
- ;;
-*)
- AC_MSG_WARN([+----------------------------------------------------------])
- AC_MSG_WARN([| WARNING WARNING WARNING])
- AC_MSG_WARN([| Host CPU has the adcx and adox instructions, but they])
- AC_MSG_WARN([| can't be assembled by])
- AC_MSG_WARN([| $CCAS $CFLAGS $CPPFLAGS])
- AC_MSG_WARN([| Older x86 instructions will be used.])
- AC_MSG_WARN([| This will be an inferior build.])
- AC_MSG_WARN([+----------------------------------------------------------])
- ifelse([$2],,:,[$2])
- ;;
-esac
-])
-
-
dnl GMP_ASM_X86_MCOUNT
dnl ------------------
dnl Find out how to call mcount for profiling on an x86 system.
@@ -3296,7 +3259,8 @@ AC_CACHE_CHECK([format of `double' floating point],
gmp_cv_c_double_format,
[gmp_cv_c_double_format=unknown
cat >conftest.c <<\EOF
-[struct foo {
+[#include <stdio.h>
+struct foo {
char before[8];
double x;
char after[8];
@@ -3306,9 +3270,16 @@ struct foo foo = {
{ '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
-123456789.0,
{ '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' },
-};]
+};
+int main(){
+ int i;
+ for (i = 0; i < 8; i++) {
+ printf ("%d %f\n", foo.before[i] + foo.after[i], foo.x);
+ }
+ return 0;
+}]
EOF
-gmp_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&AC_FD_CC 2>&1"
+gmp_compile="$CC $CFLAGS $CPPFLAGS conftest.c -o conftest$EXEEXT >&AC_FD_CC 2>&1"
if AC_TRY_EVAL(gmp_compile); then
cat >conftest.awk <<\EOF
[
@@ -3404,7 +3375,7 @@ BEGIN {
got[12] == "124" && \
got[13] == "000" && \
got[14] == "000" && \
- got[15] == "000")
+ got[15] == "000")
{
print "IEEE big endian"
found = 1
@@ -3461,11 +3432,11 @@ END {
}
]
EOF
- gmp_cv_c_double_format=`od -b conftest.$OBJEXT | $AWK -f conftest.awk`
+ gmp_cv_c_double_format=`od -b conftest$EXEEXT | $AWK -f conftest.awk`
case $gmp_cv_c_double_format in
unknown*)
- echo "cannot match anything, conftest.$OBJEXT contains" >&AC_FD_CC
- od -b conftest.$OBJEXT >&AC_FD_CC
+ echo "cannot match anything, conftest$EXEEXT contains" >&AC_FD_CC
+ od -b conftest$EXEEXT >&AC_FD_CC
;;
esac
else
@@ -3729,11 +3700,11 @@ check (const char *fmt, ...)
ret = vsnprintf (buf, 4, fmt, ap);
- if (strcmp (buf, "hel") != 0)
+ if (ret == -1 || strcmp (buf, "hel") != 0)
return 1;
/* allowed return values */
- if (ret != -1 && ret != 3 && ret != 11)
+ if (ret != 3 && ret != 11)
return 2;
return 0;
diff --git a/Build/source/libs/gmp/gmp-src/asl.h b/Build/source/libs/gmp/gmp-src/asl.h
new file mode 100644
index 00000000000..64deea06825
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/asl.h
@@ -0,0 +1,127 @@
+/* asl.h -- artificially small limbs support by means of C++ operator
+ overloading.
+
+Copyright 2016 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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 <iostream>
+#include <cstdint>
+#include <cstdlib>
+// #include <stdexcept>
+
+#ifndef GMP_ASSERT_ALWAYS
+#define GMP_ASSERT_ALWAYS(cc) do {if (!(cc)) abort();} while (0)
+#endif
+
+// Missing: post++ post-- ++pre --prec bool(limb) !limb
+
+#ifndef GMP_LIMB_BITS
+#define GMP_LIMB_BITS 4
+#endif
+
+#define GMP_NUMB_MASK (2 * (1ul << (GMP_LIMB_BITS - 1)) - 1)
+
+#define BINOP_MASK(op, type) \
+ mp_limb_t& operator op##=(const type& rhs) { \
+ limbo = (limbo op rhs.limbo) & GMP_NUMB_MASK; \
+ return *this; \
+ }
+#define BINOP_NOMASK(op, type) \
+ mp_limb_t& operator op##=(const type& rhs) { \
+ limbo = limbo op rhs.limbo; \
+ return *this; \
+ }
+
+typedef std::conditional<(GMP_NUMB_MASK <= 0xffff), uint16_t, uint32_t >::type type24;
+typedef std::conditional<(GMP_NUMB_MASK <= 0xff), uint8_t, type24>::type mtype;
+
+class mp_limb_t {
+public:
+ mp_limb_t() {} // put random garbage in limbo?
+ mp_limb_t(const unsigned int rhs) { limbo = rhs & GMP_NUMB_MASK; }
+ // mp_limb_t(const mp_limb_t& rhs) { limbo = rhs.limbo; } // Causes havoc
+ BINOP_MASK(+, mp_limb_t)
+ BINOP_MASK(-, mp_limb_t)
+ BINOP_MASK(*, mp_limb_t)
+ BINOP_NOMASK(/, mp_limb_t)
+ BINOP_NOMASK(%, mp_limb_t)
+ BINOP_NOMASK(&, mp_limb_t)
+ BINOP_NOMASK(|, mp_limb_t)
+ BINOP_NOMASK(^, mp_limb_t)
+ mp_limb_t& operator<<=(const unsigned int rhs) {
+ GMP_ASSERT_ALWAYS (rhs < GMP_LIMB_BITS);
+ limbo = (limbo << rhs) & GMP_NUMB_MASK;
+ return *this;
+ }
+ mp_limb_t& operator>>=(const unsigned int rhs) {
+ GMP_ASSERT_ALWAYS (rhs < GMP_LIMB_BITS);
+ limbo = limbo >> rhs;
+ return *this;
+ }
+ mp_limb_t operator-() {
+ return static_cast<mp_limb_t>((-limbo) & GMP_NUMB_MASK);
+ // mp_limb_t x; x.limbo = (-limbo) & GMP_NUMB_MASK; return x;
+ }
+ mp_limb_t operator~() {
+ return static_cast<mp_limb_t>((~limbo) & GMP_NUMB_MASK);
+ // mp_limb_t x; x.limbo = (~limbo) & GMP_NUMB_MASK; return x;
+ }
+ operator unsigned int() const { return limbo; }
+ operator int() const { return limbo; }
+
+#define RELOP(op) \
+ inline bool operator op(const mp_limb_t rhs) { \
+ return limbo op rhs.limbo; \
+ }
+ RELOP(==)
+ RELOP(!=)
+ RELOP(<)
+ RELOP(>)
+ RELOP(<=)
+ RELOP(>=)
+
+private:
+ mtype limbo;
+};
+
+#define BINOP2(op, type) \
+ inline mp_limb_t operator op(mp_limb_t lhs, const type& rhs) { \
+ lhs op##= rhs; \
+ return lhs; \
+ }
+
+BINOP2(+, mp_limb_t)
+BINOP2(-, mp_limb_t)
+BINOP2(*, mp_limb_t)
+BINOP2(/, mp_limb_t)
+BINOP2(%, mp_limb_t)
+BINOP2(&, mp_limb_t)
+BINOP2(|, mp_limb_t)
+BINOP2(^, mp_limb_t)
+BINOP2(<<, unsigned int)
+BINOP2(>>, unsigned int)
diff --git a/Build/source/libs/gmp/gmp-src/assert.c b/Build/source/libs/gmp/gmp-src/assert.c
index 2e85e6bf639..aef95b2bbca 100644
--- a/Build/source/libs/gmp/gmp-src/assert.c
+++ b/Build/source/libs/gmp/gmp-src/assert.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <stdlib.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/bootstrap.c b/Build/source/libs/gmp/gmp-src/bootstrap.c
index bff960ed83a..5f8ed72c786 100644
--- a/Build/source/libs/gmp/gmp-src/bootstrap.c
+++ b/Build/source/libs/gmp/gmp-src/bootstrap.c
@@ -1,6 +1,6 @@
/* Functions needed for bootstrapping the gmp build, based on mini-gmp.
-Copyright 2001, 2002, 2004, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2004, 2011, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,6 +29,7 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
+#define MINI_GMP_DONT_USE_FLOAT_H 1
#include "mini-gmp/mini-gmp.c"
#define MIN(l,o) ((l) < (o) ? (l) : (o))
@@ -88,7 +89,7 @@ log2_ceil (int n)
/* Set inv to the inverse of d, in the style of invert_limb, ie. for
udiv_qrnnd_preinv. */
void
-mpz_preinv_invert (mpz_t inv, mpz_t d, int numb_bits)
+mpz_preinv_invert (mpz_t inv, const mpz_t d, int numb_bits)
{
mpz_t t;
int norm;
@@ -96,19 +97,17 @@ mpz_preinv_invert (mpz_t inv, mpz_t d, int numb_bits)
norm = numb_bits - mpz_sizeinbase (d, 2);
assert (norm >= 0);
- mpz_init_set_ui (t, 1L);
- mpz_mul_2exp (t, t, 2*numb_bits - norm);
+ mpz_init (t);
+ mpz_setbit (t, 2*numb_bits - norm);
mpz_tdiv_q (inv, t, d);
- mpz_set_ui (t, 1L);
- mpz_mul_2exp (t, t, numb_bits);
- mpz_sub (inv, inv, t);
+ mpz_clrbit (inv, numb_bits);
mpz_clear (t);
}
/* Calculate r satisfying r*d == 1 mod 2^n. */
void
-mpz_invert_2exp (mpz_t r, mpz_t a, unsigned long n)
+mpz_invert_2exp (mpz_t r, const mpz_t a, unsigned long n)
{
unsigned long i;
mpz_t inv, prod;
@@ -140,6 +139,7 @@ void
mpz_invert_ui_2exp (mpz_t r, unsigned long a, unsigned long n)
{
mpz_t az;
+
mpz_init_set_ui (az, a);
mpz_invert_2exp (r, az, n);
mpz_clear (az);
diff --git a/Build/source/libs/gmp/gmp-src/compat.c b/Build/source/libs/gmp/gmp-src/compat.c
index b896f8489f0..b4b44ce16be 100644
--- a/Build/source/libs/gmp/gmp-src/compat.c
+++ b/Build/source/libs/gmp/gmp-src/compat.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/config.in b/Build/source/libs/gmp/gmp-src/config.in
index ec16504b90c..13bf6f8c9d7 100644
--- a/Build/source/libs/gmp/gmp-src/config.in
+++ b/Build/source/libs/gmp/gmp-src/config.in
@@ -2,7 +2,7 @@
/*
-Copyright 1996-2016 Free Software Foundation, Inc.
+Copyright 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -175,6 +175,26 @@ see https://www.gnu.org/licenses/.
#undef HAVE_HOST_CPU_pentiumpro
#undef HAVE_HOST_CPU_pentium2
#undef HAVE_HOST_CPU_pentium3
+#undef HAVE_HOST_CPU_pentium4
+#undef HAVE_HOST_CPU_core2
+#undef HAVE_HOST_CPU_nehalem
+#undef HAVE_HOST_CPU_westmere
+#undef HAVE_HOST_CPU_sandybridge
+#undef HAVE_HOST_CPU_ivybridge
+#undef HAVE_HOST_CPU_haswell
+#undef HAVE_HOST_CPU_broadwell
+#undef HAVE_HOST_CPU_skylake
+#undef HAVE_HOST_CPU_silvermont
+#undef HAVE_HOST_CPU_goldmont
+#undef HAVE_HOST_CPU_k8
+#undef HAVE_HOST_CPU_k10
+#undef HAVE_HOST_CPU_bulldozer
+#undef HAVE_HOST_CPU_piledriver
+#undef HAVE_HOST_CPU_steamroller
+#undef HAVE_HOST_CPU_excavator
+#undef HAVE_HOST_CPU_zen
+#undef HAVE_HOST_CPU_bobcat
+#undef HAVE_HOST_CPU_jaguar
#undef HAVE_HOST_CPU_s390_z900
#undef HAVE_HOST_CPU_s390_z990
#undef HAVE_HOST_CPU_s390_z9
@@ -283,6 +303,8 @@ see https://www.gnu.org/licenses/.
#undef HAVE_NATIVE_mpn_divrem_1c
#undef HAVE_NATIVE_mpn_divrem_2
#undef HAVE_NATIVE_mpn_gcd_1
+#undef HAVE_NATIVE_mpn_gcd_11
+#undef HAVE_NATIVE_mpn_gcd_22
#undef HAVE_NATIVE_mpn_hamdist
#undef HAVE_NATIVE_mpn_invert_limb
#undef HAVE_NATIVE_mpn_ior_n
@@ -325,6 +347,7 @@ see https://www.gnu.org/licenses/.
#undef HAVE_NATIVE_mpn_rsh1sub_n
#undef HAVE_NATIVE_mpn_rsh1sub_nc
#undef HAVE_NATIVE_mpn_rshift
+#undef HAVE_NATIVE_mpn_sbpi1_bdiv_r
#undef HAVE_NATIVE_mpn_sqr_basecase
#undef HAVE_NATIVE_mpn_sqr_diagonal
#undef HAVE_NATIVE_mpn_sqr_diag_addlsh1
@@ -612,6 +635,9 @@ see https://www.gnu.org/licenses/.
# endif
#endif
+/* Define to 1 if the assembler understands the mulx instruction */
+#undef X86_ASM_MULX
+
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER
diff --git a/Build/source/libs/gmp/gmp-src/configgmp.guess b/Build/source/libs/gmp/gmp-src/configgmp.guess
index 49ecca08d7c..663148895f8 100755
--- a/Build/source/libs/gmp/gmp-src/configgmp.guess
+++ b/Build/source/libs/gmp/gmp-src/configgmp.guess
@@ -3,7 +3,7 @@
# GMP config.guess wrapper.
-# Copyright 2000-2006, 2008, 2011-2016 Free Software Foundation, Inc.
+# Copyright 2000-2019 Free Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
#
@@ -204,14 +204,20 @@ arm*-*-* | aarch64-*-*)
0xc08) exact_cpu="armcortexa8";; # v7a
0xc09) exact_cpu="armcortexa9";; # v7a
0xc0f) exact_cpu="armcortexa15";; # v7a
+ 0xc0d) exact_cpu="armcortexa12";; # v7a
+ 0xc0e) exact_cpu="armcortexa17";; # v7a
0xc14) exact_cpu="armcortexr4";; # v7r
0xc15) exact_cpu="armcortexr5";; # v7r
0xc23) exact_cpu="armcortexm3";; # v7m
- 0xd04) exact_cpu="armcortexa35";; # v8-32
+ 0xd04) exact_cpu="armcortexa35";; # v8
0xd03) exact_cpu="armcortexa53";; # v8
+ 0xd05) exact_cpu="armcortexa55";; # v8.2
0xd07) exact_cpu="armcortexa57";; # v8
0xd08) exact_cpu="armcortexa72";; # v8
+ 0xd09) exact_cpu="armcortexa73";; # v8
+ 0xd0a) exact_cpu="armcortexa75";; # v8.2
+ 0xd0b) exact_cpu="armcortexa76";; # v8.3
*) exact_cpu=$guess_cpu;;
esac
fi
@@ -274,6 +280,18 @@ mips-*-irix[6789]*)
exact_cpu=mips64
;;
+mips-*-*)
+ case $(uname -m) in
+ mips64) exact_cpu=mips64;;
+ esac
+ ;;
+
+mipsel-*-*)
+ case $(uname -m) in
+ mips64) exact_cpu=mips64el;;
+ esac
+ ;;
+
m68k-*-*)
eval $set_cc_for_build
# NetBSD (and presumably other *BSD) "sysctl hw.model" gives for example
@@ -393,27 +411,9 @@ rs6000-*-* | powerpc*-*-*)
# development", so it doesn't seem wise to use it just yet, not while
# there's an alternative.
- # Grep the /proc/cpuinfo pseudo-file.
- # Anything unrecognised is ignored, since of course we mustn't spit out
- # a cpu type config.sub doesn't know.
- if test -z "$exact_cpu" && test -f /proc/cpuinfo; then
- x=`grep "^cpu[ ]" /proc/cpuinfo | head -n 1`
- x=`echo $x | sed -n 's/^cpu[ ]*:[ ]*\([A-Za-z0-9]*\).*/\1/p'`
- x=`echo $x | sed 's/PPC//'`
- case $x in
- 601) exact_cpu="power" ;;
- 603ev) exact_cpu="powerpc603e" ;;
- 604ev5) exact_cpu="powerpc604e" ;;
- 970??) exact_cpu="powerpc970" ;;
- 603 | 603e | 604 | 604e | 750 | 821 | 860)
- exact_cpu="powerpc$x" ;;
- POWER[4-9]*)
- exact_cpu=`echo $x | sed -e "s;POWER;power;" -e "s;[a-zA-Z]*$;;"` ;;
- esac
- fi
-
- # Try to read the PVR. mfpvr is a protected instruction, NetBSD, MacOS
- # and AIX don't allow it in user mode, but the Linux kernel does.
+ # Try to read the PVR. mfpvr is a protected instruction, NetBSD, MacOS and
+ # AIX don't allow it in user mode, but the Linux kernel does. We prefer this
+ # to /proc/cpuinfo since the latter lags for newer CPUs.
#
# Note this is no good on AIX, since a C function there is the address of
# a function descriptor, not actual code. But this doesn't matter since
@@ -442,7 +442,10 @@ main ()
case 0x000c: puts ("powerpc7400"); break;
case 0x0041: puts ("powerpc630"); break;
case 0x003f: puts ("power7"); break;
- case 0x004b: puts ("power8"); break;
+ case 0x004b:
+ case 0x004c:
+ case 0x004d: puts ("power8"); break;
+ case 0x004e: puts ("power9"); break;
case 0x0050: puts ("powerpc860"); break;
case 0x8000: puts ("powerpc7450"); break;
case 0x8001: puts ("powerpc7455"); break;
@@ -463,6 +466,27 @@ EOF
fi
fi
+
+ # Grep the /proc/cpuinfo pseudo-file.
+ # Anything unrecognised is ignored, since of course we mustn't spit out
+ # a cpu type config.sub doesn't know.
+ if test -z "$exact_cpu" && test -f /proc/cpuinfo; then
+ x=`grep "^cpu[ ]" /proc/cpuinfo | head -n 1`
+ x=`echo $x | sed -n 's/^cpu[ ]*:[ ]*\([A-Za-z0-9]*\).*/\1/p'`
+ x=`echo $x | sed 's/PPC//'`
+ case $x in
+ 601) exact_cpu="power" ;;
+ 603ev) exact_cpu="powerpc603e" ;;
+ 604ev5) exact_cpu="powerpc604e" ;;
+ 970??) exact_cpu="powerpc970" ;;
+ 603 | 603e | 604 | 604e | 750 | 821 | 860)
+ exact_cpu="powerpc$x" ;;
+ POWER[4-9]*)
+ exact_cpu=`echo $x | sed -e "s;POWER;power;" -e "s;[a-zA-Z]*$;;"` ;;
+ esac
+ fi
+
+
if test -z "$exact_cpu"; then
# On AIX, try looking at _system_configuration. This is present in
# version 4 at least.
@@ -514,6 +538,9 @@ main ()
#ifdef POWER_8
case POWER_8: puts ("power8"); break;
#endif
+#ifdef POWER_9
+ case POWER_9: puts ("power9"); break;
+#endif
default:
if (_system_configuration.architecture == POWER_RS)
puts ("power");
@@ -837,8 +864,8 @@ main ()
switch (family)
{
case 5:
- if (model <= 2) modelstr = "pentium";
- else if (model >= 4) modelstr = "pentiummmx";
+ if (model == 4 || model == 8) modelstr = "pentiummmx";
+ else modelstr = "pentium";
break;
case 6:
if (model <= 1) modelstr = "pentiumpro";
@@ -882,6 +909,7 @@ main ()
else if (model == 0x5c) cpu_64bit = 1, modelstr = "goldmont"; /* Goldmont */
else if (model == 0x5e) cpu_64bit = 1, cpu_avx=1, modelstr = "skylake"; /* Skylake */
else if (model == 0x5f) cpu_64bit = 1, modelstr = "goldmont"; /* Goldmont */
+ else if (model == 0x7a) cpu_64bit = 1, modelstr = "goldmont"; /* Goldmont Plus */
else if (model == 0x8e) cpu_64bit = 1, cpu_avx=1, modelstr = "kabylake"; /* Kabylake Y/U */
else if (model == 0x9e) cpu_64bit = 1, cpu_avx=1, modelstr = "kabylake"; /* Kabylake desktop */
else cpu_64bit = 1, modelstr = "nehalem"; /* default */
@@ -951,6 +979,20 @@ main ()
case 22: /* Jaguar, an improved bobcat */
cpu_64bit = 1, cpu_avx = 1, modelstr = "jaguar";
break;
+ case 23: /* Zen */
+ cpu_64bit = 1, cpu_avx = 1;
+ switch (model)
+ {
+ case 1:
+ case 8:
+ case 17:
+ case 24:
+ modelstr = "zen";
+ break;
+ default:
+ modelstr = "zen2";
+ break;
+ }
}
}
else if (strcmp (vendor_string, "CyrixInstead") == 0)
@@ -983,8 +1025,8 @@ main ()
else if (cpu_avx && ! (cpuid_avx && cpuid_osxsave))
/* For CPUs nominally capable of executing AVX, append "noavx" when not
both the AVX and OSXSAVE cpuid bits are set. We tolerate weirdness
- here, as some virtualisers set a broken cpuid state here, while other
- virtualisers allow users to set a broken state. */
+ here, as some virtualisers set a broken cpuid state, while other
+ virtualisers allow guests to set a broken state. */
suffix = "noavx";
printf ("%s%s", modelstr, suffix);
diff --git a/Build/source/libs/gmp/gmp-src/configgmp.sub b/Build/source/libs/gmp/gmp-src/configgmp.sub
index 4618cf079bd..8ec227f6a40 100755
--- a/Build/source/libs/gmp/gmp-src/configgmp.sub
+++ b/Build/source/libs/gmp/gmp-src/configgmp.sub
@@ -102,7 +102,7 @@ itanium | itanium2)
test_cpu=ia64 ;;
pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*)
test_cpu=i386 ;;
-athlon64 | atom | silvermont | goldmont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | nano | nehalem* | westmere* | sandybridge* | ivybridge* | haswell* | broadwell* | skylake* | kabylake* | knightslanding)
+athlon64 | atom | silvermont | goldmont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | zen* | nano | nehalem | westmere | sandybridge* | ivybridge* | haswell* | broadwell* | skylake* | kabylake* | knightslanding)
test_cpu=x86_64 ;;
power[2-9] | power2sc)
test_cpu=power ;;
@@ -129,8 +129,8 @@ z900esa | z990esa | z9esa | z10esa | z196esa)
armsa1 | armxscale | arm9tdmi | arm9te | \
arm10* | arm11mpcore | armsa1 | arm1136 | arm1156 | arm1176 | \
-armcortexa5 | armcortexa7 | armcortexa8 | armcortexa9 | armcortexa15 | \
-armcortexr4 | armcortexr5 | armcortexm3 | arm*neon | xgene1 | exynosm1 | thunderx)
+armcortex[arm][0-9] | armcortex[arm][0-9][0-9] | \
+arm*neon | armxgene1 | armexynosm1 | armthunderx)
test_cpu="arm";;
*)
diff --git a/Build/source/libs/gmp/gmp-src/configure.ac b/Build/source/libs/gmp/gmp-src/configure.ac
index 9641c041fd1..024cacb6b8c 100644
--- a/Build/source/libs/gmp/gmp-src/configure.ac
+++ b/Build/source/libs/gmp/gmp-src/configure.ac
@@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
define(GMP_COPYRIGHT,[[
-Copyright 1996-2016 Free Software Foundation, Inc.
+Copyright 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -47,6 +47,7 @@ m4_pattern_allow(GMP_NAIL_BITS)
m4_pattern_allow(GMP_NUMB_BITS)
m4_pattern_allow(GMP_NONSTD_ABI)
m4_pattern_allow(GMP_CPU_TYPE)
+m4_pattern_allow(GMP_AVX_NOT_REALLY_AVAILABLE)
# If --target is not used then $target_alias is empty, but if say
# "./configure athlon-pc-freebsd3.5" is used, then all three of
@@ -77,7 +78,7 @@ dnl
dnl Note that there's a copy of these options in the top-level Makefile.am,
dnl so update there too if changing anything.
dnl
-AM_INIT_AUTOMAKE([1.8 gnu no-dependencies])
+AM_INIT_AUTOMAKE([1.8 gnu no-dependencies subdir-objects])
AC_CONFIG_HEADERS(config.h:config.in)
AM_MAINTAINER_MODE
@@ -321,6 +322,26 @@ AH_VERBATIM([HAVE_HOST_CPU_1],
#undef HAVE_HOST_CPU_pentiumpro
#undef HAVE_HOST_CPU_pentium2
#undef HAVE_HOST_CPU_pentium3
+#undef HAVE_HOST_CPU_pentium4
+#undef HAVE_HOST_CPU_core2
+#undef HAVE_HOST_CPU_nehalem
+#undef HAVE_HOST_CPU_westmere
+#undef HAVE_HOST_CPU_sandybridge
+#undef HAVE_HOST_CPU_ivybridge
+#undef HAVE_HOST_CPU_haswell
+#undef HAVE_HOST_CPU_broadwell
+#undef HAVE_HOST_CPU_skylake
+#undef HAVE_HOST_CPU_silvermont
+#undef HAVE_HOST_CPU_goldmont
+#undef HAVE_HOST_CPU_k8
+#undef HAVE_HOST_CPU_k10
+#undef HAVE_HOST_CPU_bulldozer
+#undef HAVE_HOST_CPU_piledriver
+#undef HAVE_HOST_CPU_steamroller
+#undef HAVE_HOST_CPU_excavator
+#undef HAVE_HOST_CPU_zen
+#undef HAVE_HOST_CPU_bobcat
+#undef HAVE_HOST_CPU_jaguar
#undef HAVE_HOST_CPU_s390_z900
#undef HAVE_HOST_CPU_s390_z990
#undef HAVE_HOST_CPU_s390_z9
@@ -601,8 +622,8 @@ case $host in
CALLING_CONVENTIONS_OBJS='arm32call.lo arm32check.lo'
CALLING_CONVENTIONS_OBJS_64=""
cclist_64="gcc cc"
- any_32_testlist="sizeof-long-4"
- any_64_testlist="sizeof-long-8"
+ any_32_testlist="sizeof-void*-4"
+ any_64_testlist="sizeof-void*-8"
# This is needed for clang, which is not content with flags like -mfpu=neon
# alone.
@@ -611,6 +632,8 @@ case $host in
gcc_cflags_fpmode="-mfloat-abi=softfp" ;;
*-*-*eabihf)
gcc_cflags_fpmode="-mfloat-abi=hard" ;;
+ *-*-mingw*)
+ limb_64=longlong ;;
esac
# FIXME: We make mandatory compiler options optional here. We should
@@ -634,24 +657,24 @@ case $host in
gcc_cflags_arch="-march=armv6"
;;
armcortexa5 | armv7*)
- path="arm/v6t2 arm/v6 arm/v5 arm"
+ path="arm/v7a/cora5 arm/v6t2 arm/v6 arm/v5 arm"
gcc_cflags_arch="-march=armv7-a"
gcc_cflags_tune="-mtune=cortex-a5"
;;
armcortexa5neon)
- path="arm/neon arm/v6t2 arm/v6 arm/v5 arm"
+ path="arm/neon arm/v7a/cora5 arm/v6t2 arm/v6 arm/v5 arm"
gcc_cflags_neon="-mfpu=neon"
gcc_cflags_arch="-march=armv7-a"
gcc_cflags_tune="-mtune=cortex-a5"
;;
armcortexa7)
path="arm/v7a/cora7 arm/v6t2 arm/v6 arm/v5 arm"
- gcc_cflags_arch="-march=armv7-a"
+ gcc_cflags_arch="-march=armv7ve -march=armv7-a"
gcc_cflags_tune="-mtune=cortex-a7"
;;
armcortexa7neon)
path="arm/neon arm/v7a/cora7 arm/v6t2 arm/v6 arm/v5 arm"
- gcc_cflags_arch="-march=armv7-a"
+ gcc_cflags_arch="-march=armv7ve -march=armv7-a"
gcc_cflags_neon="-mfpu=neon"
gcc_cflags_tune="-mtune=cortex-a7"
;;
@@ -679,12 +702,23 @@ case $host in
;;
armcortexa15)
path="arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
- gcc_cflags_arch="-march=armv7-a"
+ gcc_cflags_arch="-march=armv7ve -march=armv7-a"
gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
;;
armcortexa15neon)
path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
- gcc_cflags_arch="-march=armv7-a"
+ gcc_cflags_arch="-march=armv7ve -march=armv7-a"
+ gcc_cflags_neon="-mfpu=neon"
+ gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
+ ;;
+ armcortexa12 | armcortexa17)
+ path="arm/v7a/cora17 arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
+ gcc_cflags_arch="-march=armv7ve -march=armv7-a"
+ gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
+ ;;
+ armcortexa12neon | armcortexa17neon)
+ path="arm/v7a/cora17/neon arm/v7a/cora15/neon arm/neon arm/v7a/cora17 arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
+ gcc_cflags_arch="-march=armv7ve -march=armv7-a"
gcc_cflags_neon="-mfpu=neon"
gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
;;
@@ -704,13 +738,13 @@ case $host in
gcc_cflags_neon="-mfpu=neon"
gcc_cflags_tune="-mtune=cortex-a57"
;;
- armcortexa72 | armcortexa72neon)
+ [armcortexa7[2-9] | armcortexa7[2-9]neon])
abilist="64 32"
path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
- path_64="arm64/cora72 arm64"
+ path_64="arm64/cora57 arm64"
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_neon="-mfpu=neon"
- gcc_cflags_tune="-mtune=cortex-a72"
+ gcc_cflags_tune="-mtune=cortex-a72 -mtune=cortex-a57"
;;
armexynosm1)
abilist="64 32"
@@ -843,7 +877,6 @@ case $host in
# systems (GNU/Linux for instance), but lets assume they're ok.
case $host in
[*-*-hpux[1-9] | *-*-hpux[1-9].* | *-*-hpux10 | *-*-hpux10.*]) ;;
- [*-*-linux*]) abilist="1.0" ;; # due to linux permanent kernel bug
*) abilist="2.0w $abilist" ;;
esac
@@ -994,7 +1027,7 @@ case $host in
GMP_INCLUDE_MPN(mips32/mips-defs.m4)
case $host in
- [mips64*-*-* | mips*-*-irix[6789]*])
+ [mips64*-*-* | mipsisa64*-*-* | mips*-*-irix[6789]*])
abilist="n32 64 o32"
cclist_n32="gcc cc"
@@ -1003,7 +1036,6 @@ case $host in
gcc_n32_cflags_abi="-mabi=n32 -mn32"
cc_n32_cflags="-O2 -n32" # no -g, it disables all optimizations
limb_n32=longlong
- path_n32="mips64"
cclist_64="gcc cc"
gcc_64_cflags_optlist="abi"
@@ -1012,7 +1044,18 @@ case $host in
gcc_64_ldflags="-Wc,-mabi=64"
cc_64_cflags="-O2 -64" # no -g, it disables all optimizations
cc_64_ldflags="-Wc,-64"
- path_64="mips64"
+
+ case $host_cpu in
+ [mips64r[6789]* | mipsisa64r[6789]*])
+ path_n32="mips64/r6 mips64"
+ path_64="mips64/r6 mips64"
+ ;;
+ *)
+ path_n32="mips64/hilo mips64"
+ path_64="mips64/hilo mips64"
+ ;;
+ esac
+
;;
esac
;;
@@ -1119,9 +1162,12 @@ case $host in
power7) gcc_cflags_cpu="-mtune=power7 -mtune=power5"
xlc_cflags_arch="-qarch=pwr7 -qarch=pwr5"
cpu_path="p7 p5 p4 p3-p7" ;;
- [power[89]]) gcc_cflags_cpu="-mtune=power8 -mtune=power7 -mtune=power5"
+ power8) gcc_cflags_cpu="-mtune=power8 -mtune=power7 -mtune=power5"
xlc_cflags_arch="-qarch=pwr8 -qarch=pwr7 -qarch=pwr5"
cpu_path="p8 p7 p5 p4 p3-p7" ;;
+ power9) gcc_cflags_cpu="-mtune=power9 -mtune=power8 -mtune=power7 -mtune=power5"
+ xlc_cflags_arch="-qarch=pwr9 -qarch=pwr8 -qarch=pwr7 -qarch=pwr5"
+ cpu_path="p9 p8 p7 p5 p4 p3-p7" ;;
esac
case $host in
@@ -1186,18 +1232,18 @@ case $host in
# incompatible with a shared library.
#
abilist="mode64 mode32 $abilist"
- gcc_cflags_opt="-O3 -O2 -O1" # will this become used?
+ gcc_cflags_opt="-O2 -O1" # will this become used?
cclist_mode32="gcc"
gcc_mode32_cflags_maybe="-m32"
gcc_mode32_cflags="-mpowerpc64"
gcc_mode32_cflags_optlist="subtype cpu opt"
gcc_mode32_cflags_subtype="-force_cpusubtype_ALL"
- gcc_mode32_cflags_opt="-O3 -O2 -O1"
+ gcc_mode32_cflags_opt="-O2 -O1"
limb_mode32=longlong
cclist_mode64="gcc"
gcc_mode64_cflags="-m64"
gcc_mode64_cflags_optlist="cpu opt"
- gcc_mode64_cflags_opt="-O3 -O2 -O1"
+ gcc_mode64_cflags_opt="-O2 -O1"
path_mode64=""
path_mode32=""
p=""
@@ -1235,12 +1281,12 @@ case $host in
gcc_mode32_cflags_maybe="-m32"
gcc_mode32_cflags="-mpowerpc64"
gcc_mode32_cflags_optlist="cpu opt"
- gcc_mode32_cflags_opt="-O3 -O2 -O1"
+ gcc_mode32_cflags_opt="-O2 -O1"
limb_mode32=longlong
cclist_mode64="gcc gcc64"
gcc_mode64_cflags_maybe="-m64"
gcc_mode64_cflags_optlist="cpu opt"
- gcc_mode64_cflags_opt="-O3 -O2 -O1"
+ gcc_mode64_cflags_opt="-O2 -O1"
path_mode64=""
path_mode32=""
p=""
@@ -1295,6 +1341,13 @@ case $host in
;;
+ # RISC-V
+ [riscv64-*-*])
+ cclist="gcc"
+ path="riscv/64"
+ ;;
+
+
# IBM System/390 and z/Architecture
S390_PATTERN | S390X_PATTERN)
abilist="32"
@@ -1540,8 +1593,10 @@ case $host in
path_64="sparc64/ultrasparc34 sparc64/ultrasparc1234 sparc64" ;;
[ultrasparct[12]])
path_64="sparc64/ultrasparct1 sparc64" ;;
- [ultrasparct[345]])
+ [ultrasparct3])
path_64="sparc64/ultrasparct3 sparc64" ;;
+ [ultrasparct[45]])
+ path_64="sparc64/ultrasparct45 sparc64/ultrasparct3 sparc64" ;;
*)
path_64="sparc64"
esac
@@ -1646,6 +1701,11 @@ case $host in
# Availability of rdtsc is checked at run-time.
SPEED_CYCLECOUNTER_OBJ=pentium.lo
+ # Set to "yes" below on a per-cpu basis. We do that in order to allow for
+ # a relevant warning to be output when using a CPU with mulx on a system
+ # which cannot assemble it.
+ x86_have_mulx=no
+
# gcc 2.7.2 only knows i386 and i486, using -m386 or -m486. These
# represent -mcpu= since -m486 doesn't generate 486 specific insns.
# gcc 2.95 adds k6, pentium and pentiumpro, and takes -march= and -mcpu=.
@@ -1788,14 +1848,14 @@ case $host in
bobcat)
gcc_cflags_cpu="-mtune=btver1 -mtune=amdfam10 -mtune=k8"
gcc_cflags_arch="-march=btver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
- path="x86/bobcat x86/k7/mmx x86/k7 x86/mmx x86"
- path_64="x86_64/bobcat x86_64/k10 x86_64/k8 x86_64"
+ path="x86/bt1 x86/k7/mmx x86/k7 x86/mmx x86"
+ path_64="x86_64/bt1 x86_64/k10 x86_64/k8 x86_64"
;;
jaguar | jaguarnoavx)
gcc_cflags_cpu="-mtune=btver2 -mtune=btver1 -mtune=amdfam10 -mtune=k8"
gcc_cflags_arch="-march=btver2 -march=btver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
- path="x86/jaguar x86/bobcat x86/k7/mmx x86/k7 x86/mmx x86"
- path_64="x86_64/jaguar x86_64/bobcat x86_64/k10 x86_64/k8 x86_64"
+ path="x86/bt2 x86/bt1 x86/k7/mmx x86/k7 x86/mmx x86"
+ path_64="x86_64/bt2 x86_64/bt1 x86_64/k10 x86_64/k8 x86_64"
;;
bulldozer | bd1 | bulldozernoavx | bd1noavx)
gcc_cflags_cpu="-mtune=bdver1 -mtune=amdfam10 -mtune=k8"
@@ -1820,6 +1880,21 @@ case $host in
gcc_cflags_arch="-march=bdver4 -march=bdver3 -march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
path="x86/bd4 x86/bd3 x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
path_64="x86_64/bd4 x86_64/bd3 x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
+ x86_have_mulx=yes
+ ;;
+ zen | zennoavx)
+ gcc_cflags_cpu="-mtune=znver1 -mtune=amdfam10 -mtune=k8"
+ gcc_cflags_arch="-march=znver1 -march=amdfam10 -march=k8"
+ path="x86/k7/mmx x86/k7 x86/mmx x86"
+ x86_have_mulx=yes
+ path_64="x86_64/zen x86_64"
+ ;;
+ zen2 | zen2noavx)
+ 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"
+ x86_have_mulx=yes
+ path_64="x86_64/zen2 x86_64/zen x86_64"
;;
core2)
gcc_cflags_cpu="-mtune=core2 -mtune=k8"
@@ -1828,8 +1903,8 @@ case $host in
path_64="x86_64/core2 x86_64"
;;
corei | coreinhm | coreiwsm | nehalem | westmere)
- gcc_cflags_cpu="-mtune=corei7 -mtune=core2 -mtune=k8"
- gcc_cflags_arch="-march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
+ gcc_cflags_cpu="-mtune=nehalem -mtune=corei7 -mtune=core2 -mtune=k8"
+ gcc_cflags_arch="-march=nehalem -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
path="x86/coreinhm x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
path_64="x86_64/coreinhm x86_64/core2 x86_64"
;;
@@ -1843,23 +1918,26 @@ case $host in
coreihwl | coreihwlnoavx | haswell | haswellnoavx)
gcc_cflags_cpu="-mtune=haswell -mtune=corei7 -mtune=core2 -mtune=k8"
gcc_cflags_arch="-march=haswell -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
- path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
+ path="x86/coreihwl x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
path_64="x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
+ x86_have_mulx=yes
;;
coreibwl | coreibwlnoavx | broadwell | broadwellnoavx)
gcc_cflags_cpu="-mtune=broadwell -mtune=corei7 -mtune=core2 -mtune=k8"
gcc_cflags_arch="-march=broadwell -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
- path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
+ path="x86/coreihwl x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
path_64="x86_64/coreibwl x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
# extra_functions_64="missing" # enable for bmi2/adx simulation
+ x86_have_mulx=yes
;;
skylake | skylakenoavx | kabylake | kabylakenoavx)
gcc_cflags_cpu="-mtune=skylake -mtune=broadwell -mtune=corei7 -mtune=core2 -mtune=k8"
# Don't pass -march=skylake for now as then some compilers emit AVX512.
gcc_cflags_arch="-march=broadwell -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
- path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
+ path="x86/coreihwl x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
path_64="x86_64/skylake x86_64/coreibwl x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
# extra_functions_64="missing" # enable for bmi2/adx simulation
+ x86_have_mulx=yes
;;
atom) # in-order pipeline atom
gcc_cflags_cpu="-mtune=atom -mtune=pentium3"
@@ -1867,12 +1945,18 @@ case $host in
path="x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86"
path_64="x86_64/atom x86_64"
;;
- silvermont | goldmont) # out-of-order pipeline atom
+ silvermont) # out-of-order pipeline atom
gcc_cflags_cpu="-mtune=slm -mtune=atom -mtune=pentium3"
gcc_cflags_arch="-march=slm -march=atom -march=pentium3"
- path="x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86"
+ path="x86/silvermont x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86"
path_64="x86_64/silvermont x86_64/atom x86_64"
;;
+ goldmont) # out-of-order pipeline atom
+ gcc_cflags_cpu="-mtune=slm -mtune=atom -mtune=pentium3"
+ gcc_cflags_arch="-march=slm -march=atom -march=pentium3"
+ path="x86/goldmont x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86"
+ path_64="x86_64/goldmont x86_64/silvermont x86_64/atom x86_64"
+ ;;
nano)
gcc_cflags_cpu="-mtune=nano"
gcc_cflags_arch="-march=nano"
@@ -1892,7 +1976,9 @@ case $host in
# unconditionally for NetBSD where they don't work but OSXSAVE is set
# to claim the contrary.
*noavx-*-* | *-*-netbsd*)
- gcc_cflags_noavx="-mno-avx";;
+ gcc_cflags_noavx="-mno-avx"
+ GMP_DEFINE_RAW(["define(<GMP_AVX_NOT_REALLY_AVAILABLE>,1)"])
+ ;;
esac
case $host in
@@ -2194,7 +2280,7 @@ case $host in
fat_functions="add_n addmul_1 bdiv_dbm1c com cnd_add_n cnd_sub_n
copyd copyi dive_1 divrem_1
- gcd_1 lshift lshiftc mod_1 mod_1_1 mod_1_1_cps mod_1_2
+ gcd_11 lshift lshiftc mod_1 mod_1_1 mod_1_1_cps mod_1_2
mod_1_2_cps mod_1_4 mod_1_4_cps mod_34lsub1 mode1o mul_1
mul_basecase mullo_basecase pre_divrem_1 pre_mod_1 redc_1
redc_2 rshift sqr_basecase sub_n submul_1"
@@ -2205,7 +2291,7 @@ 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/bobcat
+ x86/k8 x86/k10 x86/bt1
x86/pentium x86/pentium/mmx
x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2
x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2
@@ -2218,10 +2304,10 @@ case $host in
extra_functions_64="$extra_functions_64 fat fat_entry"
path_64="x86_64/fat x86_64"
fat_path="x86_64 x86_64/fat
- x86_64/k8 x86_64/k10 x86_64/bd1 x86_64/bobcat x86_64/pentium4
- x86_64/core2 x86_64/coreinhm x86_64/coreisbr x86_64/coreihwl
- x86_64/coreibwl x86_64/skylake x86_64/atom x86_64/silvermont
- x86_64/nano"
+ x86_64/k8 x86_64/k10 x86_64/bd1 x86_64/bt1 x86_64/bt2 x86_64/zen
+ x86_64/pentium4 x86_64/core2 x86_64/coreinhm x86_64/coreisbr
+ x86_64/coreihwl x86_64/coreibwl x86_64/skylake x86_64/atom
+ x86_64/silvermont x86_64/goldmont x86_64/nano"
fat_functions="$fat_functions addmul_2 addlsh1_n addlsh2_n sublsh1_n"
fi
@@ -2303,12 +2389,12 @@ if test $found_compiler = yes; then
CC="$cc"
CFLAGS="$cflags"
CPPFLAGS="$cppflags"
- eval GMP_NONSTD_ABI=\"\$GMP_NONSTD_ABI_$ABI\"
# Could easily have this in config.h too, if desired.
ABI_nodots=`echo $ABI | sed 's/\./_/'`
GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_ABI_$ABI_nodots')", POST)
+ eval GMP_NONSTD_ABI=\"\$GMP_NONSTD_ABI_$ABI_nodots\"
# GMP_LDFLAGS substitution, selected according to ABI.
# These are needed on libgmp.la and libmp.la, but currently not on
@@ -2383,9 +2469,12 @@ AC_SUBST(DEFN_LONG_LONG_LIMB)
# The C compiler and preprocessor, put into ANSI mode if possible.
AC_PROG_CC
-AC_PROG_CC_STDC
+AC_PROG_CC_C99
AC_PROG_CPP
+#if test "$ac_cv_prog_cc_c99" = no; then
+# AC_MSG_ERROR([Cannot find a C99 capable compiler])
+#fi
# The C compiler on the build system, and associated tests.
GMP_PROG_CC_FOR_BUILD
@@ -2511,12 +2600,6 @@ case $host in
*sse2*) GMP_ASM_X86_SSE2( , [GMP_STRIP_PATH(sse2)]) ;;
esac
fi
- case "$path $fat_path" in
- *mulx*) GMP_ASM_X86_MULX( , [GMP_STRIP_PATH(mulx)]) ;;
- esac
- case "$path $fat_path" in
- *adx*) GMP_ASM_X86_ADX( , [GMP_STRIP_PATH(adx)]) ;;
- esac
;;
esac
@@ -2912,15 +2995,15 @@ gmp_mpn_functions="$extra_functions \
mul_1 addmul_1 submul_1 \
add_err1_n add_err2_n add_err3_n sub_err1_n sub_err2_n sub_err3_n \
lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \
- fib2_ui mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \
+ fib2_ui fib2m mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \
mod_1_1 mod_1_2 mod_1_3 mod_1_4 lshiftc \
mul mul_fft mul_n sqr mul_basecase sqr_basecase nussbaumer_mul \
mulmid_basecase toom42_mulmid mulmid_n mulmid \
random random2 pow_1 \
- rootrem sqrtrem sizeinbase get_str set_str \
+ rootrem sqrtrem sizeinbase get_str set_str compute_powtab \
scan0 scan1 popcount hamdist cmp zero_p \
- perfsqr perfpow \
- gcd_1 gcd gcdext_1 gcdext gcd_subdiv_step \
+ perfsqr perfpow strongfibo \
+ gcd_11 gcd_22 gcd_1 gcd gcdext_1 gcdext gcd_subdiv_step \
gcdext_lehmer \
div_q tdiv_qr jacbase jacobi_2 jacobi get_d \
matrix22_mul matrix22_mul1_inverse_vector \
@@ -2944,7 +3027,7 @@ gmp_mpn_functions="$extra_functions \
dcpi1_div_q dcpi1_div_qr dcpi1_divappr_q \
mu_div_qr mu_divappr_q mu_div_q \
bdiv_q_1 \
- sbpi1_bdiv_q sbpi1_bdiv_qr \
+ sbpi1_bdiv_q sbpi1_bdiv_qr sbpi1_bdiv_r \
dcpi1_bdiv_q dcpi1_bdiv_qr \
mu_bdiv_q mu_bdiv_qr \
bdiv_q bdiv_qr broot brootinv bsqrt bsqrtinv \
@@ -3509,6 +3592,8 @@ AH_VERBATIM([HAVE_NATIVE],
#undef HAVE_NATIVE_mpn_divrem_1c
#undef HAVE_NATIVE_mpn_divrem_2
#undef HAVE_NATIVE_mpn_gcd_1
+#undef HAVE_NATIVE_mpn_gcd_11
+#undef HAVE_NATIVE_mpn_gcd_22
#undef HAVE_NATIVE_mpn_hamdist
#undef HAVE_NATIVE_mpn_invert_limb
#undef HAVE_NATIVE_mpn_ior_n
@@ -3551,6 +3636,7 @@ AH_VERBATIM([HAVE_NATIVE],
#undef HAVE_NATIVE_mpn_rsh1sub_n
#undef HAVE_NATIVE_mpn_rsh1sub_nc
#undef HAVE_NATIVE_mpn_rshift
+#undef HAVE_NATIVE_mpn_sbpi1_bdiv_r
#undef HAVE_NATIVE_mpn_sqr_basecase
#undef HAVE_NATIVE_mpn_sqr_diagonal
#undef HAVE_NATIVE_mpn_sqr_diag_addlsh1
@@ -3632,6 +3718,13 @@ if test "$gmp_asm_syntax_testing" != no; then
GMP_ASM_POWERPC_R_REGISTERS
GMP_INCLUDE_MPN(powerpc32/powerpc-defs.m4)
+ # Check for Linux ELFv1 ABI
+ AC_EGREP_CPP(yes,
+[#if _CALL_ELF == 1
+yes
+#endif],
+ [GMP_DEFINE_RAW(["define(<ELFv1_ABI>)"])])
+
# Check for Linux ELFv2 ABI
AC_EGREP_CPP(yes,
[#if _CALL_ELF == 2
@@ -3678,6 +3771,9 @@ yes
;;
X86_PATTERN | X86_64_PATTERN)
GMP_ASM_ALIGN_FILL_0x90
+ if test "$x86_have_mulx" = yes; then
+ GMP_ASM_X86_MULX
+ fi
case $ABI in
32)
GMP_INCLUDE_MPN(x86/x86-defs.m4)
@@ -3752,7 +3848,7 @@ AC_DEFINE_UNQUOTED(GMP_MPARAM_H_SUGGEST, "$gmp_mparam_source",
#
if test -z "$fat_path"; then
for i in SQR_TOOM2_THRESHOLD BMOD_1_TO_MOD_1_THRESHOLD SHLD_SLOW SHRD_SLOW; do
- value=`sed -n 's/^#define '$i'[ ]*\([0-9][0-9]*\).*$/\1/p' $gmp_mparam_source`
+ value=`sed -n 's/^#define '$i'[ ]*\([0-9A-Z][0-9A-Z_]*\).*$/\1/p' $gmp_mparam_source`
if test -n "$value"; then
GMP_DEFINE_RAW(["define(<$i>,<$value>)"])
fi
@@ -3891,15 +3987,7 @@ fi
AC_PROG_YACC
AM_PROG_LEX
-# Configs for demos/expr directory
-#
-# Libtool already runs an AC_CHECK_TOOL for ranlib, but we give
-# AC_PROG_RANLIB anyway since automake is supposed to complain if it's not
-# called. (Automake 1.8.4 doesn't, at least not when the only library is in
-# an EXTRA_LIBRARIES.)
-#
-AC_PROG_RANLIB
-
+LT_INIT
# Create config.m4.
GMP_FINISH
@@ -3917,7 +4005,7 @@ AC_OUTPUT(Makefile \
tests/cxx/Makefile \
doc/Makefile tune/Makefile \
demos/Makefile demos/calc/Makefile demos/expr/Makefile \
- gmp.h:gmp-h.in)
+ gmp.h:gmp-h.in gmp.pc:gmp.pc.in gmpxx.pc:gmpxx.pc.in)
AC_MSG_NOTICE([summary of build options:
@@ -3929,15 +4017,3 @@ AC_MSG_NOTICE([summary of build options:
Static libraries: ${enable_static}
Shared libraries: ${enable_shared}
])
-
-if test x$cross_compiling = xyes ; then
- case "$host" in
- *-*-mingw* | *-*-cygwin)
- if test x$ABI = x64 ; then
- AC_MSG_NOTICE([If wine64 is installed, use make check TESTS_ENVIRONMENT=wine64.])
- else
- AC_MSG_NOTICE([If wine is installed, use make check TESTS_ENVIRONMENT=wine.])
- fi
- ;;
- esac
-fi
diff --git a/Build/source/libs/gmp/gmp-src/errno.c b/Build/source/libs/gmp/gmp-src/errno.c
index d3c02ef4b82..b4be555018b 100644
--- a/Build/source/libs/gmp/gmp-src/errno.c
+++ b/Build/source/libs/gmp/gmp-src/errno.c
@@ -33,24 +33,26 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdlib.h>
-#include "gmp.h"
-#include "gmp-impl.h"
-int gmp_errno = 0;
+#include <signal.h>
+#include "gmp-impl.h"
-/* The deliberate divide by zero triggers an exception on most systems. On
- those where it doesn't, for example power and powerpc, use abort instead.
+int gmp_errno = 0;
- Enhancement: Perhaps raise(SIGFPE) (or the same with kill()) would be
- better than abort. Perhaps it'd be possible to get the BSD style
- FPE_INTDIV_TRAP parameter in there too. */
+/* Use SIGFPE on systems which have it. Otherwise, deliberate divide
+ by zero, which triggers an exception on most systems. On those
+ where it doesn't, for example power and powerpc, use abort instead. */
void
__gmp_exception (int error_bit)
{
gmp_errno |= error_bit;
+#ifdef SIGFPE
+ raise (SIGFPE);
+#else
__gmp_junk = 10 / __gmp_0;
+#endif
abort ();
}
diff --git a/Build/source/libs/gmp/gmp-src/extract-dbl.c b/Build/source/libs/gmp/gmp-src/extract-dbl.c
index a6e7bf94681..e44d6faa8a6 100644
--- a/Build/source/libs/gmp/gmp-src/extract-dbl.c
+++ b/Build/source/libs/gmp/gmp-src/extract-dbl.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#ifdef XDEBUG
diff --git a/Build/source/libs/gmp/gmp-src/gen-bases.c b/Build/source/libs/gmp/gmp-src/gen-bases.c
index 4d4b0db8ace..5f5e7ed3a97 100644
--- a/Build/source/libs/gmp/gmp-src/gen-bases.c
+++ b/Build/source/libs/gmp/gmp-src/gen-bases.c
@@ -1,7 +1,7 @@
/* Generate mp_bases data.
-Copyright 1991, 1993, 1994, 1996, 2000, 2002, 2004, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2002, 2004, 2011, 2012,
+2015-2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -33,9 +33,11 @@ see https://www.gnu.org/licenses/. */
int chars_per_limb;
+int big_base_ctz;
mpz_t big_base;
int normalization_steps;
mpz_t big_base_inverted;
+mpz_t big_base_binverted;
mpz_t t;
@@ -51,19 +53,27 @@ ulog2 (unsigned int x)
}
void
+binvert (int numb_bits)
+{
+ mpz_t bbo;
+
+ mpz_init_set (bbo, big_base);
+ big_base_ctz = mpz_make_odd (bbo);
+ mpz_invert_2exp (big_base_binverted, bbo, numb_bits);
+}
+
+void
generate (int limb_bits, int nail_bits, int base)
{
int numb_bits = limb_bits - nail_bits;
mpz_set_ui (t, 1L);
mpz_mul_2exp (t, t, numb_bits);
- mpz_set_ui (big_base, 1L);
+ mpz_set_ui (big_base, (long) base);
chars_per_limb = 0;
- for (;;)
+ while (mpz_cmp (big_base, t) <= 0)
{
mpz_mul_ui (big_base, big_base, (long) base);
- if (mpz_cmp (big_base, t) > 0)
- break;
chars_per_limb++;
}
@@ -74,9 +84,9 @@ generate (int limb_bits, int nail_bits, int base)
mpz_set_ui (t, 1L);
mpz_mul_2exp (t, t, 2*limb_bits - normalization_steps);
mpz_tdiv_q (big_base_inverted, t, big_base);
- mpz_set_ui (t, 1L);
- mpz_mul_2exp (t, t, limb_bits);
- mpz_sub (big_base_inverted, big_base_inverted, t);
+ mpz_clrbit (big_base_inverted, limb_bits);
+
+ binvert (numb_bits);
}
void
@@ -94,12 +104,16 @@ header (int limb_bits, int nail_bits)
printf ("\n");
printf ("/* mp_bases[10] data, as literal values */\n");
printf ("#define MP_BASES_CHARS_PER_LIMB_10 %d\n", chars_per_limb);
+ printf ("#define MP_BASES_BIG_BASE_CTZ_10 %d\n", big_base_ctz);
printf ("#define MP_BASES_BIG_BASE_10 CNST_LIMB(0x");
mpz_out_str (stdout, 16, big_base);
printf (")\n");
printf ("#define MP_BASES_BIG_BASE_INVERTED_10 CNST_LIMB(0x");
mpz_out_str (stdout, 16, big_base_inverted);
printf (")\n");
+ printf ("#define MP_BASES_BIG_BASE_BINVERTED_10 CNST_LIMB(0x");
+ mpz_out_str (stdout, 16, big_base_binverted);
+ printf (")\n");
printf ("#define MP_BASES_NORMALIZATION_STEPS_10 %d\n", normalization_steps);
}
@@ -113,13 +127,13 @@ mp_2logb (mpz_t r, int bi, int prec)
mpz_t t, t2, two, b;
int i;
- mpz_init_set_ui (t, 1);
- mpz_mul_2exp (t, t, prec+EXTRA);
+ mpz_init (t);
+ mpz_setbit (t, prec + EXTRA);
mpz_init (t2);
- mpz_init_set_ui (two, 2);
- mpz_mul_2exp (two, two, prec+EXTRA);
+ mpz_init (two);
+ mpz_setbit (two, prec + EXTRA + 1);
mpz_set_ui (r, 0);
@@ -137,7 +151,7 @@ mp_2logb (mpz_t r, int bi, int prec)
if (mpz_cmp (t2, two) < 0) /* not too large? */
{
mpz_setbit (r, i); /* set next less significant bit */
- mpz_set (t, t2); /* new value acceptable */
+ mpz_swap (t, t2); /* new value acceptable */
}
}
@@ -161,7 +175,6 @@ table (int limb_bits, int nail_bits)
printf ("/* This file generated by gen-bases.c - DO NOT EDIT. */\n");
printf ("\n");
- printf ("#include \"gmp.h\"\n");
printf ("#include \"gmp-impl.h\"\n");
printf ("\n");
printf ("#if GMP_NUMB_BITS != %d\n", numb_bits);
@@ -217,6 +230,7 @@ main (int argc, char **argv)
mpz_init (big_base);
mpz_init (big_base_inverted);
+ mpz_init (big_base_binverted);
mpz_init (t);
if (argc != 4)
diff --git a/Build/source/libs/gmp/gmp-src/gen-fac.c b/Build/source/libs/gmp/gmp-src/gen-fac.c
index 932b7259334..93ebf7b97e7 100644
--- a/Build/source/libs/gmp/gmp-src/gen-fac.c
+++ b/Build/source/libs/gmp/gmp-src/gen-fac.c
@@ -1,6 +1,6 @@
/* Generate data for combinatorics: fac_ui, bin_uiui, ...
-Copyright 2002, 2011-2015 Free Software Foundation, Inc.
+Copyright 2002, 2011-2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -43,19 +43,19 @@ mpz_remove_twos (mpz_t x)
/* returns 0 on success */
int
-gen_consts (int numb, int nail, int limb)
+gen_consts (unsigned numb, unsigned limb)
{
mpz_t x, mask, y, last;
unsigned long a, b;
unsigned long ofl, ofe;
printf ("/* This file is automatically generated by gen-fac.c */\n\n");
- printf ("#if GMP_NUMB_BITS != %d\n", numb);
- printf ("Error , error this data is for %d GMP_NUMB_BITS only\n", numb);
+ printf ("#if GMP_NUMB_BITS != %u\n", numb);
+ printf ("Error , error this data is for %u GMP_NUMB_BITS only\n", numb);
printf ("#endif\n");
#if 0
- printf ("#if GMP_LIMB_BITS != %d\n", limb);
- printf ("Error , error this data is for %d GMP_LIMB_BITS only\n", limb);
+ printf ("#if GMP_LIMB_BITS != %u\n", limb);
+ printf ("Error , error this data is for %u GMP_LIMB_BITS only\n", limb);
printf ("#endif\n");
#endif
@@ -101,7 +101,7 @@ gen_consts (int numb, int nail, int limb)
ofl = b - 1;
printf
("#define ODD_FACTORIAL_TABLE_LIMIT (%lu)\n", ofl);
- mpz_init2 (mask, numb + 1);
+ mpz_init (mask);
mpz_setbit (mask, numb);
mpz_sub_ui (mask, mask, 1);
printf
@@ -280,6 +280,6 @@ main (int argc, char *argv[])
nail_bits);
exit (1);
}
- gen_consts (numb_bits, nail_bits, limb_bits);
+ gen_consts (numb_bits, limb_bits);
return 0;
}
diff --git a/Build/source/libs/gmp/gmp-src/gen-trialdivtab.c b/Build/source/libs/gmp/gmp-src/gen-trialdivtab.c
index f1babefacc2..218c3220e4a 100644
--- a/Build/source/libs/gmp/gmp-src/gen-trialdivtab.c
+++ b/Build/source/libs/gmp/gmp-src/gen-trialdivtab.c
@@ -2,7 +2,7 @@
Contributed to the GNU project by Torbjorn Granlund.
-Copyright 2009, 2012, 2013 Free Software Foundation, Inc.
+Copyright 2009, 2012, 2013, 2016, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -59,7 +59,7 @@ mpz_t B;
int
main (int argc, char *argv[])
{
- unsigned long t, p;
+ int t, p;
mpz_t ppp, acc, inv, gmp_numb_max, tmp, Bhalf;
mpz_t pre[7];
int i;
@@ -91,15 +91,16 @@ main (int argc, char *argv[])
for (i = 0; i < 7; i++)
mpz_init (pre[i]);
- mpz_init_set_ui (gmp_numb_max, 1);
- mpz_mul_2exp (gmp_numb_max, gmp_numb_max, limb_bits);
+ mpz_init (B);
+ mpz_setbit (B, limb_bits);
+ mpz_init_set (gmp_numb_max, B);
mpz_sub_ui (gmp_numb_max, gmp_numb_max, 1);
mpz_init (tmp);
mpz_init (inv);
- mpz_init_set_ui (B, 1); mpz_mul_2exp (B, B, limb_bits);
- mpz_init_set_ui (Bhalf, 1); mpz_mul_2exp (Bhalf, Bhalf, limb_bits - 1);
+ mpz_init (Bhalf);
+ mpz_setbit (Bhalf, limb_bits - 1);
start_p = 3;
diff --git a/Build/source/libs/gmp/gmp-src/gmp-h.in b/Build/source/libs/gmp/gmp-src/gmp-h.in
index fea20958a0a..d8ce7fdb6de 100644
--- a/Build/source/libs/gmp/gmp-src/gmp-h.in
+++ b/Build/source/libs/gmp/gmp-src/gmp-h.in
@@ -1,6 +1,6 @@
/* Definitions for GNU multiple precision functions. -*- mode: c -*-
-Copyright 1991, 1993-1997, 1999-2016 Free Software Foundation, Inc.
+Copyright 1991, 1993-1997, 1999-2016, 2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -341,7 +341,11 @@ typedef __mpq_struct *mpq_ptr;
__GMP_ATTRIBUTE_PURE. */
#if defined (__cplusplus)
+#if __cplusplus >= 201103L
+#define __GMP_NOTHROW noexcept
+#else
#define __GMP_NOTHROW throw ()
+#endif
#else
#define __GMP_NOTHROW
#endif
@@ -845,13 +849,13 @@ __GMP_DECLSPEC mp_bitcnt_t mpz_hamdist (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __
__GMP_DECLSPEC void mpz_import (mpz_ptr, size_t, int, size_t, int, size_t, const void *);
#define mpz_init __gmpz_init
-__GMP_DECLSPEC void mpz_init (mpz_ptr);
+__GMP_DECLSPEC void mpz_init (mpz_ptr) __GMP_NOTHROW;
#define mpz_init2 __gmpz_init2
__GMP_DECLSPEC void mpz_init2 (mpz_ptr, mp_bitcnt_t);
#define mpz_inits __gmpz_inits
-__GMP_DECLSPEC void mpz_inits (mpz_ptr, ...);
+__GMP_DECLSPEC void mpz_inits (mpz_ptr, ...) __GMP_NOTHROW;
#define mpz_init_set __gmpz_init_set
__GMP_DECLSPEC void mpz_init_set (mpz_ptr, mpz_srcptr);
@@ -1512,6 +1516,9 @@ __GMP_DECLSPEC mp_limb_t mpn_div_qr_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_
#define mpn_gcd __MPN(gcd)
__GMP_DECLSPEC mp_size_t mpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
+#define mpn_gcd_11 __MPN(gcd_11)
+__GMP_DECLSPEC mp_limb_t mpn_gcd_11 (mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+
#define mpn_gcd_1 __MPN(gcd_1)
__GMP_DECLSPEC mp_limb_t mpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
@@ -1840,7 +1847,7 @@ mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW
mp_bitcnt_t __gmp_result;
__gmp_usize = __gmp_u->_mp_size;
- __gmp_result = (__gmp_usize < 0 ? ULONG_MAX : 0);
+ __gmp_result = (__gmp_usize < 0 ? ~ __GMP_CAST (mp_bitcnt_t, 0) : __GMP_CAST (mp_bitcnt_t, 0));
if (__GMP_LIKELY (__gmp_usize > 0))
__gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize);
return __gmp_result;
@@ -2321,8 +2328,8 @@ enum
/* Major version number is the value of __GNU_MP__ too, above. */
#define __GNU_MP_VERSION 6
-#define __GNU_MP_VERSION_MINOR 1
-#define __GNU_MP_VERSION_PATCHLEVEL 2
+#define __GNU_MP_VERSION_MINOR 2
+#define __GNU_MP_VERSION_PATCHLEVEL 0
#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 dcc233bb443..8192dac2177 100644
--- a/Build/source/libs/gmp/gmp-src/gmp-impl.h
+++ b/Build/source/libs/gmp/gmp-src/gmp-impl.h
@@ -3,7 +3,7 @@
THE CONTENTS OF THIS FILE ARE FOR INTERNAL USE AND ARE ALMOST CERTAIN TO
BE SUBJECT TO INCOMPATIBLE CHANGES IN FUTURE GNU MP RELEASES.
-Copyright 1991, 1993-1997, 1999-2015 Free Software Foundation, Inc.
+Copyright 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -91,8 +91,8 @@ see https://www.gnu.org/licenses/. */
__GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)
#define DECL_divrem_1(name) \
__GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)
-#define DECL_gcd_1(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t)
+#define DECL_gcd_11(name) \
+ __GMP_DECLSPEC mp_limb_t name (mp_limb_t, mp_limb_t)
#define DECL_lshift(name) \
__GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, unsigned)
#define DECL_lshiftc(name) \
@@ -142,6 +142,7 @@ see https://www.gnu.org/licenses/. */
#if ! defined (__GMP_WITHIN_CONFIGURE)
#include "config.h"
+#include "gmp.h"
#include "gmp-mparam.h"
#include "fib_table.h"
#include "fac_table.h"
@@ -340,10 +341,10 @@ extern "C" {
TMP_MARK was made, but then no TMP_ALLOCs. */
/* The alignment in bytes, used for TMP_ALLOCed blocks, when alloca or
- __gmp_allocate_func doesn't already determine it. Currently TMP_ALLOC
- isn't used for "double"s, so that's not in the union. */
+ __gmp_allocate_func doesn't already determine it. */
union tmp_align_t {
mp_limb_t l;
+ double d;
char *p;
};
#define __TMP_ALIGN sizeof (union tmp_align_t)
@@ -837,168 +838,255 @@ __GMP_DECLSPEC mp_limb_t mpn_addmul_8 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
#define mpn_addmul_2s __MPN(addmul_2s)
__GMP_DECLSPEC mp_limb_t mpn_addmul_2s (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-/* mpn_addlsh1_n(c,a,b,n), when it exists, sets {c,n} to {a,n}+2*{b,n}, and
- returns the carry out (0, 1 or 2). Use _ip1 when a=c. */
-#ifndef mpn_addlsh1_n /* if not done with cpuvec in a fat binary */
+/* Override mpn_addlsh1_n, mpn_addlsh2_n, mpn_sublsh1_n, etc with mpn_addlsh_n,
+ etc when !HAVE_NATIVE the former but HAVE_NATIVE_ the latter. Similarly,
+ override foo_ip1 functions with foo. We then lie and say these macros
+ represent native functions, but leave a trace by using the value 2 rather
+ than 1. */
+
+#if HAVE_NATIVE_mpn_addlsh_n && ! HAVE_NATIVE_mpn_addlsh1_n
+#define mpn_addlsh1_n(a,b,c,d) mpn_addlsh_n(a,b,c,d,1)
+#define HAVE_NATIVE_mpn_addlsh1_n 2
+#endif
+
+#if HAVE_NATIVE_mpn_addlsh_nc && ! HAVE_NATIVE_mpn_addlsh1_nc
+#define mpn_addlsh1_nc(a,b,c,d,x) mpn_addlsh_nc(a,b,c,d,1,x)
+#define HAVE_NATIVE_mpn_addlsh1_nc 2
+#endif
+
+#if HAVE_NATIVE_mpn_addlsh1_n && ! HAVE_NATIVE_mpn_addlsh1_n_ip1
+#define mpn_addlsh1_n_ip1(a,b,n) mpn_addlsh1_n(a,a,b,n)
+#define HAVE_NATIVE_mpn_addlsh1_n_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_addlsh1_nc && ! HAVE_NATIVE_mpn_addlsh1_nc_ip1
+#define mpn_addlsh1_nc_ip1(a,b,n,c) mpn_addlsh1_nc(a,a,b,n,c)
+#define HAVE_NATIVE_mpn_addlsh1_nc_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_addlsh_n && ! HAVE_NATIVE_mpn_addlsh2_n
+#define mpn_addlsh2_n(a,b,c,d) mpn_addlsh_n(a,b,c,d,2)
+#define HAVE_NATIVE_mpn_addlsh2_n 2
+#endif
+
+#if HAVE_NATIVE_mpn_addlsh_nc && ! HAVE_NATIVE_mpn_addlsh2_nc
+#define mpn_addlsh2_nc(a,b,c,d,x) mpn_addlsh_nc(a,b,c,d,2,x)
+#define HAVE_NATIVE_mpn_addlsh2_nc 2
+#endif
+
+#if HAVE_NATIVE_mpn_addlsh2_n && ! HAVE_NATIVE_mpn_addlsh2_n_ip1
+#define mpn_addlsh2_n_ip1(a,b,n) mpn_addlsh2_n(a,a,b,n)
+#define HAVE_NATIVE_mpn_addlsh2_n_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_addlsh2_nc && ! HAVE_NATIVE_mpn_addlsh2_nc_ip1
+#define mpn_addlsh2_nc_ip1(a,b,n,c) mpn_addlsh2_nc(a,a,b,n,c)
+#define HAVE_NATIVE_mpn_addlsh2_nc_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_sublsh_n && ! HAVE_NATIVE_mpn_sublsh1_n
+#define mpn_sublsh1_n(a,b,c,d) mpn_sublsh_n(a,b,c,d,1)
+#define HAVE_NATIVE_mpn_sublsh1_n 2
+#endif
+
+#if HAVE_NATIVE_mpn_sublsh_nc && ! HAVE_NATIVE_mpn_sublsh1_nc
+#define mpn_sublsh1_nc(a,b,c,d,x) mpn_sublsh_nc(a,b,c,d,1,x)
+#define HAVE_NATIVE_mpn_sublsh1_nc 2
+#endif
+
+#if HAVE_NATIVE_mpn_sublsh1_n && ! HAVE_NATIVE_mpn_sublsh1_n_ip1
+#define mpn_sublsh1_n_ip1(a,b,n) mpn_sublsh1_n(a,a,b,n)
+#define HAVE_NATIVE_mpn_sublsh1_n_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_sublsh1_nc && ! HAVE_NATIVE_mpn_sublsh1_nc_ip1
+#define mpn_sublsh1_nc_ip1(a,b,n,c) mpn_sublsh1_nc(a,a,b,n,c)
+#define HAVE_NATIVE_mpn_sublsh1_nc_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_sublsh_n && ! HAVE_NATIVE_mpn_sublsh2_n
+#define mpn_sublsh2_n(a,b,c,d) mpn_sublsh_n(a,b,c,d,2)
+#define HAVE_NATIVE_mpn_sublsh2_n 2
+#endif
+
+#if HAVE_NATIVE_mpn_sublsh_nc && ! HAVE_NATIVE_mpn_sublsh2_nc
+#define mpn_sublsh2_nc(a,b,c,d,x) mpn_sublsh_nc(a,b,c,d,2,x)
+#define HAVE_NATIVE_mpn_sublsh2_nc 2
+#endif
+
+#if HAVE_NATIVE_mpn_sublsh2_n && ! HAVE_NATIVE_mpn_sublsh2_n_ip1
+#define mpn_sublsh2_n_ip1(a,b,n) mpn_sublsh2_n(a,a,b,n)
+#define HAVE_NATIVE_mpn_sublsh2_n_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_sublsh2_nc && ! HAVE_NATIVE_mpn_sublsh2_nc_ip1
+#define mpn_sublsh2_nc_ip1(a,b,n,c) mpn_sublsh2_nc(a,a,b,n,c)
+#define HAVE_NATIVE_mpn_sublsh2_nc_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_rsblsh_n && ! HAVE_NATIVE_mpn_rsblsh1_n
+#define mpn_rsblsh1_n(a,b,c,d) mpn_rsblsh_n(a,b,c,d,1)
+#define HAVE_NATIVE_mpn_rsblsh1_n 2
+#endif
+
+#if HAVE_NATIVE_mpn_rsblsh_nc && ! HAVE_NATIVE_mpn_rsblsh1_nc
+#define mpn_rsblsh1_nc(a,b,c,d,x) mpn_rsblsh_nc(a,b,c,d,1,x)
+#define HAVE_NATIVE_mpn_rsblsh1_nc 2
+#endif
+
+#if HAVE_NATIVE_mpn_rsblsh1_n && ! HAVE_NATIVE_mpn_rsblsh1_n_ip1
+#define mpn_rsblsh1_n_ip1(a,b,n) mpn_rsblsh1_n(a,a,b,n)
+#define HAVE_NATIVE_mpn_rsblsh1_n_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_rsblsh1_nc && ! HAVE_NATIVE_mpn_rsblsh1_nc_ip1
+#define mpn_rsblsh1_nc_ip1(a,b,n,c) mpn_rsblsh1_nc(a,a,b,n,c)
+#define HAVE_NATIVE_mpn_rsblsh1_nc_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_rsblsh_n && ! HAVE_NATIVE_mpn_rsblsh2_n
+#define mpn_rsblsh2_n(a,b,c,d) mpn_rsblsh_n(a,b,c,d,2)
+#define HAVE_NATIVE_mpn_rsblsh2_n 2
+#endif
+
+#if HAVE_NATIVE_mpn_rsblsh_nc && ! HAVE_NATIVE_mpn_rsblsh2_nc
+#define mpn_rsblsh2_nc(a,b,c,d,x) mpn_rsblsh_nc(a,b,c,d,2,x)
+#define HAVE_NATIVE_mpn_rsblsh2_nc 2
+#endif
+
+#if HAVE_NATIVE_mpn_rsblsh2_n && ! HAVE_NATIVE_mpn_rsblsh2_n_ip1
+#define mpn_rsblsh2_n_ip1(a,b,n) mpn_rsblsh2_n(a,a,b,n)
+#define HAVE_NATIVE_mpn_rsblsh2_n_ip1 2
+#endif
+
+#if HAVE_NATIVE_mpn_rsblsh2_nc && ! HAVE_NATIVE_mpn_rsblsh2_nc_ip1
+#define mpn_rsblsh2_nc_ip1(a,b,n,c) mpn_rsblsh2_nc(a,a,b,n,c)
+#define HAVE_NATIVE_mpn_rsblsh2_nc_ip1 2
+#endif
+
+
+#ifndef mpn_addlsh1_n
#define mpn_addlsh1_n __MPN(addlsh1_n)
__GMP_DECLSPEC mp_limb_t mpn_addlsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
#endif
+#ifndef mpn_addlsh1_nc
#define mpn_addlsh1_nc __MPN(addlsh1_nc)
__GMP_DECLSPEC mp_limb_t mpn_addlsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-#if HAVE_NATIVE_mpn_addlsh1_n && ! HAVE_NATIVE_mpn_addlsh1_n_ip1
-#define mpn_addlsh1_n_ip1(dst,src,n) mpn_addlsh1_n(dst,dst,src,n)
-#define HAVE_NATIVE_mpn_addlsh1_n_ip1 1
-#else
+#endif
+#ifndef mpn_addlsh1_n_ip1
#define mpn_addlsh1_n_ip1 __MPN(addlsh1_n_ip1)
__GMP_DECLSPEC mp_limb_t mpn_addlsh1_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
#endif
-#if HAVE_NATIVE_mpn_addlsh1_nc && ! HAVE_NATIVE_mpn_addlsh1_nc_ip1
-#define mpn_addlsh1_nc_ip1(dst,src,n,c) mpn_addlsh1_nc(dst,dst,src,n,c)
-#define HAVE_NATIVE_mpn_addlsh1_nc_ip1 1
-#else
+#ifndef mpn_addlsh1_nc_ip1
#define mpn_addlsh1_nc_ip1 __MPN(addlsh1_nc_ip1)
__GMP_DECLSPEC mp_limb_t mpn_addlsh1_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
#endif
-#ifndef mpn_addlsh2_n /* if not done with cpuvec in a fat binary */
-/* mpn_addlsh2_n(c,a,b,n), when it exists, sets {c,n} to {a,n}+4*{b,n}, and
- returns the carry out (0, ..., 4). Use _ip1 when a=c. */
+#ifndef mpn_addlsh2_n
#define mpn_addlsh2_n __MPN(addlsh2_n)
__GMP_DECLSPEC mp_limb_t mpn_addlsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
#endif
+#ifndef mpn_addlsh2_nc
#define mpn_addlsh2_nc __MPN(addlsh2_nc)
__GMP_DECLSPEC mp_limb_t mpn_addlsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-#if HAVE_NATIVE_mpn_addlsh2_n && ! HAVE_NATIVE_mpn_addlsh2_n_ip1
-#define mpn_addlsh2_n_ip1(dst,src,n) mpn_addlsh2_n(dst,dst,src,n)
-#define HAVE_NATIVE_mpn_addlsh2_n_ip1 1
-#else
+#endif
+#ifndef mpn_addlsh2_n_ip1
#define mpn_addlsh2_n_ip1 __MPN(addlsh2_n_ip1)
__GMP_DECLSPEC mp_limb_t mpn_addlsh2_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
#endif
-#if HAVE_NATIVE_mpn_addlsh2_nc && ! HAVE_NATIVE_mpn_addlsh2_nc_ip1
-#define mpn_addlsh2_nc_ip1(dst,src,n,c) mpn_addlsh2_nc(dst,dst,src,n,c)
-#define HAVE_NATIVE_mpn_addlsh2_nc_ip1 1
-#else
+#ifndef mpn_addlsh2_nc_ip1
#define mpn_addlsh2_nc_ip1 __MPN(addlsh2_nc_ip1)
__GMP_DECLSPEC mp_limb_t mpn_addlsh2_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
#endif
-/* mpn_addlsh_n(c,a,b,n,k), when it exists, sets {c,n} to {a,n}+2^k*{b,n}, and
- returns the carry out (0, ..., 2^k). Use _ip1 when a=c. */
+#ifndef mpn_addlsh_n
#define mpn_addlsh_n __MPN(addlsh_n)
__GMP_DECLSPEC mp_limb_t mpn_addlsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
+#endif
+#ifndef mpn_addlsh_nc
#define mpn_addlsh_nc __MPN(addlsh_nc)
__GMP_DECLSPEC mp_limb_t mpn_addlsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
-#if HAVE_NATIVE_mpn_addlsh_n && ! HAVE_NATIVE_mpn_addlsh_n_ip1
-#define mpn_addlsh_n_ip1(dst,src,n,s) mpn_addlsh_n(dst,dst,src,n,s)
-#define HAVE_NATIVE_mpn_addlsh_n_ip1 1
-#else
+#endif
+#ifndef mpn_addlsh_n_ip1
#define mpn_addlsh_n_ip1 __MPN(addlsh_n_ip1)
__GMP_DECLSPEC mp_limb_t mpn_addlsh_n_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
#endif
-#if HAVE_NATIVE_mpn_addlsh_nc && ! HAVE_NATIVE_mpn_addlsh_nc_ip1
-#define mpn_addlsh_nc_ip1(dst,src,n,s,c) mpn_addlsh_nc(dst,dst,src,n,s,c)
-#define HAVE_NATIVE_mpn_addlsh_nc_ip1 1
-#else
+#ifndef mpn_addlsh_nc_ip1
#define mpn_addlsh_nc_ip1 __MPN(addlsh_nc_ip1)
__GMP_DECLSPEC mp_limb_t mpn_addlsh_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
#endif
-#ifndef mpn_sublsh1_n /* if not done with cpuvec in a fat binary */
-/* mpn_sublsh1_n(c,a,b,n), when it exists, sets {c,n} to {a,n}-2*{b,n}, and
- returns the borrow out (0, 1 or 2). Use _ip1 when a=c. */
+#ifndef mpn_sublsh1_n
#define mpn_sublsh1_n __MPN(sublsh1_n)
__GMP_DECLSPEC mp_limb_t mpn_sublsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
#endif
+#ifndef mpn_sublsh1_nc
#define mpn_sublsh1_nc __MPN(sublsh1_nc)
__GMP_DECLSPEC mp_limb_t mpn_sublsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-#if HAVE_NATIVE_mpn_sublsh1_n && ! HAVE_NATIVE_mpn_sublsh1_n_ip1
-#define mpn_sublsh1_n_ip1(dst,src,n) mpn_sublsh1_n(dst,dst,src,n)
-#define HAVE_NATIVE_mpn_sublsh1_n_ip1 1
-#else
+#endif
+#ifndef mpn_sublsh1_n_ip1
#define mpn_sublsh1_n_ip1 __MPN(sublsh1_n_ip1)
__GMP_DECLSPEC mp_limb_t mpn_sublsh1_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
#endif
-#if HAVE_NATIVE_mpn_sublsh1_nc && ! HAVE_NATIVE_mpn_sublsh1_nc_ip1
-#define mpn_sublsh1_nc_ip1(dst,src,n,c) mpn_sublsh1_nc(dst,dst,src,n,c)
-#define HAVE_NATIVE_mpn_sublsh1_nc_ip1 1
-#else
+#ifndef mpn_sublsh1_nc_ip1
#define mpn_sublsh1_nc_ip1 __MPN(sublsh1_nc_ip1)
__GMP_DECLSPEC mp_limb_t mpn_sublsh1_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
#endif
-/* mpn_rsblsh1_n(c,a,b,n), when it exists, sets {c,n} to 2*{b,n}-{a,n}, and
- returns the carry out (-1, 0, 1). */
-#define mpn_rsblsh1_n __MPN(rsblsh1_n)
-__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_rsblsh1_nc __MPN(rsblsh1_nc)
-__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-/* mpn_sublsh2_n(c,a,b,n), when it exists, sets {c,n} to {a,n}-4*{b,n}, and
- returns the borrow out (0, ..., 4). Use _ip1 when a=c. */
+#ifndef mpn_sublsh2_n
#define mpn_sublsh2_n __MPN(sublsh2_n)
__GMP_DECLSPEC mp_limb_t mpn_sublsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+#endif
+#ifndef mpn_sublsh2_nc
#define mpn_sublsh2_nc __MPN(sublsh2_nc)
__GMP_DECLSPEC mp_limb_t mpn_sublsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-#if HAVE_NATIVE_mpn_sublsh2_n && ! HAVE_NATIVE_mpn_sublsh2_n_ip1
-#define mpn_sublsh2_n_ip1(dst,src,n) mpn_sublsh2_n(dst,dst,src,n)
-#define HAVE_NATIVE_mpn_sublsh2_n_ip1 1
-#else
+#endif
+#ifndef mpn_sublsh2_n_ip1
#define mpn_sublsh2_n_ip1 __MPN(sublsh2_n_ip1)
__GMP_DECLSPEC mp_limb_t mpn_sublsh2_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
#endif
-#if HAVE_NATIVE_mpn_sublsh2_nc && ! HAVE_NATIVE_mpn_sublsh2_nc_ip1
-#define mpn_sublsh2_nc_ip1(dst,src,n,c) mpn_sublsh2_nc(dst,dst,src,n,c)
-#define HAVE_NATIVE_mpn_sublsh2_nc_ip1 1
-#else
+#ifndef mpn_sublsh2_nc_ip1
#define mpn_sublsh2_nc_ip1 __MPN(sublsh2_nc_ip1)
__GMP_DECLSPEC mp_limb_t mpn_sublsh2_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
#endif
-/* mpn_sublsh_n(c,a,b,n,k), when it exists, sets {c,n} to {a,n}-2^k*{b,n}, and
- returns the carry out (0, ..., 2^k). Use _ip1 when a=c. */
+#ifndef mpn_sublsh_n
#define mpn_sublsh_n __MPN(sublsh_n)
__GMP_DECLSPEC mp_limb_t mpn_sublsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
-#if HAVE_NATIVE_mpn_sublsh_n && ! HAVE_NATIVE_mpn_sublsh_n_ip1
-#define mpn_sublsh_n_ip1(dst,src,n,s) mpn_sublsh_n(dst,dst,src,n,s)
-#define HAVE_NATIVE_mpn_sublsh_n_ip1 1
-#else
+#endif
+#ifndef mpn_sublsh_nc
+#define mpn_sublsh_nc __MPN(sublsh_nc)
+__GMP_DECLSPEC mp_limb_t mpn_sublsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
+#endif
+#ifndef mpn_sublsh_n_ip1
#define mpn_sublsh_n_ip1 __MPN(sublsh_n_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh_n_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+ __GMP_DECLSPEC mp_limb_t mpn_sublsh_n_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
#endif
-#if HAVE_NATIVE_mpn_sublsh_nc && ! HAVE_NATIVE_mpn_sublsh_nc_ip1
-#define mpn_sublsh_nc_ip1(dst,src,n,s,c) mpn_sublsh_nc(dst,dst,src,n,s,c)
-#define HAVE_NATIVE_mpn_sublsh_nc_ip1 1
-#else
+#ifndef mpn_sublsh_nc_ip1
#define mpn_sublsh_nc_ip1 __MPN(sublsh_nc_ip1)
__GMP_DECLSPEC mp_limb_t mpn_sublsh_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
#endif
-/* mpn_rsblsh2_n(c,a,b,n), when it exists, sets {c,n} to 4*{b,n}-{a,n}, and
- returns the carry out (-1, ..., 3). */
+#define mpn_rsblsh1_n __MPN(rsblsh1_n)
+__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+#define mpn_rsblsh1_nc __MPN(rsblsh1_nc)
+__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+
#define mpn_rsblsh2_n __MPN(rsblsh2_n)
__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
#define mpn_rsblsh2_nc __MPN(rsblsh2_nc)
__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-/* mpn_rsblsh_n(c,a,b,n,k), when it exists, sets {c,n} to 2^k*{b,n}-{a,n}, and
- returns the carry out (-1, 0, ..., 2^k-1). */
#define mpn_rsblsh_n __MPN(rsblsh_n)
__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
#define mpn_rsblsh_nc __MPN(rsblsh_nc)
__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
-/* mpn_rsh1add_n(c,a,b,n), when it exists, sets {c,n} to ({a,n} + {b,n}) >> 1,
- and returns the bit rshifted out (0 or 1). */
#define mpn_rsh1add_n __MPN(rsh1add_n)
__GMP_DECLSPEC mp_limb_t mpn_rsh1add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
#define mpn_rsh1add_nc __MPN(rsh1add_nc)
__GMP_DECLSPEC mp_limb_t mpn_rsh1add_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-/* mpn_rsh1sub_n(c,a,b,n), when it exists, sets {c,n} to ({a,n} - {b,n}) >> 1,
- and returns the bit rshifted out (0 or 1). If there's a borrow from the
- subtract, it's stored as a 1 in the high bit of c[n-1], like a twos
- complement negative. */
#define mpn_rsh1sub_n __MPN(rsh1sub_n)
__GMP_DECLSPEC mp_limb_t mpn_rsh1sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
#define mpn_rsh1sub_nc __MPN(rsh1sub_nc)
@@ -1045,6 +1133,12 @@ __GMP_DECLSPEC void mpn_dump (mp_srcptr, mp_size_t);
#define mpn_fib2_ui __MPN(fib2_ui)
__GMP_DECLSPEC mp_size_t mpn_fib2_ui (mp_ptr, mp_ptr, unsigned long);
+#define mpn_fib2m __MPN(fib2m)
+__GMP_DECLSPEC int mpn_fib2m (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+
+#define mpn_strongfibo __MPN(strongfibo)
+__GMP_DECLSPEC int mpn_strongfibo (mp_srcptr, mp_size_t, mp_ptr);
+
/* Remap names of internal mpn functions. */
#define __clz_tab __MPN(clz_tab)
#define mpn_udiv_w_sdiv __MPN(udiv_w_sdiv)
@@ -1446,15 +1540,11 @@ __GMP_DECLSPEC mp_limb_t mpn_dcpi1_div_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr,
#define mpn_dcpi1_divappr_q __MPN(dcpi1_divappr_q)
__GMP_DECLSPEC mp_limb_t mpn_dcpi1_divappr_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, gmp_pi1_t *);
-#define mpn_dcpi1_divappr_q_n __MPN(dcpi1_divappr_q_n)
-__GMP_DECLSPEC mp_limb_t mpn_dcpi1_divappr_q_n (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, gmp_pi1_t *, mp_ptr);
#define mpn_mu_div_qr __MPN(mu_div_qr)
__GMP_DECLSPEC mp_limb_t mpn_mu_div_qr (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_mu_div_qr_itch __MPN(mu_div_qr_itch)
__GMP_DECLSPEC mp_size_t mpn_mu_div_qr_itch (mp_size_t, mp_size_t, int) ATTRIBUTE_CONST;
-#define mpn_mu_div_qr_choose_in __MPN(mu_div_qr_choose_in)
-__GMP_DECLSPEC mp_size_t mpn_mu_div_qr_choose_in (mp_size_t, mp_size_t, int);
#define mpn_preinv_mu_div_qr __MPN(preinv_mu_div_qr)
__GMP_DECLSPEC mp_limb_t mpn_preinv_mu_div_qr (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
@@ -1465,11 +1555,6 @@ __GMP_DECLSPEC mp_size_t mpn_preinv_mu_div_qr_itch (mp_size_t, mp_size_t, mp_siz
__GMP_DECLSPEC mp_limb_t mpn_mu_divappr_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_mu_divappr_q_itch __MPN(mu_divappr_q_itch)
__GMP_DECLSPEC mp_size_t mpn_mu_divappr_q_itch (mp_size_t, mp_size_t, int) ATTRIBUTE_CONST;
-#define mpn_mu_divappr_q_choose_in __MPN(mu_divappr_q_choose_in)
-__GMP_DECLSPEC mp_size_t mpn_mu_divappr_q_choose_in (mp_size_t, mp_size_t, int);
-
-#define mpn_preinv_mu_divappr_q __MPN(preinv_mu_divappr_q)
-__GMP_DECLSPEC mp_limb_t mpn_preinv_mu_divappr_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_mu_div_q __MPN(mu_div_q)
__GMP_DECLSPEC mp_limb_t mpn_mu_div_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
@@ -1506,6 +1591,9 @@ __GMP_DECLSPEC mp_limb_t mpn_sbpi1_bdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr
#define mpn_sbpi1_bdiv_q __MPN(sbpi1_bdiv_q)
__GMP_DECLSPEC void mpn_sbpi1_bdiv_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
+#define mpn_sbpi1_bdiv_r __MPN(sbpi1_bdiv_r)
+__GMP_DECLSPEC mp_limb_t mpn_sbpi1_bdiv_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
+
#define mpn_dcpi1_bdiv_qr __MPN(dcpi1_bdiv_qr)
__GMP_DECLSPEC mp_limb_t mpn_dcpi1_bdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
#define mpn_dcpi1_bdiv_qr_n_itch __MPN(dcpi1_bdiv_qr_n_itch)
@@ -1516,11 +1604,6 @@ __GMP_DECLSPEC mp_limb_t mpn_dcpi1_bdiv_qr_n (mp_ptr, mp_ptr, mp_srcptr, mp_size
#define mpn_dcpi1_bdiv_q __MPN(dcpi1_bdiv_q)
__GMP_DECLSPEC void mpn_dcpi1_bdiv_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
-#define mpn_dcpi1_bdiv_q_n __MPN(dcpi1_bdiv_q_n)
-__GMP_DECLSPEC void mpn_dcpi1_bdiv_q_n (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
-#define mpn_dcpi1_bdiv_q_n_itch __MPN(dcpi1_bdiv_q_n_itch)
-__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_q_n_itch (mp_size_t) ATTRIBUTE_CONST;
-
#define mpn_mu_bdiv_qr __MPN(mu_bdiv_qr)
__GMP_DECLSPEC mp_limb_t mpn_mu_bdiv_qr (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_mu_bdiv_qr_itch __MPN(mu_bdiv_qr_itch)
@@ -1565,48 +1648,6 @@ __GMP_DECLSPEC mp_limb_t mpn_sec_pi1_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcpt
__GMP_DECLSPEC void mpn_sec_pi1_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
-/* Override mpn_addlsh1_n, mpn_addlsh2_n, mpn_sublsh1_n, etc with mpn_addlsh_n,
- etc when !HAVE_NATIVE the former but HAVE_NATIVE_ the latter. We then lie
- and say these macros represent native functions, but leave a trace by using
- the value 2 rather than 1. */
-
-#if HAVE_NATIVE_mpn_addlsh_n && ! HAVE_NATIVE_mpn_addlsh1_n
-#undef mpn_addlsh1_n
-#define mpn_addlsh1_n(a,b,c,d) mpn_addlsh_n(a,b,c,d,1)
-#define HAVE_NATIVE_mpn_addlsh1_n 2
-#endif
-
-#if HAVE_NATIVE_mpn_addlsh_n && ! HAVE_NATIVE_mpn_addlsh2_n
-#undef mpn_addlsh2_n
-#define mpn_addlsh2_n(a,b,c,d) mpn_addlsh_n(a,b,c,d,2)
-#define HAVE_NATIVE_mpn_addlsh2_n 2
-#endif
-
-#if HAVE_NATIVE_mpn_sublsh_n && ! HAVE_NATIVE_mpn_sublsh1_n
-#undef mpn_sublsh1_n
-#define mpn_sublsh1_n(a,b,c,d) mpn_sublsh_n(a,b,c,d,1)
-#define HAVE_NATIVE_mpn_sublsh1_n 2
-#endif
-
-#if HAVE_NATIVE_mpn_sublsh_n && ! HAVE_NATIVE_mpn_sublsh2_n
-#undef mpn_sublsh2_n
-#define mpn_sublsh2_n(a,b,c,d) mpn_sublsh_n(a,b,c,d,2)
-#define HAVE_NATIVE_mpn_sublsh2_n 2
-#endif
-
-#if HAVE_NATIVE_mpn_rsblsh_n && ! HAVE_NATIVE_mpn_rsblsh1_n
-#undef mpn_rsblsh1_n
-#define mpn_rsblsh1_n(a,b,c,d) mpn_rsblsh_n(a,b,c,d,1)
-#define HAVE_NATIVE_mpn_rsblsh1_n 2
-#endif
-
-#if HAVE_NATIVE_mpn_rsblsh_n && ! HAVE_NATIVE_mpn_rsblsh2_n
-#undef mpn_rsblsh2_n
-#define mpn_rsblsh2_n(a,b,c,d) mpn_rsblsh_n(a,b,c,d,2)
-#define HAVE_NATIVE_mpn_rsblsh2_n 2
-#endif
-
-
#ifndef DIVEXACT_BY3_METHOD
#if GMP_NUMB_BITS % 2 == 0 && ! defined (HAVE_NATIVE_mpn_divexact_by3c)
#define DIVEXACT_BY3_METHOD 0 /* default to using mpn_bdiv_dbm1c */
@@ -1666,6 +1707,12 @@ __GMP_DECLSPEC mp_size_t mpz_prodlimbs (mpz_ptr, mp_ptr, mp_size_t);
#define mpz_oddfac_1 __gmpz_oddfac_1
__GMP_DECLSPEC void mpz_oddfac_1 (mpz_ptr, mp_limb_t, unsigned);
+#define mpz_stronglucas __gmpz_stronglucas
+__GMP_DECLSPEC int mpz_stronglucas (mpz_srcptr, mpz_ptr, mpz_ptr);
+
+#define mpz_lucas_mod __gmpz_lucas_mod
+__GMP_DECLSPEC int mpz_lucas_mod (mpz_ptr, mpz_ptr, long, mp_bitcnt_t, mpz_srcptr, mpz_ptr, mpz_ptr);
+
#define mpz_inp_str_nowhite __gmpz_inp_str_nowhite
#ifdef _GMP_H_HAVE_FILE
__GMP_DECLSPEC size_t mpz_inp_str_nowhite (mpz_ptr, FILE *, int, int, size_t);
@@ -3662,9 +3709,9 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
mp_limb_t __x = (input); \
__x -= (__x >> 1) & MP_LIMB_T_MAX/3; \
__x = ((__x >> 2) & MP_LIMB_T_MAX/5) + (__x & MP_LIMB_T_MAX/5); \
- __x = ((__x >> 4) + __x) & MP_LIMB_T_MAX/17; \
- __x = ((__x >> 8) + __x); \
- (result) = __x & 0xff; \
+ __x += (__x >> 4); \
+ __x = ((__x >> 8) & MP_LIMB_T_MAX/4369)+(__x & MP_LIMB_T_MAX/4369); \
+ (result) = __x; \
} while (0)
#endif
@@ -3921,6 +3968,14 @@ __GMP_DECLSPEC void __gmp_invalid_operation (void) ATTRIBUTE_NORETURN;
#define PP_FIRST_OMITTED 3
#endif
+typedef struct
+{
+ mp_limb_t d0, d1;
+} mp_double_limb_t;
+
+#define mpn_gcd_22 __MPN (gcd_22)
+__GMP_DECLSPEC mp_double_limb_t mpn_gcd_22 (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t);
+
/* BIT1 means a result value in bit 1 (second least significant bit), with a
zero bit representing +1 and a one bit representing -1. Bits other than
bit 1 are garbage. These are meant to be kept in "int"s, and casts are
@@ -4135,8 +4190,6 @@ mpn_jacobi_update (unsigned bits, unsigned denominator, unsigned q)
/* Matrix multiplication */
#define mpn_matrix22_mul __MPN(matrix22_mul)
__GMP_DECLSPEC void mpn_matrix22_mul (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_matrix22_mul_strassen __MPN(matrix22_mul_strassen)
-__GMP_DECLSPEC void mpn_matrix22_mul_strassen (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_matrix22_mul_itch __MPN(matrix22_mul_itch)
__GMP_DECLSPEC mp_size_t mpn_matrix22_mul_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
@@ -4297,17 +4350,16 @@ struct powers
int base;
};
typedef struct powers powers_t;
-#define mpn_dc_set_str_powtab_alloc(n) ((n) + GMP_LIMB_BITS)
+#define mpn_str_powtab_alloc(n) ((n) + 2 * GMP_LIMB_BITS) /* FIXME: This can perhaps be trimmed */
#define mpn_dc_set_str_itch(n) ((n) + GMP_LIMB_BITS)
-#define mpn_dc_get_str_powtab_alloc(n) ((n) + 2 * GMP_LIMB_BITS)
#define mpn_dc_get_str_itch(n) ((n) + GMP_LIMB_BITS)
+#define mpn_compute_powtab __MPN(compute_powtab)
+__GMP_DECLSPEC size_t mpn_compute_powtab (powers_t *, mp_ptr, mp_size_t, int);
#define mpn_dc_set_str __MPN(dc_set_str)
__GMP_DECLSPEC mp_size_t mpn_dc_set_str (mp_ptr, const unsigned char *, size_t, const powers_t *, mp_ptr);
#define mpn_bc_set_str __MPN(bc_set_str)
__GMP_DECLSPEC mp_size_t mpn_bc_set_str (mp_ptr, const unsigned char *, size_t, int);
-#define mpn_set_str_compute_powtab __MPN(set_str_compute_powtab)
-__GMP_DECLSPEC void mpn_set_str_compute_powtab (powers_t *, mp_ptr, mp_size_t, int);
/* __GMPF_BITS_TO_PREC applies a minimum 53 bits, rounds upwards to a whole
@@ -4615,7 +4667,7 @@ struct cpuvec_t {
DECL_copyi ((*copyi));
DECL_divexact_1 ((*divexact_1));
DECL_divrem_1 ((*divrem_1));
- DECL_gcd_1 ((*gcd_1));
+ DECL_gcd_11 ((*gcd_11));
DECL_lshift ((*lshift));
DECL_lshiftc ((*lshiftc));
DECL_mod_1 ((*mod_1));
@@ -4897,6 +4949,10 @@ extern mp_size_t redc_1_to_redc_n_threshold;
#define MATRIX22_STRASSEN_THRESHOLD matrix22_strassen_threshold
extern mp_size_t matrix22_strassen_threshold;
+typedef int hgcd2_func_t (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t,
+ struct hgcd_matrix1 *);
+extern hgcd2_func_t *hgcd2_func;
+
#undef HGCD_THRESHOLD
#define HGCD_THRESHOLD hgcd_threshold
extern mp_size_t hgcd_threshold;
diff --git a/Build/source/libs/gmp/gmp-src/gmp.pc.in b/Build/source/libs/gmp/gmp-src/gmp.pc.in
new file mode 100644
index 00000000000..bf1c799adc4
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/gmp.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+includedir=@includedir@
+libdir=@libdir@
+
+Name: @PACKAGE_NAME@
+Description: GNU Multiple Precision Arithmetic Library
+URL: https://gmplib.org
+Version: @PACKAGE_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lgmp
diff --git a/Build/source/libs/gmp/gmp-src/gmpxx.h b/Build/source/libs/gmp/gmp-src/gmpxx.h
index 58e87005442..0342116ef6f 100644
--- a/Build/source/libs/gmp/gmp-src/gmpxx.h
+++ b/Build/source/libs/gmp/gmp-src/gmpxx.h
@@ -1,6 +1,7 @@
/* gmpxx.h -- C++ class wrapper for GMP types. -*- C++ -*-
-Copyright 2001-2003, 2006, 2008, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2001-2003, 2006, 2008, 2011-2015, 2018 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -220,6 +221,11 @@ struct __gmp_binary_plus
{
if (q != r) mpq_set(q, r);
}
+ else if (__GMPXX_CONSTANT(l) && l == 1)
+ {
+ mpz_add (mpq_numref(q), mpq_numref(r), mpq_denref(r));
+ if (q != r) mpz_set(mpq_denref(q), mpq_denref(r));
+ }
else
{
if (q == r)
@@ -339,6 +345,11 @@ struct __gmp_binary_minus
{
if (q != r) mpq_set(q, r);
}
+ else if (__GMPXX_CONSTANT(l) && l == 1)
+ {
+ mpz_sub (mpq_numref(q), mpq_numref(r), mpq_denref(r));
+ if (q != r) mpz_set(mpq_denref(q), mpq_denref(r));
+ }
else
{
if (q == r)
@@ -689,7 +700,17 @@ struct __gmp_binary_divides
}
}
static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- { __GMPXX_TMPQ_UI; mpq_div (q, temp, r); }
+ {
+ if (__GMPXX_CONSTANT_TRUE(l == 0))
+ mpq_set_ui(q, 0, 1);
+ else if (__GMPXX_CONSTANT_TRUE(l == 1))
+ mpq_inv(q, r);
+ else
+ {
+ __GMPXX_TMPQ_UI;
+ mpq_div (q, temp, r);
+ }
+ }
static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
{
if (__GMPXX_CONSTANT_TRUE(l >= 0))
@@ -706,7 +727,22 @@ struct __gmp_binary_divides
}
}
static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- { __GMPXX_TMPQ_SI; mpq_div (q, temp, r); }
+ {
+ if (__GMPXX_CONSTANT_TRUE(l == 0))
+ mpq_set_ui(q, 0, 1);
+ else if (__GMPXX_CONSTANT_TRUE(l == 1))
+ mpq_inv(q, r);
+ else if (__GMPXX_CONSTANT_TRUE(l == -1))
+ {
+ mpq_inv(q, r);
+ mpq_neg(q, q);
+ }
+ else
+ {
+ __GMPXX_TMPQ_SI;
+ mpq_div (q, temp, r);
+ }
+ }
static void eval(mpq_ptr q, mpq_srcptr r, double d)
{ __GMPXX_TMPQ_D; mpq_div (q, r, temp); }
static void eval(mpq_ptr q, double d, mpq_srcptr r)
@@ -946,11 +982,15 @@ struct __gmp_binary_equal
{ return mpq_equal(q, r) != 0; }
static bool eval(mpq_srcptr q, unsigned long int l)
- { return mpq_cmp_ui(q, l, 1) == 0; }
+ { return ((__GMPXX_CONSTANT(l) && l == 0) ||
+ mpz_cmp_ui(mpq_denref(q), 1) == 0) &&
+ mpz_cmp_ui(mpq_numref(q), l) == 0; }
static bool eval(unsigned long int l, mpq_srcptr q)
{ return eval(q, l); }
static bool eval(mpq_srcptr q, signed long int l)
- { return mpq_cmp_si(q, l, 1) == 0; }
+ { return ((__GMPXX_CONSTANT(l) && l == 0) ||
+ mpz_cmp_ui(mpq_denref(q), 1) == 0) &&
+ mpz_cmp_si(mpq_numref(q), l) == 0; }
static bool eval(signed long int l, mpq_srcptr q)
{ return eval(q, l); }
static bool eval(mpq_srcptr q, double d)
@@ -958,7 +998,7 @@ struct __gmp_binary_equal
static bool eval(double d, mpq_srcptr q)
{ return eval(q, d); }
static bool eval(mpq_srcptr q, mpz_srcptr z)
- { return mpq_cmp_z(q, z) == 0; }
+ { return mpz_cmp_ui(mpq_denref(q), 1) == 0 && mpz_cmp(mpq_numref(q), z) == 0; }
static bool eval(mpz_srcptr z, mpq_srcptr q)
{ return eval(q, z); }
@@ -1194,6 +1234,78 @@ struct __gmp_rand_function
{ mpf_urandomb(f, s, prec); }
};
+struct __gmp_fac_function
+{
+ static void eval(mpz_ptr z, unsigned long l) { mpz_fac_ui(z, l); }
+ static void eval(mpz_ptr z, signed long l)
+ {
+ if (l < 0)
+ throw std::domain_error ("factorial(negative)");
+ eval(z, static_cast<unsigned long>(l));
+ }
+ static void eval(mpz_ptr z, mpz_srcptr w)
+ {
+ if (!mpz_fits_ulong_p(w))
+ {
+ if (mpz_sgn(w) < 0)
+ throw std::domain_error ("factorial(negative)");
+ else
+ throw std::bad_alloc(); // or std::overflow_error ("factorial")?
+ }
+ eval(z, mpz_get_ui(w));
+ }
+ static void eval(mpz_ptr z, double d)
+ { __GMPXX_TMPZ_D; eval (z, temp); }
+};
+
+struct __gmp_primorial_function
+{
+ static void eval(mpz_ptr z, unsigned long l) { mpz_primorial_ui(z, l); }
+ static void eval(mpz_ptr z, signed long l)
+ {
+ if (l < 0)
+ throw std::domain_error ("primorial(negative)");
+ eval(z, static_cast<unsigned long>(l));
+ }
+ static void eval(mpz_ptr z, mpz_srcptr w)
+ {
+ if (!mpz_fits_ulong_p(w))
+ {
+ if (mpz_sgn(w) < 0)
+ throw std::domain_error ("primorial(negative)");
+ else
+ throw std::bad_alloc(); // or std::overflow_error ("primorial")?
+ }
+ eval(z, mpz_get_ui(w));
+ }
+ static void eval(mpz_ptr z, double d)
+ { __GMPXX_TMPZ_D; eval (z, temp); }
+};
+
+struct __gmp_fib_function
+{
+ static void eval(mpz_ptr z, unsigned long l) { mpz_fib_ui(z, l); }
+ static void eval(mpz_ptr z, signed long l)
+ {
+ if (l < 0)
+ {
+ eval(z, -static_cast<unsigned long>(l));
+ if ((l & 1) == 0)
+ mpz_neg(z, z);
+ }
+ else
+ eval(z, static_cast<unsigned long>(l));
+ }
+ static void eval(mpz_ptr z, mpz_srcptr w)
+ {
+ if (!mpz_fits_slong_p(w))
+ throw std::bad_alloc(); // or std::overflow_error ("fibonacci")?
+ eval(z, mpz_get_si(w));
+ }
+ static void eval(mpz_ptr z, double d)
+ { __GMPXX_TMPZ_D; eval (z, temp); }
+};
+
/**************** Auxiliary classes ****************/
@@ -1423,6 +1535,38 @@ __GMPN_DECLARE_COMPOUND_OPERATOR(fun)
__gmp_expr & operator=(float f) { assign_d(f); return *this; } \
__gmp_expr & operator=(double d) { assign_d(d); return *this; }
+#define __GMPP_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun) \
+template <class U> \
+static __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, eval_fun> > \
+fun(const __gmp_expr<T, U> &expr);
+
+#define __GMPNN_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type, bigtype) \
+static inline __gmp_expr<T, __gmp_unary_expr<bigtype, eval_fun> > \
+fun(type expr);
+
+#define __GMPNS_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type) \
+__GMPNN_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type, signed long)
+#define __GMPNU_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type) \
+__GMPNN_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type, unsigned long)
+#define __GMPND_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type) \
+__GMPNN_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type, double)
+
+#define __GMPN_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun) \
+__GMPNS_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, signed char) \
+__GMPNU_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, unsigned char) \
+__GMPNS_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, signed int) \
+__GMPNU_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, unsigned int) \
+__GMPNS_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, signed short int) \
+__GMPNU_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, unsigned short int) \
+__GMPNS_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, signed long int) \
+__GMPNU_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, unsigned long int) \
+__GMPND_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, float) \
+__GMPND_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, double)
+
+#define __GMP_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun) \
+__GMPP_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun) \
+__GMPN_DECLARE_UNARY_STATIC_MEMFUN(T, fun, eval_fun)
+
/**************** mpz_class -- wrapper for mpz_t ****************/
template <>
@@ -1485,11 +1629,11 @@ public:
mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); }
// constructors and destructor
- __gmp_expr() { mpz_init(mp); }
+ __gmp_expr() __GMPXX_NOEXCEPT { mpz_init(mp); }
__gmp_expr(const __gmp_expr &z) { mpz_init_set(mp, z.mp); }
#if __GMPXX_USE_CXX11
- __gmp_expr(__gmp_expr &&z)
+ __gmp_expr(__gmp_expr &&z) noexcept
{ *mp = *z.mp; mpz_init(z.mp); }
#endif
template <class T>
@@ -1603,6 +1747,10 @@ public:
__GMP_DECLARE_INCREMENT_OPERATOR(operator++)
__GMP_DECLARE_INCREMENT_OPERATOR(operator--)
+
+ __GMP_DECLARE_UNARY_STATIC_MEMFUN(mpz_t, factorial, __gmp_fac_function)
+ __GMP_DECLARE_UNARY_STATIC_MEMFUN(mpz_t, primorial, __gmp_primorial_function)
+ __GMP_DECLARE_UNARY_STATIC_MEMFUN(mpz_t, fibonacci, __gmp_fib_function)
};
typedef __gmp_expr<mpz_t, mpz_t> mpz_class;
@@ -1980,7 +2128,7 @@ public:
// bool fits_ldouble_p() const { return mpf_fits_ldouble_p(mp); }
#if __GMPXX_USE_CXX11
- explicit operator bool() const { return mp->_mp_size != 0; }
+ explicit operator bool() const { return mpf_sgn(mp) != 0; }
#endif
// compound assignments
@@ -2791,6 +2939,17 @@ fun(const __gmp_expr<T, U> &expr) \
return __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, eval_fun> >(expr); \
}
+// variant that only works for one of { mpz, mpq, mpf }
+
+#define __GMP_DEFINE_UNARY_FUNCTION_1(T, fun, eval_fun) \
+ \
+template <class U> \
+inline __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, eval_fun> > \
+fun(const __gmp_expr<T, U> &expr) \
+{ \
+ return __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, eval_fun> >(expr); \
+}
+
#define __GMP_DEFINE_UNARY_TYPE_FUNCTION(type, fun, eval_fun) \
\
template <class T, class U> \
@@ -2864,6 +3023,69 @@ __GMPND_DEFINE_BINARY_FUNCTION(fun, eval_fun, double) \
__GMPP_DEFINE_BINARY_FUNCTION(fun, eval_fun) \
__GMPN_DEFINE_BINARY_FUNCTION(fun, eval_fun)
+// variant that only works for one of { mpz, mpq, mpf }
+
+#define __GMPP_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun) \
+ \
+template <class U, class W> \
+inline __gmp_expr<T, \
+__gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, W>, eval_fun> > \
+fun(const __gmp_expr<T, U> &expr1, const __gmp_expr<T, W> &expr2) \
+{ \
+ return __gmp_expr<T, \
+ __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, W>, eval_fun> > \
+ (expr1, expr2); \
+}
+
+#define __GMPNN_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, type, bigtype) \
+ \
+template <class U> \
+inline __gmp_expr \
+<T, __gmp_binary_expr<__gmp_expr<T, U>, bigtype, eval_fun> > \
+fun(const __gmp_expr<T, U> &expr, type t) \
+{ \
+ return __gmp_expr \
+ <T, __gmp_binary_expr<__gmp_expr<T, U>, bigtype, eval_fun> >(expr, t); \
+} \
+ \
+template <class U> \
+inline __gmp_expr \
+<T, __gmp_binary_expr<bigtype, __gmp_expr<T, U>, eval_fun> > \
+fun(type t, const __gmp_expr<T, U> &expr) \
+{ \
+ return __gmp_expr \
+ <T, __gmp_binary_expr<bigtype, __gmp_expr<T, U>, eval_fun> >(t, expr); \
+}
+
+#define __GMPNS_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, type) \
+__GMPNN_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, type, signed long int)
+
+#define __GMPNU_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, type) \
+__GMPNN_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, type, unsigned long int)
+
+#define __GMPND_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, type) \
+__GMPNN_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, type, double)
+
+#define __GMPNLD_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, type) \
+__GMPNN_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, type, long double)
+
+#define __GMPN_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun) \
+__GMPNS_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, signed char) \
+__GMPNU_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, unsigned char) \
+__GMPNS_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, signed int) \
+__GMPNU_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, unsigned int) \
+__GMPNS_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, signed short int) \
+__GMPNU_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, unsigned short int) \
+__GMPNS_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, signed long int) \
+__GMPNU_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, unsigned long int) \
+__GMPND_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, float) \
+__GMPND_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, double) \
+/* __GMPNLD_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun, long double) */
+
+#define __GMP_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun) \
+__GMPP_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun) \
+__GMPN_DEFINE_BINARY_FUNCTION_1(T, fun, eval_fun)
+
#define __GMP_DEFINE_BINARY_FUNCTION_UI(fun, eval_fun) \
\
@@ -3046,6 +3268,44 @@ __GMP_DEFINE_INCREMENT_OPERATOR(mpq, fun, eval_fun)
__GMP_DEFINE_INCREMENT_OPERATOR(mpf, fun, eval_fun)
+#define __GMPP_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun) \
+template <class U> \
+__gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, eval_fun> > \
+fun(const __gmp_expr<T, U> &expr) \
+{ \
+ return __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, eval_fun> >(expr); \
+}
+
+#define __GMPNN_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type, bigtype) \
+inline __gmp_expr<T, __gmp_unary_expr<bigtype, eval_fun> > \
+fun(type expr) \
+{ \
+ return __gmp_expr<T, __gmp_unary_expr<bigtype, eval_fun> >(expr); \
+}
+
+#define __GMPNS_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type) \
+__GMPNN_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type, signed long)
+#define __GMPNU_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type) \
+__GMPNN_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type, unsigned long)
+#define __GMPND_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type) \
+__GMPNN_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, type, double)
+
+#define __GMPN_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun) \
+__GMPNS_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, signed char) \
+__GMPNU_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, unsigned char) \
+__GMPNS_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, signed int) \
+__GMPNU_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, unsigned int) \
+__GMPNS_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, signed short int) \
+__GMPNU_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, unsigned short int) \
+__GMPNS_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, signed long int) \
+__GMPNU_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, unsigned long int) \
+__GMPND_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, float) \
+__GMPND_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun, double) \
+
+#define __GMP_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun) \
+__GMPP_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun) \
+__GMPN_DEFINE_UNARY_STATIC_MEMFUN(T, fun, eval_fun) \
+
/**************** Arithmetic operators and functions ****************/
@@ -3053,16 +3313,16 @@ __GMP_DEFINE_INCREMENT_OPERATOR(mpf, fun, eval_fun)
__GMP_DEFINE_UNARY_FUNCTION(operator+, __gmp_unary_plus)
__GMP_DEFINE_UNARY_FUNCTION(operator-, __gmp_unary_minus)
-__GMP_DEFINE_UNARY_FUNCTION(operator~, __gmp_unary_com)
+__GMP_DEFINE_UNARY_FUNCTION_1(mpz_t, operator~, __gmp_unary_com)
__GMP_DEFINE_BINARY_FUNCTION(operator+, __gmp_binary_plus)
__GMP_DEFINE_BINARY_FUNCTION(operator-, __gmp_binary_minus)
__GMP_DEFINE_BINARY_FUNCTION(operator*, __gmp_binary_multiplies)
__GMP_DEFINE_BINARY_FUNCTION(operator/, __gmp_binary_divides)
-__GMP_DEFINE_BINARY_FUNCTION(operator%, __gmp_binary_modulus)
-__GMP_DEFINE_BINARY_FUNCTION(operator&, __gmp_binary_and)
-__GMP_DEFINE_BINARY_FUNCTION(operator|, __gmp_binary_ior)
-__GMP_DEFINE_BINARY_FUNCTION(operator^, __gmp_binary_xor)
+__GMP_DEFINE_BINARY_FUNCTION_1(mpz_t, operator%, __gmp_binary_modulus)
+__GMP_DEFINE_BINARY_FUNCTION_1(mpz_t, operator&, __gmp_binary_and)
+__GMP_DEFINE_BINARY_FUNCTION_1(mpz_t, operator|, __gmp_binary_ior)
+__GMP_DEFINE_BINARY_FUNCTION_1(mpz_t, operator^, __gmp_binary_xor)
__GMP_DEFINE_BINARY_FUNCTION_UI(operator<<, __gmp_binary_lshift)
__GMP_DEFINE_BINARY_FUNCTION_UI(operator>>, __gmp_binary_rshift)
@@ -3075,13 +3335,17 @@ __GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator>, __gmp_binary_greater)
__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator>=, ! __gmp_binary_less)
__GMP_DEFINE_UNARY_FUNCTION(abs, __gmp_abs_function)
-__GMP_DEFINE_UNARY_FUNCTION(trunc, __gmp_trunc_function)
-__GMP_DEFINE_UNARY_FUNCTION(floor, __gmp_floor_function)
-__GMP_DEFINE_UNARY_FUNCTION(ceil, __gmp_ceil_function)
-__GMP_DEFINE_UNARY_FUNCTION(sqrt, __gmp_sqrt_function)
-__GMP_DEFINE_BINARY_FUNCTION(hypot, __gmp_hypot_function)
-__GMP_DEFINE_BINARY_FUNCTION(gcd, __gmp_gcd_function)
-__GMP_DEFINE_BINARY_FUNCTION(lcm, __gmp_lcm_function)
+__GMP_DEFINE_UNARY_FUNCTION_1(mpf_t, trunc, __gmp_trunc_function)
+__GMP_DEFINE_UNARY_FUNCTION_1(mpf_t, floor, __gmp_floor_function)
+__GMP_DEFINE_UNARY_FUNCTION_1(mpf_t, ceil, __gmp_ceil_function)
+__GMP_DEFINE_UNARY_FUNCTION_1(mpf_t, sqrt, __gmp_sqrt_function)
+__GMP_DEFINE_UNARY_FUNCTION_1(mpz_t, sqrt, __gmp_sqrt_function)
+__GMP_DEFINE_UNARY_FUNCTION_1(mpz_t, factorial, __gmp_fac_function)
+__GMP_DEFINE_UNARY_FUNCTION_1(mpz_t, primorial, __gmp_primorial_function)
+__GMP_DEFINE_UNARY_FUNCTION_1(mpz_t, fibonacci, __gmp_fib_function)
+__GMP_DEFINE_BINARY_FUNCTION_1(mpf_t, hypot, __gmp_hypot_function)
+__GMP_DEFINE_BINARY_FUNCTION_1(mpz_t, gcd, __gmp_gcd_function)
+__GMP_DEFINE_BINARY_FUNCTION_1(mpz_t, lcm, __gmp_lcm_function)
__GMP_DEFINE_UNARY_TYPE_FUNCTION(int, sgn, __gmp_sgn_function)
__GMP_DEFINE_BINARY_TYPE_FUNCTION(int, cmp, __gmp_cmp_function)
@@ -3108,6 +3372,10 @@ __GMPZ_DEFINE_COMPOUND_OPERATOR_UI(operator>>=, __gmp_binary_rshift)
__GMPZ_DEFINE_INCREMENT_OPERATOR(operator++, __gmp_unary_increment)
__GMPZ_DEFINE_INCREMENT_OPERATOR(operator--, __gmp_unary_decrement)
+__GMP_DEFINE_UNARY_STATIC_MEMFUN(mpz_t, mpz_class::factorial, __gmp_fac_function)
+__GMP_DEFINE_UNARY_STATIC_MEMFUN(mpz_t, mpz_class::primorial, __gmp_primorial_function)
+__GMP_DEFINE_UNARY_STATIC_MEMFUN(mpz_t, mpz_class::fibonacci, __gmp_fib_function)
+
// member operators for mpq_class
__GMPQ_DEFINE_COMPOUND_OPERATOR(operator+=, __gmp_binary_plus)
@@ -3381,6 +3649,7 @@ namespace std {
#undef __GMPZQ_DEFINE_EXPR
+#undef __GMP_DEFINE_UNARY_FUNCTION_1
#undef __GMP_DEFINE_UNARY_FUNCTION
#undef __GMP_DEFINE_UNARY_TYPE_FUNCTION
diff --git a/Build/source/libs/gmp/gmp-src/gmpxx.pc.in b/Build/source/libs/gmp/gmp-src/gmpxx.pc.in
new file mode 100644
index 00000000000..181cc70c670
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/gmpxx.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+includedir=@includedir@
+libdir=@libdir@
+
+Name: @PACKAGE_NAME@ C++
+Description: GNU Multiple Precision Arithmetic Library (C++ bindings)
+URL: https://gmplib.org
+Version: @PACKAGE_VERSION@
+Requires: gmp
+Cflags: -I${includedir}
+Libs: -L${libdir} -lgmpxx
diff --git a/Build/source/libs/gmp/gmp-src/invalid.c b/Build/source/libs/gmp/gmp-src/invalid.c
index 81d6720c0dd..e09eab21937 100644
--- a/Build/source/libs/gmp/gmp-src/invalid.c
+++ b/Build/source/libs/gmp/gmp-src/invalid.c
@@ -41,7 +41,6 @@ see https://www.gnu.org/licenses/. */
#include <unistd.h> /* for getpid */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/longlong.h b/Build/source/libs/gmp/gmp-src/longlong.h
index 96de9404210..bc3fc81cb0a 100644
--- a/Build/source/libs/gmp/gmp-src/longlong.h
+++ b/Build/source/libs/gmp/gmp-src/longlong.h
@@ -1,6 +1,6 @@
/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
-Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2016 Free Software
+Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2020 Free Software
Foundation, Inc.
This file is part of the GNU MP Library.
@@ -204,7 +204,6 @@ see https://www.gnu.org/licenses/. */
(pl) = __m0 * __m1; \
} while (0)
#endif
-#define UMUL_TIME 18
#else /* ! __GNUC__ */
#include <machine/builtins.h>
#define umul_ppmm(ph, pl, m0, m1) \
@@ -222,7 +221,6 @@ see https://www.gnu.org/licenses/. */
} while (0)
#define UDIV_PREINV_ALWAYS 1
#define UDIV_NEEDS_NORMALIZATION 1
-#define UDIV_TIME 220
#endif /* LONGLONG_STANDALONE */
/* clz_tab is required in all configurations, since mpn/alpha/cntlz.asm
@@ -285,7 +283,6 @@ long __MPN(count_leading_zeros) (UDItype);
#include <intrinsics.h>
#define UDIV_PREINV_ALWAYS 1
#define UDIV_NEEDS_NORMALIZATION 1
-#define UDIV_TIME 220
long __MPN(count_leading_zeros) (UDItype);
#define count_leading_zeros(count, x) \
((count) = _leadz ((UWtype) (x)))
@@ -329,7 +326,6 @@ long __MPN(count_leading_zeros) (UDItype);
__asm__ ("xma.hu %0 = %2, %3, f0\n\txma.l %1 = %2, %3, f0" \
: "=&f" (ph), "=f" (pl) \
: "f" (m0), "f" (m1))
-#define UMUL_TIME 14
#define count_leading_zeros(count, x) \
do { \
UWtype _x = (x), _y, _a, _c; \
@@ -372,7 +368,6 @@ long __MPN(count_leading_zeros) (UDItype);
#define UDIV_PREINV_ALWAYS 1
#define UDIV_NEEDS_NORMALIZATION 1
#endif
-#define UDIV_TIME 220
#endif
@@ -440,12 +435,50 @@ long __MPN(count_leading_zeros) (UDItype);
#if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \
&& W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("adds\t%1, %4, %5\n\tadc\t%0, %2, %3" \
+ do { \
+ if (__builtin_constant_p (bl) && -(USItype)(bl) < 0x100) \
+ __asm__ ("subs\t%1, %4, %5\n\tadc\t%0, %2, %3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "rI" (bh), \
+ "%r" (al), "rI" (-(USItype)(bl)) __CLOBBER_CC); \
+ else \
+ __asm__ ("adds\t%1, %4, %5\n\tadc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
- : "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
+ : "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. */
+#if defined (__thumb__)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
- if (__builtin_constant_p (al)) \
+ if (__builtin_constant_p (ah) && __builtin_constant_p (bh) \
+ && (ah) == (bh)) \
+ __asm__ ("subs\t%1, %2, %3\n\tsbc\t%0, %0, %0" \
+ : "=r" (sh), "=r" (sl) \
+ : "r" (al), "rI" (bl) __CLOBBER_CC); \
+ else if (__builtin_constant_p (al)) \
+ __asm__ ("rsbs\t%1, %5, %4\n\tsbc\t%0, %2, %3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "rI" (bh), "rI" (al), "r" (bl) __CLOBBER_CC); \
+ else if (__builtin_constant_p (bl)) \
+ __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 \
+ __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); \
+ } while (0)
+#else
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ do { \
+ if (__builtin_constant_p (ah) && __builtin_constant_p (bh) \
+ && (ah) == (bh)) \
+ __asm__ ("subs\t%1, %2, %3\n\tsbc\t%0, %0, %0" \
+ : "=r" (sh), "=r" (sl) \
+ : "r" (al), "rI" (bl) __CLOBBER_CC); \
+ else if (__builtin_constant_p (al)) \
{ \
if (__builtin_constant_p (ah)) \
__asm__ ("rsbs\t%1, %5, %4\n\trsc\t%0, %3, %2" \
@@ -468,21 +501,15 @@ long __MPN(count_leading_zeros) (UDItype);
: "rI" (ah), "r" (bh), "rI" (al), "r" (bl) __CLOBBER_CC); \
} \
else if (__builtin_constant_p (bl)) \
- { \
- if (__builtin_constant_p (bh)) \
- __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 \
- __asm__ ("subs\t%1, %4, %5\n\trsc\t%0, %3, %2" \
- : "=r" (sh), "=&r" (sl) \
- : "rI" (ah), "r" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
- } \
+ __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 */ \
__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);\
+ : "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
} while (0)
+#endif
#if defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_2A__) \
|| defined (__ARM_ARCH_3__)
#define umul_ppmm(xh, xl, a, b) \
@@ -505,7 +532,6 @@ long __MPN(count_leading_zeros) (UDItype);
"=&r" (__t0), "=&r" (__t1), "=r" (__t2) \
: "r" ((USItype) (a)), "r" ((USItype) (b)) __CLOBBER_CC); \
} while (0)
-#define UMUL_TIME 20
#ifndef LONGLONG_STANDALONE
#define udiv_qrnnd(q, r, n1, n0, d) \
do { UWtype __r; \
@@ -513,12 +539,10 @@ long __MPN(count_leading_zeros) (UDItype);
(r) = __r; \
} while (0)
extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
-#define UDIV_TIME 200
#endif /* LONGLONG_STANDALONE */
#else /* ARMv4 or newer */
#define umul_ppmm(xh, xl, a, b) \
__asm__ ("umull %0,%1,%2,%3" : "=&r" (xl), "=&r" (xh) : "r" (a), "r" (b))
-#define UMUL_TIME 5
#define smul_ppmm(xh, xl, a, b) \
__asm__ ("smull %0,%1,%2,%3" : "=&r" (xl), "=&r" (xh) : "r" (a), "r" (b))
#ifndef LONGLONG_STANDALONE
@@ -529,36 +553,60 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
} while (0)
#define UDIV_PREINV_ALWAYS 1
#define UDIV_NEEDS_NORMALIZATION 1
-#define UDIV_TIME 70
#endif /* LONGLONG_STANDALONE */
#endif /* defined(__ARM_ARCH_2__) ... */
#define count_leading_zeros(count, x) count_leading_zeros_gcc_clz(count, x)
#define count_trailing_zeros(count, x) count_trailing_zeros_gcc_ctz(count, x)
-#define COUNT_LEADING_ZEROS_0 32
#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) \
- __asm__ ("adds\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \
- : "=r" (sh), "=&r" (sl) \
- : "rZ" ((UDItype)(ah)), "rZ" ((UDItype)(bh)), \
- "%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) __CLOBBER_CC)
+ do { \
+ if (__builtin_constant_p (bl) && -(UDItype)(bl) < 0x1000) \
+ __asm__ ("subs\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rZ" ((UDItype)(ah)), "rZ" ((UDItype)(bh)), \
+ "%r" ((UDItype)(al)), "rI" (-(UDItype)(bl)) __CLOBBER_CC);\
+ else \
+ __asm__ ("adds\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rZ" ((UDItype)(ah)), "rZ" ((UDItype)(bh)), \
+ "%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) __CLOBBER_CC);\
+ } while (0)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subs\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \
- : "=r,r" (sh), "=&r,&r" (sl) \
- : "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)), \
- "r,Z" ((UDItype)(al)), "rI,r" ((UDItype)(bl)) __CLOBBER_CC)
+ do { \
+ if (__builtin_constant_p (bl) && -(UDItype)(bl) < 0x1000) \
+ __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)), \
+ "r,Z" ((UDItype)(al)), "rI,r" (-(UDItype)(bl)) __CLOBBER_CC);\
+ else \
+ __asm__ ("subs\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \
+ : "=r,r" (sh), "=&r,&r" (sl) \
+ : "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)), \
+ "r,Z" ((UDItype)(al)), "rI,r" ((UDItype)(bl)) __CLOBBER_CC);\
+ } while(0);
+#if __GMP_GNUC_PREREQ (4,9)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
+ __ll_UTItype __ll = (__ll_UTItype)(u) * (v); \
+ w1 = __ll >> 64; \
+ w0 = __ll; \
+ } while (0)
+#endif
+#if !defined (umul_ppmm)
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UDItype __m0 = (m0), __m1 = (m1); \
__asm__ ("umulh\t%0, %1, %2" : "=r" (ph) : "r" (__m0), "r" (__m1)); \
(pl) = __m0 * __m1; \
} while (0)
+#endif
#define count_leading_zeros(count, x) count_leading_zeros_gcc_clz(count, x)
#define count_trailing_zeros(count, x) count_trailing_zeros_gcc_ctz(count, x)
-#define COUNT_LEADING_ZEROS_0 64
#endif /* __aarch64__ */
#if defined (__clipper__) && W_TYPE_SIZE == 32
@@ -650,11 +698,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
(wh) = __x.__i.__h; \
(wl) = __x.__i.__l; \
} while (0)
-#define UMUL_TIME 8
-#define UDIV_TIME 60
-#else
-#define UMUL_TIME 40
-#define UDIV_TIME 80
#endif
#define count_leading_zeros(count, x) \
do { \
@@ -940,7 +983,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
double d; \
unsigned a[2]; \
} __u; \
- ASSERT ((n) != 0); \
__u.d = (UWtype) (n); \
(c) = 0x3FF + 31 - (__u.a[1] >> 20); \
} while (0)
@@ -997,12 +1039,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#endif /* ! pentium */
-#ifndef UMUL_TIME
-#define UMUL_TIME 10
-#endif
-#ifndef UDIV_TIME
-#define UDIV_TIME 40
-#endif
#endif /* 80x86 */
#if defined (__amd64__) && W_TYPE_SIZE == 64
@@ -1016,29 +1052,61 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
: "=r" (sh), "=&r" (sl) \
: "0" ((UDItype)(ah)), "rme" ((UDItype)(bh)), \
"1" ((UDItype)(al)), "rme" ((UDItype)(bl)))
+#if X86_ASM_MULX \
+ && (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" \
+ : "=r" (w0), "=r" (w1) \
+ : "%d" ((UDItype)(u)), "rm" ((UDItype)(v)))
+#else
#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("mulq %3" \
+ __asm__ ("mulq\t%3" \
: "=a" (w0), "=d" (w1) \
: "%0" ((UDItype)(u)), "rm" ((UDItype)(v)))
+#endif
#define udiv_qrnnd(q, r, n1, n0, dx) /* d renamed to dx avoiding "=d" */\
__asm__ ("divq %4" /* stringification in K&R C */ \
: "=a" (q), "=d" (r) \
: "0" ((UDItype)(n0)), "1" ((UDItype)(n1)), "rm" ((UDItype)(dx)))
-/* bsrq destination must be a 64-bit register, hence UDItype for __cbtmp. */
+
+#if HAVE_HOST_CPU_haswell || HAVE_HOST_CPU_broadwell || HAVE_HOST_CPU_skylake \
+ || HAVE_HOST_CPU_k10 || HAVE_HOST_CPU_bd1 || HAVE_HOST_CPU_bd2 \
+ || HAVE_HOST_CPU_bd3 || HAVE_HOST_CPU_bd4 || HAVE_HOST_CPU_zen \
+ || HAVE_HOST_CPU_bobcat || HAVE_HOST_CPU_jaguar
+#define count_leading_zeros(count, x) \
+ do { \
+ /* This is lzcnt, spelled for older assemblers. Destination and */ \
+ /* source must be a 64-bit registers, hence cast and %q. */ \
+ __asm__ ("rep;bsr\t%1, %q0" : "=r" (count) : "rm" ((UDItype)(x))); \
+ } while (0)
+#define COUNT_LEADING_ZEROS_0 64
+#else
#define count_leading_zeros(count, x) \
do { \
UDItype __cbtmp; \
ASSERT ((x) != 0); \
- __asm__ ("bsrq %1,%0" : "=r" (__cbtmp) : "rm" ((UDItype)(x))); \
+ __asm__ ("bsr\t%1,%0" : "=r" (__cbtmp) : "rm" ((UDItype)(x))); \
(count) = __cbtmp ^ 63; \
} while (0)
-/* bsfq destination must be a 64-bit register, "%q0" forces this in case
- count is only an int. */
+#endif
+
+#if HAVE_HOST_CPU_bd2 || HAVE_HOST_CPU_bd3 || HAVE_HOST_CPU_bd4 \
+ || HAVE_HOST_CPU_zen || HAVE_HOST_CPU_jaguar
+#define count_trailing_zeros(count, x) \
+ do { \
+ /* This is tzcnt, spelled for older assemblers. Destination and */ \
+ /* source must be a 64-bit registers, hence cast and %q. */ \
+ __asm__ ("rep;bsf\t%1, %q0" : "=r" (count) : "rm" ((UDItype)(x))); \
+ } while (0)
+#define COUNT_TRAILING_ZEROS_0 64
+#else
#define count_trailing_zeros(count, x) \
do { \
ASSERT ((x) != 0); \
- __asm__ ("bsfq %1,%q0" : "=r" (count) : "rm" ((UDItype)(x))); \
+ __asm__ ("bsf\t%1, %q0" : "=r" (count) : "rm" ((UDItype)(x))); \
} while (0)
+#endif
#endif /* __amd64__ */
#if defined (__i860__) && W_TYPE_SIZE == 32
@@ -1119,12 +1187,10 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
__asm__ ("mulu%.l %3,%1:%0" \
: "=d" (w0), "=d" (w1) \
: "%0" ((USItype)(u)), "dmi" ((USItype)(v)))
-#define UMUL_TIME 45
#define udiv_qrnnd(q, r, n1, n0, d) \
__asm__ ("divu%.l %4,%1:%0" \
: "=d" (q), "=d" (r) \
: "0" ((USItype)(n0)), "1" ((USItype)(n1)), "dmi" ((USItype)(d)))
-#define UDIV_TIME 90
#define sdiv_qrnnd(q, r, n1, n0, d) \
__asm__ ("divs%.l %4,%1:%0" \
: "=d" (q), "=d" (r) \
@@ -1158,8 +1224,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
"=d" (__umul_tmp1), "=&d" (__umul_tmp2) \
: "%2" ((USItype)(a)), "d" ((USItype)(b))); \
} while (0)
-#define UMUL_TIME 100
-#define UDIV_TIME 400
#endif /* not mc68020 */
/* The '020, '030, '040 and '060 have bitfield insns.
GCC 3.4 defines __mc68020__ when in CPU32 mode, check for __mcpu32__ to
@@ -1212,11 +1276,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
__asm__ ("divu.d %0,%1,%2" \
: "=r" (__q.__ll) : "r" (__x.__ll), "r" (d)); \
(r) = (n0) - __q.__l * (d); (q) = __q.__l; })
-#define UMUL_TIME 5
-#define UDIV_TIME 25
-#else
-#define UMUL_TIME 17
-#define UDIV_TIME 150
#endif /* __m88110__ */
#endif /* __m88000__ */
@@ -1238,12 +1297,18 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
__asm__ ("multu %2,%3\n\tmflo %0\n\tmfhi %1" \
: "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
#endif
-#define UMUL_TIME 10
-#define UDIV_TIME 100
#endif /* __mips */
#if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
-#if __GMP_GNUC_PREREQ (4,4)
+#if defined (_MIPS_ARCH_MIPS64R6)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UDItype __m0 = (u), __m1 = (v); \
+ (w0) = __m0 * __m1; \
+ __asm__ ("dmuhu\t%0, %1, %2" : "=d" (w1) : "d" (__m0), "d" (__m1)); \
+ } while (0)
+#endif
+#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (4,4)
#define umul_ppmm(w1, w0, u, v) \
do { \
typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
@@ -1264,8 +1329,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
: "=d" (w0), "=d" (w1) \
: "d" ((UDItype)(u)), "d" ((UDItype)(v)))
#endif
-#define UMUL_TIME 20
-#define UDIV_TIME 140
#endif /* __mips */
#if defined (__mmix__) && W_TYPE_SIZE == 64
@@ -1330,33 +1393,41 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
do { \
if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl) \
+ __CLOBBER_CC); \
else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \
__asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl) \
+ __CLOBBER_CC); \
else \
__asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \
- : "=r" (sh), "=&r" (sl) \
- : "r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "r" (bh), "%r" (al), "rI" (bl) \
+ __CLOBBER_CC); \
} while (0)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
if (__builtin_constant_p (ah) && (ah) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl) \
+ __CLOBBER_CC); \
else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl) \
+ __CLOBBER_CC); \
else if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl) \
+ __CLOBBER_CC); \
else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl) \
+ __CLOBBER_CC); \
else \
__asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
- : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
+ : "r" (ah), "r" (bh), "rI" (al), "r" (bl) \
+ __CLOBBER_CC); \
} while (0)
#define count_leading_zeros(count, x) \
__asm__ ("cntlzw %0,%1" : "=r" (count) : "r" (x))
@@ -1378,23 +1449,17 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
(pl) = __m0 * __m1; \
} while (0)
#endif
-#define UMUL_TIME 15
#define smul_ppmm(ph, pl, m0, m1) \
do { \
SItype __m0 = (m0), __m1 = (m1); \
__asm__ ("mulhw %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
(pl) = __m0 * __m1; \
} while (0)
-#define SMUL_TIME 14
-#define UDIV_TIME 120
#else
-#define UMUL_TIME 8
#define smul_ppmm(xh, xl, m0, m1) \
__asm__ ("mul %0,%2,%3" : "=r" (xh), "=q" (xl) : "r" (m0), "r" (m1))
-#define SMUL_TIME 4
#define sdiv_qrnnd(q, r, nh, nl, d) \
__asm__ ("div %0,%2,%4" : "=r" (q), "=q" (r) : "r" (nh), "1" (nl), "r" (d))
-#define UDIV_TIME 100
#endif
#endif /* 32-bit POWER architecture variants. */
@@ -1410,17 +1475,20 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
__asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
- "%r" ((UDItype)(al)), "rI" ((UDItype)(bl))); \
+ "%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
- "%r" ((UDItype)(al)), "rI" ((UDItype)(bl))); \
+ "%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
else \
__asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
- "%r" ((UDItype)(al)), "rI" ((UDItype)(bl))); \
+ "%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
} while (0)
/* We use "*rI" for the constant operand here, since with just "I", gcc barfs.
This might seem strange, but gcc folds away the dead code late. */
@@ -1431,60 +1499,70 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
__asm__ ("addic %1,%3,%4\n\tsubfze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \
+ "rI" ((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)))); \
+ "rI" ((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)))); \
+ "rI" ((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)))); \
+ "rI" ((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)))); \
+ "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ __CLOBBER_CC); \
} else { \
if (__builtin_constant_p (ah) && (ah) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
else if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
else \
__asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
} \
} while (0)
#endif /* ! _LONG_LONG_LIMB */
#define count_leading_zeros(count, x) \
__asm__ ("cntlzd %0,%1" : "=r" (count) : "r" (x))
#define COUNT_LEADING_ZEROS_0 64
-#if 0 && __GMP_GNUC_PREREQ (4,4) /* Disable, this results in libcalls! */
+#if __GMP_GNUC_PREREQ (4,8)
#define umul_ppmm(w1, w0, u, v) \
do { \
typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
@@ -1501,15 +1579,12 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
(pl) = __m0 * __m1; \
} while (0)
#endif
-#define UMUL_TIME 15
#define smul_ppmm(ph, pl, m0, m1) \
do { \
DItype __m0 = (m0), __m1 = (m1); \
__asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (__m0), "r" (__m1)); \
(pl) = __m0 * __m1; \
} while (0)
-#define SMUL_TIME 14 /* ??? */
-#define UDIV_TIME 120 /* ??? */
#endif /* 64-bit PowerPC. */
#if defined (__pyr__) && W_TYPE_SIZE == 32
@@ -1570,8 +1645,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
: "=r" (ph), "=r" (pl) \
: "%r" ((USItype)(m0)), "r" ((USItype)(m1)) \
: "r2")
-#define UMUL_TIME 20
-#define UDIV_TIME 200
#define count_leading_zeros(count, x) \
do { \
if ((x) >= 0x10000) \
@@ -1586,11 +1659,19 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
} while (0)
#endif /* RT/ROMP */
+#if defined (__riscv64) && W_TYPE_SIZE == 64
+#define umul_ppmm(ph, pl, u, v) \
+ do { \
+ UDItype __u = (u), __v = (v); \
+ (pl) = __u * __v; \
+ __asm__ ("mulhu\t%2, %1, %0" : "=r" (ph) : "%r" (__u), "r" (__v)); \
+ } while (0)
+#endif
+
#if (defined (__SH2__) || defined (__SH3__) || defined (__SH4__)) && W_TYPE_SIZE == 32
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("dmulu.l %2,%3\n\tsts macl,%1\n\tsts mach,%0" \
: "=r" (w1), "=r" (w0) : "r" (u), "r" (v) : "macl", "mach")
-#define UMUL_TIME 5
#endif
#if defined (__sparc__) && W_TYPE_SIZE == 32
@@ -1638,10 +1719,8 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
but INTERPRETED AS UNSIGNED. */
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("umul %2,%3,%1;rd %%y,%0" : "=r" (w1), "=r" (w0) : "r" (u), "r" (v))
-#define UMUL_TIME 5
#if HAVE_HOST_CPU_supersparc
-#define UDIV_TIME 60 /* SuperSPARC timing */
#else
/* Don't use this on SuperSPARC because its udiv only handles 53 bit
dividends and will trap to the kernel for the rest. */
@@ -1653,7 +1732,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
(r) = (n0) - __q * (d); \
(q) = __q; \
} while (0)
-#define UDIV_TIME 25
#endif /* HAVE_HOST_CPU_supersparc */
#else /* ! __sparc_v8__ */
@@ -1662,7 +1740,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
instructions scan (ffs from high bit) and divscc. */
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("umul %2,%3,%1;rd %%y,%0" : "=r" (w1), "=r" (w0) : "r" (u), "r" (v))
-#define UMUL_TIME 5
#define udiv_qrnnd(q, r, n1, n0, d) \
__asm__ ("! Inlined udiv_qrnnd\n" \
" wr %%g0,%2,%%y ! Not a delayed write for sparclite\n" \
@@ -1705,7 +1782,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
"1: ! End of inline udiv_qrnnd" \
: "=r" (q), "=r" (r) : "r" (n1), "r" (n0), "rI" (d) \
: "%g1" __AND_CLOBBER_CC)
-#define UDIV_TIME 37
#define count_leading_zeros(count, x) \
__asm__ ("scan %1,1,%0" : "=r" (count) : "r" (x))
/* Early sparclites return 63 for an argument of 0, but they warn that future
@@ -1759,7 +1835,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
" rd %%y,%1" \
: "=r" (w1), "=r" (w0) : "%rI" (u), "r" (v) \
: "%g1", "%g2" __AND_CLOBBER_CC)
-#define UMUL_TIME 39 /* 39 instructions */
#endif
#ifndef udiv_qrnnd
#ifndef LONGLONG_STANDALONE
@@ -1769,9 +1844,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
(r) = __r; \
} while (0)
extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
-#ifndef UDIV_TIME
-#define UDIV_TIME 140
-#endif
#endif /* LONGLONG_STANDALONE */
#endif /* udiv_qrnnd */
#endif /* __sparc__ */
@@ -2207,12 +2279,3 @@ extern const unsigned char __GMP_DECLSPEC __clz_tab[129];
#ifndef UDIV_PREINV_ALWAYS
#define UDIV_PREINV_ALWAYS 0
#endif
-
-/* Give defaults for UMUL_TIME and UDIV_TIME. */
-#ifndef UMUL_TIME
-#define UMUL_TIME 1
-#endif
-
-#ifndef UDIV_TIME
-#define UDIV_TIME UMUL_TIME
-#endif
diff --git a/Build/source/libs/gmp/gmp-src/memory.c b/Build/source/libs/gmp/gmp-src/memory.c
index 4475f37de37..5e001910792 100644
--- a/Build/source/libs/gmp/gmp-src/memory.c
+++ b/Build/source/libs/gmp/gmp-src/memory.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <stdlib.h> /* for malloc, realloc, free */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mini-gmp/README b/Build/source/libs/gmp/gmp-src/mini-gmp/README
index f291489ea3e..b02b8da7156 100644
--- a/Build/source/libs/gmp/gmp-src/mini-gmp/README
+++ b/Build/source/libs/gmp/gmp-src/mini-gmp/README
@@ -1,4 +1,4 @@
-Copyright 2011-2013 Free Software Foundation, Inc.
+Copyright 2011-2013, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -27,8 +27,8 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/.
-This is "mini-gmp", a small implementation of a subset of GMP's mpn
-and mpz interfaces.
+This is "mini-gmp", a small implementation of a subset of GMP's mpn,
+mpz and mpq interfaces.
It is intended for applications which need arithmetic on numbers
larger than a machine word, but which don't need to handle very large
@@ -38,12 +38,11 @@ can also arrange for optional linking with the real GMP library, using
mini-gmp as a fallback when for some reason GMP is not available, or
not desired as a dependency.
-The supported GMP subset is declared in mini-gmp.h. The implemented
+The supported GMP subset of the mpn and mpz interfaces is declared in
+mini-gmp.h, and implemented in mini-gmp.c. The implemented
functions are fully compatible with the corresponding GMP functions,
as specified in the GMP manual, with a few exceptions:
- mpz_set_str, mpz_init_set_str, mpz_get_str, mpz_out_str and
- mpz_sizeinbase support only |base| <= 36;
mpz_export and mpz_import support only NAILS = 0.
The REALLOC_FUNC and FREE_FUNC registered with
@@ -51,7 +50,7 @@ as specified in the GMP manual, with a few exceptions:
allocated block in the corresponding argument. mini-gmp always
passes zero for these rarely used arguments.
-The implementation is a single file, mini-gmp.c.
+ When mpz_get_str allocates the block, it can be longer than needed.
The performance target for mini-gmp is to be at most 10 times slower
than the real GMP library, for numbers of size up to a few hundred
@@ -59,19 +58,22 @@ bits. No asymptotically fast algorithms are included in mini-gmp, so
it will be many orders of magnitude slower than GMP for very large
numbers.
+The supported GMP subset of the mpq layer is declared in mini-mpq.h,
+and implemented in mini-mpq.c.
+
You should never "install" mini-gmp. Applications can either just
#include mini-gmp.c (but then, beware that it defines several macros
-and functions outside of the advertised interface). Or compile
-mini-gmp.c as a separate compilation unit, and use the declarations in
-mini-gmp.h.
+and functions outside of the advertised interface), and if needed
+#include mini-mpq.c in a later line (order is important). Or compile
+mini-gmp.c and mini-mpq.c as separate compilation units, and use the
+declarations in mini-gmp.h and mini-mpq.h.
The tests subdirectory contains a testsuite. To use it, you need GMP
and GNU make. Just run make check in the tests directory. If the
hard-coded compiler settings are not right, you have to either edit the
Makefile or pass overriding values on the make command line (e.g.,
-make CC=cc check). Testing is not (yet) as thorough as for the real
-GMP.
+make CC=cc check).
-The current version was put together by Niels Möller
+The initial version of mini-gmp was put together by Niels Möller
<nisse@lysator.liu.se>, with a fair amount of copy-and-paste from the
GMP sources.
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 04bed3f51dd..78cd1034473 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
@@ -2,7 +2,7 @@
Contributed to the GNU project by Niels Möller
-Copyright 1991-1997, 1999-2016 Free Software Foundation, Inc.
+Copyright 1991-1997, 1999-2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -50,11 +50,15 @@ see https://www.gnu.org/licenses/. */
#include "mini-gmp.h"
+#if !defined(MINI_GMP_DONT_USE_FLOAT_H)
+#include <float.h>
+#endif
+
/* Macros */
#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
-#define GMP_LIMB_MAX (~ (mp_limb_t) 0)
+#define GMP_LIMB_MAX ((mp_limb_t) ~ (mp_limb_t) 0)
#define GMP_LIMB_HIGHBIT ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1))
#define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2))
@@ -71,6 +75,18 @@ see https://www.gnu.org/licenses/. */
#define GMP_CMP(a,b) (((a) > (b)) - ((a) < (b)))
+#if defined(DBL_MANT_DIG) && FLT_RADIX == 2
+#define GMP_DBL_MANT_BITS DBL_MANT_DIG
+#else
+#define GMP_DBL_MANT_BITS (53)
+#endif
+
+/* Return non-zero if xp,xsize and yp,ysize overlap.
+ If xp+xsize<=yp there's no overlap, or if yp+ysize<=xp there's no
+ overlap. If both these are false, there's an overlap. */
+#define GMP_MPN_OVERLAP_P(xp, xsize, yp, ysize) \
+ ((xp) + (xsize) > (yp) && (yp) + (ysize) > (xp))
+
#define gmp_assert_nocarry(x) do { \
mp_limb_t __cy = (x); \
assert (__cy == 0); \
@@ -78,11 +94,13 @@ see https://www.gnu.org/licenses/. */
#define gmp_clz(count, x) do { \
mp_limb_t __clz_x = (x); \
- unsigned __clz_c; \
- for (__clz_c = 0; \
- (__clz_x & ((mp_limb_t) 0xff << (GMP_LIMB_BITS - 8))) == 0; \
- __clz_c += 8) \
- __clz_x <<= 8; \
+ unsigned __clz_c = 0; \
+ int LOCAL_SHIFT_BITS = 8; \
+ if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS) \
+ for (; \
+ (__clz_x & ((mp_limb_t) 0xff << (GMP_LIMB_BITS - 8))) == 0; \
+ __clz_c += 8) \
+ { __clz_x <<= LOCAL_SHIFT_BITS; } \
for (; (__clz_x & GMP_LIMB_HIGHBIT) == 0; __clz_c++) \
__clz_x <<= 1; \
(count) = __clz_c; \
@@ -113,27 +131,42 @@ see https://www.gnu.org/licenses/. */
#define gmp_umul_ppmm(w1, w0, u, v) \
do { \
- mp_limb_t __x0, __x1, __x2, __x3; \
- unsigned __ul, __vl, __uh, __vh; \
- mp_limb_t __u = (u), __v = (v); \
+ int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS; \
+ if (sizeof(unsigned int) * CHAR_BIT >= 2 * GMP_LIMB_BITS) \
+ { \
+ unsigned int __ww = (unsigned int) (u) * (v); \
+ w0 = (mp_limb_t) __ww; \
+ w1 = (mp_limb_t) (__ww >> LOCAL_GMP_LIMB_BITS); \
+ } \
+ else if (GMP_ULONG_BITS >= 2 * GMP_LIMB_BITS) \
+ { \
+ unsigned long int __ww = (unsigned long int) (u) * (v); \
+ w0 = (mp_limb_t) __ww; \
+ w1 = (mp_limb_t) (__ww >> LOCAL_GMP_LIMB_BITS); \
+ } \
+ else { \
+ mp_limb_t __x0, __x1, __x2, __x3; \
+ unsigned __ul, __vl, __uh, __vh; \
+ mp_limb_t __u = (u), __v = (v); \
\
- __ul = __u & GMP_LLIMB_MASK; \
- __uh = __u >> (GMP_LIMB_BITS / 2); \
- __vl = __v & GMP_LLIMB_MASK; \
- __vh = __v >> (GMP_LIMB_BITS / 2); \
+ __ul = __u & GMP_LLIMB_MASK; \
+ __uh = __u >> (GMP_LIMB_BITS / 2); \
+ __vl = __v & GMP_LLIMB_MASK; \
+ __vh = __v >> (GMP_LIMB_BITS / 2); \
\
- __x0 = (mp_limb_t) __ul * __vl; \
- __x1 = (mp_limb_t) __ul * __vh; \
- __x2 = (mp_limb_t) __uh * __vl; \
- __x3 = (mp_limb_t) __uh * __vh; \
+ __x0 = (mp_limb_t) __ul * __vl; \
+ __x1 = (mp_limb_t) __ul * __vh; \
+ __x2 = (mp_limb_t) __uh * __vl; \
+ __x3 = (mp_limb_t) __uh * __vh; \
\
- __x1 += __x0 >> (GMP_LIMB_BITS / 2);/* this can't give carry */ \
- __x1 += __x2; /* but this indeed can */ \
- if (__x1 < __x2) /* did we get it? */ \
- __x3 += GMP_HLIMB_BIT; /* yes, add it in the proper pos. */ \
+ __x1 += __x0 >> (GMP_LIMB_BITS / 2);/* this can't give carry */ \
+ __x1 += __x2; /* but this indeed can */ \
+ if (__x1 < __x2) /* did we get it? */ \
+ __x3 += GMP_HLIMB_BIT; /* yes, add it in the proper pos. */ \
\
- (w1) = __x3 + (__x1 >> (GMP_LIMB_BITS / 2)); \
- (w0) = (__x1 << (GMP_LIMB_BITS / 2)) + (__x0 & GMP_LLIMB_MASK); \
+ (w1) = __x3 + (__x1 >> (GMP_LIMB_BITS / 2)); \
+ (w0) = (__x1 << (GMP_LIMB_BITS / 2)) + (__x0 & GMP_LLIMB_MASK); \
+ } \
} while (0)
#define gmp_udiv_qrnnd_preinv(q, r, nh, nl, d, di) \
@@ -264,7 +297,7 @@ gmp_default_alloc (size_t size)
}
static void *
-gmp_default_realloc (void *old, size_t old_size, size_t new_size)
+gmp_default_realloc (void *old, size_t unused_old_size, size_t new_size)
{
void * p;
@@ -277,7 +310,7 @@ gmp_default_realloc (void *old, size_t old_size, size_t new_size)
}
static void
-gmp_default_free (void *p, size_t size)
+gmp_default_free (void *p, size_t unused_size)
{
free (p);
}
@@ -576,6 +609,8 @@ mpn_mul (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
{
assert (un >= vn);
assert (vn >= 1);
+ assert (!GMP_MPN_OVERLAP_P(rp, un + vn, up, un));
+ assert (!GMP_MPN_OVERLAP_P(rp, un + vn, vp, vn));
/* We first multiply by the low order limb. This result can be
stored, not added, to rp. We also avoid a loop for zeroing this
@@ -735,81 +770,83 @@ mpn_neg (mp_ptr rp, mp_srcptr up, mp_size_t n)
mp_limb_t
mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
{
- mp_limb_t r, p, m, ql;
- unsigned ul, uh, qh;
+ mp_limb_t r, m;
- assert (u1 >= GMP_LIMB_HIGHBIT);
+ {
+ mp_limb_t p, ql;
+ unsigned ul, uh, qh;
- /* For notation, let b denote the half-limb base, so that B = b^2.
- Split u1 = b uh + ul. */
- ul = u1 & GMP_LLIMB_MASK;
- uh = u1 >> (GMP_LIMB_BITS / 2);
+ /* For notation, let b denote the half-limb base, so that B = b^2.
+ Split u1 = b uh + ul. */
+ ul = u1 & GMP_LLIMB_MASK;
+ uh = u1 >> (GMP_LIMB_BITS / 2);
- /* Approximation of the high half of quotient. Differs from the 2/1
- inverse of the half limb uh, since we have already subtracted
- u0. */
- qh = ~u1 / uh;
+ /* Approximation of the high half of quotient. Differs from the 2/1
+ inverse of the half limb uh, since we have already subtracted
+ u0. */
+ qh = (u1 ^ GMP_LIMB_MAX) / uh;
- /* Adjust to get a half-limb 3/2 inverse, i.e., we want
+ /* Adjust to get a half-limb 3/2 inverse, i.e., we want
- qh' = floor( (b^3 - 1) / u) - b = floor ((b^3 - b u - 1) / u
- = floor( (b (~u) + b-1) / u),
+ qh' = floor( (b^3 - 1) / u) - b = floor ((b^3 - b u - 1) / u
+ = floor( (b (~u) + b-1) / u),
+
+ and the remainder
- and the remainder
-
- r = b (~u) + b-1 - qh (b uh + ul)
+ r = b (~u) + b-1 - qh (b uh + ul)
= b (~u - qh uh) + b-1 - qh ul
- Subtraction of qh ul may underflow, which implies adjustments.
- But by normalization, 2 u >= B > qh ul, so we need to adjust by
- at most 2.
- */
+ Subtraction of qh ul may underflow, which implies adjustments.
+ But by normalization, 2 u >= B > qh ul, so we need to adjust by
+ at most 2.
+ */
- r = ((~u1 - (mp_limb_t) qh * uh) << (GMP_LIMB_BITS / 2)) | GMP_LLIMB_MASK;
+ r = ((~u1 - (mp_limb_t) qh * uh) << (GMP_LIMB_BITS / 2)) | GMP_LLIMB_MASK;
- p = (mp_limb_t) qh * ul;
- /* Adjustment steps taken from udiv_qrnnd_c */
- if (r < p)
- {
- qh--;
- r += u1;
- if (r >= u1) /* i.e. we didn't get carry when adding to r */
- if (r < p)
- {
- qh--;
- r += u1;
- }
- }
- r -= p;
+ p = (mp_limb_t) qh * ul;
+ /* Adjustment steps taken from udiv_qrnnd_c */
+ if (r < p)
+ {
+ qh--;
+ r += u1;
+ if (r >= u1) /* i.e. we didn't get carry when adding to r */
+ if (r < p)
+ {
+ qh--;
+ r += u1;
+ }
+ }
+ r -= p;
- /* Low half of the quotient is
+ /* Low half of the quotient is
ql = floor ( (b r + b-1) / u1).
- This is a 3/2 division (on half-limbs), for which qh is a
- suitable inverse. */
+ This is a 3/2 division (on half-limbs), for which qh is a
+ suitable inverse. */
- p = (r >> (GMP_LIMB_BITS / 2)) * qh + r;
- /* Unlike full-limb 3/2, we can add 1 without overflow. For this to
- work, it is essential that ql is a full mp_limb_t. */
- ql = (p >> (GMP_LIMB_BITS / 2)) + 1;
+ p = (r >> (GMP_LIMB_BITS / 2)) * qh + r;
+ /* Unlike full-limb 3/2, we can add 1 without overflow. For this to
+ work, it is essential that ql is a full mp_limb_t. */
+ ql = (p >> (GMP_LIMB_BITS / 2)) + 1;
- /* By the 3/2 trick, we don't need the high half limb. */
- r = (r << (GMP_LIMB_BITS / 2)) + GMP_LLIMB_MASK - ql * u1;
+ /* By the 3/2 trick, we don't need the high half limb. */
+ r = (r << (GMP_LIMB_BITS / 2)) + GMP_LLIMB_MASK - ql * u1;
- if (r >= (p << (GMP_LIMB_BITS / 2)))
- {
- ql--;
- r += u1;
- }
- m = ((mp_limb_t) qh << (GMP_LIMB_BITS / 2)) + ql;
- if (r >= u1)
- {
- m++;
- r -= u1;
- }
+ if (r >= (GMP_LIMB_MAX & (p << (GMP_LIMB_BITS / 2))))
+ {
+ ql--;
+ r += u1;
+ }
+ m = ((mp_limb_t) qh << (GMP_LIMB_BITS / 2)) + ql;
+ if (r >= u1)
+ {
+ m++;
+ r -= u1;
+ }
+ }
- /* Now m is the 2/1 invers of u1. If u0 > 0, adjust it to become a
+ /* Now m is the 2/1 inverse of u1. If u0 > 0, adjust it to become a
3/2 inverse. */
if (u0 > 0)
{
@@ -922,7 +959,8 @@ mpn_div_qr_1_preinv (mp_ptr qp, mp_srcptr np, mp_size_t nn,
if (inv->shift > 0)
{
- tp = gmp_xalloc_limbs (nn);
+ /* Shift, reusing qp area if possible. In-place shift if qp == np. */
+ tp = qp ? qp : gmp_xalloc_limbs (nn);
r = mpn_lshift (tp, np, nn, inv->shift);
np = tp;
}
@@ -939,50 +977,19 @@ mpn_div_qr_1_preinv (mp_ptr qp, mp_srcptr np, mp_size_t nn,
if (qp)
qp[nn] = q;
}
- if (inv->shift > 0)
+ if ((inv->shift > 0) && (tp != qp))
gmp_free (tp);
return r >> inv->shift;
}
-static mp_limb_t
-mpn_div_qr_1 (mp_ptr qp, mp_srcptr np, mp_size_t nn, mp_limb_t d)
-{
- assert (d > 0);
-
- /* Special case for powers of two. */
- if ((d & (d-1)) == 0)
- {
- mp_limb_t r = np[0] & (d-1);
- if (qp)
- {
- if (d <= 1)
- mpn_copyi (qp, np, nn);
- else
- {
- unsigned shift;
- gmp_ctz (shift, d);
- mpn_rshift (qp, np, nn, shift);
- }
- }
- return r;
- }
- else
- {
- struct gmp_div_inverse inv;
- mpn_div_qr_1_invert (&inv, d);
- return mpn_div_qr_1_preinv (qp, np, nn, &inv);
- }
-}
-
static void
-mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
+mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
const struct gmp_div_inverse *inv)
{
unsigned shift;
mp_size_t i;
mp_limb_t d1, d0, di, r1, r0;
- mp_ptr tp;
assert (nn >= 2);
shift = inv->shift;
@@ -991,11 +998,7 @@ mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
di = inv->di;
if (shift > 0)
- {
- tp = gmp_xalloc_limbs (nn);
- r1 = mpn_lshift (tp, np, nn, shift);
- np = tp;
- }
+ r1 = mpn_lshift (np, np, nn, shift);
else
r1 = 0;
@@ -1015,29 +1018,14 @@ mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
if (shift > 0)
{
- assert ((r0 << (GMP_LIMB_BITS - shift)) == 0);
+ assert ((r0 & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - shift))) == 0);
r0 = (r0 >> shift) | (r1 << (GMP_LIMB_BITS - shift));
r1 >>= shift;
-
- gmp_free (tp);
}
- rp[1] = r1;
- rp[0] = r0;
-}
-
-#if 0
-static void
-mpn_div_qr_2 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
- mp_limb_t d1, mp_limb_t d0)
-{
- struct gmp_div_inverse inv;
- assert (nn >= 2);
-
- mpn_div_qr_2_invert (&inv, d1, d0);
- mpn_div_qr_2_preinv (qp, rp, np, nn, &inv);
+ np[1] = r1;
+ np[0] = r0;
}
-#endif
static void
mpn_div_qr_pi1 (mp_ptr qp,
@@ -1113,7 +1101,7 @@ mpn_div_qr_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
if (dn == 1)
np[0] = mpn_div_qr_1_preinv (qp, np, nn, inv);
else if (dn == 2)
- mpn_div_qr_2_preinv (qp, np, np, nn, inv);
+ mpn_div_qr_2_preinv (qp, np, nn, inv);
else
{
mp_limb_t nh;
@@ -1253,7 +1241,7 @@ mpn_limb_get_str (unsigned char *sp, mp_limb_t w,
l = w << binv->shift;
gmp_udiv_qrnnd_preinv (w, r, h, l, binv->d1, binv->di);
- assert ( (r << (GMP_LIMB_BITS - binv->shift)) == 0);
+ assert ((r & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - binv->shift))) == 0);
r >>= binv->shift;
sp[i] = r;
@@ -1421,7 +1409,7 @@ mpn_set_str (mp_ptr rp, const unsigned char *sp, size_t sn, int base)
void
mpz_init (mpz_t r)
{
- static const mp_limb_t dummy_limb = 0xc1a0;
+ static const mp_limb_t dummy_limb = GMP_LIMB_MAX & 0xc1a0;
r->_mp_alloc = 0;
r->_mp_size = 0;
@@ -1479,6 +1467,12 @@ mpz_set_si (mpz_t r, signed long int x)
if (x >= 0)
mpz_set_ui (r, x);
else /* (x < 0) */
+ if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+ {
+ mpz_set_ui (r, GMP_NEG_CAST (unsigned long int, x));
+ mpz_neg (r, r);
+ }
+ else
{
r->_mp_size = -1;
MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (unsigned long int, x);
@@ -1492,6 +1486,15 @@ mpz_set_ui (mpz_t r, unsigned long int x)
{
r->_mp_size = 1;
MPZ_REALLOC (r, 1)[0] = x;
+ if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+ {
+ int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;
+ while (x >>= LOCAL_GMP_LIMB_BITS)
+ {
+ ++ r->_mp_size;
+ MPZ_REALLOC (r, r->_mp_size)[r->_mp_size - 1] = x;
+ }
+ }
}
else
r->_mp_size = 0;
@@ -1538,14 +1541,20 @@ mpz_init_set (mpz_t r, const mpz_t x)
int
mpz_fits_slong_p (const mpz_t u)
{
- mp_size_t us = u->_mp_size;
+ return (LONG_MAX + LONG_MIN == 0 || mpz_cmp_ui (u, LONG_MAX) <= 0) &&
+ mpz_cmpabs_ui (u, GMP_NEG_CAST (unsigned long int, LONG_MIN)) <= 0;
+}
- if (us == 1)
- return u->_mp_d[0] < GMP_LIMB_HIGHBIT;
- else if (us == -1)
- return u->_mp_d[0] <= GMP_LIMB_HIGHBIT;
- else
- return (us == 0);
+static int
+mpn_absfits_ulong_p (mp_srcptr up, mp_size_t un)
+{
+ int ulongsize = GMP_ULONG_BITS / GMP_LIMB_BITS;
+ mp_limb_t ulongrem = 0;
+
+ if (GMP_ULONG_BITS % GMP_LIMB_BITS != 0)
+ ulongrem = (mp_limb_t) (ULONG_MAX >> GMP_LIMB_BITS * ulongsize) + 1;
+
+ return un <= ulongsize || (up[ulongsize] < ulongrem && un == ulongsize + 1);
}
int
@@ -1553,22 +1562,36 @@ mpz_fits_ulong_p (const mpz_t u)
{
mp_size_t us = u->_mp_size;
- return (us == (us > 0));
+ return us >= 0 && mpn_absfits_ulong_p (u->_mp_d, us);
}
long int
mpz_get_si (const mpz_t u)
{
+ unsigned long r = mpz_get_ui (u);
+ unsigned long c = -LONG_MAX - LONG_MIN;
+
if (u->_mp_size < 0)
- /* This expression is necessary to properly handle 0x80000000 */
- return -1 - (long) ((u->_mp_d[0] - 1) & ~GMP_LIMB_HIGHBIT);
+ /* This expression is necessary to properly handle -LONG_MIN */
+ return -(long) c - (long) ((r - c) & LONG_MAX);
else
- return (long) (mpz_get_ui (u) & ~GMP_LIMB_HIGHBIT);
+ return (long) (r & LONG_MAX);
}
unsigned long int
mpz_get_ui (const mpz_t u)
{
+ if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+ {
+ int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;
+ unsigned long r = 0;
+ mp_size_t n = GMP_ABS (u->_mp_size);
+ n = GMP_MIN (n, 1 + (mp_size_t) (GMP_ULONG_BITS - 1) / GMP_LIMB_BITS);
+ while (--n >= 0)
+ r = (r << LOCAL_GMP_LIMB_BITS) + u->_mp_d[n];
+ return r;
+ }
+
return u->_mp_size == 0 ? 0 : u->_mp_d[0];
}
@@ -1620,11 +1643,19 @@ mpz_limbs_finish (mpz_t x, mp_size_t xs)
x->_mp_size = xs < 0 ? -xn : xn;
}
-mpz_srcptr
-mpz_roinit_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+static mpz_srcptr
+mpz_roinit_normal_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
{
x->_mp_alloc = 0;
x->_mp_d = (mp_ptr) xp;
+ x->_mp_size = xs;
+ return x;
+}
+
+mpz_srcptr
+mpz_roinit_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+{
+ mpz_roinit_normal_n (x, xp, xs);
mpz_limbs_finish (x, xs);
return x;
}
@@ -1658,7 +1689,7 @@ mpz_set_d (mpz_t r, double x)
r->_mp_size = 0;
return;
}
- B = 2.0 * (double) GMP_LIMB_HIGHBIT;
+ B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
Bi = 1.0 / B;
for (rn = 1; x >= B; rn++)
x *= Bi;
@@ -1692,18 +1723,34 @@ mpz_init_set_d (mpz_t r, double x)
double
mpz_get_d (const mpz_t u)
{
+ int m;
+ mp_limb_t l;
mp_size_t un;
double x;
- double B = 2.0 * (double) GMP_LIMB_HIGHBIT;
+ double B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
un = GMP_ABS (u->_mp_size);
if (un == 0)
return 0.0;
- x = u->_mp_d[--un];
- while (un > 0)
- x = B*x + u->_mp_d[--un];
+ l = u->_mp_d[--un];
+ gmp_clz (m, l);
+ m = m + GMP_DBL_MANT_BITS - GMP_LIMB_BITS;
+ if (m < 0)
+ l &= GMP_LIMB_MAX << -m;
+
+ for (x = l; --un >= 0;)
+ {
+ x = B*x;
+ if (m > 0) {
+ l = u->_mp_d[un];
+ m -= GMP_LIMB_BITS;
+ if (m < 0)
+ l &= GMP_LIMB_MAX << -m;
+ x += l;
+ }
+ }
if (u->_mp_size < 0)
x = -x;
@@ -1725,7 +1772,7 @@ mpz_cmpabs_d (const mpz_t x, double d)
{
xn = GMP_ABS (xn);
- B = 2.0 * (double) GMP_LIMB_HIGHBIT;
+ B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
Bi = 1.0 / B;
/* Scale d so it can be compared with the top limb. */
@@ -1784,14 +1831,12 @@ mpz_cmp_si (const mpz_t u, long v)
{
mp_size_t usize = u->_mp_size;
- if (usize < -1)
- return -1;
- else if (v >= 0)
+ if (v >= 0)
return mpz_cmp_ui (u, v);
else if (usize >= 0)
return 1;
- else /* usize == -1 */
- return GMP_CMP (GMP_NEG_CAST (mp_limb_t, v), u->_mp_d[0]);
+ else
+ return - mpz_cmpabs_ui (u, GMP_NEG_CAST (unsigned long int, v));
}
int
@@ -1799,12 +1844,10 @@ mpz_cmp_ui (const mpz_t u, unsigned long v)
{
mp_size_t usize = u->_mp_size;
- if (usize > 1)
- return 1;
- else if (usize < 0)
+ if (usize < 0)
return -1;
else
- return GMP_CMP (mpz_get_ui (u), v);
+ return mpz_cmpabs_ui (u, v);
}
int
@@ -1824,10 +1867,15 @@ mpz_cmp (const mpz_t a, const mpz_t b)
int
mpz_cmpabs_ui (const mpz_t u, unsigned long v)
{
- if (GMP_ABS (u->_mp_size) > 1)
+ mp_size_t un = GMP_ABS (u->_mp_size);
+
+ if (! mpn_absfits_ulong_p (u->_mp_d, un))
return 1;
else
- return GMP_CMP (mpz_get_ui (u), v);
+ {
+ unsigned long uu = mpz_get_ui (u);
+ return GMP_CMP(uu, v);
+ }
}
int
@@ -1862,81 +1910,28 @@ mpz_swap (mpz_t u, mpz_t v)
/* MPZ addition and subtraction */
-/* Adds to the absolute value. Returns new size, but doesn't store it. */
-static mp_size_t
-mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b)
-{
- mp_size_t an;
- mp_ptr rp;
- mp_limb_t cy;
-
- an = GMP_ABS (a->_mp_size);
- if (an == 0)
- {
- MPZ_REALLOC (r, 1)[0] = b;
- return b > 0;
- }
-
- rp = MPZ_REALLOC (r, an + 1);
-
- cy = mpn_add_1 (rp, a->_mp_d, an, b);
- rp[an] = cy;
- an += cy;
-
- return an;
-}
-
-/* Subtract from the absolute value. Returns new size, (or -1 on underflow),
- but doesn't store it. */
-static mp_size_t
-mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
-{
- mp_size_t an = GMP_ABS (a->_mp_size);
- mp_ptr rp;
-
- if (an == 0)
- {
- MPZ_REALLOC (r, 1)[0] = b;
- return -(b > 0);
- }
- rp = MPZ_REALLOC (r, an);
- if (an == 1 && a->_mp_d[0] < b)
- {
- rp[0] = b - a->_mp_d[0];
- return -1;
- }
- else
- {
- gmp_assert_nocarry (mpn_sub_1 (rp, a->_mp_d, an, b));
- return mpn_normalized_size (rp, an);
- }
-}
void
mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
{
- if (a->_mp_size >= 0)
- r->_mp_size = mpz_abs_add_ui (r, a, b);
- else
- r->_mp_size = -mpz_abs_sub_ui (r, a, b);
+ mpz_t bb;
+ mpz_init_set_ui (bb, b);
+ mpz_add (r, a, bb);
+ mpz_clear (bb);
}
void
mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
{
- if (a->_mp_size < 0)
- r->_mp_size = -mpz_abs_add_ui (r, a, b);
- else
- r->_mp_size = mpz_abs_sub_ui (r, a, b);
+ mpz_ui_sub (r, b, a);
+ mpz_neg (r, r);
}
void
mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b)
{
- if (b->_mp_size < 0)
- r->_mp_size = mpz_abs_add_ui (r, b, a);
- else
- r->_mp_size = -mpz_abs_sub_ui (r, b, a);
+ mpz_neg (r, b);
+ mpz_add_ui (r, r, a);
}
static mp_size_t
@@ -2023,32 +2018,17 @@ mpz_mul_si (mpz_t r, const mpz_t u, long int v)
mpz_neg (r, r);
}
else
- mpz_mul_ui (r, u, (unsigned long int) v);
+ mpz_mul_ui (r, u, v);
}
void
mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v)
{
- mp_size_t un, us;
- mp_ptr tp;
- mp_limb_t cy;
-
- us = u->_mp_size;
-
- if (us == 0 || v == 0)
- {
- r->_mp_size = 0;
- return;
- }
-
- un = GMP_ABS (us);
-
- tp = MPZ_REALLOC (r, un + 1);
- cy = mpn_mul_1 (tp, u->_mp_d, un, v);
- tp[un] = cy;
-
- un += (cy > 0);
- r->_mp_size = (us < 0) ? - un : un;
+ mpz_t vv;
+ mpz_init_set_ui (vv, v);
+ mpz_mul (r, u, vv);
+ mpz_clear (vv);
+ return;
}
void
@@ -2127,8 +2107,8 @@ void
mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v)
{
mpz_t t;
- mpz_init (t);
- mpz_mul_ui (t, u, v);
+ mpz_init_set_ui (t, v);
+ mpz_mul (t, u, t);
mpz_add (r, r, t);
mpz_clear (t);
}
@@ -2137,8 +2117,8 @@ void
mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v)
{
mpz_t t;
- mpz_init (t);
- mpz_mul_ui (t, u, v);
+ mpz_init_set_ui (t, v);
+ mpz_mul (t, u, t);
mpz_sub (r, r, t);
mpz_clear (t);
}
@@ -2534,56 +2514,20 @@ static unsigned long
mpz_div_qr_ui (mpz_t q, mpz_t r,
const mpz_t n, unsigned long d, enum mpz_div_round_mode mode)
{
- mp_size_t ns, qn;
- mp_ptr qp;
- mp_limb_t rl;
- mp_size_t rs;
+ unsigned long ret;
+ mpz_t rr, dd;
- ns = n->_mp_size;
- if (ns == 0)
- {
- if (q)
- q->_mp_size = 0;
- if (r)
- r->_mp_size = 0;
- return 0;
- }
-
- qn = GMP_ABS (ns);
- if (q)
- qp = MPZ_REALLOC (q, qn);
- else
- qp = NULL;
-
- rl = mpn_div_qr_1 (qp, n->_mp_d, qn, d);
- assert (rl < d);
-
- rs = rl > 0;
- rs = (ns < 0) ? -rs : rs;
-
- if (rl > 0 && ( (mode == GMP_DIV_FLOOR && ns < 0)
- || (mode == GMP_DIV_CEIL && ns >= 0)))
- {
- if (q)
- gmp_assert_nocarry (mpn_add_1 (qp, qp, qn, 1));
- rl = d - rl;
- rs = -rs;
- }
+ mpz_init (rr);
+ mpz_init_set_ui (dd, d);
+ mpz_div_qr (q, rr, n, dd, mode);
+ mpz_clear (dd);
+ ret = mpz_get_ui (rr);
if (r)
- {
- MPZ_REALLOC (r, 1)[0] = rl;
- r->_mp_size = rs;
- }
- if (q)
- {
- qn -= (qp[qn-1] == 0);
- assert (qn == 0 || qp[qn-1] > 0);
+ mpz_swap (r, rr);
+ mpz_clear (rr);
- q->_mp_size = (ns < 0) ? - qn : qn;
- }
-
- return rl;
+ return ret;
}
unsigned long
@@ -2722,22 +2666,16 @@ mpn_gcd_11 (mp_limb_t u, mp_limb_t v)
unsigned long
mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v)
{
- mp_size_t un;
+ mpz_t t;
+ mpz_init_set_ui(t, v);
+ mpz_gcd (t, u, t);
+ if (v > 0)
+ v = mpz_get_ui (t);
- if (v == 0)
- {
- if (g)
- mpz_abs (g, u);
- }
- else
- {
- un = GMP_ABS (u->_mp_size);
- if (un != 0)
- v = mpn_gcd_11 (mpn_div_qr_1 (NULL, u->_mp_d, un, v), v);
+ if (g)
+ mpz_swap (t, g);
- if (g)
- mpz_set_ui (g, v);
- }
+ mpz_clear (t);
return v;
}
@@ -2831,7 +2769,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
signed long sign = mpz_sgn (v);
mpz_abs (g, v);
if (s)
- mpz_set_ui (s, 0);
+ s->_mp_size = 0;
if (t)
mpz_set_si (t, sign);
return;
@@ -2845,7 +2783,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
if (s)
mpz_set_si (s, sign);
if (t)
- mpz_set_ui (t, 0);
+ t->_mp_size = 0;
return;
}
@@ -2970,8 +2908,9 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
mpz_sub (s0, s0, s1);
mpz_add (t0, t0, t1);
}
- mpz_divexact_ui (s0, s0, 2);
- mpz_divexact_ui (t0, t0, 2);
+ assert (mpz_even_p (t0) && mpz_even_p (s0));
+ mpz_tdiv_q_2exp (s0, s0, 1);
+ mpz_tdiv_q_2exp (t0, t0, 1);
}
/* Arrange so that |s| < |u| / 2g */
@@ -3096,7 +3035,10 @@ void
mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e)
{
mpz_t b;
- mpz_pow_ui (r, mpz_roinit_n (b, &blimb, 1), e);
+
+ mpz_init_set_ui (b, blimb);
+ mpz_pow_ui (r, b, e);
+ mpz_clear (b);
}
void
@@ -3208,7 +3150,10 @@ void
mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m)
{
mpz_t e;
- mpz_powm (r, b, mpz_roinit_n (e, &elimb, 1), m);
+
+ mpz_init_set_ui (e, elimb);
+ mpz_powm (r, b, e, m);
+ mpz_clear (e);
}
/* x=trunc(y^(1/z)), r=y-x^z */
@@ -3315,7 +3260,7 @@ mpn_perfect_square_p (mp_srcptr p, mp_size_t n)
assert (n > 0);
assert (p [n-1] != 0);
- return mpz_root (NULL, mpz_roinit_n (t, p, n), 2);
+ return mpz_root (NULL, mpz_roinit_normal_n (t, p, n), 2);
}
mp_size_t
@@ -3329,7 +3274,7 @@ mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n)
mpz_init (r);
mpz_init (s);
- mpz_rootrem (s, r, mpz_roinit_n (u, p, n), 2);
+ mpz_rootrem (s, r, mpz_roinit_normal_n (u, p, n), 2);
assert (s->_mp_size == (n+1)/2);
mpn_copyd (sp, s->_mp_d, s->_mp_size);
@@ -3344,11 +3289,24 @@ mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n)
/* Combinatorics */
void
-mpz_fac_ui (mpz_t x, unsigned long n)
+mpz_mfac_uiui (mpz_t x, unsigned long n, unsigned long m)
{
mpz_set_ui (x, n + (n == 0));
- while (n > 2)
- mpz_mul_ui (x, x, --n);
+ if (m + 1 < 2) return;
+ while (n > m + 1)
+ mpz_mul_ui (x, x, n -= m);
+}
+
+void
+mpz_2fac_ui (mpz_t x, unsigned long n)
+{
+ mpz_mfac_uiui (x, n, 2);
+}
+
+void
+mpz_fac_ui (mpz_t x, unsigned long n)
+{
+ mpz_mfac_uiui (x, n, 1);
}
void
@@ -3364,8 +3322,8 @@ mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
mpz_init (t);
mpz_fac_ui (t, k);
- for (; k > 0; k--)
- mpz_mul_ui (r, r, n--);
+ for (; k > 0; --k)
+ mpz_mul_ui (r, r, n--);
mpz_divexact (r, r, t);
mpz_clear (t);
@@ -3373,6 +3331,177 @@ mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
/* Primality testing */
+
+/* Computes Kronecker (a/b) with odd b, a!=0 and GCD(a,b) = 1 */
+/* Adapted from JACOBI_BASE_METHOD==4 in mpn/generic/jacbase.c */
+static int
+gmp_jacobi_coprime (mp_limb_t a, mp_limb_t b)
+{
+ int c, bit = 0;
+
+ assert (b & 1);
+ assert (a != 0);
+ /* assert (mpn_gcd_11 (a, b) == 1); */
+
+ /* Below, we represent a and b shifted right so that the least
+ significant one bit is implicit. */
+ b >>= 1;
+
+ gmp_ctz(c, a);
+ a >>= 1;
+
+ do
+ {
+ a >>= c;
+ /* (2/b) = -1 if b = 3 or 5 mod 8 */
+ bit ^= c & (b ^ (b >> 1));
+ if (a < b)
+ {
+ bit ^= a & b;
+ a = b - a;
+ b -= a;
+ }
+ else
+ {
+ a -= b;
+ assert (a != 0);
+ }
+
+ gmp_ctz(c, a);
+ ++c;
+ }
+ while (b > 0);
+
+ return bit & 1 ? -1 : 1;
+}
+
+static void
+gmp_lucas_step_k_2k (mpz_t V, mpz_t Qk, const mpz_t n)
+{
+ mpz_mod (Qk, Qk, n);
+ /* V_{2k} <- V_k ^ 2 - 2Q^k */
+ mpz_mul (V, V, V);
+ mpz_submul_ui (V, Qk, 2);
+ mpz_tdiv_r (V, V, n);
+ /* Q^{2k} = (Q^k)^2 */
+ mpz_mul (Qk, Qk, Qk);
+}
+
+/* Computes V_k, Q^k (mod n) for the Lucas' sequence */
+/* with P=1, Q=Q; k = (n>>b0)|1. */
+/* Requires an odd n > 4; b0 > 0; -2*Q must not overflow a long */
+/* Returns (U_k == 0) and sets V=V_k and Qk=Q^k. */
+static int
+gmp_lucas_mod (mpz_t V, mpz_t Qk, long Q,
+ mp_bitcnt_t b0, const mpz_t n)
+{
+ mp_bitcnt_t bs;
+ mpz_t U;
+ int res;
+
+ assert (b0 > 0);
+ assert (Q <= - (LONG_MIN / 2));
+ assert (Q >= - (LONG_MAX / 2));
+ assert (mpz_cmp_ui (n, 4) > 0);
+ assert (mpz_odd_p (n));
+
+ mpz_init_set_ui (U, 1); /* U1 = 1 */
+ mpz_set_ui (V, 1); /* V1 = 1 */
+ mpz_set_si (Qk, Q);
+
+ for (bs = mpz_sizeinbase (n, 2) - 1; --bs >= b0;)
+ {
+ /* U_{2k} <- U_k * V_k */
+ mpz_mul (U, U, V);
+ /* V_{2k} <- V_k ^ 2 - 2Q^k */
+ /* Q^{2k} = (Q^k)^2 */
+ 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 */
+ /* should be 1 in $n+1$ (bs == b0) */
+ if (b0 == bs || mpz_tstbit (n, bs))
+ {
+ /* Q^{k+1} <- Q^k * Q */
+ mpz_mul_si (Qk, Qk, Q);
+ /* U_{k+1} <- (U_k + V_k) / 2 */
+ mpz_swap (U, V); /* Keep in V the old value of U_k */
+ mpz_add (U, U, V);
+ /* We have to compute U/2, so we need an even value, */
+ /* equivalent (mod n) */
+ if (mpz_odd_p (U))
+ mpz_add (U, U, n);
+ mpz_tdiv_q_2exp (U, U, 1);
+ /* V_{k+1} <-(D*U_k + V_k) / 2 =
+ U_{k+1} + (D-1)/2*U_k = U_{k+1} - 2Q*U_k */
+ mpz_mul_si (V, V, -2*Q);
+ mpz_add (V, U, V);
+ mpz_tdiv_r (V, V, n);
+ }
+ mpz_tdiv_r (U, U, n);
+ }
+
+ res = U->_mp_size == 0;
+ mpz_clear (U);
+ return res;
+}
+
+/* Performs strong Lucas' test on x, with parameters suggested */
+/* for the BPSW test. Qk is only passed to recycle a variable. */
+/* Requires GCD (x,6) = 1.*/
+static int
+gmp_stronglucas (const mpz_t x, mpz_t Qk)
+{
+ mp_bitcnt_t b0;
+ mpz_t V, n;
+ mp_limb_t maxD, D; /* The absolute value is stored. */
+ long Q;
+ mp_limb_t tl;
+
+ /* Test on the absolute value. */
+ mpz_roinit_normal_n (n, x->_mp_d, GMP_ABS (x->_mp_size));
+
+ assert (mpz_odd_p (n));
+ /* assert (mpz_gcd_ui (NULL, n, 6) == 1); */
+ if (mpz_root (Qk, n, 2))
+ return 0; /* A square is composite. */
+
+ /* Check Ds up to square root (in case, n is prime)
+ or avoid overflows */
+ maxD = (Qk->_mp_size == 1) ? Qk->_mp_d [0] - 1 : GMP_LIMB_MAX;
+
+ D = 3;
+ /* Search a D such that (D/n) = -1 in the sequence 5,-7,9,-11,.. */
+ /* For those Ds we have (D/n) = (n/|D|) */
+ do
+ {
+ if (D >= maxD)
+ return 1 + (D != GMP_LIMB_MAX); /* (1 + ! ~ D) */
+ D += 2;
+ tl = mpz_tdiv_ui (n, D);
+ if (tl == 0)
+ return 0;
+ }
+ while (gmp_jacobi_coprime (tl, D) == 1);
+
+ mpz_init (V);
+
+ /* n-(D/n) = n+1 = d*2^{b0}, with d = (n>>b0) | 1 */
+ b0 = mpz_scan0 (n, 0);
+
+ /* D= P^2 - 4Q; P = 1; Q = (1-D)/4 */
+ Q = (D & 2) ? (long) (D >> 2) + 1 : -(long) (D >> 2);
+
+ if (! gmp_lucas_mod (V, Qk, Q, b0, n)) /* If Ud != 0 */
+ while (V->_mp_size != 0 && --b0 != 0) /* while Vk != 0 */
+ /* V <- V ^ 2 - 2Q^k */
+ /* Q^{2k} = (Q^k)^2 */
+ gmp_lucas_step_k_2k (V, Qk, n);
+
+ mpz_clear (V);
+ return (b0 != 0);
+}
+
static int
gmp_millerrabin (const mpz_t n, const mpz_t nm1, mpz_t y,
const mpz_t q, mp_bitcnt_t k)
@@ -3434,21 +3563,26 @@ mpz_probab_prime_p (const mpz_t n, int reps)
if (mpz_cmpabs_ui (n, 31*31) < 0)
return 2;
- /* Use Miller-Rabin, with a deterministic sequence of bases, a[j] =
- j^2 + j + 41 using Euler's polynomial. We potentially stop early,
- if a[j] >= n - 1. Since n >= 31*31, this can happen only if reps >
- 30 (a[30] == 971 > 31*31 == 961). */
-
mpz_init (nm1);
mpz_init (q);
- mpz_init (y);
/* Find q and k, where q is odd and n = 1 + 2**k * q. */
- nm1->_mp_size = mpz_abs_sub_ui (nm1, n, 1);
+ mpz_abs (nm1, n);
+ nm1->_mp_d[0] -= 1;
k = mpz_scan1 (nm1, 0);
mpz_tdiv_q_2exp (q, nm1, k);
- for (j = 0, is_prime = 1; is_prime & (j < reps); j++)
+ /* BPSW test */
+ mpz_init_set_ui (y, 2);
+ is_prime = gmp_millerrabin (n, nm1, y, q, k) && gmp_stronglucas (n, y);
+ reps -= 24; /* skip the first 24 repetitions */
+
+ /* Use Miller-Rabin, with a deterministic sequence of bases, a[j] =
+ j^2 + j + 41 using Euler's polynomial. We potentially stop early,
+ if a[j] >= n - 1. Since n >= 31*31, this can happen only if reps >
+ 30 (a[30] == 971 > 31*31 == 961). */
+
+ for (j = 0; is_prime & (j < reps); j++)
{
mpz_set_ui (y, (unsigned long) j*j+j+41);
if (mpz_cmp (y, nm1) >= 0)
@@ -3516,7 +3650,7 @@ mpz_tstbit (const mpz_t d, mp_bitcnt_t bit_index)
{
/* d < 0. Check if any of the bits below is set: If so, our bit
must be complemented. */
- if (shift > 0 && (w << (GMP_LIMB_BITS - shift)) > 0)
+ if (shift > 0 && (mp_limb_t) (w << (GMP_LIMB_BITS - shift)) > 0)
return bit ^ 1;
while (--limb_index >= 0)
if (d->_mp_d[limb_index] > 0)
@@ -3623,8 +3757,8 @@ mpz_combit (mpz_t d, mp_bitcnt_t bit_index)
void
mpz_com (mpz_t r, const mpz_t u)
{
- mpz_neg (r, u);
- mpz_sub_ui (r, r, 1);
+ mpz_add_ui (r, u, 1);
+ mpz_neg (r, r);
}
void
@@ -3847,13 +3981,18 @@ gmp_popcount_limb (mp_limb_t x)
unsigned c;
/* Do 16 bits at a time, to avoid limb-sized constants. */
- for (c = 0; x > 0; x >>= 16)
+ int LOCAL_SHIFT_BITS = 16;
+ for (c = 0; x > 0;)
{
- unsigned w = ((x >> 1) & 0x5555) + (x & 0x5555);
+ unsigned w = x - ((x >> 1) & 0x5555);
w = ((w >> 2) & 0x3333) + (w & 0x3333);
- w = ((w >> 4) & 0x0f0f) + (w & 0x0f0f);
- w = (w >> 8) + (w & 0x00ff);
+ w = (w >> 4) + w;
+ w = ((w >> 8) & 0x000f) + (w & 0x000f);
c += w;
+ if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
+ x >>= LOCAL_SHIFT_BITS;
+ else
+ x = 0;
}
return c;
}
@@ -3964,7 +4103,7 @@ mpz_scan1 (const mpz_t u, mp_bitcnt_t starting_bit)
}
/* Mask to 0 all bits before starting_bit, thus ignoring them. */
- limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
+ limb &= GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS);
}
return mpn_common_scan (limb, i, up, un, ux);
@@ -3994,7 +4133,7 @@ mpz_scan0 (const mpz_t u, mp_bitcnt_t starting_bit)
limb -= mpn_zero_p (up, i); /* limb = ~(~limb + zero_p) */
/* Mask all bits before starting_bit, thus ignoring them. */
- limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
+ limb &= GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS);
return mpn_common_scan (limb, i, up, un, ux);
}
@@ -4013,7 +4152,7 @@ mpz_sizeinbase (const mpz_t u, int base)
size_t ndigits;
assert (base >= 2);
- assert (base <= 36);
+ assert (base <= 62);
un = GMP_ABS (u->_mp_size);
if (un == 0)
@@ -4063,19 +4202,22 @@ mpz_get_str (char *sp, int base, const mpz_t u)
mp_size_t un;
size_t i, sn;
- if (base >= 0)
+ digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ if (base > 1)
{
- digits = "0123456789abcdefghijklmnopqrstuvwxyz";
+ if (base <= 36)
+ digits = "0123456789abcdefghijklmnopqrstuvwxyz";
+ else if (base > 62)
+ return NULL;
}
+ else if (base >= -1)
+ base = 10;
else
{
base = -base;
- digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ if (base > 36)
+ return NULL;
}
- if (base <= 1)
- base = 10;
- if (base > 36)
- return NULL;
sn = 1 + mpz_sizeinbase (u, base);
if (!sp)
@@ -4123,14 +4265,14 @@ mpz_get_str (char *sp, int base, const mpz_t u)
int
mpz_set_str (mpz_t r, const char *sp, int base)
{
- unsigned bits;
+ unsigned bits, value_of_a;
mp_size_t rn, alloc;
mp_ptr rp;
size_t dn;
int sign;
unsigned char *dp;
- assert (base == 0 || (base >= 2 && base <= 36));
+ assert (base == 0 || (base >= 2 && base <= 62));
while (isspace( (unsigned char) *sp))
sp++;
@@ -4166,6 +4308,7 @@ mpz_set_str (mpz_t r, const char *sp, int base)
}
dp = (unsigned char *) gmp_xalloc (strlen (sp));
+ value_of_a = (base > 36) ? 36 : 10;
for (dn = 0; *sp; sp++)
{
unsigned digit;
@@ -4175,7 +4318,7 @@ mpz_set_str (mpz_t r, const char *sp, int base)
else if (*sp >= '0' && *sp <= '9')
digit = *sp - '0';
else if (*sp >= 'a' && *sp <= 'z')
- digit = *sp - 'a' + 10;
+ digit = *sp - 'a' + value_of_a;
else if (*sp >= 'A' && *sp <= 'Z')
digit = *sp - 'A' + 10;
else
@@ -4356,10 +4499,15 @@ mpz_export (void *r, size_t *countp, int order, size_t size, int endian,
limb = u->_mp_d[un-1];
assert (limb != 0);
- k = 0;
- do {
- k++; limb >>= CHAR_BIT;
- } while (limb != 0);
+ k = (GMP_LIMB_BITS <= CHAR_BIT);
+ if (!k)
+ {
+ do {
+ int LOCAL_CHAR_BIT = CHAR_BIT;
+ k++; limb >>= LOCAL_CHAR_BIT;
+ } while (limb != 0);
+ }
+ /* else limb = 0; */
count = (k + (un-1) * sizeof (mp_limb_t) + size - 1) / size;
@@ -4388,17 +4536,28 @@ mpz_export (void *r, size_t *countp, int order, size_t size, int endian,
for (bytes = 0, i = 0, k = 0; k < count; k++, p += word_step)
{
size_t j;
- for (j = 0; j < size; j++, p -= (ptrdiff_t) endian)
+ for (j = 0; j < size; ++j, p -= (ptrdiff_t) endian)
{
- if (bytes == 0)
+ if (sizeof (mp_limb_t) == 1)
{
if (i < un)
- limb = u->_mp_d[i++];
- bytes = sizeof (mp_limb_t);
+ *p = u->_mp_d[i++];
+ else
+ *p = 0;
+ }
+ else
+ {
+ int LOCAL_CHAR_BIT = CHAR_BIT;
+ if (bytes == 0)
+ {
+ if (i < un)
+ limb = u->_mp_d[i++];
+ bytes = sizeof (mp_limb_t);
+ }
+ *p = limb;
+ limb >>= LOCAL_CHAR_BIT;
+ bytes--;
}
- *p = limb;
- limb >>= CHAR_BIT;
- bytes--;
}
}
assert (i == un);
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 bb5c6371d93..7cce3f7a328 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 Free Software Foundation, Inc.
+Copyright 2011-2015, 2017, 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -53,7 +53,11 @@ void mp_get_memory_functions (void *(**) (size_t),
void *(**) (void *, size_t, size_t),
void (**) (void *, size_t));
-typedef unsigned long mp_limb_t;
+#ifndef MINI_GMP_LIMB_TYPE
+#define MINI_GMP_LIMB_TYPE long
+#endif
+
+typedef unsigned MINI_GMP_LIMB_TYPE mp_limb_t;
typedef long mp_size_t;
typedef unsigned long mp_bitcnt_t;
@@ -217,6 +221,8 @@ void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long);
int mpz_root (mpz_t, const mpz_t, unsigned long);
void mpz_fac_ui (mpz_t, unsigned long);
+void mpz_2fac_ui (mpz_t, unsigned long);
+void mpz_mfac_uiui (mpz_t, unsigned long, unsigned long);
void mpz_bin_uiui (mpz_t, unsigned long, unsigned long);
int mpz_probab_prime_p (const mpz_t, int);
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
new file mode 100644
index 00000000000..fd9b4399070
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.c
@@ -0,0 +1,554 @@
+/* mini-mpq, a minimalistic implementation of a GNU GMP subset.
+
+ Contributed to the GNU project by Marco Bodrato
+
+ Acknowledgment: special thanks to Bradley Lucier for his comments
+ to the preliminary version of this code.
+
+Copyright 2018, 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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 <assert.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mini-mpq.h"
+
+#ifndef GMP_LIMB_HIGHBIT
+/* Define macros and static functions already defined by mini-gmp.c */
+#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
+#define GMP_LIMB_HIGHBIT ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1))
+#define GMP_NEG_CAST(T,x) (-((T)((x) + 1) - 1))
+#define GMP_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+static mpz_srcptr
+mpz_roinit_normal_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+{
+ x->_mp_alloc = 0;
+ x->_mp_d = (mp_ptr) xp;
+ x->_mp_size = xs;
+ return x;
+}
+
+static void
+gmp_die (const char *msg)
+{
+ fprintf (stderr, "%s\n", msg);
+ abort();
+}
+#endif
+
+
+/* MPQ helper functions */
+static mpq_srcptr
+mpq_roinit_normal_nn (mpq_t x, mp_srcptr np, mp_size_t ns,
+ mp_srcptr dp, mp_size_t ds)
+{
+ mpz_roinit_normal_n (mpq_numref(x), np, ns);
+ mpz_roinit_normal_n (mpq_denref(x), dp, ds);
+ return x;
+}
+
+static mpq_srcptr
+mpq_roinit_zz (mpq_t x, mpz_srcptr n, mpz_srcptr d)
+{
+ return mpq_roinit_normal_nn (x, n->_mp_d, n->_mp_size,
+ d->_mp_d, d->_mp_size);
+}
+
+static void
+mpq_nan_init (mpq_t x)
+{
+ mpz_init (mpq_numref (x));
+ mpz_init (mpq_denref (x));
+}
+
+void
+mpq_init (mpq_t x)
+{
+ mpz_init (mpq_numref (x));
+ mpz_init_set_ui (mpq_denref (x), 1);
+}
+
+void
+mpq_clear (mpq_t x)
+{
+ mpz_clear (mpq_numref (x));
+ mpz_clear (mpq_denref (x));
+}
+
+static void
+mpq_canonical_sign (mpq_t r)
+{
+ int cmp = mpq_denref (r)->_mp_size;
+ if (cmp <= 0)
+ {
+ if (cmp == 0)
+ gmp_die("mpq: Fraction with zero denominator.");
+ mpz_neg (mpq_denref (r), mpq_denref (r));
+ mpz_neg (mpq_numref (r), mpq_numref (r));
+ }
+}
+
+static void
+mpq_helper_canonicalize (mpq_t r, const mpz_t num, const mpz_t den, mpz_t g)
+{
+ if (num->_mp_size == 0)
+ mpq_set_ui (r, 0, 1);
+ else
+ {
+ mpz_gcd (g, num, den);
+ mpz_tdiv_q (mpq_numref (r), num, g);
+ mpz_tdiv_q (mpq_denref (r), den, g);
+ mpq_canonical_sign (r);
+ }
+}
+
+void
+mpq_canonicalize (mpq_t r)
+{
+ mpz_t t;
+
+ mpz_init (t);
+ mpq_helper_canonicalize (r, mpq_numref (r), mpq_denref (r), t);
+ mpz_clear (t);
+}
+
+void
+mpq_swap (mpq_t a, mpq_t b)
+{
+ mpz_swap (mpq_numref (a), mpq_numref (b));
+ mpz_swap (mpq_denref (a), mpq_denref (b));
+}
+
+
+/* MPQ assignment and conversions. */
+void
+mpz_set_q (mpz_t r, const mpq_t q)
+{
+ mpz_tdiv_q (r, mpq_numref (q), mpq_denref (q));
+}
+
+void
+mpq_set (mpq_t r, const mpq_t q)
+{
+ mpz_set (mpq_numref (r), mpq_numref (q));
+ mpz_set (mpq_denref (r), mpq_denref (q));
+}
+
+void
+mpq_set_ui (mpq_t r, unsigned long n, unsigned long d)
+{
+ mpz_set_ui (mpq_numref (r), n);
+ mpz_set_ui (mpq_denref (r), d);
+}
+
+void
+mpq_set_si (mpq_t r, signed long n, unsigned long d)
+{
+ mpz_set_si (mpq_numref (r), n);
+ mpz_set_ui (mpq_denref (r), d);
+}
+
+void
+mpq_set_z (mpq_t r, const mpz_t n)
+{
+ mpz_set_ui (mpq_denref (r), 1);
+ mpz_set (mpq_numref (r), n);
+}
+
+void
+mpq_set_num (mpq_t r, const mpz_t z)
+{
+ mpz_set (mpq_numref (r), z);
+}
+
+void
+mpq_set_den (mpq_t r, const mpz_t z)
+{
+ mpz_set (mpq_denref (r), z);
+}
+
+void
+mpq_get_num (mpz_t r, const mpq_t q)
+{
+ mpz_set (r, mpq_numref (q));
+}
+
+void
+mpq_get_den (mpz_t r, const mpq_t q)
+{
+ mpz_set (r, mpq_denref (q));
+}
+
+
+/* MPQ comparisons and the like. */
+int
+mpq_cmp (const mpq_t a, const mpq_t b)
+{
+ mpz_t t1, t2;
+ int res;
+
+ mpz_init (t1);
+ mpz_init (t2);
+ mpz_mul (t1, mpq_numref (a), mpq_denref (b));
+ mpz_mul (t2, mpq_numref (b), mpq_denref (a));
+ res = mpz_cmp (t1, t2);
+ mpz_clear (t1);
+ mpz_clear (t2);
+
+ return res;
+}
+
+int
+mpq_cmp_z (const mpq_t a, const mpz_t b)
+{
+ mpz_t t;
+ int res;
+
+ mpz_init (t);
+ mpz_mul (t, b, mpq_denref (a));
+ res = mpz_cmp (mpq_numref (a), t);
+ mpz_clear (t);
+
+ return res;
+}
+
+int
+mpq_equal (const mpq_t a, const mpq_t b)
+{
+ return (mpz_cmp (mpq_numref (a), mpq_numref (b)) == 0) &&
+ (mpz_cmp (mpq_denref (a), mpq_denref (b)) == 0);
+}
+
+int
+mpq_cmp_ui (const mpq_t q, unsigned long n, unsigned long d)
+{
+ mpq_t t;
+ assert (d != 0);
+ if (ULONG_MAX <= GMP_LIMB_MAX) {
+ mp_limb_t nl = n, dl = d;
+ return mpq_cmp (q, mpq_roinit_normal_nn (t, &nl, n != 0, &dl, 1));
+ } else {
+ int ret;
+
+ mpq_init (t);
+ mpq_set_ui (t, n, d);
+ ret = mpq_cmp (q, t);
+ mpq_clear (t);
+
+ return ret;
+ }
+}
+
+int
+mpq_cmp_si (const mpq_t q, signed long n, unsigned long d)
+{
+ assert (d != 0);
+
+ if (n >= 0)
+ return mpq_cmp_ui (q, n, d);
+ else
+ {
+ mpq_t t;
+
+ if (ULONG_MAX <= GMP_LIMB_MAX)
+ {
+ mp_limb_t nl = GMP_NEG_CAST (unsigned long, n), dl = d;
+ return mpq_cmp (q, mpq_roinit_normal_nn (t, &nl, -1, &dl, 1));
+ }
+ else
+ {
+ unsigned long l_n = GMP_NEG_CAST (unsigned long, n);
+
+ mpq_roinit_normal_nn (t, mpq_numref (q)->_mp_d, - mpq_numref (q)->_mp_size,
+ mpq_denref (q)->_mp_d, mpq_denref (q)->_mp_size);
+ return - mpq_cmp_ui (t, l_n, d);
+ }
+ }
+}
+
+int
+mpq_sgn (const mpq_t a)
+{
+ return mpz_sgn (mpq_numref (a));
+}
+
+
+/* MPQ arithmetic. */
+void
+mpq_abs (mpq_t r, const mpq_t q)
+{
+ mpz_abs (mpq_numref (r), mpq_numref (q));
+ mpz_set (mpq_denref (r), mpq_denref (q));
+}
+
+void
+mpq_neg (mpq_t r, const mpq_t q)
+{
+ mpz_neg (mpq_numref (r), mpq_numref (q));
+ mpz_set (mpq_denref (r), mpq_denref (q));
+}
+
+void
+mpq_add (mpq_t r, const mpq_t a, const mpq_t b)
+{
+ mpz_t t;
+
+ mpz_init (t);
+ mpz_gcd (t, mpq_denref (a), mpq_denref (b));
+ if (mpz_cmp_ui (t, 1) == 0)
+ {
+ mpz_mul (t, mpq_numref (a), mpq_denref (b));
+ mpz_addmul (t, mpq_numref (b), mpq_denref (a));
+ mpz_mul (mpq_denref (r), mpq_denref (a), mpq_denref (b));
+ mpz_swap (mpq_numref (r), t);
+ }
+ else
+ {
+ mpz_t x, y;
+ mpz_init (x);
+ mpz_init (y);
+
+ mpz_tdiv_q (x, mpq_denref (b), t);
+ mpz_tdiv_q (y, mpq_denref (a), t);
+ mpz_mul (x, mpq_numref (a), x);
+ mpz_addmul (x, mpq_numref (b), y);
+
+ mpz_gcd (t, x, t);
+ mpz_tdiv_q (mpq_numref (r), x, t);
+ mpz_tdiv_q (x, mpq_denref (b), t);
+ mpz_mul (mpq_denref (r), x, y);
+
+ mpz_clear (x);
+ mpz_clear (y);
+ }
+ mpz_clear (t);
+}
+
+void
+mpq_sub (mpq_t r, const mpq_t a, const mpq_t b)
+{
+ mpq_t t;
+
+ mpq_roinit_normal_nn (t, mpq_numref (b)->_mp_d, - mpq_numref (b)->_mp_size,
+ mpq_denref (b)->_mp_d, mpq_denref (b)->_mp_size);
+ mpq_add (r, a, t);
+}
+
+void
+mpq_div (mpq_t r, const mpq_t a, const mpq_t b)
+{
+ mpq_t t;
+ mpq_mul (r, a, mpq_roinit_zz (t, mpq_denref (b), mpq_numref (b)));
+}
+
+void
+mpq_mul (mpq_t r, const mpq_t a, const mpq_t b)
+{
+ mpq_t t;
+ mpq_nan_init (t);
+
+ if (a != b) {
+ mpz_t g;
+
+ mpz_init (g);
+ mpq_helper_canonicalize (t, mpq_numref (a), mpq_denref (b), g);
+ mpq_helper_canonicalize (r, mpq_numref (b), mpq_denref (a), g);
+ mpz_clear (g);
+
+ a = r;
+ b = t;
+ }
+
+ mpz_mul (mpq_numref (r), mpq_numref (a), mpq_numref (b));
+ mpz_mul (mpq_denref (r), mpq_denref (a), mpq_denref (b));
+ mpq_clear (t);
+}
+
+void
+mpq_div_2exp (mpq_t r, const mpq_t q, mp_bitcnt_t e)
+{
+ mp_bitcnt_t z = mpz_scan1 (mpq_numref (q), 0);
+ z = GMP_MIN (z, e);
+ mpz_mul_2exp (mpq_denref (r), mpq_denref (q), e - z);
+ mpz_tdiv_q_2exp (mpq_numref (r), mpq_numref (q), z);
+}
+
+void
+mpq_mul_2exp (mpq_t r, const mpq_t q, mp_bitcnt_t e)
+{
+ mp_bitcnt_t z = mpz_scan1 (mpq_denref (q), 0);
+ z = GMP_MIN (z, e);
+ mpz_mul_2exp (mpq_numref (r), mpq_numref (q), e - z);
+ mpz_tdiv_q_2exp (mpq_denref (r), mpq_denref (q), z);
+}
+
+void
+mpq_inv (mpq_t r, const mpq_t q)
+{
+ mpq_set (r, q);
+ mpz_swap (mpq_denref (r), mpq_numref (r));
+ mpq_canonical_sign (r);
+}
+
+
+/* MPQ to/from double. */
+void
+mpq_set_d (mpq_t r, double x)
+{
+ mpz_set_ui (mpq_denref (r), 1);
+
+ /* x != x is true when x is a NaN, and x == x * 0.5 is true when x is
+ zero or infinity. */
+ if (x == x * 0.5 || x != x)
+ mpq_numref (r)->_mp_size = 0;
+ else
+ {
+ double B;
+ mp_bitcnt_t e;
+
+ B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
+ for (e = 0; x != x + 0.5; e += GMP_LIMB_BITS)
+ x *= B;
+
+ mpz_set_d (mpq_numref (r), x);
+ mpq_div_2exp (r, r, e);
+ }
+}
+
+double
+mpq_get_d (const mpq_t u)
+{
+ mp_bitcnt_t ne, de, ee;
+ mpz_t z;
+ double B, ret;
+
+ ne = mpz_sizeinbase (mpq_numref (u), 2);
+ de = mpz_sizeinbase (mpq_denref (u), 2);
+
+ ee = CHAR_BIT * sizeof (double);
+ if (de == 1 || ne > de + ee)
+ ee = 0;
+ else
+ ee = (ee + de - ne) / GMP_LIMB_BITS + 1;
+
+ mpz_init (z);
+ mpz_mul_2exp (z, mpq_numref (u), ee * GMP_LIMB_BITS);
+ mpz_tdiv_q (z, z, mpq_denref (u));
+ ret = mpz_get_d (z);
+ mpz_clear (z);
+
+ B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
+ for (B = 1 / B; ee != 0; --ee)
+ ret *= B;
+
+ return ret;
+}
+
+
+/* MPQ and strings/streams. */
+char *
+mpq_get_str (char *sp, int base, const mpq_t q)
+{
+ char *res;
+ char *rden;
+ size_t len;
+
+ res = mpz_get_str (sp, base, mpq_numref (q));
+ if (res == NULL || mpz_cmp_ui (mpq_denref (q), 1) == 0)
+ return res;
+
+ len = strlen (res) + 1;
+ rden = sp ? sp + len : NULL;
+ rden = mpz_get_str (rden, base, mpq_denref (q));
+ assert (rden != NULL);
+
+ if (sp == NULL) {
+ void * (*gmp_reallocate_func) (void *, size_t, size_t);
+ void (*gmp_free_func) (void *, size_t);
+ size_t lden;
+
+ mp_get_memory_functions (NULL, &gmp_reallocate_func, &gmp_free_func);
+ lden = strlen (rden) + 1;
+ res = (char *) gmp_reallocate_func (res, 0, (lden + len) * sizeof (char));
+ memcpy (res + len, rden, lden);
+ gmp_free_func (rden, 0);
+ }
+
+ res [len - 1] = '/';
+ return res;
+}
+
+size_t
+mpq_out_str (FILE *stream, int base, const mpq_t x)
+{
+ char * str;
+ size_t len;
+ void (*gmp_free_func) (void *, size_t);
+
+ str = mpq_get_str (NULL, base, x);
+ len = strlen (str);
+ len = fwrite (str, 1, len, stream);
+ mp_get_memory_functions (NULL, NULL, &gmp_free_func);
+ gmp_free_func (str, 0);
+ return len;
+}
+
+int
+mpq_set_str (mpq_t r, const char *sp, int base)
+{
+ const char *slash;
+
+ slash = strchr (sp, '/');
+ if (slash == NULL) {
+ mpz_set_ui (mpq_denref(r), 1);
+ return mpz_set_str (mpq_numref(r), sp, base);
+ } else {
+ char *num;
+ size_t numlen;
+ int ret;
+ void * (*gmp_allocate_func) (size_t);
+ void (*gmp_free_func) (void *, size_t);
+
+ mp_get_memory_functions (&gmp_allocate_func, NULL, &gmp_free_func);
+ numlen = slash - sp;
+ num = (char *) gmp_allocate_func ((numlen + 1) * sizeof (char));
+ memcpy (num, sp, numlen);
+ num[numlen] = '\0';
+ ret = mpz_set_str (mpq_numref(r), num, base);
+ gmp_free_func (num, 0);
+
+ if (ret != 0)
+ return ret;
+
+ return mpz_set_str (mpq_denref(r), slash + 1, base);
+ }
+}
diff --git a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.h b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.h
new file mode 100644
index 00000000000..8eabcec87c0
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-mpq.h
@@ -0,0 +1,114 @@
+/* mini-mpq, a minimalistic implementation of a GNU GMP subset.
+
+Copyright 2018, 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+/* Header */
+
+#ifndef __MINI_MPQ_H__
+#define __MINI_MPQ_H__
+
+#include "mini-gmp.h"
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+typedef struct
+{
+ __mpz_struct _mp_num;
+ __mpz_struct _mp_den;
+} __mpq_struct;
+
+typedef __mpq_struct mpq_t[1];
+
+typedef const __mpq_struct *mpq_srcptr;
+typedef __mpq_struct *mpq_ptr;
+
+#define mpq_numref(Q) (&((Q)->_mp_num))
+#define mpq_denref(Q) (&((Q)->_mp_den))
+
+void mpq_abs (mpq_t, const mpq_t);
+void mpq_add (mpq_t, const mpq_t, const mpq_t);
+void mpq_canonicalize (mpq_t);
+void mpq_clear (mpq_t);
+int mpq_cmp (const mpq_t, const mpq_t);
+int mpq_cmp_si (const mpq_t, signed long, unsigned long);
+int mpq_cmp_ui (const mpq_t, unsigned long, unsigned long);
+int mpq_cmp_z (const mpq_t, const mpz_t);
+void mpq_div (mpq_t, const mpq_t, const mpq_t);
+void mpq_div_2exp (mpq_t, const mpq_t, mp_bitcnt_t);
+int mpq_equal (const mpq_t, const mpq_t);
+double mpq_get_d (const mpq_t);
+void mpq_get_den (mpz_t, const mpq_t);
+void mpq_get_num (mpz_t, const mpq_t);
+char * mpq_get_str (char *, int, const mpq_t q);
+void mpq_init (mpq_t);
+void mpq_inv (mpq_t, const mpq_t);
+void mpq_mul (mpq_t, const mpq_t, const mpq_t);
+void mpq_mul_2exp (mpq_t, const mpq_t, mp_bitcnt_t);
+void mpq_neg (mpq_t, const mpq_t);
+void mpq_set (mpq_t, const mpq_t);
+void mpq_set_d (mpq_t, double);
+void mpq_set_den (mpq_t, const mpz_t);
+void mpq_set_num (mpq_t, const mpz_t);
+void mpq_set_si (mpq_t, signed long, unsigned long);
+int mpq_set_str (mpq_t, const char *, int);
+void mpq_set_ui (mpq_t, unsigned long, unsigned long);
+void mpq_set_z (mpq_t, const mpz_t);
+int mpq_sgn (const mpq_t);
+void mpq_sub (mpq_t, const mpq_t, const mpq_t);
+void mpq_swap (mpq_t, mpq_t);
+
+/* This long list taken from gmp.h. */
+/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4,
+ <iostream> defines EOF but not FILE. */
+#if defined (FILE) \
+ || defined (H_STDIO) \
+ || defined (_H_STDIO) /* AIX */ \
+ || defined (_STDIO_H) /* glibc, Sun, SCO */ \
+ || defined (_STDIO_H_) /* BSD, OSF */ \
+ || defined (__STDIO_H) /* Borland */ \
+ || defined (__STDIO_H__) /* IRIX */ \
+ || defined (_STDIO_INCLUDED) /* HPUX */ \
+ || defined (__dj_include_stdio_h_) /* DJGPP */ \
+ || defined (_FILE_DEFINED) /* Microsoft */ \
+ || defined (__STDIO__) /* Apple MPW MrC */ \
+ || defined (_MSL_STDIO_H) /* Metrowerks */ \
+ || defined (_STDIO_H_INCLUDED) /* QNX4 */ \
+ || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \
+ || defined (__STDIO_LOADED) /* VMS */
+size_t mpq_out_str (FILE *, int, const mpq_t);
+#endif
+
+void mpz_set_q (mpz_t, const mpq_t);
+
+#if defined (__cplusplus)
+}
+#endif
+#endif /* __MINI_MPQ_H__ */
diff --git a/Build/source/libs/gmp/gmp-src/mp_bpl.c b/Build/source/libs/gmp/gmp-src/mp_bpl.c
index 6328057965d..a13fb15964a 100644
--- a/Build/source/libs/gmp/gmp-src/mp_bpl.c
+++ b/Build/source/libs/gmp/gmp-src/mp_bpl.c
@@ -27,7 +27,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
const int mp_bits_per_limb = GMP_LIMB_BITS;
diff --git a/Build/source/libs/gmp/gmp-src/mp_clz_tab.c b/Build/source/libs/gmp/gmp-src/mp_clz_tab.c
index 7c9227e8b32..fc7cb0bca07 100644
--- a/Build/source/libs/gmp/gmp-src/mp_clz_tab.c
+++ b/Build/source/libs/gmp/gmp-src/mp_clz_tab.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mp_dv_tab.c b/Build/source/libs/gmp/gmp-src/mp_dv_tab.c
index c6d74eb3f29..cd09d5d3d78 100644
--- a/Build/source/libs/gmp/gmp-src/mp_dv_tab.c
+++ b/Build/source/libs/gmp/gmp-src/mp_dv_tab.c
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* Table to be indexed by character, to get its numerical value. Assumes ASCII
diff --git a/Build/source/libs/gmp/gmp-src/mp_get_fns.c b/Build/source/libs/gmp/gmp-src/mp_get_fns.c
index c77980fbeb6..70ed96d1478 100644
--- a/Build/source/libs/gmp/gmp-src/mp_get_fns.c
+++ b/Build/source/libs/gmp/gmp-src/mp_get_fns.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mp_minv_tab.c b/Build/source/libs/gmp/gmp-src/mp_minv_tab.c
index 522bd0184bf..833d4c1ed3e 100644
--- a/Build/source/libs/gmp/gmp-src/mp_minv_tab.c
+++ b/Build/source/libs/gmp/gmp-src/mp_minv_tab.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mp_set_fns.c b/Build/source/libs/gmp/gmp-src/mp_set_fns.c
index 7be60066b9f..b7bcd5b7ecb 100644
--- a/Build/source/libs/gmp/gmp-src/mp_set_fns.c
+++ b/Build/source/libs/gmp/gmp-src/mp_set_fns.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/abs.c b/Build/source/libs/gmp/gmp-src/mpf/abs.c
index a2bde2a4f85..1642a467273 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/abs.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/abs.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/add.c b/Build/source/libs/gmp/gmp-src/mpf/add.c
index d2a5c097c57..77a9e476fc2 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/add.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/add.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/add_ui.c b/Build/source/libs/gmp/gmp-src/mpf/add_ui.c
index b1e57d04c1e..1e2a94b1122 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/add_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/add_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/ceilfloor.c b/Build/source/libs/gmp/gmp-src/mpf/ceilfloor.c
index 302e2b8ae5a..9bb663866f8 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/ceilfloor.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/ceilfloor.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/clear.c b/Build/source/libs/gmp/gmp-src/mpf/clear.c
index 9ff2dd336fe..0939e03a47e 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/clear.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/clear.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/clears.c b/Build/source/libs/gmp/gmp-src/mpf/clears.c
index 68a4cbebdc1..115fa199fb9 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/clears.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/clears.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdarg.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -39,11 +38,12 @@ mpf_clears (mpf_ptr x, ...)
va_start (ap, x);
- while (x != NULL)
+ do
{
__GMP_FREE_FUNC_LIMBS (PTR(x), PREC(x) + 1);
x = va_arg (ap, mpf_ptr);
}
+ while (x != NULL);
va_end (ap);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpf/cmp.c b/Build/source/libs/gmp/gmp-src/mpf/cmp.c
index 0c066721827..3518b518171 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/cmp.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/cmp.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpf/cmp_d.c b/Build/source/libs/gmp/gmp-src/mpf/cmp_d.c
index 52893a781ec..3fa099bf80b 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/cmp_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/cmp_d.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
#include <float.h> /* for DBL_MAX */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpf/cmp_si.c b/Build/source/libs/gmp/gmp-src/mpf/cmp_si.c
index 3bf98211ddb..d8d98800ba8 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/cmp_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/cmp_si.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpf/cmp_ui.c b/Build/source/libs/gmp/gmp-src/mpf/cmp_ui.c
index 198eb21e517..a9a60365a83 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/cmp_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/cmp_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpf/cmp_z.c b/Build/source/libs/gmp/gmp-src/mpf/cmp_z.c
index e9c1559d6a8..279980f5cbd 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/cmp_z.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/cmp_z.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
@@ -39,7 +38,7 @@ mpf_cmp_z (mpf_srcptr u, mpz_srcptr v) __GMP_NOTHROW
SIZ (vf) = size = SIZ (v);
EXP (vf) = size = ABS (size);
- /* PREC (vf) = size; */
+ /* PREC (vf) = size; */
PTR (vf) = PTR (v);
return mpf_cmp (u, vf);
diff --git a/Build/source/libs/gmp/gmp-src/mpf/div.c b/Build/source/libs/gmp/gmp-src/mpf/div.c
index af38cb8698f..d13af756611 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/div.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/div.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/div_2exp.c b/Build/source/libs/gmp/gmp-src/mpf/div_2exp.c
index fef81520503..ad552c115ca 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/div_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/div_2exp.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/div_ui.c b/Build/source/libs/gmp/gmp-src/mpf/div_ui.c
index 9be7e680bef..e1b0112baa6 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/div_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/div_ui.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/dump.c b/Build/source/libs/gmp/gmp-src/mpf/dump.c
index af671059237..cd37dabe62f 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/dump.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/dump.c
@@ -35,7 +35,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <string.h> /* for strlen */
-#include "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/eq.c b/Build/source/libs/gmp/gmp-src/mpf/eq.c
index 30c6befd061..cddb9d50869 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/eq.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/eq.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/fits_s.h b/Build/source/libs/gmp/gmp-src/mpf/fits_s.h
index 25f323e255c..80e74befdbd 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/fits_s.h
+++ b/Build/source/libs/gmp/gmp-src/mpf/fits_s.h
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -68,5 +67,5 @@ FUNCTION (mpf_srcptr f) __GMP_NOTHROW
else
return 0;
- return fl <= (fs >= 0 ? (mp_limb_t) MAXIMUM : - (mp_limb_t) MINIMUM);
+ return fl <= (fs >= 0 ? (mp_limb_t) MAXIMUM : NEG_CAST (mp_limb_t, MINIMUM));
}
diff --git a/Build/source/libs/gmp/gmp-src/mpf/fits_u.h b/Build/source/libs/gmp/gmp-src/mpf/fits_u.h
index be7a271b2fa..bd7ca782dd4 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/fits_u.h
+++ b/Build/source/libs/gmp/gmp-src/mpf/fits_u.h
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/get_d.c b/Build/source/libs/gmp/gmp-src/mpf/get_d.c
index 8f6f9bbea1d..34826fb7d8a 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/get_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/get_d.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
double
diff --git a/Build/source/libs/gmp/gmp-src/mpf/get_d_2exp.c b/Build/source/libs/gmp/gmp-src/mpf/get_d_2exp.c
index 17ce229f251..440a753018e 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/get_d_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/get_d_2exp.c
@@ -1,6 +1,6 @@
/* double mpf_get_d_2exp (signed long int *exp, mpf_t src).
-Copyright 2001-2004 Free Software Foundation, Inc.
+Copyright 2001-2004, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,23 +28,21 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
double
-mpf_get_d_2exp (signed long int *exp2, mpf_srcptr src)
+mpf_get_d_2exp (signed long int *expptr, mpf_srcptr src)
{
mp_size_t size, abs_size;
mp_srcptr ptr;
int cnt;
- long exp;
size = SIZ(src);
if (UNLIKELY (size == 0))
{
- *exp2 = 0;
+ *expptr = 0;
return 0.0;
}
@@ -53,9 +51,6 @@ mpf_get_d_2exp (signed long int *exp2, mpf_srcptr src)
count_leading_zeros (cnt, ptr[abs_size - 1]);
cnt -= GMP_NAIL_BITS;
- exp = EXP(src) * GMP_NUMB_BITS - cnt;
- *exp2 = exp;
-
- return mpn_get_d (ptr, abs_size, (mp_size_t) 0,
- (long) - (abs_size * GMP_NUMB_BITS - cnt));
+ *expptr = EXP(src) * GMP_NUMB_BITS - cnt;
+ return mpn_get_d (ptr, abs_size, size, -(abs_size * GMP_NUMB_BITS - cnt));
}
diff --git a/Build/source/libs/gmp/gmp-src/mpf/get_dfl_prec.c b/Build/source/libs/gmp/gmp-src/mpf/get_dfl_prec.c
index 9a773d83acb..13fc514290f 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/get_dfl_prec.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/get_dfl_prec.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/get_prc.c b/Build/source/libs/gmp/gmp-src/mpf/get_prc.c
index 3b3283a48c5..8dee99ec817 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/get_prc.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/get_prc.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mp_bitcnt_t
diff --git a/Build/source/libs/gmp/gmp-src/mpf/get_si.c b/Build/source/libs/gmp/gmp-src/mpf/get_si.c
index 5b63dbd4256..6ac4d44b49b 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/get_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/get_si.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/get_str.c b/Build/source/libs/gmp/gmp-src/mpf/get_str.c
index 682819daaab..946c4aec23c 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/get_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/get_str.c
@@ -4,8 +4,8 @@
example, the number 3.1416 would be returned as "31416" in DIGIT_PTR and
1 in EXP.
-Copyright 1993-1997, 2000-2003, 2005, 2006, 2011, 2015 Free Software
-Foundation, Inc.
+Copyright 1993-1997, 2000-2003, 2005, 2006, 2011, 2015, 2017 Free
+Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,7 +34,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdlib.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h" /* for count_leading_zeros */
@@ -139,26 +138,23 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u)
un = ABSIZ(u);
ue = EXP(u);
- if (base >= 0)
+ num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ if (base > 1)
{
- num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
- if (base <= 1)
- base = 10;
- else if (base > 36)
- {
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- if (base > 62)
+ if (base <= 36)
+ num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
+ else if (UNLIKELY (base > 62))
return NULL;
- }
+ }
+ else if (base > -2)
+ {
+ base = 10;
}
else
{
base = -base;
- if (base <= 1)
- base = 10;
- else if (base > 36)
+ if (UNLIKELY (base > 36))
return NULL;
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
MPF_SIGNIFICANT_DIGITS (max_digits, base, PREC(u));
@@ -170,7 +166,7 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u)
/* We didn't get a string from the user. Allocate one (and return
a pointer to it) with space for `-' and terminating null. */
alloc_size = n_digits + 2;
- dbuf = (char *) (*__gmp_allocate_func) (n_digits + 2);
+ dbuf = __GMP_ALLOCATE_FUNC_TYPE (n_digits + 2, char);
}
if (un == 0)
diff --git a/Build/source/libs/gmp/gmp-src/mpf/get_ui.c b/Build/source/libs/gmp/gmp-src/mpf/get_ui.c
index eb9b30e69c0..e7b933365c3 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/get_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/get_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/init.c b/Build/source/libs/gmp/gmp-src/mpf/init.c
index 0e428d3d44c..26ab262f674 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/init.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/init.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/init2.c b/Build/source/libs/gmp/gmp-src/mpf/init2.c
index 72c87260885..b90a08a185f 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/init2.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/init2.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/inits.c b/Build/source/libs/gmp/gmp-src/mpf/inits.c
index db7cacc4258..b6d054fc120 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/inits.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/inits.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdarg.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -39,11 +38,12 @@ mpf_inits (mpf_ptr x, ...)
va_start (ap, x);
- while (x != NULL)
+ do
{
mpf_init (x);
x = va_arg (ap, mpf_ptr);
}
+ while (x != NULL);
va_end (ap);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpf/inp_str.c b/Build/source/libs/gmp/gmp-src/mpf/inp_str.c
index 45cc34cebba..c661a792b00 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/inp_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/inp_str.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <ctype.h>
-#include "gmp.h"
#include "gmp-impl.h"
size_t
@@ -47,7 +46,7 @@ mpf_inp_str (mpf_ptr rop, FILE *stream, int base)
stream = stdin;
alloc_size = 100;
- str = (char *) (*__gmp_allocate_func) (alloc_size);
+ str = __GMP_ALLOCATE_FUNC_TYPE (alloc_size, char);
str_size = 0;
nread = 0;
@@ -65,7 +64,7 @@ mpf_inp_str (mpf_ptr rop, FILE *stream, int base)
{
size_t old_alloc_size = alloc_size;
alloc_size = alloc_size * 3 / 2;
- str = (char *) (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size);
+ str = __GMP_REALLOCATE_FUNC_TYPE (str, old_alloc_size, alloc_size, char);
}
if (c == EOF || isspace (c))
break;
@@ -79,7 +78,7 @@ mpf_inp_str (mpf_ptr rop, FILE *stream, int base)
{
size_t old_alloc_size = alloc_size;
alloc_size = alloc_size * 3 / 2;
- str = (char *) (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size);
+ str = __GMP_REALLOCATE_FUNC_TYPE (str, old_alloc_size, alloc_size, char);
}
str[str_size] = 0;
diff --git a/Build/source/libs/gmp/gmp-src/mpf/int_p.c b/Build/source/libs/gmp/gmp-src/mpf/int_p.c
index e0e337d2f8f..024cfb5ea59 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/int_p.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/int_p.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/iset.c b/Build/source/libs/gmp/gmp-src/mpf/iset.c
index 246f367488b..07f9006712c 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/iset.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/iset.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/iset_d.c b/Build/source/libs/gmp/gmp-src/mpf/iset_d.c
index e3492e36179..2f36240f67b 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/iset_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/iset_d.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/iset_si.c b/Build/source/libs/gmp/gmp-src/mpf/iset_si.c
index 179f80c9151..65abb9a4583 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/iset_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/iset_si.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/iset_str.c b/Build/source/libs/gmp/gmp-src/mpf/iset_str.c
index 5cb42917685..10acda916b3 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/iset_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/iset_str.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpf/iset_ui.c b/Build/source/libs/gmp/gmp-src/mpf/iset_ui.c
index 3f48cbd685c..2c426bf56a3 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/iset_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/iset_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/mul.c b/Build/source/libs/gmp/gmp-src/mpf/mul.c
index 5bde28c4b2f..30994611003 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/mul.c
@@ -1,6 +1,6 @@
/* mpf_mul -- Multiply two floats.
-Copyright 1993, 1994, 1996, 2001, 2005 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2001, 2005, 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,70 +28,107 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
mpf_mul (mpf_ptr r, mpf_srcptr u, mpf_srcptr v)
{
- mp_srcptr up, vp;
- mp_size_t usize, vsize;
mp_size_t sign_product;
mp_size_t prec = r->_mp_prec;
+ mp_size_t rsize;
+ mp_limb_t cy_limb;
+ mp_ptr rp, tp;
+ mp_size_t adj;
+ TMP_DECL;
- usize = u->_mp_size;
- vsize = v->_mp_size;
- sign_product = usize ^ vsize;
+ if (u == v)
+ {
+ mp_srcptr up;
+ mp_size_t usize;
- usize = ABS (usize);
- vsize = ABS (vsize);
+ usize = u->_mp_size;
+ sign_product = 0;
- up = u->_mp_d;
- vp = v->_mp_d;
- if (usize > prec)
- {
- up += usize - prec;
- usize = prec;
- }
- if (vsize > prec)
- {
- vp += vsize - prec;
- vsize = prec;
- }
+ usize = ABS (usize);
- if (usize == 0 || vsize == 0)
- {
- r->_mp_size = 0;
- r->_mp_exp = 0; /* ??? */
+ up = u->_mp_d;
+ if (usize > prec)
+ {
+ up += usize - prec;
+ usize = prec;
+ }
+
+ if (usize == 0)
+ {
+ r->_mp_size = 0;
+ r->_mp_exp = 0; /* ??? */
+ return;
+ }
+ else
+ {
+ TMP_MARK;
+ rsize = 2 * usize;
+ tp = TMP_ALLOC_LIMBS (rsize);
+
+ mpn_sqr (tp, up, usize);
+ cy_limb = tp[rsize - 1];
+ }
}
else
{
- mp_size_t rsize;
- mp_limb_t cy_limb;
- mp_ptr rp, tp;
- mp_size_t adj;
- TMP_DECL;
-
- TMP_MARK;
- rsize = usize + vsize;
- tp = TMP_ALLOC_LIMBS (rsize);
- cy_limb = (usize >= vsize
- ? mpn_mul (tp, up, usize, vp, vsize)
- : mpn_mul (tp, vp, vsize, up, usize));
-
- adj = cy_limb == 0;
- rsize -= adj;
- prec++;
- if (rsize > prec)
+ mp_srcptr up, vp;
+ mp_size_t usize, vsize;
+
+ usize = u->_mp_size;
+ vsize = v->_mp_size;
+ sign_product = usize ^ vsize;
+
+ usize = ABS (usize);
+ vsize = ABS (vsize);
+
+ up = u->_mp_d;
+ vp = v->_mp_d;
+ if (usize > prec)
+ {
+ up += usize - prec;
+ usize = prec;
+ }
+ if (vsize > prec)
+ {
+ vp += vsize - prec;
+ vsize = prec;
+ }
+
+ if (usize == 0 || vsize == 0)
{
- tp += rsize - prec;
- rsize = prec;
+ r->_mp_size = 0;
+ r->_mp_exp = 0;
+ return;
}
- rp = r->_mp_d;
- MPN_COPY (rp, tp, rsize);
- r->_mp_exp = u->_mp_exp + v->_mp_exp - adj;
- r->_mp_size = sign_product >= 0 ? rsize : -rsize;
+ else
+ {
+ TMP_MARK;
+ rsize = usize + vsize;
+ tp = TMP_ALLOC_LIMBS (rsize);
+ cy_limb = (usize >= vsize
+ ? mpn_mul (tp, up, usize, vp, vsize)
+ : mpn_mul (tp, vp, vsize, up, usize));
- TMP_FREE;
+ }
}
+
+ adj = cy_limb == 0;
+ rsize -= adj;
+ prec++;
+ if (rsize > prec)
+ {
+ tp += rsize - prec;
+ rsize = prec;
+ }
+ rp = r->_mp_d;
+ MPN_COPY (rp, tp, rsize);
+ r->_mp_exp = u->_mp_exp + v->_mp_exp - adj;
+ r->_mp_size = sign_product >= 0 ? rsize : -rsize;
+
+ TMP_FREE;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpf/mul_2exp.c b/Build/source/libs/gmp/gmp-src/mpf/mul_2exp.c
index 83df2176d3b..5de73633b4c 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/mul_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/mul_2exp.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/mul_ui.c b/Build/source/libs/gmp/gmp-src/mpf/mul_ui.c
index 031b2fe06fe..30da6ae5045 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/mul_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/mul_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/neg.c b/Build/source/libs/gmp/gmp-src/mpf/neg.c
index 553018f306a..d294815ce04 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/neg.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/neg.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/out_str.c b/Build/source/libs/gmp/gmp-src/mpf/out_str.c
index 200da748063..1802d0fd251 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/out_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/out_str.c
@@ -45,7 +45,6 @@ see https://www.gnu.org/licenses/. */
#include <locale.h> /* for localeconv */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/pow_ui.c b/Build/source/libs/gmp/gmp-src/mpf/pow_ui.c
index 6d0528bedb2..8d54dc06db1 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/pow_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/pow_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/random2.c b/Build/source/libs/gmp/gmp-src/mpf/random2.c
index 4d7f37e976d..2e0163c5700 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/random2.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/random2.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/reldiff.c b/Build/source/libs/gmp/gmp-src/mpf/reldiff.c
index f49da081665..81f05dd9eba 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/reldiff.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/reldiff.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set.c b/Build/source/libs/gmp/gmp-src/mpf/set.c
index ec8161d779f..382fe86e406 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set_d.c b/Build/source/libs/gmp/gmp-src/mpf/set_d.c
index 100194d1167..0442f2f8820 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set_d.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
#include <float.h> /* for DBL_MAX */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set_dfl_prec.c b/Build/source/libs/gmp/gmp-src/mpf/set_dfl_prec.c
index 04c9a551354..9be71c04429 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set_dfl_prec.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set_dfl_prec.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mp_size_t __gmp_default_fp_limb_precision = __GMPF_BITS_TO_PREC (53);
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set_prc.c b/Build/source/libs/gmp/gmp-src/mpf/set_prc.c
index 30ba06c6e65..40c3f0ebe10 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set_prc.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set_prc.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set_prc_raw.c b/Build/source/libs/gmp/gmp-src/mpf/set_prc_raw.c
index 77994422994..e5c52cc29a1 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set_prc_raw.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set_prc_raw.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set_q.c b/Build/source/libs/gmp/gmp-src/mpf/set_q.c
index c5739b2abec..b0b7fe309fb 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set_q.c
@@ -1,6 +1,6 @@
/* mpf_set_q (mpf_t rop, mpq_t op) -- Convert the rational op to the float rop.
-Copyright 1996, 1999, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+Copyright 1996, 1999, 2001, 2002, 2004, 2005, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,47 +28,27 @@ 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 <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
-/* As usual the aim is to produce PREC(r) limbs, with the high non-zero.
- The basic mpn_tdiv_qr produces a quotient of nsize-dsize+1 limbs, with
- either the high or second highest limb non-zero. We arrange for
- nsize-dsize+1 to equal prec+1, hence giving either prec or prec+1 result
- limbs at PTR(r).
+/* As usual the aim is to produce PREC(r) limbs, with the high non-zero. The
+ basic mpn_div_q produces a quotient of nsize-dsize+1 limbs, with either the
+ high or second highest limb non-zero. We arrange for nsize-dsize+1 to equal
+ prec+1, hence giving either prec or prec+1 result limbs at PTR(r).
- nsize-dsize+1 == prec+1 is achieved by adjusting num(q), either dropping
- low limbs if it's too big, or padding with low zeros if it's too small.
- The full given den(q) is always used.
+ nsize-dsize+1 == prec+1 is achieved by adjusting num(q), either dropping low
+ limbs if it's too big, or padding with low zeros if it's too small. The
+ full given den(q) is always used.
- We cannot truncate den(q), because even when it's much bigger than prec
- the last limbs can still influence the final quotient. Often they don't,
- but we leave optimization of that to a prospective quotient-only mpn
- division.
-
- Not done:
-
- If den(q) is a power of 2 then we may end up with low zero limbs on the
- result. But nothing is done about this, since it should be unlikely on
- random data, and can be left to an application to call mpf_div_2exp if it
- might occur with any frequency.
+ We cannot truncate den(q), because even when it's much bigger than prec the
+ last limbs can still influence the final quotient. Often they don't, but we
+ leave optimization of that to mpn_div_q.
Enhancements:
- The high quotient limb is non-zero when high{np,dsize} >= {dp,dsize}. We
+ The high quotient limb is non-zero when high{np,dsize} > {dp,dsize}. We
could make that comparison and use qsize==prec instead of qsize==prec+1,
- to save one limb in the division.
-
- Future:
-
- If/when mpn_tdiv_qr supports its qxn parameter we can use that instead of
- padding n with zeros in temporary space.
-
- If/when a quotient-only division exists it can be used here immediately.
- remp is only to satisfy mpn_tdiv_qr, the remainder is not used. */
+ to save one limb in the division. */
void
mpf_set_q (mpf_t r, mpq_srcptr q)
@@ -76,7 +56,7 @@ mpf_set_q (mpf_t r, mpq_srcptr q)
mp_srcptr np, dp;
mp_size_t prec, nsize, dsize, qsize, prospective_qsize, tsize, zeros;
mp_size_t sign_quotient, high_zero;
- mp_ptr qp, tp, remp;
+ mp_ptr qp, tp;
mp_exp_t exp;
TMP_DECL;
@@ -106,42 +86,25 @@ mpf_set_q (mpf_t r, mpq_srcptr q)
exp = prospective_qsize; /* ie. number of integer limbs */
qsize = prec + 1; /* desired q */
- zeros = qsize - prospective_qsize; /* n zeros to get desired qsize */
- tsize = nsize + zeros; /* possible copy of n */
-
- if (WANT_TMP_DEBUG)
- {
- /* separate alloc blocks, for malloc debugging */
- remp = TMP_ALLOC_LIMBS (dsize);
- tp = NULL;
- if (zeros > 0)
- tp = TMP_ALLOC_LIMBS (tsize);
- }
- else
- {
- /* one alloc with a conditionalized size, for efficiency */
- mp_size_t size = dsize + (zeros > 0 ? tsize : 0);
- remp = TMP_ALLOC_LIMBS (size);
- tp = remp + dsize;
- }
+ zeros = qsize - prospective_qsize; /* n zeros to get desired qsize */
+ tsize = nsize + zeros; /* size of intermediate numerator */
+ tp = TMP_ALLOC_LIMBS (tsize + 1); /* +1 for mpn_div_q's scratch */
if (zeros > 0)
{
/* pad n with zeros into temporary space */
MPN_ZERO (tp, zeros);
MPN_COPY (tp+zeros, np, nsize);
- np = tp;
- nsize = tsize;
+ np = tp; /* mpn_div_q allows this overlap */
}
else
{
/* shorten n to get desired qsize */
- nsize += zeros;
np -= zeros;
}
- ASSERT (nsize-dsize+1 == qsize);
- mpn_tdiv_qr (qp, remp, (mp_size_t) 0, np, nsize, dp, dsize);
+ ASSERT (tsize-dsize+1 == qsize);
+ mpn_div_q (qp, np, tsize, dp, dsize, tp);
/* strip possible zero high limb */
high_zero = (qp[qsize-1] == 0);
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set_si.c b/Build/source/libs/gmp/gmp-src/mpf/set_si.c
index 9c47c7511ff..23f713da796 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set_si.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set_str.c b/Build/source/libs/gmp/gmp-src/mpf/set_str.c
index 9053accadeb..c7bfe0b22a8 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set_str.c
@@ -2,8 +2,8 @@
in base BASE to a float in dest. If BASE is zero, the leading characters
of STRING is used to figure out the base.
-Copyright 1993-1997, 2000-2003, 2005, 2007, 2008, 2011, 2013 Free Software
-Foundation, Inc.
+Copyright 1993-1997, 2000-2003, 2005, 2007, 2008, 2011, 2013, 2019 Free
+Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -54,7 +54,6 @@ see https://www.gnu.org/licenses/. */
#include <locale.h> /* for localeconv */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -127,12 +126,15 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
size_t i, j;
int c;
int negative;
- char *dotpos = 0;
+ char *dotpos;
const char *expptr;
int exp_base;
const char *point = GMP_DECIMAL_POINT;
size_t pointlen = strlen (point);
const unsigned char *digit_value;
+ int incr;
+ size_t n_zeros_skipped;
+
TMP_DECL;
c = (unsigned char) *str;
@@ -199,6 +201,10 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
TMP_MARK;
s = begs = (char *) TMP_ALLOC (str_size + 1);
+ incr = 0;
+ n_zeros_skipped = 0;
+ dotpos = NULL;
+
/* Loop through mantissa, converting it from ASCII to raw byte values. */
for (i = 0; i < str_size; i++)
{
@@ -231,7 +237,13 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
TMP_FREE;
return -1;
}
- *s++ = dig;
+ *s = dig;
+ incr |= dig != 0;
+ s += incr; /* Increment after first non-0 digit seen. */
+ if (dotpos != NULL)
+ /* Count skipped zeros between radix point and first non-0
+ digit. */
+ n_zeros_skipped += 1 - incr;
}
}
c = (unsigned char) *++str;
@@ -252,19 +264,14 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
#if 0
size_t n_chars_needed;
- /* This breaks things like 0.000...0001. To safely ignore superfluous
- digits, we need to skip over leading zeros. */
+ /* This needs careful testing. Leave disabled for now. */
/* Just consider the relevant leading digits of the mantissa. */
LIMBS_PER_DIGIT_IN_BASE (n_chars_needed, prec, base);
if (str_size > n_chars_needed)
str_size = n_chars_needed;
#endif
- LIMBS_PER_DIGIT_IN_BASE (ma, str_size, base);
- mp = TMP_ALLOC_LIMBS (ma);
- mn = mpn_set_str (mp, (unsigned char *) begs, str_size, base);
-
- if (mn == 0)
+ if (str_size == 0)
{
SIZ(x) = 0;
EXP(x) = 0;
@@ -272,6 +279,10 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
return 0;
}
+ LIMBS_PER_DIGIT_IN_BASE (ma, str_size, base);
+ mp = TMP_ALLOC_LIMBS (ma);
+ mn = mpn_set_str (mp, (unsigned char *) begs, str_size, base);
+
madj = 0;
/* Ignore excess limbs in MP,MSIZE. */
if (mn > prec)
@@ -311,7 +322,7 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
else
exp_in_base = 0;
if (dotpos != 0)
- exp_in_base -= s - dotpos;
+ exp_in_base -= s - dotpos + n_zeros_skipped;
divflag = exp_in_base < 0;
exp_in_base = ABS (exp_in_base);
@@ -325,8 +336,7 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
}
ra = 2 * (prec + 1);
- rp = TMP_ALLOC_LIMBS (ra);
- tp = TMP_ALLOC_LIMBS (ra);
+ TMP_ALLOC_LIMBS_2 (rp, ra, tp, ra);
rn = mpn_pow_1_highpart (rp, &radj, (mp_limb_t) base, exp_in_base, prec, tp);
if (divflag)
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set_ui.c b/Build/source/libs/gmp/gmp-src/mpf/set_ui.c
index 617bce13c14..bd4ba26b6db 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/set_z.c b/Build/source/libs/gmp/gmp-src/mpf/set_z.c
index fe91904563d..f7626334262 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/set_z.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/set_z.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/size.c b/Build/source/libs/gmp/gmp-src/mpf/size.c
index c6b22b64cc3..f7a9dbd7e2c 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/size.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/size.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
size_t
diff --git a/Build/source/libs/gmp/gmp-src/mpf/sqrt.c b/Build/source/libs/gmp/gmp-src/mpf/sqrt.c
index 44502244e24..ffb7c10b920 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/sqrt.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/sqrt.c
@@ -30,7 +30,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/sqrt_ui.c b/Build/source/libs/gmp/gmp-src/mpf/sqrt_ui.c
index f390e2425b8..9f91f9974f1 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/sqrt_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/sqrt_ui.c
@@ -30,7 +30,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/sub.c b/Build/source/libs/gmp/gmp-src/mpf/sub.c
index 5fb9ab60cb8..56f26f6d39c 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/sub.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/sub.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/sub_ui.c b/Build/source/libs/gmp/gmp-src/mpf/sub_ui.c
index cf9b88eb004..a23d2a884fb 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/sub_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/sub_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/swap.c b/Build/source/libs/gmp/gmp-src/mpf/swap.c
index a3706528763..80b2e9b8b99 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/swap.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/swap.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/trunc.c b/Build/source/libs/gmp/gmp-src/mpf/trunc.c
index 5f94f7aec85..e9af4a70c14 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/trunc.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/trunc.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/ui_div.c b/Build/source/libs/gmp/gmp-src/mpf/ui_div.c
index ceb881ebcc2..d228bd44a78 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/ui_div.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/ui_div.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpf/ui_sub.c b/Build/source/libs/gmp/gmp-src/mpf/ui_sub.c
index 71050246622..58da56b47a9 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/ui_sub.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/ui_sub.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpf/urandomb.c b/Build/source/libs/gmp/gmp-src/mpf/urandomb.c
index 72271e8762a..ebe85ab6957 100644
--- a/Build/source/libs/gmp/gmp-src/mpf/urandomb.c
+++ b/Build/source/libs/gmp/gmp-src/mpf/urandomb.c
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpn/Makefile.am b/Build/source/libs/gmp/gmp-src/mpn/Makefile.am
index fc54483ee5f..3ab40061203 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/Makefile.am
+++ b/Build/source/libs/gmp/gmp-src/mpn/Makefile.am
@@ -41,7 +41,7 @@ libmpn_la_DEPENDENCIES = $(OFILES)
TARG_DIST = alpha arm arm64 cray generic ia64 lisp m68k m88k \
minithres mips32 mips64 pa32 pa64 power powerpc32 powerpc64 \
- s390_32 s390_64 sh sparc32 sparc64 thumb vax x86 x86_64
+ riscv s390_32 s390_64 sh sparc32 sparc64 thumb vax x86 x86_64
EXTRA_DIST = asm-defs.m4 cpp-ccas m4-ccas $(TARG_DIST)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/alpha/dive_1.c b/Build/source/libs/gmp/gmp-src/mpn/alpha/dive_1.c
index 88b82db2f73..349d58189ed 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/alpha/dive_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/alpha/dive_1.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/alpha/ev5/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/alpha/ev5/gmp-mparam.h
index b560c20afec..1575a287f55 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/alpha/ev5/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/alpha/ev5/gmp-mparam.h
@@ -1,7 +1,6 @@
/* Alpha EV5 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2004, 2005, 2008-2010, 2014 Free
-Software Foundation, Inc.
+Copyright 1991-2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,44 +33,46 @@ see https://www.gnu.org/licenses/. */
/* 600 MHz 21164A */
/* FFT tuning limit = 5000000 */
-/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
+/* Generated by tuneup.c, 2017-02-02, gcc 4.9 */
#define DIVREM_1_NORM_THRESHOLD 0 /* preinv always */
#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1_1P_METHOD 2
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 10
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 22
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 15
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 20
#define USE_PREINV_DIVREM_1 1 /* preinv always */
#define DIV_QR_1N_PI1_METHOD 1
#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 76
+#define BMOD_1_TO_MOD_1_THRESHOLD 69
-#define MUL_TOOM22_THRESHOLD 14
+#define DIV_1_VS_MUL_1_PERCENT 181
+
+#define MUL_TOOM22_THRESHOLD 16
#define MUL_TOOM33_THRESHOLD 50
#define MUL_TOOM44_THRESHOLD 118
-#define MUL_TOOM6H_THRESHOLD 157
+#define MUL_TOOM6H_THRESHOLD 173
#define MUL_TOOM8H_THRESHOLD 236
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 77
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 49
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 84
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 81
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 56
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 53
#define MUL_TOOM43_TO_TOOM54_THRESHOLD 70
#define SQR_BASECASE_THRESHOLD 0 /* always */
#define SQR_TOOM2_THRESHOLD 22
-#define SQR_TOOM3_THRESHOLD 73
+#define SQR_TOOM3_THRESHOLD 69
#define SQR_TOOM4_THRESHOLD 178
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 260
+#define SQR_TOOM6_THRESHOLD 189
+#define SQR_TOOM8_THRESHOLD 357
#define MULMID_TOOM42_THRESHOLD 18
@@ -147,41 +148,44 @@ see https://www.gnu.org/licenses/. */
#define SQR_FFT_THRESHOLD 3968
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 45
-#define MULLO_MUL_N_THRESHOLD 8397
+#define MULLO_DC_THRESHOLD 50
+#define MULLO_MUL_N_THRESHOLD 5558
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 78
+#define SQRLO_SQR_THRESHOLD 3597
#define DC_DIV_QR_THRESHOLD 47
-#define DC_DIVAPPR_Q_THRESHOLD 168
+#define DC_DIVAPPR_Q_THRESHOLD 167
#define DC_BDIV_QR_THRESHOLD 47
#define DC_BDIV_Q_THRESHOLD 110
-#define INV_MULMOD_BNM1_THRESHOLD 26
-#define INV_NEWTON_THRESHOLD 189
-#define INV_APPR_THRESHOLD 181
+#define INV_MULMOD_BNM1_THRESHOLD 30
+#define INV_NEWTON_THRESHOLD 181
+#define INV_APPR_THRESHOLD 173
-#define BINV_NEWTON_THRESHOLD 196
-#define REDC_1_TO_REDC_N_THRESHOLD 51
+#define BINV_NEWTON_THRESHOLD 182
+#define REDC_1_TO_REDC_N_THRESHOLD 47
-#define MU_DIV_QR_THRESHOLD 1558
-#define MU_DIVAPPR_Q_THRESHOLD 1558
+#define MU_DIV_QR_THRESHOLD 979
+#define MU_DIVAPPR_Q_THRESHOLD 1142
#define MUPI_DIV_QR_THRESHOLD 90
-#define MU_BDIV_QR_THRESHOLD 855
-#define MU_BDIV_Q_THRESHOLD 1078
-
-#define POWM_SEC_TABLE 1,16,90,452,1221
+#define MU_BDIV_QR_THRESHOLD 748
+#define MU_BDIV_Q_THRESHOLD 979
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 99
-#define HGCD_APPR_THRESHOLD 103
-#define HGCD_REDUCE_THRESHOLD 2899
-#define GCD_DC_THRESHOLD 283
-#define GCDEXT_DC_THRESHOLD 201
-#define JACOBI_BASE_METHOD 3
+#define POWM_SEC_TABLE 1,16,90,386,2177
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 426
-#define SET_STR_PRECOMPUTE_THRESHOLD 1505
+#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_PRECOMPUTE_THRESHOLD 26
+#define SET_STR_DC_THRESHOLD 363
+#define SET_STR_PRECOMPUTE_THRESHOLD 1201
-#define FAC_DSC_THRESHOLD 1404
+#define FAC_DSC_THRESHOLD 342
#define FAC_ODD_THRESHOLD 0 /* always */
+
+#define MATRIX22_STRASSEN_THRESHOLD 13
+#define HGCD_THRESHOLD 105
+#define HGCD_APPR_THRESHOLD 108
+#define HGCD_REDUCE_THRESHOLD 1679
+#define GCD_DC_THRESHOLD 238
+#define GCDEXT_DC_THRESHOLD 199
+#define JACOBI_BASE_METHOD 2
diff --git a/Build/source/libs/gmp/gmp-src/mpn/alpha/ev67/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/alpha/ev67/gcd_11.asm
index 55fa7d36731..03c234b90ff 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/alpha/ev67/gcd_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/alpha/ev67/gcd_11.asm
@@ -1,4 +1,4 @@
-dnl Alpha ev67 mpn_gcd_1 -- Nx1 greatest common divisor.
+dnl Alpha ev67 mpn_gcd_11 -- Nx1 greatest common divisor.
dnl Copyright 2003, 2004 Free Software Foundation, Inc.
@@ -48,79 +48,15 @@ C operands with this algorithm gives the measured 3.4 c/l.
C
C The slottings shown are for SVR4 style systems, Unicos differs in the
C initial gp setup and the LEA.
-C
-C Enhancement:
-C
-C On the jsr, !lituse_jsr! (when available) would allow the linker to relax
-C it to a bsr, but probably only in a static binary. Plain "jsr foo" gives
-C the right object code for relaxation, and ought to be available
-C everywhere, but we prefer to schedule the GOT ldq (LEA) back earlier, for
-C the usual case of running in a shared library.
-C
-C bsr could perhaps be used explicitly anyway. We should be able to assume
-C modexact is in the same module as us (ie. shared library or mainline).
-C Would there be any worries about the size of the displacement? Could
-C always put modexact and gcd_1 in the same .o to be certain.
-
-ASM_START()
-PROLOGUE(mpn_gcd_1, gp)
-
- C r16 xp
- C r17 size
- C r18 y
-
- C ldah C l
- C lda C u
-
- ldq r0, 0(r16) C L x = xp[0]
- lda r30, -32(r30) C u alloc stack
-
- LEA( r27, mpn_modexact_1c_odd) C L modexact addr, ldq (gp)
- stq r10, 16(r30) C L save r10
- cttz r18, r10 C U0 y twos
- cmpeq r17, 1, r5 C u test size==1
-
- stq r9, 8(r30) C L save r9
- clr r19 C u zero c for modexact
- unop
- unop
- cttz r0, r6 C U0 x twos
- stq r26, 0(r30) C L save ra
- srl r18, r10, r18 C U y odd
-
- mov r18, r9 C l hold y across call
-
- cmpult r6, r10, r2 C u test x_twos < y_twos
-
- cmovne r2, r6, r10 C l common_twos = min(x_twos,y_twos)
- bne r5, L(one) C U no modexact if size==1
- jsr r26, (r27), mpn_modexact_1c_odd C L0
-
- LDGP( r29, 0(r26)) C u,l ldah,lda
- cttz r0, r6 C U0 new x twos
- ldq r26, 0(r30) C L restore ra
-
-L(one):
- mov r9, r1 C u y
- ldq r9, 8(r30) C L restore r9
- mov r10, r2 C u common twos
- ldq r10, 16(r30) C L restore r10
-
- lda r30, 32(r30) C l free stack
- beq r0, L(done) C U return y if x%y==0
-
- srl r0, r6, r0 C U x odd
- unop
+ASM_START()
+PROLOGUE(mpn_gcd_11)
+ mov r16, r0
+ mov r17, r1
ALIGN(16)
-L(top):
- C r0 x
- C r1 y
- C r2 common twos, for use at end
-
- subq r0, r1, r7 C l0 d = x - y
+L(top): subq r0, r1, r7 C l0 d = x - y
cmpult r0, r1, r16 C u0 test x >= y
subq r1, r0, r4 C l0 new_x = y - x
@@ -137,9 +73,7 @@ L(top):
bne r7, L(top) C U1 stop when d==0
-L(done):
- sll r1, r2, r0 C U0 return y << common_twos
+L(end): mov r1, r0 C U0 return y << common_twos
ret r31, (r26), 1 C L0
-
EPILOGUE()
ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/aorslsh1_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/aorslsh1_n.asm
index 09b1662b708..889e654c552 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/aorslsh1_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/aorslsh1_n.asm
@@ -163,5 +163,5 @@ L(rt1): mov r14, r12
REVCY(r12)
L(rt0): RETVAL( r14)
pop {r4-r10r11, r14}
- ret r14
+ return r14
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/arm-defs.m4 b/Build/source/libs/gmp/gmp-src/mpn/arm/arm-defs.m4
index 371d8ea0f4d..4b4fa0be153 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/arm-defs.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/arm-defs.m4
@@ -2,7 +2,7 @@ divert(-1)
dnl m4 macros for ARM assembler.
-dnl Copyright 2001, 2012, 2013 Free Software Foundation, Inc.
+dnl Copyright 2001, 2012-2016, 2018-2019 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -36,6 +36,11 @@ dnl don't want to disable macro expansions in or after them.
changecom(@&*$)
+define(`ASM_START',
+m4_assert_numargs_range(0,1)
+`ifelse($1,`neon',`.fpu neon',
+ $1,,`',
+ 1,1,`m4_error(`$0 got invalid argument $1')')')
dnl APCS register names.
@@ -43,18 +48,18 @@ deflit(a1,r0)
deflit(a2,r1)
deflit(a3,r2)
deflit(a4,r3)
-deflit(v1,r4)
-deflit(v2,r5)
-deflit(v3,r6)
-deflit(v4,r7)
-deflit(v5,r8)
-deflit(v6,r9)
+dnl deflit(v1,r4)
+dnl deflit(v2,r5)
+dnl deflit(v3,r6)
+dnl deflit(v4,r7)
+dnl deflit(v5,r8)
+dnl deflit(v6,r9)
deflit(sb,r9)
-deflit(v7,r10)
+dnl deflit(v7,r10)
deflit(sl,r10)
deflit(fp,r11)
deflit(ip,r12)
-deflit(sp,r13)
+dnl deflit(sp,r13)
deflit(lr,r14)
deflit(pc,r15)
@@ -84,11 +89,12 @@ L(ptr'lea_num`): .word GSYM_PREFIX`'$2')
')dnl
')
-define(`ret',`ifdef(`NOTHUMB',`mov pc, ',`bx')')
+define(`return',`ifdef(`NOTHUMB',`mov pc, ',`bx')')
define(`EPILOGUE_cpu',
`lea_list
- SIZE(`$1',.-`$1')')
+ SIZE(`$1',.-`$1')'
+`define(`lea_list', `')')
divert
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/bdiv_dbm1c.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/bdiv_dbm1c.asm
index 48057559c9b..b919dc451c8 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/bdiv_dbm1c.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/bdiv_dbm1c.asm
@@ -109,5 +109,5 @@ L(wd1): subs r5, r5, r8
str r5, [qp]
sbc r0, r5, r12
pop {r4, r5, r6, r7, r8}
- ret lr
+ return lr
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/bdiv_q_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/bdiv_q_1.asm
new file mode 100644
index 00000000000..ae395d1ffd6
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/bdiv_q_1.asm
@@ -0,0 +1,162 @@
+dnl ARM v4 mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- Hensel division by 1-limb divisor.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 2012, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C norm unorm
+C 1176 13 18
+C Cortex-A5 8 12
+C Cortex-A7 10.5 18
+C Cortex-A8 14 15
+C Cortex-A9 10 12 not measured since latest edits
+C Cortex-A15 9 9
+C Cortex-A53 14 20
+
+C Architecture requirements:
+C v5 -
+C v5t -
+C v5te -
+C v6 -
+C v6t2 -
+C v7a -
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`n', `r2')
+define(`d', `r3')
+define(`di_arg', `sp[0]') C just mpn_pi1_bdiv_q_1
+define(`cnt_arg', `sp[4]') C just mpn_pi1_bdiv_q_1
+
+define(`cy', `r7')
+define(`cnt', `r6')
+define(`tnc', `r8')
+
+ASM_START()
+PROLOGUE(mpn_bdiv_q_1)
+ tst d, #1
+ push {r6-r11}
+ mov cnt, #0
+ bne L(inv)
+
+C count trailing zeros
+ movs r10, d, lsl #16
+ moveq d, d, lsr #16
+ moveq cnt, #16
+ tst d, #0xff
+ moveq d, d, lsr #8
+ addeq cnt, cnt, #8
+ LEA( r10, ctz_tab)
+ and r11, d, #0xff
+ ldrb r10, [r10, r11]
+ mov d, d, lsr r10
+ add cnt, cnt, r10
+
+C binvert limb
+L(inv): LEA( r10, binvert_limb_table)
+ and r12, d, #254
+ ldrb r10, [r10, r12, lsr #1]
+ mul r12, r10, r10
+ mul r12, d, r12
+ rsb r12, r12, r10, lsl #1
+ mul r10, r12, r12
+ mul r10, d, r10
+ rsb r10, r10, r12, lsl #1 C r10 = inverse
+ b L(pi1)
+EPILOGUE()
+
+PROLOGUE(mpn_pi1_bdiv_q_1)
+ push {r6-r11}
+
+ ldr cnt, [sp, #28]
+ ldr r10, [sp, #24]
+
+L(pi1): ldr r11, [up], #4 C up[0]
+ cmp cnt, #0
+ mov cy, #0
+ bne L(unorm)
+
+L(norm):
+ subs n, n, #1 C set carry as side-effect
+ beq L(edn)
+
+ ALIGN(16)
+L(tpn): sbcs cy, r11, cy
+ ldr r11, [up], #4
+ sub n, n, #1
+ mul r9, r10, cy
+ tst n, n
+ umull r12, cy, d, r9
+ str r9, [rp], #4
+ bne L(tpn)
+
+L(edn): sbc cy, r11, cy
+ mul r9, r10, cy
+ str r9, [rp]
+ pop {r6-r11}
+ return r14
+
+L(unorm):
+ rsb tnc, cnt, #32
+ mov r11, r11, lsr cnt
+ subs n, n, #1 C set carry as side-effect
+ beq L(edu)
+
+ ALIGN(16)
+L(tpu): ldr r12, [up], #4
+ orr r9, r11, r12, lsl tnc
+ mov r11, r12, lsr cnt
+ sbcs cy, r9, cy C critical path ->cy->cy->
+ sub n, n, #1
+ mul r9, r10, cy C critical path ->cy->r9->
+ tst n, n
+ umull r12, cy, d, r9 C critical path ->r9->cy->
+ str r9, [rp], #4
+ bne L(tpu)
+
+L(edu): sbc cy, r11, cy
+ mul r9, r10, cy
+ str r9, [rp]
+ pop {r6-r11}
+ return r14
+EPILOGUE()
+
+ RODATA
+ctz_tab:
+ .byte 8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
+ .byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
+ .byte 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
+ .byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
+ .byte 7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
+ .byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
+ .byte 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
+ .byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/cnd_aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/cnd_aors_n.asm
index f0399e29dab..0479f0d2092 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/cnd_aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/cnd_aors_n.asm
@@ -130,5 +130,5 @@ L(top): ldm vp!, {r4,r5,r6,r7}
L(end): RETVAL
pop {r4-r11}
- ret r14
+ return r14
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/com.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/com.asm
index 57db9af0f4d..850b10ad4c0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/com.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/com.asm
@@ -71,5 +71,5 @@ L(top): ldmia up!, { r3, r8, r9, r12 } C load 4 limbs
bne L(top)
ldmfd sp!, { r7, r8, r9 } C restore regs from stack
-L(rtn): ret lr
+L(rtn): return lr
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/copyd.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/copyd.asm
index 938b1dcb013..bcad98db2ef 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/copyd.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/copyd.asm
@@ -80,5 +80,5 @@ L(top): subs n, n, #4
L(end): stmda rp, { r3,r4,r5,r12 }
pop { r4-r5 }
-L(rtn): ret lr
+L(rtn): return lr
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/copyi.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/copyi.asm
index 0dc4e597111..421930f956c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/copyi.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/copyi.asm
@@ -75,5 +75,5 @@ L(top): subs n, n, #4
L(end): stm rp, { r3,r4,r5,r12 }
pop { r4-r5 }
-L(rtn): ret lr
+L(rtn): return lr
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/dive_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/dive_1.asm
index f9921e55ea1..8bffb0cccd5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/dive_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/dive_1.asm
@@ -1,4 +1,4 @@
-dnl ARM v4 mpn_modexact_1c_odd
+dnl ARM v4 mpn_divexact_1.
dnl Contributed to the GNU project by Torbjorn Granlund.
@@ -96,23 +96,23 @@ L(inv): LEA( r4, binvert_limb_table)
L(norm):
subs n, n, #1 C set carry as side-effect
- beq L(end)
+ beq L(edn)
ALIGN(16)
-L(top): sbcs cy, r5, cy
+L(tpn): sbcs cy, r5, cy
ldr r5, [up], #4
sub n, n, #1
mul r9, r4, cy
tst n, n
umull r12, cy, d, r9
str r9, [rp], #4
- bne L(top)
+ bne L(tpn)
-L(end): sbc cy, r5, cy
+L(edn): sbc cy, r5, cy
mul r9, r4, cy
str r9, [rp]
pop {r4-r9}
- ret r14
+ return r14
L(unnorm):
rsb tnc, cnt, #32
@@ -136,7 +136,7 @@ L(edu): sbc cy, r5, cy
mul r9, r4, cy
str r9, [rp]
pop {r4-r9}
- ret r14
+ return r14
EPILOGUE()
RODATA
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/invert_limb.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/invert_limb.asm
index c969ed525c4..af7502de9bf 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/invert_limb.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/invert_limb.asm
@@ -52,7 +52,7 @@ PROLOGUE(mpn_invert_limb)
adds r1, r12, r0
adc r3, r3, r0
rsb r0, r3, r2
- ret lr
+ return lr
EPILOGUE()
RODATA
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/logops_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/logops_n.asm
index 02ebbf3b9ce..7e04165ed82 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/logops_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/logops_n.asm
@@ -135,5 +135,5 @@ L(mid): sub n, n, #4
pop { r4, r5, r6, r7 } C popping r8-r10 here strangely fails
L(rtn): pop { r8, r9, r10 }
- ret r14
+ return r14
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/lshift.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/lshift.asm
index 9e828423b39..1d5ce0a0011 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/lshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/lshift.asm
@@ -84,5 +84,5 @@ L(end): orr r7, r7, r6, lsr tnc
L(1): str r7, [rp, #-4]
mov r0, r4, lsr tnc
pop {r4, r6, r7, r8}
- ret r14
+ return r14
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/lshiftc.asm
index 1a2fa682ae6..e5b52dfa34b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/lshiftc.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/lshiftc.asm
@@ -91,5 +91,5 @@ L(1): mvn r6, #0
str r7, [rp, #-4]
mov r0, r4, lsr tnc
pop {r4, r6, r7, r8}
- ret r14
+ return r14
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/mod_34lsub1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/mod_34lsub1.asm
index 0dace666f6c..596cd3c7fdf 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/mod_34lsub1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/mod_34lsub1.asm
@@ -33,10 +33,13 @@ include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
-C Cortex-A7 ?
-C Cortex-A8 ?
+C Cortex-A5 2.67
+C Cortex-A7 2.35
+C Cortex-A8 2.0
C Cortex-A9 1.33
C Cortex-A15 1.33
+C Cortex-A17 3.34
+C Cortex-A53 2.0
define(`ap', r0)
define(`n', r1)
@@ -106,7 +109,7 @@ L(sum2):
add r0, r0, r12, lsr #8
pop { r4, r5, r6, r7 }
- ret lr
+ return lr
L(le2): cmn n, #1
bne L(1)
@@ -117,5 +120,5 @@ L(1): ldr r2, [ap]
bic r0, r2, #0xff000000
add r0, r0, r2, lsr #24
pop { r4, r5, r6, r7 }
- ret lr
+ return lr
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/mode1o.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/mode1o.asm
index 83a33aa650d..63a7f36ebde 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/mode1o.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/mode1o.asm
@@ -88,5 +88,5 @@ L(end): sbcs cy, r5, cy
addcc r0, r0, #1
ldmfd sp!, {r4, r5}
- ret r14
+ return r14
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/neon/lorrshift.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/neon/lorrshift.asm
index 3d6253fd495..7ebc780f9ab 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/neon/lorrshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/neon/lorrshift.asm
@@ -56,8 +56,8 @@ C TODO
C * Try using 128-bit operations. Note that Neon lacks pure 128-bit shifts,
C which might make it tricky.
C * Clean up and simplify.
-C * Consider sharing most of the code for lshift and rshift, since the feed-in code,
-C the loop, and most of the wind-down code are identical.
+C * Consider sharing most of the code for lshift and rshift, since the feed-in
+C code, the loop, and most of the wind-down code are identical.
C * Replace the basecase code with code using 'extension' registers.
C * Optimise. It is not clear that this loop insn permutation is optimal for
C either A9 or A15.
@@ -85,7 +85,7 @@ ifdef(`OPERATION_rshift',`
MULFUNC_PROLOGUE(mpn_lshift mpn_rshift)
-ASM_START()
+ASM_START(neon)
TEXT
ALIGN(64)
PROLOGUE(func)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/neon/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/neon/lshiftc.asm
index 803963049a4..f1bf0dec74a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/neon/lshiftc.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/neon/lshiftc.asm
@@ -68,53 +68,38 @@ define(`ap', `r1')
define(`n', `r2')
define(`cnt', `r3')
- define(`IFLSH', `$1')
- define(`IFRSH', `')
- define(`X',`0')
- define(`Y',`1')
- define(`func',`mpn_lshiftc')
-define(`OPERATION_lshiftc',1)
-
-ASM_START()
+ASM_START(neon)
TEXT
ALIGN(64)
PROLOGUE(mpn_lshiftc)
-IFLSH(` mov r12, n, lsl #2 ')
-IFLSH(` add rp, rp, r12 ')
-IFLSH(` add ap, ap, r12 ')
+ mov r12, n, lsl #2
+ add rp, rp, r12
+ add ap, ap, r12
cmp n, #4 C SIMD code n limit
ble L(base)
-ifdef(`OPERATION_lshiftc',`
vdup.32 d6, r3 C left shift count is positive
sub r3, r3, #64 C right shift count is negative
vdup.32 d7, r3
- mov r12, #-8') C lshift pointer update offset
-ifdef(`OPERATION_rshift',`
- rsb r3, r3, #0 C right shift count is negative
- vdup.32 d6, r3
- add r3, r3, #64 C left shift count is positive
- vdup.32 d7, r3
- mov r12, #8') C rshift pointer update offset
+ mov r12, #-8 C lshift pointer update offset
-IFLSH(` sub ap, ap, #8 ')
+ sub ap, ap, #8
vld1.32 {d19}, [ap], r12 C load initial 2 limbs
vshl.u64 d18, d19, d7 C retval
tst rp, #4 C is rp 64-bit aligned already?
beq L(rp_aligned) C yes, skip
vmvn d19, d19
-IFLSH(` add ap, ap, #4 ') C move back ap pointer
-IFRSH(` sub ap, ap, #4 ') C move back ap pointer
+ add ap, ap, #4 C move back ap pointer
vshl.u64 d4, d19, d6
sub n, n, #1 C first limb handled
-IFLSH(` sub rp, rp, #4 ')
- vst1.32 {d4[Y]}, [rp]IFRSH(!) C store first limb, rp gets aligned
+ sub rp, rp, #4
+ vst1.32 {d4[1]}, [rp] C store first limb, rp gets aligned
vld1.32 {d19}, [ap], r12 C load ap[1] and ap[2]
L(rp_aligned):
-IFLSH(` sub rp, rp, #8 ')
+ sub rp, rp, #8
subs n, n, #6
vmvn d19, d19
blt L(two_or_three_more)
@@ -180,9 +165,9 @@ L(two_or_three_more):
L(l3): vshl.u64 d5, d19, d6
vld1.32 {d17}, [ap], r12
L(cj1): vmov.u8 d16, #0
-IFLSH(` add ap, ap, #4 ')
+ add ap, ap, #4
vmvn d17, d17
- vld1.32 {d16[Y]}, [ap], r12
+ vld1.32 {d16[1]}, [ap], r12
vshl.u64 d0, d17, d7
vshl.u64 d4, d17, d6
vmvn d16, d16
@@ -192,9 +177,9 @@ IFLSH(` add ap, ap, #4 ')
vst1.32 {d3}, [rp:64], r12
vorr d2, d4, d1
vst1.32 {d2}, [rp:64], r12
-IFLSH(` add rp, rp, #4 ')
- vst1.32 {d5[Y]}, [rp]
- vmov.32 r0, d18[X]
+ add rp, rp, #4
+ vst1.32 {d5[1]}, [rp]
+ vmov.32 r0, d18[0]
bx lr
L(l2): vld1.32 {d16}, [ap], r12
@@ -208,7 +193,7 @@ L(l2): vld1.32 {d16}, [ap], r12
vorr d3, d5, d0
L(cj2): vst1.32 {d2}, [rp:64], r12
vst1.32 {d3}, [rp]
- vmov.32 r0, d18[X]
+ vmov.32 r0, d18[0]
bx lr
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/rsh1aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/rsh1aors_n.asm
index 454cf5605d6..f2e300684bf 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/rsh1aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/rsh1aors_n.asm
@@ -120,5 +120,5 @@ L(e1): RSTCY( r12, r1)
str r4, [rp, #0]
mov r0, r11
pop {r4-r11}
- ret r14
+ return r14
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/rshift.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/rshift.asm
index dbe9f93e70a..9ddbc2eeb36 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/rshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/rshift.asm
@@ -82,5 +82,5 @@ L(end): orr r7, r7, r6, lsl tnc
L(1): str r7, [rp]
mov r0, r4, lsl tnc
pop {r4, r6, r7, r8}
- ret r14
+ return r14
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/sec_tabselect.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/sec_tabselect.asm
index c2b05497173..76a412b3fd3 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/sec_tabselect.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/sec_tabselect.asm
@@ -109,7 +109,7 @@ L(tp2): subs c, c, #1
bge L(tp2)
stmia rp, {r8,r9}
pop {r4-r11, r14}
- ret lr
+ return lr
L(n2): cmp j, #-2
bne L(n1)
@@ -127,5 +127,5 @@ L(tp1): subs c, c, #1
bge L(tp1)
str r8, [rp]
L(n1): pop {r4-r11, r14}
- ret lr
+ return lr
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/udiv.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/udiv.asm
index bcf66ef0edb..7c04789e859 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/udiv.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/udiv.asm
@@ -61,7 +61,7 @@ L(oop): divstep(n1,n0,d)
str n1, [rem_ptr] C store remainder
adc r0, n0, n0 C quotient: add last carry from divstep
- ret lr
+ return lr
L(_large_divisor):
stmfd sp!, { r8, lr }
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v5/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v5/gcd_1.asm
deleted file mode 100644
index 169d154bf0b..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v5/gcd_1.asm
+++ /dev/null
@@ -1,120 +0,0 @@
-dnl ARM v5 mpn_gcd_1.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for ARM by Torbjörn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011, 2012 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/.
-
-include(`../config.m4')
-
-C cycles/bit (approx)
-C StrongARM -
-C XScale ?
-C Cortex-A7 ?
-C Cortex-A8 ?
-C Cortex-A9 5.9
-C Cortex-A15 ?
-C Numbers measured with: speed -CD -s8-32 -t24 mpn_gcd_1
-
-C TODO
-C * Optimise inner-loop better.
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 6)
-
-C INPUT PARAMETERS
-define(`up', `r0')
-define(`n', `r1')
-define(`v0', `r2')
-
-ifdef(`BMOD_1_TO_MOD_1_THRESHOLD',,
- `define(`BMOD_1_TO_MOD_1_THRESHOLD',0xffffffff)')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- push {r4, r7, lr}
- ldr r3, [up] C U low limb
-
- orr r3, r3, v0
- rsb r4, r3, #0
- and r4, r4, r3
- clz r4, r4 C min(ctz(u0),ctz(v0))
- rsb r4, r4, #31
-
- rsb r12, v0, #0
- and r12, r12, v0
- clz r12, r12
- rsb r12, r12, #31
- mov v0, v0, lsr r12
-
- mov r7, v0
-
- cmp n, #1
- bne L(nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- ldr r3, [up]
- cmp v0, r3, lsr #BMOD_THRES_LOG2
- bhi L(red1)
-
-L(bmod):mov r3, #0 C carry argument
- bl mpn_modexact_1c_odd
- b L(red0)
-
-L(nby1):cmp n, #BMOD_1_TO_MOD_1_THRESHOLD
- blo L(bmod)
-
- bl mpn_mod_1
-
-L(red0):mov r3, r0
-L(red1):rsbs r12, r3, #0
- and r12, r12, r3
- clz r12, r12
- rsb r12, r12, #31
- bne L(mid)
- b L(end)
-
- ALIGN(8)
-L(top): rsb r12, r12, #31
- movcc r3, r1 C if x-y < 0
- movcc r7, r0 C use x,y-x
-L(mid): mov r3, r3, lsr r12 C
- mov r0, r3 C
- sub r1, r7, r3 C
- rsbs r3, r7, r3 C
- and r12, r1, r3 C
- clz r12, r12 C
- bne L(top) C
-
-L(end): mov r0, r7, lsl r4
- pop {r4, r7, pc}
-EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v5/gcd_11.asm
index 20636479630..3c2b48f6e2e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v5/gcd_11.asm
@@ -1,4 +1,4 @@
-dnl ARM v6t2 mpn_gcd_1.
+dnl ARM v5 mpn_gcd_11.
dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for ARM by Torbjörn
dnl Granlund.
@@ -35,81 +35,36 @@ include(`../config.m4')
C cycles/bit (approx)
C StrongARM -
-C XScale -
-C Cortex-A7 ?
-C Cortex-A8 ?
-C Cortex-A9 5.3
-C Cortex-A15 3.5
+C XScale ?
+C Cortex-A5 6.45 obsolete
+C Cortex-A7 6.41 obsolete
+C Cortex-A8 5.0 obsolete
+C Cortex-A9 5.9 obsolete
+C Cortex-A15 4.40 obsolete
+C Cortex-A17 5.68 obsolete
+C Cortex-A53 4.37 obsolete
C Numbers measured with: speed -CD -s8-32 -t24 mpn_gcd_1
-C TODO
-C * Optimise inner-loop better.
-C * Push saving/restoring of callee-user regs into call code
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 7)
-
-C INPUT PARAMETERS
-define(`up', `r0')
-define(`n', `r1')
-define(`v0', `r2')
-
-ifdef(`BMOD_1_TO_MOD_1_THRESHOLD',,
- `define(`BMOD_1_TO_MOD_1_THRESHOLD',0xffffffff)')
+define(`u0', `r0')
+define(`v0', `r1')
ASM_START()
TEXT
ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- push {r4, r7, lr}
- ldr r3, [up] C U low limb
-
- orr r3, r3, v0
- rbit r4, r3
- clz r4, r4 C min(ctz(u0),ctz(v0))
-
- rbit r12, v0
- clz r12, r12
- mov v0, v0, lsr r12
-
- mov r7, v0
-
- cmp n, #1
- bne L(nby1)
+PROLOGUE(mpn_gcd_11)
+ subs r3, u0, v0 C 0
+ beq L(end) C
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- ldr r3, [up]
- cmp v0, r3, lsr #BMOD_THRES_LOG2
- bhi L(red1)
-
-L(bmod):mov r3, #0 C carry argument
- bl mpn_modexact_1c_odd
- b L(red0)
-
-L(nby1):cmp n, #BMOD_1_TO_MOD_1_THRESHOLD
- blo L(bmod)
-
- bl mpn_mod_1
-
-L(red0):mov r3, r0
-L(red1):cmp r3, #0
- rbit r12, r3
- clz r12, r12
- bne L(mid)
- b L(end)
-
- ALIGN(8)
-L(top): movcs r3, r1 C if x-y < 0
- movcs r7, r0 C use x,y-x
-L(mid): mov r3, r3, lsr r12 C
- mov r0, r3 C
- subs r1, r7, r3 C
- rsb r3, r7, r3 C
- rbit r12, r1
- clz r12, r12 C
+ ALIGN(16)
+L(top): sub r2, v0, u0 C 0,5
+ and r12, r2, r3 C 1
+ clz r12, r12 C 2
+ rsb r12, r12, #31 C 3
+ rsbcc r3, r3, #0 C v = abs(u-v), even 1
+ movcs u0, v0 C u = min(u,v) 1
+ lsr v0, r3, r12 C 4
+ subs r3, u0, v0 C 5
bne L(top) C
-L(end): mov r0, r7, lsl r4
- pop {r4, r7, pc}
+L(end): bx lr
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_2.asm
index 33eeeec87bb..69d0b8f6073 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_2.asm
@@ -36,10 +36,13 @@ C cycles/limb
C StrongARM: -
C XScale -
C ARM11 4.68
-C Cortex-A7 3.625
-C Cortex-A8 4
+C Cortex-A5 3.63
+C Cortex-A7 3.65
+C Cortex-A8 4.0
C Cortex-A9 2.25
C Cortex-A15 2.5
+C Cortex-A17 2.13
+C Cortex-A53 3.5
define(`rp',`r0')
define(`up',`r1')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_3.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_3.asm
index d3d183343d4..d1490cd7dc1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_3.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v6/addmul_3.asm
@@ -36,10 +36,13 @@ C cycles/limb
C StrongARM: -
C XScale -
C ARM11 4.33
-C Cortex-A7 3.23
-C Cortex-A8 3.19
+C Cortex-A5 3.28
+C Cortex-A7 3.25
+C Cortex-A8 3.17
C Cortex-A9 2.125
C Cortex-A15 2
+C Cortex-A17 2.11
+C Cortex-A53 4.18
C TODO
C * Use a fast path for n <= KARATSUBA_MUL_THRESHOLD using a jump table,
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v6/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm/v6/gmp-mparam.h
index 67e6f777870..35a7c557274 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v6/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v6/gmp-mparam.h
@@ -1,7 +1,6 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010, 2012, 2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -33,98 +32,97 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BYTES 4
/* 700 MHz ARM11 (raspberry pi) */
-/* FFT tuning limit = 10 M */
-/* Generated by tuneup.c, 2015-10-05, gcc 4.6 */
+/* FFT tuning limit = 8,088,775 */
+/* Generated by tuneup.c, 2019-10-23, gcc 8.3 */
#define DIVREM_1_NORM_THRESHOLD 0 /* preinv always */
#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
#define MOD_1_2_TO_MOD_1_4_THRESHOLD MP_SIZE_T_MAX
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 19
#define USE_PREINV_DIVREM_1 1 /* preinv always */
-#define DIV_QR_1N_PI1_METHOD 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 71.61% faster than 2 */
#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 39
+#define BMOD_1_TO_MOD_1_THRESHOLD 38
-#define MUL_TOOM22_THRESHOLD 44
-#define MUL_TOOM33_THRESHOLD 138
-#define MUL_TOOM44_THRESHOLD 517
+#define DIV_1_VS_MUL_1_PERCENT 251
+
+#define MUL_TOOM22_THRESHOLD 38
+#define MUL_TOOM33_THRESHOLD 134
+#define MUL_TOOM44_THRESHOLD 512
#define MUL_TOOM6H_THRESHOLD 0 /* always */
-#define MUL_TOOM8H_THRESHOLD 692
+#define MUL_TOOM8H_THRESHOLD 620
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 141
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 407
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 132
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 209
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 625
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 209
#define MUL_TOOM42_TO_TOOM63_THRESHOLD 211
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 225
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 300
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 56
-#define SQR_TOOM3_THRESHOLD 173
-#define SQR_TOOM4_THRESHOLD 711
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 915
+#define SQR_TOOM2_THRESHOLD 55
+#define SQR_TOOM3_THRESHOLD 200
+#define SQR_TOOM4_THRESHOLD 470
+#define SQR_TOOM6_THRESHOLD 614
+#define SQR_TOOM8_THRESHOLD 882
-#define MULMID_TOOM42_THRESHOLD 70
+#define MULMID_TOOM42_THRESHOLD 62
-#define MULMOD_BNM1_THRESHOLD 24
-#define SQRMOD_BNM1_THRESHOLD 28
+#define MULMOD_BNM1_THRESHOLD 23
+#define SQRMOD_BNM1_THRESHOLD 26
-#define MUL_FFT_MODF_THRESHOLD 560 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 565 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 560, 5}, { 27, 6}, { 15, 5}, { 31, 6}, \
- { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 36, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 25, 6}, { 51, 7}, { 27, 6}, \
- { 55, 7}, { 29, 8}, { 15, 7}, { 37, 8}, \
+ { { 565, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 15, 5}, { 31, 6}, { 28, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 21, 6}, { 43, 7}, { 23, 6}, \
+ { 47, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
{ 19, 7}, { 43, 8}, { 23, 7}, { 51, 8}, \
{ 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
- { 35, 7}, { 71, 8}, { 43, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 71, 9}, { 39, 8}, \
- { 83, 9}, { 47, 8}, { 99, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 103,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 159,10}, { 95, 9}, { 191,10}, { 111,11}, \
- { 63,10}, { 159,11}, { 95,10}, { 207,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271,11}, { 159,10}, { 335,11}, { 191,10}, \
- { 399,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 511,11}, { 287,10}, { 575,11}, { 319,10}, \
- { 639,11}, { 351,12}, { 191,11}, { 383,10}, \
- { 767,11}, { 415,13}, { 127,12}, { 255,11}, \
- { 575,12}, { 319,11}, { 703,12}, { 383,11}, \
- { 799,12}, { 447,13}, { 255,12}, { 511,11}, \
- { 1023,12}, { 575,11}, { 1151,12}, { 703,13}, \
- { 383,12}, { 831,14}, { 255,13}, { 511,12}, \
- { 1151,13}, { 639,12}, { 1343,13}, { 767,12}, \
- { 1599,13}, { 895,14}, { 511,13}, { 1023,12}, \
- { 2111,13}, { 1151,12}, { 2367,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 110
-#define MUL_FFT_THRESHOLD 5760
-
-#define SQR_FFT_MODF_THRESHOLD 505 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 505, 5}, { 27, 6}, { 15, 5}, { 31, 6}, \
- { 29, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 40, 7}, { 23, 6}, \
- { 47, 7}, { 29, 8}, { 15, 7}, { 37, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 49, 8}, \
- { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
{ 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
{ 71, 9}, { 39, 8}, { 83, 9}, { 47, 8}, \
{ 99, 9}, { 55,10}, { 31, 9}, { 79,10}, \
{ 47, 9}, { 103,11}, { 31,10}, { 63, 9}, \
{ 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
- { 191,10}, { 111,11}, { 63,10}, { 127, 9}, \
- { 255,10}, { 143, 9}, { 287,10}, { 159,11}, \
+ { 191,10}, { 111,11}, { 63,10}, { 159,11}, \
+ { 95,10}, { 207,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271,11}, { 159,10}, \
+ { 351,11}, { 191,10}, { 399,11}, { 223,12}, \
+ { 127,11}, { 255,10}, { 511,11}, { 287,10}, \
+ { 607,11}, { 319,10}, { 639,11}, { 351,12}, \
+ { 191,11}, { 415,13}, { 127,12}, { 255,11}, \
+ { 575,12}, { 319,11}, { 671,12}, { 383,11}, \
+ { 799,12}, { 447,13}, { 255,12}, { 511,11}, \
+ { 1023,12}, { 703,13}, { 383,12}, { 895,14}, \
+ { 255,13}, { 511,12}, { 1151,13}, { 639,12}, \
+ { 1343,13}, { 767,12}, { 1599,13}, { 895,14}, \
+ { 16384,15}, { 32768,16} }
+#define MUL_FFT_TABLE3_SIZE 98
+#define MUL_FFT_THRESHOLD 5760
+
+#define SQR_FFT_MODF_THRESHOLD 530 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 530, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
+ { 35, 7}, { 19, 6}, { 39, 7}, { 21, 6}, \
+ { 43, 7}, { 23, 6}, { 47, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 7}, { 55, 8}, \
+ { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
+ { 55, 9}, { 31, 8}, { 71, 9}, { 39, 8}, \
+ { 83, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 103,11}, \
+ { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
+ { 167,10}, { 95, 9}, { 191,10}, { 111,11}, \
+ { 63,10}, { 143, 9}, { 287,10}, { 159,11}, \
{ 95,10}, { 191, 9}, { 383,12}, { 63,11}, \
{ 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
{ 543,10}, { 287,11}, { 159,10}, { 351,11}, \
@@ -133,56 +131,57 @@ see https://www.gnu.org/licenses/. */
{ 319,10}, { 639,11}, { 351,12}, { 191,11}, \
{ 383,10}, { 767,11}, { 415,13}, { 127,12}, \
{ 255,11}, { 607,12}, { 319,11}, { 703,12}, \
- { 383,11}, { 831,12}, { 447,13}, { 255,12}, \
- { 511,11}, { 1023,12}, { 703,13}, { 383,12}, \
- { 831,14}, { 255,13}, { 511,12}, { 1087,13}, \
- { 639,12}, { 1343,13}, { 767,12}, { 1599,13}, \
- { 895,14}, { 511,13}, { 1023,12}, { 2111,13}, \
- { 1151,12}, { 2431,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 109
-#define SQR_FFT_THRESHOLD 4672
+ { 383,11}, { 799,12}, { 447,11}, { 895,13}, \
+ { 255,12}, { 511,11}, { 1023,12}, { 703,13}, \
+ { 383,12}, { 895,14}, { 255,13}, { 511,12}, \
+ { 1151,13}, { 639,12}, { 1343,13}, { 767,12}, \
+ { 1599,13}, { 895,14}, { 16384,15}, { 32768,16} }
+#define SQR_FFT_TABLE3_SIZE 104
+#define SQR_FFT_THRESHOLD 4416
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 55
+#define MULLO_DC_THRESHOLD 51
#define MULLO_MUL_N_THRESHOLD 11278
-#define SQRLO_BASECASE_THRESHOLD 8
-#define SQRLO_DC_THRESHOLD 51
-#define SQRLO_SQR_THRESHOLD 8907
+#define SQRLO_BASECASE_THRESHOLD 10
+#define SQRLO_DC_THRESHOLD 55
+#define SQRLO_SQR_THRESHOLD 8648
-#define DC_DIV_QR_THRESHOLD 46
-#define DC_DIVAPPR_Q_THRESHOLD 148
-#define DC_BDIV_QR_THRESHOLD 57
+#define DC_DIV_QR_THRESHOLD 36
+#define DC_DIVAPPR_Q_THRESHOLD 146
+#define DC_BDIV_QR_THRESHOLD 46
#define DC_BDIV_Q_THRESHOLD 160
-#define INV_MULMOD_BNM1_THRESHOLD 86
-#define INV_NEWTON_THRESHOLD 138
-#define INV_APPR_THRESHOLD 139
+#define INV_MULMOD_BNM1_THRESHOLD 74
+#define INV_NEWTON_THRESHOLD 145
+#define INV_APPR_THRESHOLD 147
-#define BINV_NEWTON_THRESHOLD 216
+#define BINV_NEWTON_THRESHOLD 372
#define REDC_1_TO_REDC_2_THRESHOLD 6
-#define REDC_2_TO_REDC_N_THRESHOLD 124
-
-#define MU_DIV_QR_THRESHOLD 2642
-#define MU_DIVAPPR_Q_THRESHOLD 2492
-#define MUPI_DIV_QR_THRESHOLD 74
-#define MU_BDIV_QR_THRESHOLD 2130
-#define MU_BDIV_Q_THRESHOLD 2541
-
-#define POWM_SEC_TABLE 5,26,143,446
-
-#define GET_STR_DC_THRESHOLD 20
-#define GET_STR_PRECOMPUTE_THRESHOLD 39
-#define SET_STR_DC_THRESHOLD 527
-#define SET_STR_PRECOMPUTE_THRESHOLD 1069
-
-#define FAC_DSC_THRESHOLD 430
-#define FAC_ODD_THRESHOLD 55
-
-#define MATRIX22_STRASSEN_THRESHOLD 23
-#define HGCD_THRESHOLD 79
-#define HGCD_APPR_THRESHOLD 71
-#define HGCD_REDUCE_THRESHOLD 3810
-#define GCD_DC_THRESHOLD 283
-#define GCDEXT_DC_THRESHOLD 253
-#define JACOBI_BASE_METHOD 1
+#define REDC_2_TO_REDC_N_THRESHOLD 140
+
+#define MU_DIV_QR_THRESHOLD 2801
+#define MU_DIVAPPR_Q_THRESHOLD 2801
+#define MUPI_DIV_QR_THRESHOLD 79
+#define MU_BDIV_QR_THRESHOLD 2541
+#define MU_BDIV_Q_THRESHOLD 2764
+
+#define POWM_SEC_TABLE 3,20,139,734
+
+#define GET_STR_DC_THRESHOLD 27
+#define GET_STR_PRECOMPUTE_THRESHOLD 45
+#define SET_STR_DC_THRESHOLD 342
+#define SET_STR_PRECOMPUTE_THRESHOLD 1290
+
+#define FAC_DSC_THRESHOLD 390
+#define FAC_ODD_THRESHOLD 438
+
+#define MATRIX22_STRASSEN_THRESHOLD 25
+#define HGCD2_DIV1_METHOD 5 /* 1.32% faster than 3 */
+#define HGCD_THRESHOLD 82
+#define HGCD_APPR_THRESHOLD 81
+#define HGCD_REDUCE_THRESHOLD 4633
+#define GCD_DC_THRESHOLD 345
+#define GCDEXT_DC_THRESHOLD 268
+#define JACOBI_BASE_METHOD 1 /* 3.30% faster than 2 */
+
+/* Tuneup completed successfully, took 45018 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v6/mul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v6/mul_2.asm
index 91a74c8fda6..edd27f34094 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v6/mul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v6/mul_2.asm
@@ -36,10 +36,13 @@ C cycles/limb
C StrongARM: -
C XScale -
C ARM11 5.25
-C Cortex-A7 3.13
-C Cortex-A8 5
+C Cortex-A5 3.63
+C Cortex-A7 3.15
+C Cortex-A8 5.0
C Cortex-A9 2.25
C Cortex-A15 2.5
+C Cortex-A17 2.13
+C Cortex-A53 3.5
C TODO
C * This is a trivial edit of the addmul_2 code. Check for simplifications,
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_11.asm
new file mode 100644
index 00000000000..8a38351430e
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_11.asm
@@ -0,0 +1,65 @@
+dnl ARM v6t2 mpn_gcd_11.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011, 2012, 2019 Free Software Foundation,
+dnl 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/.
+
+include(`../config.m4')
+
+C cycles/bit (approx)
+C StrongARM -
+C XScale -
+C Cortex-A5 5.2
+C Cortex-A7 5.04
+C Cortex-A8 3.59
+C Cortex-A9 9.5
+C Cortex-A15 3.2
+C Cortex-A17 5.25
+C Cortex-A53 3.57
+
+define(`u0', `r0')
+define(`v0', `r1')
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_11)
+ subs r3, u0, v0 C 0
+ beq L(end) C
+
+ ALIGN(16)
+L(top): rbit r12, r3 C 1,5
+ clz r12, r12 C 2
+ rsbcc r3, r3, #0 C v = abs(u-v), even 1
+ movcs u0, v0 C u = min(u,v) 1
+ lsr v0, r3, r12 C 3
+ subs r3, u0, v0 C 4
+ bne L(top) C
+
+L(end): bx lr
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_22.asm
new file mode 100644
index 00000000000..3b23808c7b8
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v6t2/gcd_22.asm
@@ -0,0 +1,113 @@
+dnl ARM v6t2 mpn_gcd_22.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit (approx)
+C StrongARM -
+C XScale -
+C Cortex-A5 10.1
+C Cortex-A7 9.1
+C Cortex-A8 6.3
+C Cortex-A9 ?
+C Cortex-A12 7.7
+C Cortex-A15 5.7
+C Cortex-A17 ?
+C Cortex-A53 7.0
+
+
+define(`gp', `r0')
+
+define(`u1', `r1')
+define(`u0', `r2')
+define(`v1', `r3')
+define(`v0', `r4')
+
+define(`t0', `r5')
+define(`t1', `r6')
+define(`cnt', `r7')
+
+ASM_START()
+PROLOGUE(mpn_gcd_22)
+ push { r4-r7 }
+
+ ldr v0, [sp,#16] C
+
+L(top): subs t0, u0, v0 C 0 7
+ beq L(lowz)
+ sbcs t1, u1, v1 C 1 8
+
+ rbit cnt, t0 C 1
+
+ negcc t0, t0
+ mvncc t1, t1
+L(bck): movcc v0, u0
+ movcc v1, u1
+
+ clz cnt, cnt C 2
+ rsb r12, cnt, #32 C 3
+
+ lsr u0, t0, cnt C 3
+ lsl r12, t1, r12 C 4
+ lsr u1, t1, cnt C 3
+ orr u0, u0, r12 C 5
+
+ orrs r12, u1, v1
+ bne L(top)
+
+
+ str r12, [gp,#4] C high result limb <= 0
+
+ mov r6, gp
+ mov r0, u0 C pass 1st argument
+ mov r1, v0 C pass 2nd argument
+ mov r7, r14 C preserve link register
+ bl mpn_gcd_11
+ str r0, [r6,#0]
+ mov r14, r7
+ pop { r4-r7 }
+ bx r14
+
+L(lowz):C We come here when v0 - u0 = 0
+ C 1. If v1 - u1 = 0, then gcd is u = v.
+ C 2. Else compute gcd_21({v1,v0}, |u1-v1|)
+ subs t0, u1, v1
+ beq L(end)
+ mov t1, #0
+ rbit cnt, t0 C 1
+ negcc t0, t0
+ b L(bck)
+
+L(end): str v0, [gp,#0]
+ str v1, [gp,#4]
+ pop { r4-r7 }
+ bx r14
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/bdiv_q_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/bdiv_q_1.asm
new file mode 100644
index 00000000000..245b3715177
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/bdiv_q_1.asm
@@ -0,0 +1,36 @@
+dnl ARM mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- Hensel division by 1-limb divisor.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 2012, 2013, 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 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/.
+
+include(`../config.m4')
+
+MULFUNC_PROLOGUE(mpn_bdiv_q_1 mpn_pi1_bdiv_q_1)
+include_mpn(`arm/v7a/cora8/bdiv_q_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/gmp-mparam.h
index 53301910c46..409cbbb62f5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/gmp-mparam.h
@@ -1,7 +1,6 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010, 2012-2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,162 +31,182 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 1700 MHz Cortex-A15 with Neon (in spite of file position) */
-/* FFT tuning limit = 25 M */
-/* Generated by tuneup.c, 2015-10-06, gcc 4.8 */
+/* 2000 MHz Cortex-A15 with Neon (in spite of file position) */
+/* FFT tuning limit = 50,736,668 */
+/* Generated by tuneup.c, 2019-10-22, gcc 5.4 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
#define MOD_1U_TO_MOD_1_1_THRESHOLD 2
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 9
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 102
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD MP_SIZE_T_MAX
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 8
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 49.14% faster than 2 */
#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 15
+#define BMOD_1_TO_MOD_1_THRESHOLD 17
+
+#define DIV_1_VS_MUL_1_PERCENT 267
#define MUL_TOOM22_THRESHOLD 28
-#define MUL_TOOM33_THRESHOLD 116
-#define MUL_TOOM44_THRESHOLD 169
-#define MUL_TOOM6H_THRESHOLD 399
+#define MUL_TOOM33_THRESHOLD 114
+#define MUL_TOOM44_THRESHOLD 178
+#define MUL_TOOM6H_THRESHOLD 238
#define MUL_TOOM8H_THRESHOLD 597
#define MUL_TOOM32_TO_TOOM43_THRESHOLD 113
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 115
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 115
#define MUL_TOOM42_TO_TOOM63_THRESHOLD 115
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 160
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 154
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 38
#define SQR_TOOM3_THRESHOLD 126
-#define SQR_TOOM4_THRESHOLD 345
-#define SQR_TOOM6_THRESHOLD 470
-#define SQR_TOOM8_THRESHOLD 644
+#define SQR_TOOM4_THRESHOLD 336
+#define SQR_TOOM6_THRESHOLD 446
+#define SQR_TOOM8_THRESHOLD 650
#define MULMID_TOOM42_THRESHOLD 52
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 19
+#define MULMOD_BNM1_THRESHOLD 23
+#define SQRMOD_BNM1_THRESHOLD 17
-#define MUL_FFT_MODF_THRESHOLD 500 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 575 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 500, 5}, { 26, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 19, 6}, { 39, 7}, { 25, 6}, \
- { 51, 7}, { 27, 8}, { 15, 7}, { 33, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 51, 8}, \
- { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
- { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 67, 9}, { 47, 8}, { 99, 9}, \
- { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
- { 95,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 159,10}, { 95, 9}, { 191,10}, \
- { 111,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 143, 9}, { 287,10}, { 159,11}, { 95,10}, \
- { 191, 9}, { 383, 8}, { 767,12}, { 63,11}, \
+ { { 575, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 27, 7}, { 15, 6}, { 31, 7}, { 19, 6}, \
+ { 39, 7}, { 25, 6}, { 51, 7}, { 27, 8}, \
+ { 15, 7}, { 33, 8}, { 19, 7}, { 41, 8}, \
+ { 23, 7}, { 51, 8}, { 27, 9}, { 15, 8}, \
+ { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
+ { 55,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
+ { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
+ { 55,10}, { 31, 9}, { 71, 8}, { 143, 9}, \
+ { 87,10}, { 47, 9}, { 111,11}, { 31,10}, \
+ { 63, 9}, { 143,10}, { 79, 9}, { 159,10}, \
+ { 95,11}, { 63,10}, { 143, 9}, { 287,10}, \
+ { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,10}, { 287,11}, { 159,10}, { 335, 9}, \
+ { 671,10}, { 367, 9}, { 735,11}, { 191,10}, \
+ { 383, 9}, { 799,10}, { 415,11}, { 223,12}, \
+ { 127,10}, { 543,11}, { 287,10}, { 575,11}, \
+ { 319,10}, { 639,11}, { 351,10}, { 703,12}, \
+ { 191,11}, { 383,10}, { 767,11}, { 415,10}, \
+ { 831,11}, { 447,13}, { 127,12}, { 255,11}, \
+ { 543,10}, { 1087,11}, { 575,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,12}, { 383,11}, \
+ { 831,12}, { 447,11}, { 959,13}, { 255,12}, \
+ { 511,11}, { 1087,12}, { 575,11}, { 1151,12}, \
+ { 639,11}, { 1343,12}, { 703,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 895,14}, { 255,13}, \
+ { 511,12}, { 1087,13}, { 639,12}, { 1407,13}, \
+ { 767,12}, { 1599,13}, { 895,14}, { 511,13}, \
+ { 1023,12}, { 2111,13}, { 1151,12}, { 2431,13}, \
+ { 1279,12}, { 2559,13}, { 1407,14}, { 767,13}, \
+ { 1535,12}, { 3135,13}, { 1663,15}, { 511,14}, \
+ { 1023,13}, { 2303,14}, { 1279,13}, { 2559,12}, \
+ { 5119,13}, { 2687,14}, { 1535,13}, { 3071,12}, \
+ { 6143,13}, { 3199,12}, { 6399,14}, { 1791,15}, \
+ { 1023,14}, { 2047,13}, { 4095,14}, { 2303,13}, \
+ { 4607,12}, { 9215,13}, { 4863,12}, { 9727,14}, \
+ { 2559,13}, { 5119,15}, { 1535,14}, { 3071,13}, \
+ { 8192,14}, { 16384,15}, { 32768,16} }
+#define MUL_FFT_TABLE3_SIZE 155
+#define MUL_FFT_THRESHOLD 5760
+
+#define SQR_FFT_MODF_THRESHOLD 525 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 525, 5}, { 25, 6}, { 27, 7}, { 15, 6}, \
+ { 31, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 25, 6}, { 51, 7}, { 27, 8}, \
+ { 15, 7}, { 33, 8}, { 19, 7}, { 41, 8}, \
+ { 23, 7}, { 51, 8}, { 27, 7}, { 55, 9}, \
+ { 15, 8}, { 31, 7}, { 63, 8}, { 39, 9}, \
+ { 23, 8}, { 51,10}, { 15, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 99, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 95,11}, { 63,10}, { 143, 9}, \
+ { 287, 8}, { 575, 9}, { 303,10}, { 159,11}, \
+ { 95,10}, { 191, 9}, { 383,12}, { 63,11}, \
{ 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
{ 543,10}, { 287,11}, { 159,10}, { 319, 9}, \
{ 639,10}, { 335, 9}, { 671,10}, { 351,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 415,11}, \
- { 223,12}, { 127,11}, { 255,10}, { 543,11}, \
- { 287,10}, { 575,11}, { 319,10}, { 639,11}, \
- { 351,12}, { 191,11}, { 383,10}, { 767,11}, \
- { 447,13}, { 127,12}, { 255,11}, { 607,12}, \
- { 319,11}, { 735,12}, { 383,11}, { 831,12}, \
- { 447,11}, { 895,13}, { 255,12}, { 511,11}, \
- { 1023,12}, { 703,13}, { 383,12}, { 895,14}, \
- { 255,13}, { 511,12}, { 1151,13}, { 639,12}, \
- { 1471,13}, { 767,12}, { 1663,13}, { 895,14}, \
+ { 191,10}, { 399, 9}, { 799,10}, { 415, 9}, \
+ { 831,11}, { 223,10}, { 447,12}, { 127,10}, \
+ { 543,11}, { 287,10}, { 575,11}, { 319,10}, \
+ { 639,11}, { 351,10}, { 703,12}, { 191,11}, \
+ { 383,10}, { 799,11}, { 415,10}, { 831,11}, \
+ { 447,13}, { 127,11}, { 543,10}, { 1087,11}, \
+ { 607,12}, { 319,11}, { 735,12}, { 383,11}, \
+ { 831,12}, { 447,11}, { 959,12}, { 511,11}, \
+ { 1023,12}, { 575,11}, { 1151,12}, { 639,11}, \
+ { 1279,12}, { 703,13}, { 383,12}, { 767,11}, \
+ { 1535,12}, { 831,11}, { 1663,12}, { 895,14}, \
+ { 255,13}, { 511,12}, { 1087,13}, { 639,12}, \
+ { 1343,13}, { 767,12}, { 1599,13}, { 895,14}, \
{ 511,13}, { 1023,12}, { 2111,13}, { 1151,12}, \
- { 2431,13}, { 1279,14}, { 767,13}, { 1535,12}, \
- { 3135,15}, { 511,14}, { 1023,13}, { 2303,14}, \
- { 1279,13}, { 2559,12}, { 5119,13}, { 2815,14}, \
+ { 2303,13}, { 1279,14}, { 767,13}, { 1535,12}, \
+ { 3135,13}, { 1663,15}, { 511,14}, { 1023,13}, \
+ { 2047,12}, { 4095,13}, { 2303,14}, { 1279,13}, \
+ { 2559,12}, { 5119,14}, { 1535,13}, { 3071,12}, \
+ { 6143,13}, { 3199,12}, { 6399,14}, { 1791,15}, \
+ { 1023,14}, { 2047,13}, { 4095,14}, { 2303,13}, \
+ { 4607,12}, { 9215,13}, { 4863,12}, { 9727,14}, \
+ { 2559,15}, { 1535,14}, { 3071,13}, { 8192,14}, \
{ 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 122
-#define MUL_FFT_THRESHOLD 5312
-
-#define SQR_FFT_MODF_THRESHOLD 468 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 468, 5}, { 25, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 19, 6}, { 39, 7}, { 25, 6}, \
- { 51, 7}, { 27, 8}, { 15, 7}, { 33, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 51, 8}, \
- { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
- { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
- { 47, 8}, { 95, 9}, { 55,10}, { 31, 9}, \
- { 79,10}, { 47, 9}, { 103,11}, { 31,10}, \
- { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
- { 95, 9}, { 191,10}, { 111,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 143, 9}, { 287,10}, \
- { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
- { 383, 8}, { 767,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
- { 287,11}, { 159,10}, { 319, 9}, { 639,10}, \
- { 335, 9}, { 671,10}, { 351, 9}, { 703,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 415,11}, \
- { 223,12}, { 127,11}, { 255,10}, { 511,11}, \
- { 287,10}, { 575,11}, { 319,10}, { 639,11}, \
- { 351,12}, { 191,11}, { 383,10}, { 767,11}, \
- { 447,13}, { 127,12}, { 255,11}, { 607,12}, \
- { 319,11}, { 735,12}, { 383,11}, { 831,12}, \
- { 447,13}, { 255,12}, { 511,11}, { 1023,12}, \
- { 575,11}, { 1151,12}, { 639,11}, { 1279,12}, \
- { 703,13}, { 383,12}, { 895,14}, { 255,13}, \
- { 511,12}, { 1151,13}, { 639,12}, { 1407,13}, \
- { 767,12}, { 1663,13}, { 895,14}, { 511,13}, \
- { 1023,12}, { 2047,13}, { 1151,12}, { 2431,13}, \
- { 1279,14}, { 767,13}, { 1535,12}, { 3135,15}, \
- { 511,14}, { 1023,13}, { 2175,14}, { 1279,13}, \
- { 2687,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 127
-#define SQR_FFT_THRESHOLD 4736
+#define SQR_FFT_TABLE3_SIZE 154
+#define SQR_FFT_THRESHOLD 5312
#define MULLO_BASECASE_THRESHOLD 0 /* always */
#define MULLO_DC_THRESHOLD 38
-#define MULLO_MUL_N_THRESHOLD 8907
+#define MULLO_MUL_N_THRESHOLD 10950
#define SQRLO_BASECASE_THRESHOLD 10
#define SQRLO_DC_THRESHOLD 35
-#define SQRLO_SQR_THRESHOLD 8907
+#define SQRLO_SQR_THRESHOLD 10323
-#define DC_DIV_QR_THRESHOLD 54
-#define DC_DIVAPPR_Q_THRESHOLD 266
+#define DC_DIV_QR_THRESHOLD 57
+#define DC_DIVAPPR_Q_THRESHOLD 254
#define DC_BDIV_QR_THRESHOLD 48
-#define DC_BDIV_Q_THRESHOLD 296
+#define DC_BDIV_Q_THRESHOLD 286
-#define INV_MULMOD_BNM1_THRESHOLD 54
-#define INV_NEWTON_THRESHOLD 274
-#define INV_APPR_THRESHOLD 276
+#define INV_MULMOD_BNM1_THRESHOLD 55
+#define INV_NEWTON_THRESHOLD 252
+#define INV_APPR_THRESHOLD 252
-#define BINV_NEWTON_THRESHOLD 348
-#define REDC_1_TO_REDC_2_THRESHOLD 59
+#define BINV_NEWTON_THRESHOLD 372
+#define REDC_1_TO_REDC_2_THRESHOLD 61
#define REDC_2_TO_REDC_N_THRESHOLD 0 /* always */
-#define MU_DIV_QR_THRESHOLD 1787
+#define MU_DIV_QR_THRESHOLD 1858
#define MU_DIVAPPR_Q_THRESHOLD 1787
#define MUPI_DIV_QR_THRESHOLD 122
#define MU_BDIV_QR_THRESHOLD 1528
-#define MU_BDIV_Q_THRESHOLD 1752
+#define MU_BDIV_Q_THRESHOLD 1836
-#define POWM_SEC_TABLE 1,32,224,398,2211
+#define POWM_SEC_TABLE 1,14,200,480,1532
#define GET_STR_DC_THRESHOLD 16
-#define GET_STR_PRECOMPUTE_THRESHOLD 30
-#define SET_STR_DC_THRESHOLD 100
-#define SET_STR_PRECOMPUTE_THRESHOLD 807
-
-#define FAC_DSC_THRESHOLD 309
-#define FAC_ODD_THRESHOLD 28
-
-#define MATRIX22_STRASSEN_THRESHOLD 25
-#define HGCD_THRESHOLD 153
-#define HGCD_APPR_THRESHOLD 176
-#define HGCD_REDUCE_THRESHOLD 3014
-#define GCD_DC_THRESHOLD 667
-#define GCDEXT_DC_THRESHOLD 483
-#define JACOBI_BASE_METHOD 4
+#define GET_STR_PRECOMPUTE_THRESHOLD 33
+#define SET_STR_DC_THRESHOLD 104
+#define SET_STR_PRECOMPUTE_THRESHOLD 1120
+
+#define FAC_DSC_THRESHOLD 164
+#define FAC_ODD_THRESHOLD 27
+
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD2_DIV1_METHOD 1 /* 3.70% faster than 3 */
+#define HGCD_THRESHOLD 137
+#define HGCD_APPR_THRESHOLD 157
+#define HGCD_REDUCE_THRESHOLD 3389
+#define GCD_DC_THRESHOLD 610
+#define GCDEXT_DC_THRESHOLD 443
+#define JACOBI_BASE_METHOD 4 /* 12.66% faster than 1 */
+
+/* Tuneup completed successfully, took 69757 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm
index 16c34a2699d..51f93c1f8a5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm
@@ -59,7 +59,7 @@ ifdef(`DO_sub', `
define(`CLRCY', `cmp r13, #0')
define(`RETVAL', `sbc $2, $2, $2
cmn $2, #1
- adc r0, $1, #0')
+ adc r0, $1, #0')
define(`func', mpn_sublsh`'LSH`'_n)')
ifdef(`DO_rsb', `
define(`ADCSBCS', `sbcs $1, $3, $2')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/addmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/addmul_1.asm
new file mode 100644
index 00000000000..c11ed47f715
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/addmul_1.asm
@@ -0,0 +1,34 @@
+dnl ARM mpn_addmul_1
+
+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 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/.
+
+include(`../config.m4')
+
+MULFUNC_PROLOGUE(mpn_addmul_1)
+include_mpn(`arm/v6/addmul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/gmp-mparam.h
new file mode 100644
index 00000000000..143d4bc2ff8
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/gmp-mparam.h
@@ -0,0 +1,233 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* 1800 MHz Cortex-A17 with Neon (in spite of file position) */
+/* FFT tuning limit = 51243975 */
+/* Generated by tuneup.c, 2019-10-29, gcc 6.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD MP_SIZE_T_MAX
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 12
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 54.08% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 45
+
+#define DIV_1_VS_MUL_1_PERCENT 248
+
+#define MUL_TOOM22_THRESHOLD 38
+#define MUL_TOOM33_THRESHOLD 132
+#define MUL_TOOM44_THRESHOLD 200
+#define MUL_TOOM6H_THRESHOLD 303
+#define MUL_TOOM8H_THRESHOLD 478
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 137
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 179
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 132
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 145
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 191
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 62
+#define SQR_TOOM3_THRESHOLD 189
+#define SQR_TOOM4_THRESHOLD 354
+#define SQR_TOOM6_THRESHOLD 426
+#define SQR_TOOM8_THRESHOLD 608
+
+#define MULMID_TOOM42_THRESHOLD 62
+
+#define MULMOD_BNM1_THRESHOLD 21
+#define SQRMOD_BNM1_THRESHOLD 29
+
+#define MUL_FFT_MODF_THRESHOLD 595 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 595, 5}, { 29, 6}, { 15, 5}, { 31, 6}, \
+ { 16, 5}, { 33, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
+ { 39, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
+ { 27, 7}, { 55, 9}, { 15, 8}, { 31, 7}, \
+ { 63, 8}, { 43, 9}, { 23, 8}, { 55, 9}, \
+ { 31, 8}, { 63, 9}, { 39, 8}, { 83, 9}, \
+ { 47, 8}, { 95, 9}, { 55,10}, { 31, 9}, \
+ { 79,10}, { 47, 9}, { 103,11}, { 31,10}, \
+ { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
+ { 95, 9}, { 191,10}, { 111,11}, { 63,10}, \
+ { 143, 8}, { 575,10}, { 159,11}, { 95,10}, \
+ { 191, 9}, { 383, 8}, { 767, 9}, { 399, 8}, \
+ { 799,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511, 8}, { 1023, 9}, { 543, 8}, { 1087, 9}, \
+ { 575,10}, { 303,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 335, 9}, { 671,10}, { 351, 9}, \
+ { 703,10}, { 367, 9}, { 735,11}, { 191,10}, \
+ { 383, 9}, { 767,10}, { 399, 9}, { 799,10}, \
+ { 415, 9}, { 831,10}, { 431, 9}, { 863,11}, \
+ { 223,10}, { 447,12}, { 127,10}, { 511, 9}, \
+ { 1023,10}, { 543, 9}, { 1087,10}, { 607, 9}, \
+ { 1215,11}, { 319,10}, { 671, 9}, { 1343,11}, \
+ { 351,10}, { 735,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,10}, { 863,11}, { 447,10}, \
+ { 895,13}, { 127,11}, { 511,10}, { 1023,11}, \
+ { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
+ { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
+ { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
+ { 863,10}, { 1727,12}, { 447,11}, { 991,10}, \
+ { 1983,12}, { 511,11}, { 1087,12}, { 575,11}, \
+ { 1215,10}, { 2431,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,12}, { 959,11}, \
+ { 1983,13}, { 511,12}, { 1087,11}, { 2239,12}, \
+ { 1215,11}, { 2431,13}, { 639,12}, { 1471,11}, \
+ { 2943,13}, { 767,12}, { 1727,13}, { 895,12}, \
+ { 1983,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2495,13}, { 1279,12}, { 2623,13}, \
+ { 1407,12}, { 2943,14}, { 767,13}, { 1535,12}, \
+ { 3135,13}, { 1663,12}, { 3455,13}, { 1919,12}, \
+ { 3839,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
+ { 2303,13}, { 4991,12}, { 9983,14}, { 2559,13}, \
+ { 5247,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 16384,15}, { 32768,16} }
+#define MUL_FFT_TABLE3_SIZE 194
+#define MUL_FFT_THRESHOLD 6784
+
+#define SQR_FFT_MODF_THRESHOLD 500 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 500, 5}, { 29, 6}, { 15, 5}, { 31, 6}, \
+ { 16, 5}, { 33, 6}, { 29, 7}, { 15, 6}, \
+ { 32, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
+ { 39, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
+ { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
+ { 43, 9}, { 23, 8}, { 55,10}, { 15, 9}, \
+ { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
+ { 47, 8}, { 95, 9}, { 55,10}, { 31, 9}, \
+ { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
+ { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
+ { 95, 9}, { 191,10}, { 111,11}, { 63,10}, \
+ { 127, 9}, { 255,10}, { 143, 9}, { 287,10}, \
+ { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
+ { 383, 8}, { 767, 9}, { 399,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,10}, { 287, 9}, { 575,10}, { 303,11}, \
+ { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
+ { 671,10}, { 351, 9}, { 703,10}, { 367, 9}, \
+ { 735,11}, { 191,10}, { 383, 9}, { 767,10}, \
+ { 399, 9}, { 799,10}, { 415, 9}, { 831,10}, \
+ { 431, 9}, { 863,10}, { 447,12}, { 127,11}, \
+ { 255,10}, { 511, 9}, { 1023,10}, { 543, 9}, \
+ { 1087,11}, { 287,10}, { 607, 9}, { 1215,11}, \
+ { 319,10}, { 671,11}, { 351,10}, { 735,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 863,11}, { 447,10}, { 895,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
+ { 1087,11}, { 607,10}, { 1215,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,10}, { 1471,12}, \
+ { 383,11}, { 799,10}, { 1599,11}, { 863,12}, \
+ { 447,11}, { 959,10}, { 1919,11}, { 991,13}, \
+ { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
+ { 1215,10}, { 2431,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,12}, { 959,11}, \
+ { 1919,14}, { 255,13}, { 511,12}, { 1087,11}, \
+ { 2239,12}, { 1215,11}, { 2431,13}, { 639,12}, \
+ { 1471,11}, { 2943,13}, { 767,12}, { 1727,13}, \
+ { 895,12}, { 1983,14}, { 511,13}, { 1023,12}, \
+ { 2239,13}, { 1151,12}, { 2495,13}, { 1279,12}, \
+ { 2623,13}, { 1407,12}, { 2943,14}, { 767,13}, \
+ { 1535,12}, { 3071,13}, { 1663,12}, { 3455,13}, \
+ { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
+ { 2175,12}, { 4479,13}, { 2431,14}, { 1279,13}, \
+ { 2943,12}, { 5887,14}, { 1535,13}, { 3455,14}, \
+ { 1791,13}, { 3967,15}, { 1023,14}, { 2047,13}, \
+ { 4479,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
+ { 2559,13}, { 5119,14}, { 2815,13}, { 5887,15}, \
+ { 1535,14}, { 16384,15}, { 32768,16} }
+#define SQR_FFT_TABLE3_SIZE 199
+#define SQR_FFT_THRESHOLD 4736
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 27
+#define MULLO_MUL_N_THRESHOLD 13463
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 26
+#define SQRLO_SQR_THRESHOLD 8907
+
+#define DC_DIV_QR_THRESHOLD 38
+#define DC_DIVAPPR_Q_THRESHOLD 103
+#define DC_BDIV_QR_THRESHOLD 44
+#define DC_BDIV_Q_THRESHOLD 98
+
+#define INV_MULMOD_BNM1_THRESHOLD 78
+#define INV_NEWTON_THRESHOLD 165
+#define INV_APPR_THRESHOLD 115
+
+#define BINV_NEWTON_THRESHOLD 296
+#define REDC_1_TO_REDC_2_THRESHOLD 2
+#define REDC_2_TO_REDC_N_THRESHOLD 147
+
+#define MU_DIV_QR_THRESHOLD 2089
+#define MU_DIVAPPR_Q_THRESHOLD 2089
+#define MUPI_DIV_QR_THRESHOLD 70
+#define MU_BDIV_QR_THRESHOLD 1718
+#define MU_BDIV_Q_THRESHOLD 2089
+
+#define POWM_SEC_TABLE 7,19,107,480,1486
+
+#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_PRECOMPUTE_THRESHOLD 29
+#define SET_STR_DC_THRESHOLD 126
+#define SET_STR_PRECOMPUTE_THRESHOLD 541
+
+#define FAC_DSC_THRESHOLD 132
+#define FAC_ODD_THRESHOLD 29
+
+#define MATRIX22_STRASSEN_THRESHOLD 30
+#define HGCD2_DIV1_METHOD 1 /* 6.55% faster than 3 */
+#define HGCD_THRESHOLD 54
+#define HGCD_APPR_THRESHOLD 52
+#define HGCD_REDUCE_THRESHOLD 3524
+#define GCD_DC_THRESHOLD 303
+#define GCDEXT_DC_THRESHOLD 225
+#define JACOBI_BASE_METHOD 4 /* 9.73% faster than 1 */
+
+/* Tuneup completed successfully, took 111418 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/mod_34lsub1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/mod_34lsub1.asm
new file mode 100644
index 00000000000..39e5a15fb71
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/mod_34lsub1.asm
@@ -0,0 +1,121 @@
+dnl ARM mpn_mod_34lsub1 -- remainder modulo 2^24-1.
+
+dnl Copyright 2012, 2013, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C StrongARM ?
+C XScale ?
+C Cortex-A5 2.67
+C Cortex-A7 2.37
+C Cortex-A8 2.34
+C Cortex-A9 ?
+C Cortex-A15 1.39
+C Cortex-A17 1.60
+C Cortex-A53 2.51
+
+define(`ap', r0)
+define(`n', r1)
+
+C mp_limb_t mpn_mod_34lsub1 (mp_srcptr up, mp_size_t n)
+
+C TODO
+C * Write cleverer summation code.
+C * Consider loading 6 64-bit aligned registers at a time, to approach 1 c/l.
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_mod_34lsub1)
+ push { r4, r5, r6, r7 }
+
+ subs n, n, #3
+ mov r7, #0
+ blt L(le2) C n <= 2
+
+ ldmia ap!, { r2, r3, r12 }
+ subs n, n, #3
+ blt L(sum) C n <= 5
+ mov r7, #0
+ b L(mid)
+
+L(top): adds r2, r2, r4
+ adcs r3, r3, r5
+ adcs r12, r12, r6
+ adc r7, r7, #0
+L(mid): ldmia ap!, { r4, r5, r6 }
+ subs n, n, #3
+ bpl L(top)
+
+ adds r2, r2, r4
+ adcs r3, r3, r5
+ adcs r12, r12, r6
+ adc r7, r7, #0 C r7 <= 1
+
+L(sum): cmn n, #2
+ movlo r4, #0
+ ldrhs r4, [ap], #4
+ movls r5, #0
+ ldrhi r5, [ap], #4
+
+ adds r2, r2, r4
+ adcs r3, r3, r5
+ adcs r12, r12, #0
+ adc r7, r7, #0 C r7 <= 2
+
+L(sum2):
+ bic r0, r2, #0xff000000
+ add r0, r0, r2, lsr #24
+ add r0, r0, r7
+
+ mov r7, r3, lsl #8
+ bic r2, r7, #0xff000000
+ add r0, r0, r2
+ add r0, r0, r3, lsr #16
+
+ mov r2, r12, lsl #16
+ bic r1, r2, #0xff000000
+ add r0, r0, r1
+ add r0, r0, r12, lsr #8
+
+ pop { r4, r5, r6, r7 }
+ return lr
+
+L(le2): cmn n, #1
+ bne L(1)
+ ldmia ap!, { r2, r3 }
+ mov r12, #0
+ b L(sum2)
+L(1): ldr r2, [ap]
+ bic r0, r2, #0xff000000
+ add r0, r0, r2, lsr #24
+ pop { r4, r5, r6, r7 }
+ return lr
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/mul_1.asm
new file mode 100644
index 00000000000..d9b6042c378
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/mul_1.asm
@@ -0,0 +1,34 @@
+dnl ARM mpn_mul_1
+
+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 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/.
+
+include(`../config.m4')
+
+MULFUNC_PROLOGUE(mpn_mul_1)
+include_mpn(`arm/v6/mul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/submul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/submul_1.asm
new file mode 100644
index 00000000000..f3e8139ec38
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora17/submul_1.asm
@@ -0,0 +1,34 @@
+dnl ARM mpn_submul_1
+
+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 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/.
+
+include(`../config.m4')
+
+MULFUNC_PROLOGUE(mpn_submul_1)
+include_mpn(`arm/v6/submul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora5/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora5/gmp-mparam.h
new file mode 100644
index 00000000000..e3564e04e0f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora5/gmp-mparam.h
@@ -0,0 +1,205 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* 1500 MHz Cortex-A5 (odroid c1) */
+/* FFT tuning limit = 18,235,562 */
+/* Generated by tuneup.c, 2019-10-22, gcc 4.9 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD MP_SIZE_T_MAX
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 23
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 132.79% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 52
+
+#define DIV_1_VS_MUL_1_PERCENT 213
+
+#define MUL_TOOM22_THRESHOLD 48
+#define MUL_TOOM33_THRESHOLD 143
+#define MUL_TOOM44_THRESHOLD 262
+#define MUL_TOOM6H_THRESHOLD 414
+#define MUL_TOOM8H_THRESHOLD 527
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 153
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 168
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 152
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 180
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 226
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 66
+#define SQR_TOOM3_THRESHOLD 149
+#define SQR_TOOM4_THRESHOLD 348
+#define SQR_TOOM6_THRESHOLD 517
+#define SQR_TOOM8_THRESHOLD 608
+
+#define MULMID_TOOM42_THRESHOLD 70
+
+#define MULMOD_BNM1_THRESHOLD 26
+#define SQRMOD_BNM1_THRESHOLD 28
+
+#define MUL_FFT_MODF_THRESHOLD 660 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 660, 5}, { 29, 6}, { 15, 5}, { 33, 6}, \
+ { 17, 5}, { 35, 6}, { 29, 7}, { 15, 6}, \
+ { 37, 7}, { 19, 6}, { 40, 7}, { 21, 6}, \
+ { 43, 7}, { 37, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 51, 8}, { 27, 7}, { 55, 8}, \
+ { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
+ { 55, 9}, { 31, 8}, { 71, 9}, { 39, 8}, \
+ { 83, 9}, { 47, 8}, { 99, 9}, { 55,10}, \
+ { 31, 9}, { 63, 8}, { 127, 9}, { 79,10}, \
+ { 47, 9}, { 103,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 167,10}, { 95, 9}, \
+ { 191,10}, { 111,11}, { 63,10}, { 159,11}, \
+ { 95,10}, { 191, 9}, { 383,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271,11}, \
+ { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
+ { 671,11}, { 191,10}, { 383, 9}, { 767,10}, \
+ { 399, 9}, { 799,10}, { 415,11}, { 223,12}, \
+ { 127,11}, { 255,10}, { 511, 9}, { 1023,10}, \
+ { 543,11}, { 287,10}, { 607,11}, { 319,10}, \
+ { 671,11}, { 351,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,10}, { 831,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
+ { 1087,11}, { 575,10}, { 1151,11}, { 607,12}, \
+ { 319,11}, { 703,12}, { 383,11}, { 831,12}, \
+ { 447,11}, { 895,13}, { 255,12}, { 511,11}, \
+ { 1087,12}, { 575,11}, { 1183,12}, { 639,11}, \
+ { 1279,12}, { 703,13}, { 383,12}, { 767,11}, \
+ { 1535,12}, { 895,14}, { 255,13}, { 511,12}, \
+ { 1151,13}, { 639,12}, { 1407,13}, { 767,12}, \
+ { 1599,13}, { 895,12}, { 1791,14}, { 511,13}, \
+ { 1023,12}, { 2111,13}, { 1151,12}, { 2367,13}, \
+ { 1279,12}, { 2559,13}, { 1407,14}, { 767,13}, \
+ { 1535,12}, { 3071,13}, { 1663,12}, { 3327,13}, \
+ { 1791,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4351,13}, { 8192,14}, { 16384,15}, { 32768,16} }
+#define MUL_FFT_TABLE3_SIZE 140
+#define MUL_FFT_THRESHOLD 7552
+
+#define SQR_FFT_MODF_THRESHOLD 590 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 590, 5}, { 33, 6}, { 17, 5}, { 35, 6}, \
+ { 36, 7}, { 19, 6}, { 40, 7}, { 21, 6}, \
+ { 43, 7}, { 23, 6}, { 47, 7}, { 37, 8}, \
+ { 19, 7}, { 43, 8}, { 23, 7}, { 49, 8}, \
+ { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
+ { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 83, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 103,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 167,10}, { 95, 9}, \
+ { 191,10}, { 111,11}, { 63,10}, { 159,11}, \
+ { 95,10}, { 191, 9}, { 383,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 335, 9}, { 671,10}, { 351,11}, { 191,10}, \
+ { 383, 9}, { 767,10}, { 415,12}, { 127,11}, \
+ { 255,10}, { 511, 9}, { 1023,10}, { 543, 9}, \
+ { 1087,11}, { 287,10}, { 575, 9}, { 1151,10}, \
+ { 607,11}, { 319,10}, { 671,11}, { 351,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 831,13}, { 127,12}, { 255,11}, { 511,10}, \
+ { 1023,11}, { 543,10}, { 1087,11}, { 575,10}, \
+ { 1151,11}, { 607,12}, { 319,11}, { 735,12}, \
+ { 383,11}, { 831,12}, { 447,11}, { 927,13}, \
+ { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
+ { 1151,12}, { 639,11}, { 1279,12}, { 703,13}, \
+ { 383,12}, { 767,11}, { 1535,12}, { 831,11}, \
+ { 1663,12}, { 895,11}, { 1791,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1023,11}, { 2047,12}, \
+ { 1151,13}, { 639,12}, { 1407,13}, { 767,12}, \
+ { 1599,13}, { 895,12}, { 1791,14}, { 511,13}, \
+ { 1023,12}, { 2111,13}, { 1151,12}, { 2367,13}, \
+ { 1279,12}, { 2559,13}, { 1407,14}, { 767,13}, \
+ { 1535,12}, { 3071,13}, { 1663,12}, { 3327,13}, \
+ { 1791,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4351,13}, { 8192,14}, { 16384,15}, { 32768,16} }
+#define SQR_FFT_TABLE3_SIZE 144
+#define SQR_FFT_THRESHOLD 5760
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 39
+#define MULLO_MUL_N_THRESHOLD 14709
+#define SQRLO_BASECASE_THRESHOLD 8
+#define SQRLO_DC_THRESHOLD 33
+#define SQRLO_SQR_THRESHOLD 11278
+
+#define DC_DIV_QR_THRESHOLD 36
+#define DC_DIVAPPR_Q_THRESHOLD 116
+#define DC_BDIV_QR_THRESHOLD 48
+#define DC_BDIV_Q_THRESHOLD 140
+
+#define INV_MULMOD_BNM1_THRESHOLD 95
+#define INV_NEWTON_THRESHOLD 181
+#define INV_APPR_THRESHOLD 125
+
+#define BINV_NEWTON_THRESHOLD 327
+#define REDC_1_TO_REDC_2_THRESHOLD 0 /* always */
+#define REDC_2_TO_REDC_N_THRESHOLD 152
+
+#define MU_DIV_QR_THRESHOLD 2350
+#define MU_DIVAPPR_Q_THRESHOLD 2130
+#define MUPI_DIV_QR_THRESHOLD 98
+#define MU_BDIV_QR_THRESHOLD 1970
+#define MU_BDIV_Q_THRESHOLD 2172
+
+#define POWM_SEC_TABLE 6,37,108,624,2351
+
+#define GET_STR_DC_THRESHOLD 28
+#define GET_STR_PRECOMPUTE_THRESHOLD 44
+#define SET_STR_DC_THRESHOLD 309
+#define SET_STR_PRECOMPUTE_THRESHOLD 762
+
+#define FAC_DSC_THRESHOLD 236
+#define FAC_ODD_THRESHOLD 29
+
+#define MATRIX22_STRASSEN_THRESHOLD 25
+#define HGCD2_DIV1_METHOD 5 /* 2.92% faster than 3 */
+#define HGCD_THRESHOLD 70
+#define HGCD_APPR_THRESHOLD 59
+#define HGCD_REDUCE_THRESHOLD 4120
+#define GCD_DC_THRESHOLD 229
+#define GCDEXT_DC_THRESHOLD 233
+#define JACOBI_BASE_METHOD 1 /* 17.07% faster than 4 */
+
+/* Tuneup completed successfully, took 47845 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora7/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora7/gmp-mparam.h
index dbb0ab46f6f..78de045b4aa 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora7/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora7/gmp-mparam.h
@@ -1,7 +1,6 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010, 2012, 2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -33,47 +32,49 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BYTES 4
/* 900 MHz Cortex-A7 (raspberry pi2) */
-/* FFT tuning limit = 25 M */
-/* Generated by tuneup.c, 2015-05-15, gcc 4.6 */
+/* FFT tuning limit = 21,559,921 */
+/* Generated by tuneup.c, 2019-10-22, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 7
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
#define MOD_1_2_TO_MOD_1_4_THRESHOLD MP_SIZE_T_MAX
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 18
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 16
-#define DIV_QR_1_UNNORM_THRESHOLD 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 64.16% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 47
+#define BMOD_1_TO_MOD_1_THRESHOLD 48
+
+#define DIV_1_VS_MUL_1_PERCENT 216
#define MUL_TOOM22_THRESHOLD 39
#define MUL_TOOM33_THRESHOLD 129
-#define MUL_TOOM44_THRESHOLD 195
-#define MUL_TOOM6H_THRESHOLD 414
+#define MUL_TOOM44_THRESHOLD 196
+#define MUL_TOOM6H_THRESHOLD 327
#define MUL_TOOM8H_THRESHOLD 478
#define MUL_TOOM32_TO_TOOM43_THRESHOLD 129
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 183
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 129
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 145
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 191
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 132
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 144
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 190
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 52
#define SQR_TOOM3_THRESHOLD 162
-#define SQR_TOOM4_THRESHOLD 280
+#define SQR_TOOM4_THRESHOLD 268
#define SQR_TOOM6_THRESHOLD 399
-#define SQR_TOOM8_THRESHOLD 567
+#define SQR_TOOM8_THRESHOLD 547
-#define MULMID_TOOM42_THRESHOLD 58
+#define MULMID_TOOM42_THRESHOLD 50
-#define MULMOD_BNM1_THRESHOLD 22
-#define SQRMOD_BNM1_THRESHOLD 27
+#define MULMOD_BNM1_THRESHOLD 21
+#define SQRMOD_BNM1_THRESHOLD 25
#define MUL_FFT_MODF_THRESHOLD 636 /* k = 5 */
#define MUL_FFT_TABLE3 \
@@ -91,104 +92,111 @@ see https://www.gnu.org/licenses/. */
{ 63,10}, { 159,11}, { 95,10}, { 191,12}, \
{ 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
{ 271, 9}, { 543,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335, 9}, { 671,11}, { 191,10}, \
- { 383, 9}, { 767,10}, { 399, 9}, { 799,11}, \
- { 223,12}, { 127,11}, { 255,10}, { 543,11}, \
- { 287,10}, { 607,11}, { 319,10}, { 671,11}, \
- { 351,12}, { 191,11}, { 383,10}, { 799,11}, \
- { 415,13}, { 127,12}, { 255,11}, { 543,10}, \
- { 1087,11}, { 607,12}, { 319,11}, { 735,12}, \
- { 383,11}, { 863,12}, { 447,11}, { 959,13}, \
- { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
- { 1215,12}, { 703,13}, { 383,12}, { 767,11}, \
- { 1535,12}, { 959,14}, { 255,13}, { 511,12}, \
- { 1215,13}, { 639,12}, { 1471,13}, { 767,12}, \
- { 1663,13}, { 895,12}, { 1855,14}, { 511,13}, \
- { 1023,12}, { 2111,13}, { 1151,12}, { 2431,13}, \
- { 1407,14}, { 767,13}, { 1663,12}, { 3327,13}, \
- { 1791,15}, { 511,14}, { 1023,13}, { 2431,14}, \
- { 1279,13}, { 2815,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 124
-#define MUL_FFT_THRESHOLD 5760
-
-#define SQR_FFT_MODF_THRESHOLD 555 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 555, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 29, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 36, 7}, { 19, 6}, { 39, 7}, { 29, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
- { 23, 7}, { 49, 8}, { 31, 7}, { 63, 8}, \
- { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
- { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
- { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
- { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
- { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
- { 191,10}, { 111,11}, { 63,10}, { 143, 9}, \
- { 287,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511, 8}, \
- { 1023, 9}, { 543,10}, { 287,11}, { 159,10}, \
- { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
- { 351,11}, { 191,10}, { 383, 9}, { 767,10}, \
- { 399, 9}, { 799,10}, { 415,12}, { 127,11}, \
+ { 639,10}, { 335, 9}, { 671,10}, { 351,11}, \
+ { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
+ { 799,10}, { 415,11}, { 223,12}, { 127,11}, \
{ 255,10}, { 511, 9}, { 1023,10}, { 543,11}, \
{ 287,10}, { 607,11}, { 319,10}, { 671,11}, \
{ 351,12}, { 191,11}, { 383,10}, { 799,11}, \
{ 415,10}, { 831,13}, { 127,12}, { 255,11}, \
{ 511,10}, { 1023,11}, { 543,10}, { 1087,11}, \
{ 607,12}, { 319,11}, { 735,12}, { 383,11}, \
- { 863,12}, { 447,11}, { 991,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
- { 1279,12}, { 703,13}, { 383,12}, { 959,13}, \
+ { 863,12}, { 447,11}, { 959,13}, { 255,12}, \
+ { 511,11}, { 1087,12}, { 575,11}, { 1215,12}, \
+ { 639,11}, { 1279,12}, { 703,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 959,14}, { 255,13}, \
{ 511,12}, { 1215,13}, { 639,12}, { 1471,13}, \
{ 767,12}, { 1663,13}, { 895,12}, { 1855,14}, \
{ 511,13}, { 1023,12}, { 2111,13}, { 1151,12}, \
{ 2431,13}, { 1407,14}, { 767,13}, { 1663,12}, \
{ 3327,13}, { 1791,15}, { 511,14}, { 1023,13}, \
- { 2431,14}, { 1279,13}, { 2815,14}, { 16384,15}, \
+ { 2431,14}, { 1279,13}, { 8192,14}, { 16384,15}, \
{ 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 129
+#define MUL_FFT_TABLE3_SIZE 133
+#define MUL_FFT_THRESHOLD 6784
+
+#define SQR_FFT_MODF_THRESHOLD 535 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 535, 5}, { 25, 6}, { 13, 5}, { 28, 6}, \
+ { 15, 5}, { 31, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
+ { 39, 7}, { 29, 8}, { 15, 7}, { 37, 8}, \
+ { 19, 7}, { 43, 8}, { 23, 7}, { 49, 8}, \
+ { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
+ { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 103,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
+ { 191,10}, { 111,11}, { 63,10}, { 143, 9}, \
+ { 287,10}, { 159,11}, { 95,10}, { 191,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543,10}, { 287,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
+ { 351,11}, { 191,10}, { 383, 9}, { 767,10}, \
+ { 399, 9}, { 799,10}, { 415, 9}, { 831,11}, \
+ { 223,12}, { 127,10}, { 543,11}, { 287,10}, \
+ { 607,11}, { 319,10}, { 671,11}, { 351,10}, \
+ { 703,12}, { 191,11}, { 383,10}, { 799,11}, \
+ { 415,10}, { 831,13}, { 127,11}, { 511,10}, \
+ { 1023,11}, { 543,10}, { 1087,11}, { 607,12}, \
+ { 319,11}, { 735,12}, { 383,11}, { 863,12}, \
+ { 447,11}, { 991,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1279,12}, \
+ { 703,13}, { 383,12}, { 767,11}, { 1535,12}, \
+ { 831,11}, { 1663,12}, { 959,13}, { 511,12}, \
+ { 1215,13}, { 639,12}, { 1471,13}, { 767,12}, \
+ { 1663,13}, { 895,12}, { 1855,14}, { 511,13}, \
+ { 1023,12}, { 2111,13}, { 1151,12}, { 2431,13}, \
+ { 1407,14}, { 767,13}, { 1791,15}, { 511,14}, \
+ { 1023,13}, { 2431,14}, { 1279,13}, { 8192,14}, \
+ { 16384,15}, { 32768,16} }
+#define SQR_FFT_TABLE3_SIZE 134
#define SQR_FFT_THRESHOLD 4736
#define MULLO_BASECASE_THRESHOLD 0 /* always */
#define MULLO_DC_THRESHOLD 27
-#define MULLO_MUL_N_THRESHOLD 11278
+#define MULLO_MUL_N_THRESHOLD 13463
#define SQRLO_BASECASE_THRESHOLD 5
-#define SQRLO_DC_THRESHOLD 30
-#define SQRLO_SQR_THRESHOLD 8907
+#define SQRLO_DC_THRESHOLD 31
+#define SQRLO_SQR_THRESHOLD 9449
-#define DC_DIV_QR_THRESHOLD 32
-#define DC_DIVAPPR_Q_THRESHOLD 89
-#define DC_BDIV_QR_THRESHOLD 39
-#define DC_BDIV_Q_THRESHOLD 112
+#define DC_DIV_QR_THRESHOLD 28
+#define DC_DIVAPPR_Q_THRESHOLD 90
+#define DC_BDIV_QR_THRESHOLD 32
+#define DC_BDIV_Q_THRESHOLD 110
-#define INV_MULMOD_BNM1_THRESHOLD 76
-#define INV_NEWTON_THRESHOLD 110
+#define INV_MULMOD_BNM1_THRESHOLD 78
+#define INV_NEWTON_THRESHOLD 134
#define INV_APPR_THRESHOLD 98
-#define BINV_NEWTON_THRESHOLD 214
+#define BINV_NEWTON_THRESHOLD 278
#define REDC_1_TO_REDC_2_THRESHOLD 4
-#define REDC_2_TO_REDC_N_THRESHOLD 122
+#define REDC_2_TO_REDC_N_THRESHOLD 123
#define MU_DIV_QR_THRESHOLD 1718
#define MU_DIVAPPR_Q_THRESHOLD 1685
-#define MUPI_DIV_QR_THRESHOLD 54
-#define MU_BDIV_QR_THRESHOLD 1470
-#define MU_BDIV_Q_THRESHOLD 1685
+#define MUPI_DIV_QR_THRESHOLD 62
+#define MU_BDIV_QR_THRESHOLD 1528
+#define MU_BDIV_Q_THRESHOLD 1718
-#define POWM_SEC_TABLE 1,16,102,615,2016
+#define POWM_SEC_TABLE 1,22,95,563,1955
-#define GET_STR_DC_THRESHOLD 29
-#define GET_STR_PRECOMPUTE_THRESHOLD 57
-#define SET_STR_DC_THRESHOLD 272
-#define SET_STR_PRECOMPUTE_THRESHOLD 788
+#define GET_STR_DC_THRESHOLD 28
+#define GET_STR_PRECOMPUTE_THRESHOLD 51
+#define SET_STR_DC_THRESHOLD 182
+#define SET_STR_PRECOMPUTE_THRESHOLD 638
-#define FAC_DSC_THRESHOLD 360
-#define FAC_ODD_THRESHOLD 55
+#define FAC_DSC_THRESHOLD 153
+#define FAC_ODD_THRESHOLD 56
-#define MATRIX22_STRASSEN_THRESHOLD 27
+#define MATRIX22_STRASSEN_THRESHOLD 25
+#define HGCD2_DIV1_METHOD 1 /* 5.04% faster than 3 */
#define HGCD_THRESHOLD 55
-#define HGCD_APPR_THRESHOLD 51
+#define HGCD_APPR_THRESHOLD 50
#define HGCD_REDUCE_THRESHOLD 3389
-#define GCD_DC_THRESHOLD 168
-#define GCDEXT_DC_THRESHOLD 189
-#define JACOBI_BASE_METHOD 1
+#define GCD_DC_THRESHOLD 153
+#define GCDEXT_DC_THRESHOLD 180
+#define JACOBI_BASE_METHOD 1 /* 30.60% faster than 4 */
+
+/* Tuneup completed successfully, took 75202 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora8/bdiv_q_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora8/bdiv_q_1.asm
new file mode 100644
index 00000000000..e74b260f7f4
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora8/bdiv_q_1.asm
@@ -0,0 +1,158 @@
+dnl ARM v6 mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- Hensel division by 1-limb divisor.
+dnl This is v6 code but it runs well on just the v7a Cortex-A8, A9, and A15.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 2012, 2013, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C norm unorm
+C 1176 - -
+C Cortex-A5 9 13
+C Cortex-A7 12 18
+C Cortex-A8 13 14
+C Cortex-A9 9 10 not measured since latest edits
+C Cortex-A15 7 7
+C Cortex-A53 16 24
+
+C Architecture requirements:
+C v5 -
+C v5t clz
+C v5te -
+C v6 umaal
+C v6t2 -
+C v7a -
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`n', `r2')
+define(`d', `r3')
+define(`di_arg', `sp[0]') C just mpn_pi1_bdiv_q_1
+define(`cnt_arg', `sp[4]') C just mpn_pi1_bdiv_q_1
+
+define(`cy', `r7')
+define(`cnt', `r6')
+define(`tnc', `r4')
+
+ASM_START()
+PROLOGUE(mpn_bdiv_q_1)
+ push {r6-r11}
+
+ rsb r10, d, #0
+ and r10, r10, d
+ clz r10, r10
+ rsbs cnt, r10, #31 C count_trailing_zeros
+ mov d, d, lsr cnt
+
+C binvert limb
+ LEA( r10, binvert_limb_table)
+ and r12, d, #254
+ ldrb r10, [r10, r12, lsr #1]
+ mul r12, r10, r10
+ mul r12, d, r12
+ rsb r12, r12, r10, lsl #1
+ mul r10, r12, r12
+ mul r10, d, r10
+ rsb r10, r10, r12, lsl #1 C r10 = inverse
+ b L(pi1)
+EPILOGUE()
+
+PROLOGUE(mpn_pi1_bdiv_q_1)
+ push {r6-r11}
+
+ ldr cnt, [sp, #28]
+ ldr r10, [sp, #24]
+ cmp cnt, #0
+
+L(pi1): ldr r11, [up], #4 C up[0]
+ mov cy, #0
+ rsb r8, r10, #0 C r8 = -inverse
+ bne L(unorm)
+
+L(norm):
+ subs n, n, #1
+ mul r11, r11, r10
+ beq L(edn)
+
+ ALIGN(16)
+L(tpn): ldr r9, [up], #4
+ mov r12, #0
+ str r11, [rp], #4
+ umaal r12, cy, r11, d
+ mul r11, r9, r10
+ mla r11, cy, r8, r11
+ subs n, n, #1
+ bne L(tpn)
+
+L(edn): str r11, [rp]
+ pop {r6-r11}
+ bx r14
+
+L(unorm):
+ push {r4-r5}
+ rsb tnc, cnt, #32
+ mov r5, r11, lsr cnt
+ subs n, n, #1
+ beq L(ed1)
+
+ ldr r12, [up], #4
+ orr r9, r5, r12, lsl tnc
+ mov r5, r12, lsr cnt
+ mul r11, r9, r10
+ subs n, n, #1
+ beq L(edu)
+
+ ALIGN(16)
+L(tpu): ldr r12, [up], #4
+ orr r9, r5, r12, lsl tnc
+ mov r5, r12, lsr cnt
+ mov r12, #0
+ str r11, [rp], #4
+ umaal r12, cy, r11, d
+ mul r11, r9, r10
+ mla r11, cy, r8, r11
+ subs n, n, #1
+ bne L(tpu)
+
+L(edu): str r11, [rp], #4
+ mov r12, #0
+ umaal r12, cy, r11, d
+ mul r11, r5, r10
+ mla r11, cy, r8, r11
+ str r11, [rp]
+ pop {r4-r11}
+ bx r14
+
+L(ed1): mul r11, r5, r10
+ str r11, [rp]
+ pop {r4-r11}
+ bx r14
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora8/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora8/gmp-mparam.h
index 85205fd50f0..5864841bff5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora8/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora8/gmp-mparam.h
@@ -1,7 +1,6 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010, 2012, 2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -33,175 +32,176 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BYTES 4
/* 1000 MHz Cortex-A8 (beaglebone black) */
-/* FFT tuning limit = 10 M */
-/* Generated by tuneup.c, 2015-10-05, gcc 4.6 */
+/* FFT tuning limit = 9,464,348 */
+/* Generated by tuneup.c, 2019-10-23, gcc 6.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 5
#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
#define MOD_1_1_TO_MOD_1_2_THRESHOLD MP_SIZE_T_MAX
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 12
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 50.65% faster than 2 */
#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 28
+#define BMOD_1_TO_MOD_1_THRESHOLD 31
+
+#define DIV_1_VS_MUL_1_PERCENT 192
#define MUL_TOOM22_THRESHOLD 39
#define MUL_TOOM33_THRESHOLD 129
-#define MUL_TOOM44_THRESHOLD 220
+#define MUL_TOOM44_THRESHOLD 226
#define MUL_TOOM6H_THRESHOLD 366
#define MUL_TOOM8H_THRESHOLD 620
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 129
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 179
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 139
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 149
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 141
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 183
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 154
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 160
#define MUL_TOOM43_TO_TOOM54_THRESHOLD 193
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 44
+#define SQR_TOOM2_THRESHOLD 46
#define SQR_TOOM3_THRESHOLD 145
-#define SQR_TOOM4_THRESHOLD 384
-#define SQR_TOOM6_THRESHOLD 414
+#define SQR_TOOM4_THRESHOLD 375
+#define SQR_TOOM6_THRESHOLD 0 /* always */
#define SQR_TOOM8_THRESHOLD 547
-#define MULMID_TOOM42_THRESHOLD 40
+#define MULMID_TOOM42_THRESHOLD 38
#define MULMOD_BNM1_THRESHOLD 22
-#define SQRMOD_BNM1_THRESHOLD 25
+#define SQRMOD_BNM1_THRESHOLD 23
#define MUL_FFT_MODF_THRESHOLD 476 /* k = 5 */
#define MUL_FFT_TABLE3 \
{ { 476, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
- { 23, 7}, { 49, 8}, { 27, 7}, { 55, 8}, \
- { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 71, 9}, { 39, 8}, \
- { 83, 9}, { 47, 8}, { 99, 9}, { 55,10}, \
- { 31, 9}, { 63, 8}, { 127, 9}, { 87,10}, \
+ { 28, 7}, { 15, 6}, { 33, 7}, { 19, 6}, \
+ { 39, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 43, 8}, { 23, 7}, { 51, 8}, \
+ { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
+ { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 71, 9}, { 39, 8}, { 83, 9}, { 47, 8}, \
+ { 99, 9}, { 55,10}, { 31, 9}, { 87,10}, \
{ 47, 9}, { 103,11}, { 31,10}, { 63, 9}, \
- { 143,10}, { 79, 9}, { 167,10}, { 95, 9}, \
- { 191,10}, { 111,11}, { 63,10}, { 127, 9}, \
+ { 135,10}, { 79, 9}, { 167,10}, { 95, 9}, \
+ { 199,10}, { 111,11}, { 63,10}, { 127, 9}, \
{ 255,10}, { 143, 9}, { 287, 8}, { 575,10}, \
{ 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
{ 383, 8}, { 767, 9}, { 399,10}, { 207,12}, \
{ 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
{ 271, 9}, { 543,10}, { 287, 9}, { 575,11}, \
{ 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
- { 671,10}, { 351, 9}, { 703,11}, { 191,10}, \
- { 383, 9}, { 767,10}, { 399, 9}, { 799,10}, \
- { 415, 9}, { 831,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 511, 9}, { 1023,10}, { 543,11}, \
+ { 671,10}, { 351, 9}, { 703,10}, { 367,11}, \
+ { 191,10}, { 399, 9}, { 799,10}, { 415,11}, \
+ { 223,12}, { 127,11}, { 255,10}, { 543,11}, \
{ 287,10}, { 607, 9}, { 1215,11}, { 319,10}, \
{ 671,11}, { 351,10}, { 703,12}, { 191,11}, \
{ 383,10}, { 799,11}, { 415,10}, { 863,11}, \
- { 447,13}, { 127,12}, { 255,11}, { 511,10}, \
- { 1023,11}, { 543,10}, { 1087,11}, { 607,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 735,12}, \
- { 383,11}, { 799,10}, { 1599,11}, { 863,12}, \
- { 447,11}, { 959,13}, { 255,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
- { 1343,12}, { 703,11}, { 1407,13}, { 383,12}, \
- { 767,11}, { 1599,12}, { 831,11}, { 1663,12}, \
- { 959,14}, { 255,13}, { 511,12}, { 1215,13}, \
- { 639,12}, { 1471,13}, { 767,12}, { 1663,13}, \
- { 895,12}, { 1791,14}, { 511,13}, { 1023,12}, \
- { 2111,13}, { 1151,12}, { 2431,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 150
-#define MUL_FFT_THRESHOLD 7552
-
-#define SQR_FFT_MODF_THRESHOLD 428 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 428, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 25, 7}, { 13, 6}, { 28, 7}, { 15, 6}, \
- { 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
- { 27, 9}, { 15, 8}, { 39, 9}, { 23, 8}, \
- { 55,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 83, 9}, { 47, 8}, { 95, 9}, \
- { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
- { 103,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 159, 8}, { 319, 9}, { 167,10}, \
- { 95, 9}, { 191,10}, { 111,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511, 9}, { 271,10}, \
- { 143, 9}, { 287, 8}, { 575, 9}, { 303,10}, \
- { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
- { 383, 8}, { 767, 9}, { 399,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543,10}, { 287, 9}, { 575,10}, { 303,11}, \
- { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
- { 671,10}, { 351, 9}, { 703,10}, { 367,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
- { 799,10}, { 415, 9}, { 831,11}, { 223,10}, \
- { 447,12}, { 127,11}, { 255,10}, { 511, 9}, \
- { 1023,10}, { 543,11}, { 287,10}, { 607,11}, \
- { 319,10}, { 671,11}, { 351,10}, { 735,12}, \
- { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
- { 863,11}, { 447,10}, { 895,13}, { 127,12}, \
- { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
+ { 447,13}, { 127,12}, { 255,11}, { 543,10}, \
{ 1087,11}, { 607,12}, { 319,11}, { 671,10}, \
{ 1343,11}, { 735,12}, { 383,11}, { 799,10}, \
{ 1599,11}, { 863,12}, { 447,11}, { 959,13}, \
{ 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
+ { 1215,12}, { 639,11}, { 1343,12}, { 703,13}, \
+ { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
+ { 1663,12}, { 959,14}, { 255,13}, { 511,12}, \
+ { 1215,13}, { 639,12}, { 1407,13}, { 767,12}, \
+ { 1663,13}, { 895,12}, { 1791,14}, { 511,13}, \
+ { 1023,12}, { 2111,13}, { 1151,12}, { 4096,13}, \
+ { 8192,14}, { 16384,15}, { 32768,16} }
+#define MUL_FFT_TABLE3_SIZE 139
+#define MUL_FFT_THRESHOLD 6784
+
+#define SQR_FFT_MODF_THRESHOLD 436 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 436, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 28, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
+ { 35, 7}, { 19, 6}, { 39, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
+ { 43, 9}, { 23, 8}, { 55,10}, { 15, 9}, \
+ { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
+ { 47, 8}, { 95, 9}, { 55,10}, { 31, 9}, \
+ { 79,10}, { 47, 9}, { 103,11}, { 31,10}, \
+ { 63, 9}, { 135,10}, { 79, 9}, { 159, 8}, \
+ { 319, 9}, { 167,10}, { 95, 9}, { 191,10}, \
+ { 111,11}, { 63,10}, { 127, 9}, { 255, 8}, \
+ { 511, 9}, { 271,10}, { 143, 9}, { 287, 8}, \
+ { 575, 9}, { 303,10}, { 159, 9}, { 319,11}, \
+ { 95,10}, { 191, 9}, { 383, 8}, { 767, 9}, \
+ { 399,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 271, 9}, { 543,10}, { 287, 9}, \
+ { 575,10}, { 303,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 335, 9}, { 671,10}, { 351, 9}, \
+ { 703,10}, { 367,11}, { 191,10}, { 383, 9}, \
+ { 767,10}, { 399, 9}, { 799,10}, { 415, 9}, \
+ { 831,11}, { 223,10}, { 447,12}, { 127,11}, \
+ { 255,10}, { 511, 9}, { 1023,10}, { 543,11}, \
+ { 287,10}, { 607,11}, { 319,10}, { 671,11}, \
+ { 351,10}, { 735,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,10}, { 863,11}, { 447,10}, \
+ { 895,13}, { 127,12}, { 255,11}, { 511,10}, \
+ { 1023,11}, { 543,10}, { 1087,11}, { 607,12}, \
+ { 319,11}, { 671,10}, { 1343,11}, { 735,12}, \
+ { 383,11}, { 863,12}, { 447,11}, { 959,13}, \
+ { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
{ 1215,12}, { 639,11}, { 1343,12}, { 703,11}, \
{ 1407,13}, { 383,12}, { 767,11}, { 1599,12}, \
{ 831,11}, { 1663,12}, { 959,14}, { 255,13}, \
{ 511,12}, { 1215,13}, { 639,12}, { 1471,13}, \
- { 767,12}, { 1663,13}, { 895,12}, { 1919,14}, \
+ { 767,12}, { 1663,13}, { 895,12}, { 1855,14}, \
{ 511,13}, { 1023,12}, { 2111,13}, { 1151,12}, \
- { 2431,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 156
+ { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
+#define SQR_FFT_TABLE3_SIZE 152
#define SQR_FFT_THRESHOLD 3712
-#define MULLO_BASECASE_THRESHOLD 19
+#define MULLO_BASECASE_THRESHOLD 21
#define MULLO_DC_THRESHOLD 0 /* never mpn_mullo_basecase */
-#define MULLO_MUL_N_THRESHOLD 22
-#define SQRLO_BASECASE_THRESHOLD 13
-#define SQRLO_DC_THRESHOLD 14
+#define MULLO_MUL_N_THRESHOLD 13463
+#define SQRLO_BASECASE_THRESHOLD 9
+#define SQRLO_DC_THRESHOLD 17
#define SQRLO_SQR_THRESHOLD 7246
-#define DC_DIV_QR_THRESHOLD 23
-#define DC_DIVAPPR_Q_THRESHOLD 64
-#define DC_BDIV_QR_THRESHOLD 25
-#define DC_BDIV_Q_THRESHOLD 56
+#define DC_DIV_QR_THRESHOLD 27
+#define DC_DIVAPPR_Q_THRESHOLD 74
+#define DC_BDIV_QR_THRESHOLD 21
+#define DC_BDIV_Q_THRESHOLD 64
-#define INV_MULMOD_BNM1_THRESHOLD 77
+#define INV_MULMOD_BNM1_THRESHOLD 78
#define INV_NEWTON_THRESHOLD 31
#define INV_APPR_THRESHOLD 37
-#define BINV_NEWTON_THRESHOLD 166
-#define REDC_1_TO_REDC_2_THRESHOLD 0 /* always */
+#define BINV_NEWTON_THRESHOLD 167
+#define REDC_1_TO_REDC_2_THRESHOLD 4
#define REDC_2_TO_REDC_N_THRESHOLD 198
-#define MU_DIV_QR_THRESHOLD 1787
-#define MU_DIVAPPR_Q_THRESHOLD 1558
-#define MUPI_DIV_QR_THRESHOLD 45
-#define MU_BDIV_QR_THRESHOLD 1718
+#define MU_DIV_QR_THRESHOLD 1858
+#define MU_DIVAPPR_Q_THRESHOLD 1685
+#define MUPI_DIV_QR_THRESHOLD 43
+#define MU_BDIV_QR_THRESHOLD 1589
#define MU_BDIV_Q_THRESHOLD 1685
-#define POWM_SEC_TABLE 1,19,101,371,1486
+#define POWM_SEC_TABLE 1,13,96,487,1378
-#define GET_STR_DC_THRESHOLD 21
-#define GET_STR_PRECOMPUTE_THRESHOLD 38
-#define SET_STR_DC_THRESHOLD 146
-#define SET_STR_PRECOMPUTE_THRESHOLD 531
+#define GET_STR_DC_THRESHOLD 18
+#define GET_STR_PRECOMPUTE_THRESHOLD 36
+#define SET_STR_DC_THRESHOLD 145
+#define SET_STR_PRECOMPUTE_THRESHOLD 505
-#define FAC_DSC_THRESHOLD 155
-#define FAC_ODD_THRESHOLD 24
+#define FAC_DSC_THRESHOLD 137
+#define FAC_ODD_THRESHOLD 29
#define MATRIX22_STRASSEN_THRESHOLD 24
-#define HGCD_THRESHOLD 42
+#define HGCD2_DIV1_METHOD 5 /* 4.29% faster than 4 */
+#define HGCD_THRESHOLD 39
#define HGCD_APPR_THRESHOLD 50
-#define HGCD_REDUCE_THRESHOLD 3664
-#define GCD_DC_THRESHOLD 156
-#define GCDEXT_DC_THRESHOLD 116
-#define JACOBI_BASE_METHOD 4
+#define HGCD_REDUCE_THRESHOLD 3524
+#define GCD_DC_THRESHOLD 116
+#define GCDEXT_DC_THRESHOLD 124
+#define JACOBI_BASE_METHOD 4 /* 5.89% faster than 1 */
+
+/* Tuneup completed successfully, took 48230 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora9/bdiv_q_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora9/bdiv_q_1.asm
new file mode 100644
index 00000000000..245b3715177
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora9/bdiv_q_1.asm
@@ -0,0 +1,36 @@
+dnl ARM mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- Hensel division by 1-limb divisor.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 2012, 2013, 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 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/.
+
+include(`../config.m4')
+
+MULFUNC_PROLOGUE(mpn_bdiv_q_1 mpn_pi1_bdiv_q_1)
+include_mpn(`arm/v7a/cora8/bdiv_q_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora9/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora9/gmp-mparam.h
index b1ad6b4e8ee..5c540122625 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora9/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm/v7a/cora9/gmp-mparam.h
@@ -51,6 +51,8 @@ see https://www.gnu.org/licenses/. */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD 20
+#define DIV_1_VS_MUL_1_PERCENT 190
+
#define MUL_TOOM22_THRESHOLD 45
#define MUL_TOOM33_THRESHOLD 129
#define MUL_TOOM44_THRESHOLD 387
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/aors_n.asm
index a880cd35cfd..b1f3bb943eb 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/aors_n.asm
@@ -2,7 +2,7 @@ dnl ARM64 mpn_add_n and mpn_sub_n
dnl Contributed to the GNU project by Torbjörn Granlund.
-dnl Copyright 2013 Free Software Foundation, Inc.
+dnl Copyright 2013, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -33,10 +33,11 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 2.75-3.25
+C Cortex-A57 1.5
+C X-Gene 2.0
-changecom(@&*$)
+changecom(blah)
define(`rp', `x0')
define(`up', `x1')
@@ -47,16 +48,15 @@ ifdef(`OPERATION_add_n', `
define(`ADDSUBC', adcs)
define(`CLRCY', `cmn xzr, xzr')
define(`SETCY', `cmp $1, #1')
- define(`RETVAL', `adc x0, xzr, xzr')
- define(`func', mpn_add_n)
+ define(`RETVAL', `cset x0, cs')
+ define(`func_n', mpn_add_n)
define(`func_nc', mpn_add_nc)')
ifdef(`OPERATION_sub_n', `
define(`ADDSUBC', sbcs)
define(`CLRCY', `cmp xzr, xzr')
- define(`SETCY', `subs $1, xzr, $1')
- define(`RETVAL', `sbc x0, xzr, xzr
- and x0, x0, #1')
- define(`func', mpn_sub_n)
+ define(`SETCY', `cmp xzr, $1')
+ define(`RETVAL', `cset x0, cc')
+ define(`func_n', mpn_sub_n)
define(`func_nc', mpn_sub_nc)')
MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
@@ -66,33 +66,60 @@ PROLOGUE(func_nc)
SETCY( x4)
b L(ent)
EPILOGUE()
-PROLOGUE(func)
+PROLOGUE(func_n)
CLRCY
-L(ent): tbz n, #0, L(b0)
-
- ldr x4, [up],#8
- ldr x6, [vp],#8
- sub n, n, #1
- ADDSUBC x8, x4, x6
- str x8, [rp],#8
- cbz n, L(rt)
-
-L(b0): ldp x4, x5, [up],#16
- ldp x6, x7, [vp],#16
- sub n, n, #2
- ADDSUBC x8, x4, x6
- ADDSUBC x9, x5, x7
- cbz n, L(end)
-
-L(top): ldp x4, x5, [up],#16
- ldp x6, x7, [vp],#16
- sub n, n, #2
- stp x8, x9, [rp],#16
- ADDSUBC x8, x4, x6
- ADDSUBC x9, x5, x7
- cbnz n, L(top)
-
-L(end): stp x8, x9, [rp]
-L(rt): RETVAL
+L(ent): lsr x18, n, #2
+ tbz n, #0, L(bx0)
+
+L(bx1): ldr x7, [up]
+ ldr x11, [vp]
+ ADDSUBC x13, x7, x11
+ str x13, [rp],#8
+ tbnz n, #1, L(b11)
+
+L(b01): cbz x18, L(ret)
+ ldp x4, x5, [up,#8]
+ ldp x8, x9, [vp,#8]
+ sub up, up, #8
+ sub vp, vp, #8
+ b L(mid)
+
+L(b11): ldp x6, x7, [up,#8]
+ ldp x10, x11, [vp,#8]
+ add up, up, #8
+ add vp, vp, #8
+ cbz x18, L(end)
+ b L(top)
+
+L(bx0): tbnz n, #1, L(b10)
+
+L(b00): ldp x4, x5, [up]
+ ldp x8, x9, [vp]
+ sub up, up, #16
+ sub vp, vp, #16
+ b L(mid)
+
+L(b10): ldp x6, x7, [up]
+ ldp x10, x11, [vp]
+ cbz x18, L(end)
+
+ ALIGN(16)
+L(top): ldp x4, x5, [up,#16]
+ ldp x8, x9, [vp,#16]
+ ADDSUBC x12, x6, x10
+ ADDSUBC x13, x7, x11
+ stp x12, x13, [rp],#16
+L(mid): ldp x6, x7, [up,#32]!
+ ldp x10, x11, [vp,#32]!
+ ADDSUBC x12, x4, x8
+ ADDSUBC x13, x5, x9
+ stp x12, x13, [rp],#16
+ sub x18, x18, #1
+ cbnz x18, L(top)
+
+L(end): ADDSUBC x12, x6, x10
+ ADDSUBC x13, x7, x11
+ stp x12, x13, [rp]
+L(ret): RETVAL
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsmul_1.asm
index e033bda2bf1..fd3c36e6afa 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsmul_1.asm
@@ -1,8 +1,8 @@
-dnl ARM64 mpn_submul_1
+dnl ARM64 mpn_addmul_1 and mpn_submul_1
dnl Contributed to the GNU project by Torbjörn Granlund.
-dnl Copyright 2013 Free Software Foundation, Inc.
+dnl Copyright 2013, 2015, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -33,10 +33,18 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 9.3-9.8
+C Cortex-A57 7.0
+C X-Gene 5.0
-changecom(@&*$)
+C NOTES
+C * It is possible to keep the carry chain alive between the addition blocks
+C and thus avoid csinc, but only for addmul_1. Since that saves no time
+C on the tested pipelines, we keep addmul_1 and submul_1 similar.
+C * We could separate feed-in into 4 blocks, one for each residue (mod 4).
+C That is likely to save a few cycles.
+
+changecom(blah)
define(`rp', `x0')
define(`up', `x1')
@@ -57,15 +65,14 @@ ifdef(`OPERATION_submul_1', `
MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
PROLOGUE(func)
- mov x15, #0
+ adds x15, xzr, xzr
tbz n, #0, L(1)
ldr x4, [up],#8
mul x8, x4, v0
umulh x12, x4, v0
- adds x8, x8, x15
- ldr x4, [rp,#0]
+ ldr x4, [rp]
ADDSUB x8, x4, x8
csinc x15, x12, x12, COND
str x8, [rp],#8
@@ -79,19 +86,32 @@ L(1): tbz n, #1, L(2)
umulh x13, x5, v0
adds x8, x8, x15
adcs x9, x9, x12
- ldp x4, x5, [rp,#0]
+ ldp x4, x5, [rp]
adc x15, x13, xzr
- sub n, n, #1
ADDSUB x8, x4, x8
ADDSUBC x9, x5, x9
csinc x15, x15, x15, COND
stp x8, x9, [rp],#16
L(2): lsr n, n, #2
- cbz n, L(end)
+ cbz n, L(le3)
+ ldp x4, x5, [up],#32
+ ldp x6, x7, [up,#-16]
+ b L(mid)
+L(le3): mov x0, x15
+ ret
-L(top): ldp x4, x5, [up],#16
- ldp x6, x7, [up],#16
+ ALIGN(16)
+L(top): ldp x4, x5, [up],#32
+ ldp x6, x7, [up,#-16]
+ ADDSUB x8, x16, x8
+ ADDSUBC x9, x17, x9
+ stp x8, x9, [rp],#32
+ ADDSUBC x10, x12, x10
+ ADDSUBC x11, x13, x11
+ stp x10, x11, [rp,#-16]
+ csinc x15, x15, x15, COND
+L(mid): sub n, n, #1
mul x8, x4, v0
umulh x12, x4, v0
mul x9, x5, v0
@@ -103,20 +123,18 @@ L(top): ldp x4, x5, [up],#16
mul x11, x7, v0
umulh x15, x7, v0
adcs x10, x10, x13
- ldp x4, x5, [rp,#0]
+ ldp x16, x17, [rp]
adcs x11, x11, x14
- ldp x6, x7, [rp,#16]
+ ldp x12, x13, [rp,#16]
adc x15, x15, xzr
- sub n, n, #1
- ADDSUB x8, x4, x8
- ADDSUBC x9, x5, x9
- ADDSUBC x10, x6, x10
- ADDSUBC x11, x7, x11
- stp x8, x9, [rp],#16
- csinc x15, x15, x15, COND
- stp x10, x11, [rp],#16
cbnz n, L(top)
-L(end): mov x0, x15
+ ADDSUB x8, x16, x8
+ ADDSUBC x9, x17, x9
+ ADDSUBC x10, x12, x10
+ ADDSUBC x11, x13, x11
+ stp x8, x9, [rp]
+ stp x10, x11, [rp,#16]
+ csinc x0, x15, x15, COND
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlsh1_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlsh1_n.asm
new file mode 100644
index 00000000000..c617a67a956
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlsh1_n.asm
@@ -0,0 +1,43 @@
+dnl ARM64 mpn_addlsh1_n, mpn_sublsh1_n, mpn_rsblsh1_n.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+
+define(LSH, 1)
+define(RSH, 63)
+
+ifdef(`OPERATION_addlsh1_n',`define(`DO_add')')
+ifdef(`OPERATION_sublsh1_n',`define(`DO_sub')')
+ifdef(`OPERATION_rsblsh1_n',`define(`DO_rsb')')
+
+MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n mpn_rsblsh1_n)
+
+include_mpn(`arm64/aorsorrlshC_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlsh2_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlsh2_n.asm
new file mode 100644
index 00000000000..852d117206e
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlsh2_n.asm
@@ -0,0 +1,43 @@
+dnl ARM64 mpn_addlsh2_n, mpn_sublsh2_n, mpn_rsblsh2_n.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+
+define(LSH, 2)
+define(RSH, 62)
+
+ifdef(`OPERATION_addlsh2_n',`define(`DO_add')')
+ifdef(`OPERATION_sublsh2_n',`define(`DO_sub')')
+ifdef(`OPERATION_rsblsh2_n',`define(`DO_rsb')')
+
+MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_sublsh2_n mpn_rsblsh2_n)
+
+include_mpn(`arm64/aorsorrlshC_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlshC_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlshC_n.asm
new file mode 100644
index 00000000000..168caad6823
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/aorsorrlshC_n.asm
@@ -0,0 +1,139 @@
+dnl ARM64 mpn_addlshC_n, mpn_sublshC_n, mpn_rsblshC_n.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C Cortex-A53 3.25-3.75
+C Cortex-A57 2.18
+C X-Gene 2.5
+
+changecom(blah)
+
+define(`rp', `x0')
+define(`up', `x1')
+define(`vp', `x2')
+define(`n', `x3')
+
+ifdef(`DO_add', `
+ define(`ADDSUB', `adds $1, $2, $3')
+ define(`ADDSUBC', `adcs $1, $2, $3')
+ define(`CLRRCY', `adds $1, xzr, xzr')
+ define(`RETVAL', `adc x0, $1, xzr')
+ define(`func_n', mpn_addlsh`'LSH`'_n)')
+ifdef(`DO_sub', `
+ define(`ADDSUB', `subs $1, $3, $2')
+ define(`ADDSUBC', `sbcs $1, $3, $2')
+ define(`CLRRCY', `subs $1, xzr, xzr')
+ define(`RETVAL', `cinc x0, $1, cc')
+ define(`func_n', mpn_sublsh`'LSH`'_n)')
+ifdef(`DO_rsb', `
+ define(`ADDSUB', `subs $1, $2, $3')
+ define(`ADDSUBC', `sbcs $1, $2, $3')
+ define(`CLRRCY', `subs $1, xzr, xzr')
+ define(`RETVAL', `sbc x0, $1, xzr')
+ define(`func_n', mpn_rsblsh`'LSH`'_n)')
+
+ASM_START()
+PROLOGUE(func_n)
+ lsr x18, n, #2
+ tbz n, #0, L(bx0)
+
+L(bx1): ldr x5, [up]
+ tbnz n, #1, L(b11)
+
+L(b01): ldr x11, [vp]
+ cbz x18, L(1)
+ ldp x8, x9, [vp,#8]
+ lsl x13, x11, #LSH
+ ADDSUB( x15, x13, x5)
+ str x15, [rp],#8
+ sub up, up, #24
+ sub vp, vp, #8
+ b L(mid)
+
+L(1): lsl x13, x11, #LSH
+ ADDSUB( x15, x13, x5)
+ str x15, [rp]
+ lsr x0, x11, RSH
+ RETVAL( x0, x1)
+ ret
+
+L(b11): ldr x9, [vp]
+ ldp x10, x11, [vp,#8]!
+ lsl x13, x9, #LSH
+ ADDSUB( x17, x13, x5)
+ str x17, [rp],#8
+ sub up, up, #8
+ cbz x18, L(end)
+ b L(top)
+
+L(bx0): tbnz n, #1, L(b10)
+
+L(b00): CLRRCY( x11)
+ ldp x8, x9, [vp],#-16
+ sub up, up, #32
+ b L(mid)
+
+L(b10): CLRRCY( x9)
+ ldp x10, x11, [vp]
+ sub up, up, #16
+ cbz x18, L(end)
+
+ ALIGN(16)
+L(top): ldp x4, x5, [up,#16]
+ extr x12, x10, x9, #RSH
+ ldp x8, x9, [vp,#16]
+ extr x13, x11, x10, #RSH
+ ADDSUBC(x14, x12, x4)
+ ADDSUBC(x15, x13, x5)
+ stp x14, x15, [rp],#16
+L(mid): ldp x4, x5, [up,#32]!
+ extr x12, x8, x11, #RSH
+ ldp x10, x11, [vp,#32]!
+ extr x13, x9, x8, #RSH
+ ADDSUBC(x16, x12, x4)
+ ADDSUBC(x17, x13, x5)
+ stp x16, x17, [rp],#16
+ sub x18, x18, #1
+ cbnz x18, L(top)
+
+L(end): ldp x4, x5, [up,#16]
+ extr x12, x10, x9, #RSH
+ extr x13, x11, x10, #RSH
+ ADDSUBC(x14, x12, x4)
+ ADDSUBC(x15, x13, x5)
+ stp x14, x15, [rp]
+ lsr x0, x11, RSH
+ RETVAL( x0, x1)
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_dbm1c.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_dbm1c.asm
index 3ccb2b60e53..78984b42660 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_dbm1c.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_dbm1c.asm
@@ -31,8 +31,9 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 8
+C Cortex-A57 7
+C X-Gene 4.25
define(`qp', `x0')
define(`up', `x1')
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
new file mode 100644
index 00000000000..2e189b884b2
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/bdiv_q_1.asm
@@ -0,0 +1,128 @@
+dnl ARM64 mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- Hensel division by 1-limb divisor.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 2012, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C norm unorm
+C Cortex-A53 12 15
+C Cortex-A57 12 12
+C Cortex-A72
+C Cortex-A73
+C X-Gene 11 11
+
+C TODO
+C * Scheduling of umulh later in the unorm loop brings A53 time to 12 c/l.
+C Unfortunately, that requires software pipelining.
+
+define(`rp', `x0')
+define(`up', `x1')
+define(`n', `x2')
+define(`d', `x3')
+define(`di', `x4') C just mpn_pi1_bdiv_q_1
+define(`cnt', `x5') C just mpn_pi1_bdiv_q_1
+
+define(`cy', `r7')
+define(`tnc', `x8')
+
+ASM_START()
+PROLOGUE(mpn_bdiv_q_1)
+
+ rbit x6, d
+ clz cnt, x6
+ lsr d, d, cnt
+
+ifdef(`PIC',`
+ adrp x7, :got:__gmp_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
+')
+ ldrb w6, [x7, x6]
+ ubfiz x7, x6, 1, 8
+ umull x6, w6, w6
+ msub x6, x6, d, x7
+ lsl x7, x6, 1
+ mul x6, x6, x6
+ msub x6, x6, d, x7
+ lsl x7, x6, 1
+ mul x6, x6, x6
+ msub di, x6, d, x7
+
+ b mpn_pi1_bdiv_q_1
+EPILOGUE()
+
+PROLOGUE(mpn_pi1_bdiv_q_1)
+ sub n, n, #1
+ subs x6, x6, x6 C clear r6 and C flag
+ ldr x9, [up],#8
+ cbz cnt, L(norm)
+
+L(unorm):
+ lsr x12, x9, cnt
+ cbz n, L(eu1)
+ sub tnc, xzr, cnt
+
+L(tpu): ldr x9, [up],#8
+ lsl x7, x9, tnc
+ orr x7, x7, x12
+ sbcs x6, x7, x6
+ mul x7, x6, di
+ str x7, [rp],#8
+ lsr x12, x9, cnt
+ umulh x6, x7, d
+ sub n, n, #1
+ cbnz n, L(tpu)
+
+L(eu1): sbcs x6, x12, x6
+ mul x6, x6, di
+ str x6, [rp]
+ ret
+
+L(norm):
+ mul x5, x9, di
+ str x5, [rp],#8
+ cbz n, L(en1)
+
+L(tpn): ldr x9, [up],#8
+ umulh x5, x5, d
+ sbcs x5, x9, x5
+ mul x5, x5, di
+ str x5, [rp],#8
+ sub n, n, #1
+ cbnz n, L(tpn)
+
+L(en1): ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/cnd_aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/cnd_aors_n.asm
index e7836500d5e..39e6cd3783a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/cnd_aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/cnd_aors_n.asm
@@ -2,7 +2,7 @@ dnl ARM64 mpn_cnd_add_n, mpn_cnd_sub_n
dnl Contributed to the GNU project by Torbjörn Granlund.
-dnl Copyright 2012, 2013 Free Software Foundation, Inc.
+dnl Copyright 2012, 2013, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -33,10 +33,11 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 3.87-4.37
+C Cortex-A57 1.75
+C X-Gene 2.0
-changecom(@&*$)
+changecom(blah)
define(`cnd', `x0')
define(`rp', `x1')
@@ -45,16 +46,15 @@ define(`vp', `x3')
define(`n', `x4')
ifdef(`OPERATION_cnd_add_n', `
- define(`ADDSUBC', adcs)
+ define(`ADDSUBC', adcs)
define(`CLRCY', `cmn xzr, xzr')
- define(`RETVAL', `adc x0, xzr, xzr')
- define(func, mpn_cnd_add_n)')
+ define(`RETVAL', `cset x0, cs')
+ define(`func', mpn_cnd_add_n)')
ifdef(`OPERATION_cnd_sub_n', `
- define(`ADDSUBC', sbcs)
+ define(`ADDSUBC', sbcs)
define(`CLRCY', `cmp xzr, xzr')
- define(`RETVAL', `sbc x0, xzr, xzr
- and x0, x0, #1')
- define(func, mpn_cnd_sub_n)')
+ define(`RETVAL', `cset x0, cc')
+ define(`func', mpn_cnd_sub_n)')
MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n)
@@ -63,37 +63,67 @@ PROLOGUE(func)
cmp cnd, #1
sbc cnd, cnd, cnd
- CLRCY C really only needed for n = 0 (mod 4)
+ CLRCY
- tbz n, #0, L(1)
- ldr x10, [up], #8
- ldr x12, [vp], #8
- bic x6, x12, cnd
- ADDSUBC x8, x10, x6
- sub n, n, #1
- str x8, [rp], #8
- cbz n, L(rt)
+ lsr x18, n, #2
+ tbz n, #0, L(bx0)
+
+L(bx1): ldr x13, [vp]
+ ldr x11, [up]
+ bic x7, x13, cnd
+ ADDSUBC x9, x11, x7
+ str x9, [rp]
+ tbnz n, #1, L(b11)
+
+L(b01): cbz x18, L(rt)
+ ldp x12, x13, [vp,#8]
+ ldp x10, x11, [up,#8]
+ sub up, up, #8
+ sub vp, vp, #8
+ sub rp, rp, #24
+ b L(mid)
+
+L(b11): ldp x12, x13, [vp,#8]!
+ ldp x10, x11, [up,#8]!
+ sub rp, rp, #8
+ cbz x18, L(end)
+ b L(top)
-L(1): ldp x10, x11, [up], #16
- ldp x12, x13, [vp], #16
- sub n, n, #2
- cbz n, L(end)
+L(bx0): ldp x12, x13, [vp]
+ ldp x10, x11, [up]
+ tbnz n, #1, L(b10)
+L(b00): sub up, up, #16
+ sub vp, vp, #16
+ sub rp, rp, #32
+ b L(mid)
+
+L(b10): sub rp, rp, #16
+ cbz x18, L(end)
+
+ ALIGN(16)
L(top): bic x6, x12, cnd
bic x7, x13, cnd
- ldp x12, x13, [vp], #16
+ ldp x12, x13, [vp,#16]
+ ADDSUBC x8, x10, x6
+ ADDSUBC x9, x11, x7
+ ldp x10, x11, [up,#16]
+ stp x8, x9, [rp,#16]
+L(mid): bic x6, x12, cnd
+ bic x7, x13, cnd
+ ldp x12, x13, [vp,#32]!
ADDSUBC x8, x10, x6
ADDSUBC x9, x11, x7
- ldp x10, x11, [up], #16
- sub n, n, #2
- stp x8, x9, [rp], #16
- cbnz n, L(top)
+ ldp x10, x11, [up,#32]!
+ stp x8, x9, [rp,#32]!
+ sub x18, x18, #1
+ cbnz x18, L(top)
L(end): bic x6, x12, cnd
bic x7, x13, cnd
ADDSUBC x8, x10, x6
ADDSUBC x9, x11, x7
- stp x8, x9, [rp]
+ stp x8, x9, [rp,#16]
L(rt): RETVAL
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/com.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/com.asm
index 9b8b3a7d08d..63ad2492552 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/com.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/com.asm
@@ -31,10 +31,11 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 2.25
+C Cortex-A57 1.25
+C X-Gene 1.75
-changecom(@&*$)
+changecom(blah)
define(`rp', `x0')
define(`up', `x1')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/copyd.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/copyd.asm
index bb477716e5b..c8001a34f18 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/copyd.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/copyd.asm
@@ -34,7 +34,7 @@ C cycles/limb
C Cortex-A53 ?
C Cortex-A57 ?
-changecom(@&*$)
+changecom(blah)
define(`rp', `x0')
define(`up', `x1')
@@ -58,9 +58,9 @@ C Copy until rp is 128-bit aligned
L(al2): sub up, up, #16
ld1 {v26.2d}, [up]
- subs n, n, #6
+ sub n, n, #6
sub rp, rp, #16 C offset rp for loop
- b.lt L(end)
+ tbnz n, #63, L(end)
sub up, up, #16 C offset up for loop
mov x12, #-16
@@ -70,8 +70,8 @@ L(top): ld1 {v22.2d}, [up], x12
st1 {v26.2d}, [rp], x12
ld1 {v26.2d}, [up], x12
st1 {v22.2d}, [rp], x12
- subs n, n, #4
- b.ge L(top)
+ sub n, n, #4
+ tbz n, #63, L(top)
add up, up, #16 C undo up offset
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/copyi.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/copyi.asm
index 8f7dbd4f520..cfb90c73b7a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/copyi.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/copyi.asm
@@ -31,10 +31,11 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 2
+C Cortex-A57 1
+C X-Gene 1.25
-changecom(@&*$)
+changecom(blah)
define(`rp', `x0')
define(`up', `x1')
@@ -52,16 +53,16 @@ C Copy until rp is 128-bit aligned
st1 {v22.1d}, [rp], #8
L(al2): ld1 {v26.2d}, [up], #16
- subs n, n, #6
- b.lt L(end)
+ sub n, n, #6
+ tbnz n, #63, L(end)
ALIGN(16)
L(top): ld1 {v22.2d}, [up], #16
st1 {v26.2d}, [rp], #16
ld1 {v26.2d}, [up], #16
st1 {v22.2d}, [rp], #16
- subs n, n, #4
- b.ge L(top)
+ sub n, n, #4
+ tbz n, #63, L(top)
L(end): st1 {v26.2d}, [rp], #16
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/cora53/cnd_aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora53/cnd_aors_n.asm
new file mode 100644
index 00000000000..1b227daf66d
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora53/cnd_aors_n.asm
@@ -0,0 +1,99 @@
+dnl ARM64 mpn_cnd_add_n, mpn_cnd_sub_n
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 2012, 2013, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C Cortex-A53 3.5-4
+C Cortex-A57 2.25
+C X-Gene 3.5
+
+changecom(blah)
+
+define(`cnd', `x0')
+define(`rp', `x1')
+define(`up', `x2')
+define(`vp', `x3')
+define(`n', `x4')
+
+ifdef(`OPERATION_cnd_add_n', `
+ define(`ADDSUBC', adcs)
+ define(`CLRCY', `cmn xzr, xzr')
+ define(`RETVAL', `cset x0, cs')
+ define(`func', mpn_cnd_add_n)')
+ifdef(`OPERATION_cnd_sub_n', `
+ define(`ADDSUBC', sbcs)
+ define(`CLRCY', `cmp xzr, xzr')
+ define(`RETVAL', `cset x0, cc')
+ define(`func', mpn_cnd_sub_n)')
+
+MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n)
+
+ASM_START()
+PROLOGUE(func)
+ cmp cnd, #1
+ sbc cnd, cnd, cnd
+
+ CLRCY C really only needed for n = 0 (mod 4)
+
+ tbz n, #0, L(1)
+ ldr x10, [up], #8
+ ldr x12, [vp], #8
+ bic x6, x12, cnd
+ ADDSUBC x8, x10, x6
+ sub n, n, #1
+ str x8, [rp], #8
+ cbz n, L(rt)
+
+L(1): ldp x10, x11, [up], #16
+ ldp x12, x13, [vp], #16
+ sub n, n, #2
+ cbz n, L(end)
+
+L(top): bic x6, x12, cnd
+ bic x7, x13, cnd
+ ldp x12, x13, [vp], #16
+ ADDSUBC x8, x10, x6
+ ADDSUBC x9, x11, x7
+ ldp x10, x11, [up], #16
+ sub n, n, #2
+ stp x8, x9, [rp], #16
+ cbnz n, L(top)
+
+L(end): bic x6, x12, cnd
+ bic x7, x13, cnd
+ ADDSUBC x8, x10, x6
+ ADDSUBC x9, x11, x7
+ stp x8, x9, [rp]
+L(rt): RETVAL
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/cora53/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora53/gmp-mparam.h
new file mode 100644
index 00000000000..f4e258dd1a5
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora53/gmp-mparam.h
@@ -0,0 +1,242 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file for a53.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 1536 MHz Cortex-A53 */
+/* FFT tuning limit = 21,583,800 */
+/* Generated by tuneup.c, 2019-10-22, gcc 5.4 */
+
+#define DIVREM_1_NORM_THRESHOLD 3
+#define DIVREM_1_UNNORM_THRESHOLD 4
+#define MOD_1_1P_METHOD 2 /* 4.84% faster than 1 */
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 4
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 12
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 18
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 22
+#define USE_PREINV_DIVREM_1 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 39.05% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 21
+#define DIV_QR_1_UNNORM_THRESHOLD 21
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define BMOD_1_TO_MOD_1_THRESHOLD 38
+
+#define DIV_1_VS_MUL_1_PERCENT 161
+
+#define MUL_TOOM22_THRESHOLD 14
+#define MUL_TOOM33_THRESHOLD 49
+#define MUL_TOOM44_THRESHOLD 73
+#define MUL_TOOM6H_THRESHOLD 173
+#define MUL_TOOM8H_THRESHOLD 236
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 77
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 81
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 88
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 65
+
+#define SQR_BASECASE_THRESHOLD 0 /* always */
+#define SQR_TOOM2_THRESHOLD 18
+#define SQR_TOOM3_THRESHOLD 68
+#define SQR_TOOM4_THRESHOLD 183
+#define SQR_TOOM6_THRESHOLD 230
+#define SQR_TOOM8_THRESHOLD 357
+
+#define MULMID_TOOM42_THRESHOLD 23
+
+#define MULMOD_BNM1_THRESHOLD 9
+#define SQRMOD_BNM1_THRESHOLD 11
+
+#define MUL_FFT_MODF_THRESHOLD 316 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 316, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
+ { 13, 7}, { 7, 6}, { 15, 7}, { 8, 6}, \
+ { 17, 7}, { 9, 6}, { 19, 7}, { 17, 8}, \
+ { 9, 7}, { 20, 8}, { 11, 7}, { 23, 8}, \
+ { 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 49, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 71,10}, { 39, 9}, \
+ { 83,10}, { 47, 9}, { 99,10}, { 55,11}, \
+ { 31,10}, { 63, 8}, { 255,10}, { 71, 8}, \
+ { 287,10}, { 79, 9}, { 159, 8}, { 319,10}, \
+ { 87,11}, { 47,10}, { 95, 9}, { 191, 8}, \
+ { 383,10}, { 103, 9}, { 207, 8}, { 415,10}, \
+ { 111, 9}, { 223,12}, { 31,11}, { 63, 9}, \
+ { 255, 8}, { 511,10}, { 135, 9}, { 287, 8}, \
+ { 575,11}, { 79,10}, { 159, 9}, { 319, 8}, \
+ { 639,10}, { 175, 9}, { 351, 8}, { 703,11}, \
+ { 95,10}, { 191, 9}, { 383, 8}, { 767,10}, \
+ { 207, 9}, { 415, 8}, { 831,10}, { 223, 9}, \
+ { 447,12}, { 63,10}, { 255, 9}, { 511, 8}, \
+ { 1023, 9}, { 543,10}, { 287, 9}, { 575, 8}, \
+ { 1151,11}, { 159,10}, { 319, 9}, { 639,11}, \
+ { 175,10}, { 351, 9}, { 703, 8}, { 1407,12}, \
+ { 95,11}, { 191,10}, { 383, 9}, { 767,11}, \
+ { 207,10}, { 415, 9}, { 831,11}, { 223,10}, \
+ { 447,13}, { 63,11}, { 255,10}, { 543,11}, \
+ { 287,10}, { 575, 9}, { 1151,12}, { 159,11}, \
+ { 319,10}, { 639,11}, { 351,10}, { 703, 9}, \
+ { 1407, 8}, { 2815,12}, { 191,11}, { 383,10}, \
+ { 767,11}, { 415,10}, { 831,12}, { 223,11}, \
+ { 447,10}, { 895,11}, { 479,10}, { 959, 9}, \
+ { 1919,12}, { 255,11}, { 511,10}, { 1023,11}, \
+ { 543,10}, { 1087,12}, { 287,11}, { 575,10}, \
+ { 1151,12}, { 319,11}, { 639,12}, { 351,11}, \
+ { 703,10}, { 1407, 9}, { 2815,13}, { 191,12}, \
+ { 383,11}, { 767,12}, { 415,11}, { 831,10}, \
+ { 1663,12}, { 447,11}, { 895,10}, { 1791,12}, \
+ { 479,11}, { 959,13}, { 255,12}, { 511,11}, \
+ { 1023,12}, { 543,11}, { 1087,12}, { 575,11}, \
+ { 1151,13}, { 319,12}, { 703,11}, { 1407,10}, \
+ { 2815,13}, { 383,12}, { 831,11}, { 1663,13}, \
+ { 447,12}, { 895,11}, { 1791,12}, { 959,11}, \
+ { 1919,14}, { 255,13}, { 511,12}, { 1087,13}, \
+ { 575,12}, { 1151,13}, { 703,12}, { 1407,11}, \
+ { 2815,14}, { 383,13}, { 831,12}, { 1663,13}, \
+ { 895,12}, { 1791,13}, { 959,12}, { 1919,15}, \
+ { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
+ { 1215,14}, { 639,13}, { 1407,12}, { 2815,14}, \
+ { 767,13}, { 1663,14}, { 895,13}, { 1919,12}, \
+ { 3839,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2431,12}, { 4863,14}, { 16384,15}, \
+ { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 217
+#define MUL_FFT_THRESHOLD 3200
+
+#define SQR_FFT_MODF_THRESHOLD 276 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 276, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
+ { 17, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
+ { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
+ { 15, 7}, { 31, 8}, { 19, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
+ { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 47,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 47, 9}, { 95, 8}, { 191,10}, \
+ { 55,11}, { 31,10}, { 63, 8}, { 255,10}, \
+ { 71, 9}, { 143, 8}, { 287,10}, { 79, 9}, \
+ { 159,11}, { 47,10}, { 95, 9}, { 191, 8}, \
+ { 383, 7}, { 767,10}, { 103,12}, { 31,11}, \
+ { 63, 9}, { 255, 8}, { 511, 7}, { 1023,10}, \
+ { 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
+ { 319, 8}, { 639,10}, { 175, 9}, { 351, 8}, \
+ { 703,11}, { 95,10}, { 191, 9}, { 383, 8}, \
+ { 767,10}, { 207, 9}, { 415, 8}, { 831,10}, \
+ { 223, 9}, { 447,12}, { 63,10}, { 255, 9}, \
+ { 511, 8}, { 1023,11}, { 143,10}, { 287, 9}, \
+ { 575, 8}, { 1151,11}, { 159,10}, { 319, 9}, \
+ { 639,11}, { 175,10}, { 351, 9}, { 703,12}, \
+ { 95,11}, { 191,10}, { 383, 9}, { 767,11}, \
+ { 207,10}, { 415, 9}, { 831,11}, { 223,10}, \
+ { 447,13}, { 63,11}, { 255,10}, { 511, 9}, \
+ { 1023,11}, { 287,10}, { 575, 9}, { 1151,12}, \
+ { 159,11}, { 319,10}, { 639,11}, { 351,10}, \
+ { 703, 9}, { 1407,12}, { 191,11}, { 383,10}, \
+ { 767,11}, { 415,10}, { 831,12}, { 223,11}, \
+ { 447,10}, { 895,11}, { 479,10}, { 959,12}, \
+ { 255,11}, { 511,10}, { 1023,12}, { 287,11}, \
+ { 575,10}, { 1151,12}, { 319,11}, { 639,12}, \
+ { 351,11}, { 703,10}, { 1407,13}, { 191,12}, \
+ { 383,11}, { 767,12}, { 415,11}, { 831,10}, \
+ { 1663,12}, { 447,11}, { 895,12}, { 479,11}, \
+ { 959,10}, { 1919,13}, { 255,12}, { 511,11}, \
+ { 1023,12}, { 543,11}, { 1087,12}, { 575,11}, \
+ { 1151,13}, { 319,12}, { 703,11}, { 1407,10}, \
+ { 2815,13}, { 383,12}, { 831,11}, { 1663,13}, \
+ { 447,12}, { 895,11}, { 1791,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1087,13}, { 575,12}, \
+ { 1151,13}, { 703,12}, { 1407,11}, { 2815,14}, \
+ { 383,13}, { 831,12}, { 1663,13}, { 895,12}, \
+ { 1791,13}, { 959,12}, { 1919,15}, { 255,14}, \
+ { 511,13}, { 1087,12}, { 2175,13}, { 1151,14}, \
+ { 639,13}, { 1407,12}, { 2815,14}, { 767,13}, \
+ { 1663,14}, { 895,13}, { 1919,12}, { 3839,15}, \
+ { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
+ { 2431,12}, { 4863,14}, { 16384,15}, { 32768,16}, \
+ { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+ {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 204
+#define SQR_FFT_THRESHOLD 2688
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 38
+#define MULLO_MUL_N_THRESHOLD 6253
+#define SQRLO_BASECASE_THRESHOLD 4
+#define SQRLO_DC_THRESHOLD 67
+#define SQRLO_SQR_THRESHOLD 5240
+
+#define DC_DIV_QR_THRESHOLD 43
+#define DC_DIVAPPR_Q_THRESHOLD 155
+#define DC_BDIV_QR_THRESHOLD 39
+#define DC_BDIV_Q_THRESHOLD 89
+
+#define INV_MULMOD_BNM1_THRESHOLD 34
+#define INV_NEWTON_THRESHOLD 163
+#define INV_APPR_THRESHOLD 161
+
+#define BINV_NEWTON_THRESHOLD 196
+#define REDC_1_TO_REDC_N_THRESHOLD 43
+
+#define MU_DIV_QR_THRESHOLD 998
+#define MU_DIVAPPR_Q_THRESHOLD 998
+#define MUPI_DIV_QR_THRESHOLD 91
+#define MU_BDIV_QR_THRESHOLD 807
+#define MU_BDIV_Q_THRESHOLD 924
+
+#define POWM_SEC_TABLE 6,30,125,579,1730
+
+#define GET_STR_DC_THRESHOLD 15
+#define GET_STR_PRECOMPUTE_THRESHOLD 30
+#define SET_STR_DC_THRESHOLD 802
+#define SET_STR_PRECOMPUTE_THRESHOLD 1815
+
+#define FAC_DSC_THRESHOLD 258
+#define FAC_ODD_THRESHOLD 24
+
+#define MATRIX22_STRASSEN_THRESHOLD 10
+#define HGCD2_DIV1_METHOD 1 /* 7.05% faster than 3 */
+#define HGCD_THRESHOLD 107
+#define HGCD_APPR_THRESHOLD 112
+#define HGCD_REDUCE_THRESHOLD 1679
+#define GCD_DC_THRESHOLD 324
+#define GCDEXT_DC_THRESHOLD 242
+#define JACOBI_BASE_METHOD 4 /* 22.41% faster than 1 */
+
+/* Tuneup completed successfully, took 66624 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/cora57/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora57/gmp-mparam.h
new file mode 100644
index 00000000000..0d38621e1f4
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora57/gmp-mparam.h
@@ -0,0 +1,187 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file for a57, a72-a75.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 1800 MHz Cortex-A72 */
+/* FFT tuning limit = 0.5 M */
+/* Generated by tuneup.c, 2019-10-02, gcc 7.4 */
+
+#define DIVREM_1_NORM_THRESHOLD 3
+#define DIVREM_1_UNNORM_THRESHOLD 4
+#define MOD_1_1P_METHOD 1 /* 2.21% faster than 2 */
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 4
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 42
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 15
+#define USE_PREINV_DIVREM_1 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 34.95% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 5
+#define DIV_QR_1_UNNORM_THRESHOLD 5
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define BMOD_1_TO_MOD_1_THRESHOLD 33
+
+#define DIV_1_VS_MUL_1_PERCENT 168
+
+#define MUL_TOOM22_THRESHOLD 10
+#define MUL_TOOM33_THRESHOLD 41
+#define MUL_TOOM44_THRESHOLD 99
+#define MUL_TOOM6H_THRESHOLD 142
+#define MUL_TOOM8H_THRESHOLD 199
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 65
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 69
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 63
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 66
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 55
+
+#define SQR_BASECASE_THRESHOLD 0 /* always */
+#define SQR_TOOM2_THRESHOLD 18
+#define SQR_TOOM3_THRESHOLD 65
+#define SQR_TOOM4_THRESHOLD 166
+#define SQR_TOOM6_THRESHOLD 222
+#define SQR_TOOM8_THRESHOLD 309
+
+#define MULMID_TOOM42_THRESHOLD 22
+
+#define MULMOD_BNM1_THRESHOLD 7
+#define SQRMOD_BNM1_THRESHOLD 12
+
+#define MUL_FFT_MODF_THRESHOLD 276 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 276, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
+ { 13, 7}, { 7, 6}, { 15, 7}, { 8, 6}, \
+ { 17, 7}, { 9, 6}, { 19, 7}, { 13, 8}, \
+ { 7, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
+ { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
+ { 21, 9}, { 11, 8}, { 25,10}, { 7, 9}, \
+ { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
+ { 23, 8}, { 49, 9}, { 27,10}, { 15, 9}, \
+ { 39,10}, { 23, 9}, { 51,11}, { 15,10}, \
+ { 31, 9}, { 67,10}, { 39, 9}, { 79,10}, \
+ { 47, 9}, { 99,10}, { 55,11}, { 31,10}, \
+ { 63, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
+ { 287,10}, { 79, 9}, { 159, 8}, { 319,11}, \
+ { 47,10}, { 95, 9}, { 191,10}, { 103,12}, \
+ { 31,11}, { 63, 9}, { 255, 8}, { 511,10}, \
+ { 143, 8}, { 575,11}, { 79,10}, { 159, 9}, \
+ { 319,10}, { 175, 9}, { 351, 8}, { 703,11}, \
+ { 95,10}, { 191, 9}, { 383,10}, { 207, 9}, \
+ { 415,10}, { 223, 9}, { 447, 8}, { 895,12}, \
+ { 63,10}, { 255, 9}, { 511, 8}, { 1023, 9}, \
+ { 543,11}, { 143,10}, { 287, 9}, { 575, 8}, \
+ { 1151,10}, { 319, 9}, { 639,11}, { 175,10}, \
+ { 351, 9}, { 703,12}, { 95,10}, { 383, 9}, \
+ { 767,11}, { 207, 9}, { 831,11}, { 223,10}, \
+ { 447, 9}, { 895,13}, { 8192,14}, { 16384,15}, \
+ { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 109
+#define MUL_FFT_THRESHOLD 3200
+
+#define SQR_FFT_MODF_THRESHOLD 244 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 244, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
+ { 8, 5}, { 17, 6}, { 17, 7}, { 9, 6}, \
+ { 19, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
+ { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
+ { 19, 9}, { 11, 8}, { 25,10}, { 7, 9}, \
+ { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
+ { 27,10}, { 15, 9}, { 39,10}, { 23, 9}, \
+ { 47,11}, { 15,10}, { 31, 9}, { 67,10}, \
+ { 39, 9}, { 79,10}, { 47, 9}, { 99,10}, \
+ { 55,11}, { 31,10}, { 63, 9}, { 127, 8}, \
+ { 255,10}, { 71, 8}, { 287, 7}, { 575, 9}, \
+ { 159, 8}, { 319,11}, { 47,10}, { 95, 9}, \
+ { 191, 8}, { 383,12}, { 31,11}, { 63,10}, \
+ { 127, 9}, { 255,10}, { 143, 9}, { 287, 8}, \
+ { 575,11}, { 79,10}, { 159, 9}, { 319, 8}, \
+ { 639, 9}, { 351,10}, { 191, 9}, { 383,10}, \
+ { 207, 9}, { 415,10}, { 239,12}, { 63,10}, \
+ { 255, 9}, { 511,10}, { 271,11}, { 143,10}, \
+ { 287, 9}, { 575,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 351, 9}, { 703,11}, { 191,10}, \
+ { 383, 9}, { 767,11}, { 207,10}, { 415, 9}, \
+ { 831,11}, { 223,13}, { 8192,14}, { 16384,15}, \
+ { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 97
+#define SQR_FFT_THRESHOLD 2496
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 39
+#define MULLO_MUL_N_THRESHOLD 6253
+#define SQRLO_BASECASE_THRESHOLD 4
+#define SQRLO_DC_THRESHOLD 56
+#define SQRLO_SQR_THRESHOLD 4940
+
+#define DC_DIV_QR_THRESHOLD 41
+#define DC_DIVAPPR_Q_THRESHOLD 136
+#define DC_BDIV_QR_THRESHOLD 39
+#define DC_BDIV_Q_THRESHOLD 89
+
+#define INV_MULMOD_BNM1_THRESHOLD 22
+#define INV_NEWTON_THRESHOLD 154
+#define INV_APPR_THRESHOLD 141
+
+#define BINV_NEWTON_THRESHOLD 182
+#define REDC_1_TO_REDC_N_THRESHOLD 39
+
+#define MU_DIV_QR_THRESHOLD 979
+#define MU_DIVAPPR_Q_THRESHOLD 1078
+#define MUPI_DIV_QR_THRESHOLD 75
+#define MU_BDIV_QR_THRESHOLD 872
+#define MU_BDIV_Q_THRESHOLD 942
+
+#define POWM_SEC_TABLE 1,19,117,539,1730
+
+#define GET_STR_DC_THRESHOLD 10
+#define GET_STR_PRECOMPUTE_THRESHOLD 21
+#define SET_STR_DC_THRESHOLD 572
+#define SET_STR_PRECOMPUTE_THRESHOLD 1036
+
+#define FAC_DSC_THRESHOLD 142
+#define FAC_ODD_THRESHOLD 23
+
+#define MATRIX22_STRASSEN_THRESHOLD 11
+#define HGCD2_DIV1_METHOD 1 /* 8.83% faster than 3 */
+#define HGCD_THRESHOLD 80
+#define HGCD_APPR_THRESHOLD 70
+#define HGCD_REDUCE_THRESHOLD 1962
+#define GCD_DC_THRESHOLD 273
+#define GCDEXT_DC_THRESHOLD 198
+#define JACOBI_BASE_METHOD 1 /* 7.49% faster than 4 */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/cora72/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora72/gmp-mparam.h
new file mode 100644
index 00000000000..fc66fd3e42e
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora72/gmp-mparam.h
@@ -0,0 +1,242 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file for a72.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 1800 MHz Cortex-A72 */
+/* FFT tuning limit = 50,811,960 */
+/* Generated by tuneup.c, 2019-10-22, gcc 7.3 */
+
+#define DIVREM_1_NORM_THRESHOLD 3
+#define DIVREM_1_UNNORM_THRESHOLD 3
+#define MOD_1_1P_METHOD 2 /* 12.09% faster than 1 */
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 3
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 26
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 15
+#define USE_PREINV_DIVREM_1 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 13.42% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 4
+#define DIV_QR_1_UNNORM_THRESHOLD 4
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define BMOD_1_TO_MOD_1_THRESHOLD 38
+
+#define DIV_1_VS_MUL_1_PERCENT 168
+
+#define MUL_TOOM22_THRESHOLD 8
+#define MUL_TOOM33_THRESHOLD 57
+#define MUL_TOOM44_THRESHOLD 153
+#define MUL_TOOM6H_THRESHOLD 222
+#define MUL_TOOM8H_THRESHOLD 333
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 57
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 108
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 104
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 56
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 82
+
+#define SQR_BASECASE_THRESHOLD 0 /* always */
+#define SQR_TOOM2_THRESHOLD 16
+#define SQR_TOOM3_THRESHOLD 73
+#define SQR_TOOM4_THRESHOLD 154
+#define SQR_TOOM6_THRESHOLD 206
+#define SQR_TOOM8_THRESHOLD 333
+
+#define MULMID_TOOM42_THRESHOLD 18
+
+#define MULMOD_BNM1_THRESHOLD 8
+#define SQRMOD_BNM1_THRESHOLD 10
+
+#define MUL_FFT_MODF_THRESHOLD 268 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 268, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
+ { 15, 7}, { 13, 8}, { 7, 7}, { 16, 8}, \
+ { 9, 7}, { 19, 8}, { 11, 7}, { 23, 8}, \
+ { 13, 9}, { 7, 8}, { 15, 7}, { 31, 8}, \
+ { 19, 9}, { 11, 8}, { 27,10}, { 7, 9}, \
+ { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
+ { 27,10}, { 15, 9}, { 39,10}, { 23, 9}, \
+ { 51,11}, { 15,10}, { 31, 9}, { 71,10}, \
+ { 39, 9}, { 79, 8}, { 159, 7}, { 319, 9}, \
+ { 83,10}, { 47, 9}, { 95, 7}, { 383, 9}, \
+ { 99,10}, { 55,11}, { 31,10}, { 63, 8}, \
+ { 255, 7}, { 511, 9}, { 131,10}, { 71, 9}, \
+ { 143, 8}, { 287, 7}, { 575, 6}, { 1151,10}, \
+ { 79, 8}, { 319, 7}, { 639,10}, { 87, 8}, \
+ { 351,11}, { 47,10}, { 95, 8}, { 383, 7}, \
+ { 767,10}, { 103, 8}, { 415, 7}, { 831, 6}, \
+ { 1663, 9}, { 223, 8}, { 447,12}, { 31,11}, \
+ { 63, 9}, { 255, 8}, { 511, 7}, { 1023, 9}, \
+ { 287, 8}, { 575, 7}, { 1151, 6}, { 2303, 7}, \
+ { 1215,11}, { 79, 9}, { 319, 8}, { 639, 7}, \
+ { 1279, 9}, { 351, 8}, { 703, 7}, { 1407, 6}, \
+ { 2815, 9}, { 383, 8}, { 831, 7}, { 1663, 9}, \
+ { 447, 8}, { 895, 7}, { 1791, 6}, { 3583, 8}, \
+ { 959, 6}, { 3839, 5}, { 7679, 9}, { 511, 8}, \
+ { 1023, 7}, { 2175, 9}, { 575, 8}, { 1151, 7}, \
+ { 2303, 8}, { 1215,10}, { 351, 9}, { 703, 7}, \
+ { 3071, 8}, { 1663, 9}, { 895, 8}, { 1791, 7}, \
+ { 3583, 8}, { 1919, 6}, { 7679, 7}, { 3967, 9}, \
+ { 1023,10}, { 575, 9}, { 1151, 8}, { 2559,10}, \
+ { 703, 8}, { 2815, 9}, { 1471, 7}, { 5887,10}, \
+ { 767,11}, { 415, 9}, { 1791, 8}, { 3583,11}, \
+ { 479,10}, { 959, 8}, { 3967,11}, { 511, 9}, \
+ { 2175,10}, { 1151, 8}, { 4607, 9}, { 2815,10}, \
+ { 1471, 9}, { 2943,11}, { 767,10}, { 1535,11}, \
+ { 831,10}, { 1791,11}, { 959,10}, { 1919, 9}, \
+ { 3839, 8}, { 7679,10}, { 1983,12}, { 511,10}, \
+ { 2047,11}, { 1215,12}, { 639,11}, { 1407,10}, \
+ { 2815,11}, { 1471,12}, { 767,11}, { 1663,12}, \
+ { 895,11}, { 1791,12}, { 959,11}, { 1919,10}, \
+ { 3839,14}, { 255,13}, { 511,12}, { 1023,11}, \
+ { 2047,12}, { 1215,13}, { 639,12}, { 1279,13}, \
+ { 703,12}, { 1407,11}, { 2815,13}, { 767,12}, \
+ { 1535,13}, { 831,12}, { 1663,13}, { 895,12}, \
+ { 1791,11}, { 3583,13}, { 959,12}, { 1919,11}, \
+ { 3839,14}, { 511,13}, { 1023,12}, { 2047,13}, \
+ { 1215,12}, { 2431,14}, { 639,13}, { 1407,12}, \
+ { 2815,13}, { 1471,12}, { 2943,14}, { 767,13}, \
+ { 1535,12}, { 3071,13}, { 1791,12}, { 3583,13}, \
+ { 1919,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
+ { 2431,14}, { 1279,13}, { 2559,15}, { 767,14}, \
+ { 1791,13}, { 3839,15}, { 1023,14}, { 2431,13}, \
+ { 4863,15}, { 1279,14}, { 2943,15}, { 1535,14}, \
+ { 16384,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
+ { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+ {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 218
+#define MUL_FFT_THRESHOLD 2688
+
+#define SQR_FFT_MODF_THRESHOLD 236 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 236, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
+ { 15, 7}, { 8, 6}, { 17, 7}, { 13, 8}, \
+ { 7, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
+ { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
+ { 19, 9}, { 11, 8}, { 25,10}, { 7, 9}, \
+ { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
+ { 27,10}, { 15, 9}, { 39,10}, { 23, 9}, \
+ { 47,11}, { 15,10}, { 31, 9}, { 67,10}, \
+ { 39, 9}, { 79, 8}, { 159,10}, { 47, 9}, \
+ { 95, 8}, { 191, 7}, { 383,10}, { 55,11}, \
+ { 31,10}, { 63, 9}, { 127, 8}, { 255, 7}, \
+ { 511,10}, { 71, 9}, { 143, 8}, { 287, 7}, \
+ { 575,10}, { 79, 8}, { 319, 7}, { 639,11}, \
+ { 47,10}, { 95, 8}, { 383, 7}, { 767, 8}, \
+ { 415,12}, { 31,11}, { 63,10}, { 127, 9}, \
+ { 255, 8}, { 543, 9}, { 287, 8}, { 575, 7}, \
+ { 1151, 9}, { 319, 8}, { 639, 9}, { 351, 8}, \
+ { 703, 7}, { 1407, 6}, { 2815,10}, { 191, 9}, \
+ { 383, 8}, { 767, 9}, { 415, 8}, { 831, 7}, \
+ { 1663,10}, { 223, 9}, { 447, 8}, { 895, 7}, \
+ { 1791, 9}, { 479, 8}, { 959,12}, { 63,11}, \
+ { 127, 9}, { 543, 8}, { 1087,10}, { 287, 9}, \
+ { 575, 8}, { 1151,10}, { 319, 9}, { 639,10}, \
+ { 351, 9}, { 703, 8}, { 1407, 7}, { 2815, 8}, \
+ { 1471, 5}, { 11775, 9}, { 767, 8}, { 1535,10}, \
+ { 415, 9}, { 895, 8}, { 1919, 6}, { 7679, 7}, \
+ { 3967,11}, { 255,10}, { 543, 9}, { 1087, 8}, \
+ { 2175,10}, { 575, 9}, { 1151, 8}, { 2431,10}, \
+ { 639, 9}, { 1279,10}, { 703, 9}, { 1407, 8}, \
+ { 2943,11}, { 383,10}, { 767,11}, { 447,10}, \
+ { 895,11}, { 479,10}, { 959, 9}, { 1919, 8}, \
+ { 3839,10}, { 1023, 9}, { 2175,10}, { 1215, 9}, \
+ { 2431,11}, { 703, 9}, { 2815,10}, { 1471,11}, \
+ { 767,10}, { 1663,11}, { 895,10}, { 1791,11}, \
+ { 959, 9}, { 3839,12}, { 511,11}, { 1087,10}, \
+ { 2175,11}, { 1215,10}, { 2431,12}, { 639,11}, \
+ { 1279,12}, { 703,11}, { 1471,12}, { 767,11}, \
+ { 1663,12}, { 895,11}, { 1919,10}, { 3839,13}, \
+ { 511,12}, { 1087,11}, { 2175,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1279,13}, { 703,12}, \
+ { 1407,13}, { 767,12}, { 1535,13}, { 831,12}, \
+ { 1791,13}, { 1151,12}, { 2303,13}, { 1215,14}, \
+ { 639,12}, { 2559,13}, { 1407,14}, { 767,12}, \
+ { 3071,14}, { 895,13}, { 1919,12}, { 3839,14}, \
+ { 1023,13}, { 2175,14}, { 1151,12}, { 4607,14}, \
+ { 1279,13}, { 2559,14}, { 1407,13}, { 2943,15}, \
+ { 767,14}, { 1663,13}, { 3583,14}, { 1919,15}, \
+ { 1023,14}, { 2047,13}, { 4095,14}, { 2943,15}, \
+ { 1535,14}, { 16384,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 203
+#define SQR_FFT_THRESHOLD 2176
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 33
+#define MULLO_MUL_N_THRESHOLD 5240
+#define SQRLO_BASECASE_THRESHOLD 6
+#define SQRLO_DC_THRESHOLD 45
+#define SQRLO_SQR_THRESHOLD 4265
+
+#define DC_DIV_QR_THRESHOLD 38
+#define DC_DIVAPPR_Q_THRESHOLD 108
+#define DC_BDIV_QR_THRESHOLD 36
+#define DC_BDIV_Q_THRESHOLD 71
+
+#define INV_MULMOD_BNM1_THRESHOLD 14
+#define INV_NEWTON_THRESHOLD 132
+#define INV_APPR_THRESHOLD 124
+
+#define BINV_NEWTON_THRESHOLD 199
+#define REDC_1_TO_REDC_N_THRESHOLD 34
+
+#define MU_DIV_QR_THRESHOLD 979
+#define MU_DIVAPPR_Q_THRESHOLD 979
+#define MUPI_DIV_QR_THRESHOLD 61
+#define MU_BDIV_QR_THRESHOLD 734
+#define MU_BDIV_Q_THRESHOLD 942
+
+#define POWM_SEC_TABLE 6,30,110,579,1730
+
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 19
+#define SET_STR_DC_THRESHOLD 458
+#define SET_STR_PRECOMPUTE_THRESHOLD 875
+
+#define FAC_DSC_THRESHOLD 153
+#define FAC_ODD_THRESHOLD 24
+
+#define MATRIX22_STRASSEN_THRESHOLD 15
+#define HGCD2_DIV1_METHOD 1 /* 8.41% faster than 3 */
+#define HGCD_THRESHOLD 81
+#define HGCD_APPR_THRESHOLD 80
+#define HGCD_REDUCE_THRESHOLD 1494
+#define GCD_DC_THRESHOLD 268
+#define GCDEXT_DC_THRESHOLD 189
+#define JACOBI_BASE_METHOD 1 /* 10.80% faster than 4 */
+
+/* Tuneup completed successfully, took 96906 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/cora73/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora73/gmp-mparam.h
new file mode 100644
index 00000000000..7fc7f4ec9c0
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/cora73/gmp-mparam.h
@@ -0,0 +1,225 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file for a73.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 1800 MHz Cortex-A72 */
+/* FFT tuning limit = 48,820,337 */
+/* Generated by tuneup.c, 2019-10-22, gcc 7.4 */
+
+#define DIVREM_1_NORM_THRESHOLD 3
+#define DIVREM_1_UNNORM_THRESHOLD 3
+#define MOD_1_1P_METHOD 1 /* 2.28% faster than 2 */
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 4
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 44
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 16
+#define USE_PREINV_DIVREM_1 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 35.13% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 5
+#define DIV_QR_1_UNNORM_THRESHOLD 5
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define BMOD_1_TO_MOD_1_THRESHOLD 33
+
+#define DIV_1_VS_MUL_1_PERCENT 168
+
+#define MUL_TOOM22_THRESHOLD 10
+#define MUL_TOOM33_THRESHOLD 57
+#define MUL_TOOM44_THRESHOLD 89
+#define MUL_TOOM6H_THRESHOLD 141
+#define MUL_TOOM8H_THRESHOLD 199
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 61
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 69
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 65
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 66
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 58
+
+#define SQR_BASECASE_THRESHOLD 0 /* always */
+#define SQR_TOOM2_THRESHOLD 18
+#define SQR_TOOM3_THRESHOLD 62
+#define SQR_TOOM4_THRESHOLD 166
+#define SQR_TOOM6_THRESHOLD 222
+#define SQR_TOOM8_THRESHOLD 309
+
+#define MULMID_TOOM42_THRESHOLD 22
+
+#define MULMOD_BNM1_THRESHOLD 8
+#define SQRMOD_BNM1_THRESHOLD 11
+
+#define MUL_FFT_MODF_THRESHOLD 276 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 276, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
+ { 15, 7}, { 8, 6}, { 17, 7}, { 9, 6}, \
+ { 19, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
+ { 9, 7}, { 19, 8}, { 11, 7}, { 23, 8}, \
+ { 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
+ { 27,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
+ { 19, 8}, { 39, 9}, { 23, 8}, { 47, 9}, \
+ { 27,10}, { 15, 9}, { 43,10}, { 23, 9}, \
+ { 51,11}, { 15,10}, { 31, 9}, { 67,10}, \
+ { 39, 9}, { 83,10}, { 47, 9}, { 99,10}, \
+ { 55,11}, { 31,10}, { 63, 9}, { 127, 8}, \
+ { 255, 9}, { 131,10}, { 71, 9}, { 143, 8}, \
+ { 287,10}, { 79, 9}, { 159, 8}, { 319,11}, \
+ { 47, 9}, { 191, 8}, { 383, 7}, { 767, 8}, \
+ { 415,12}, { 31,11}, { 63, 9}, { 255, 8}, \
+ { 511,10}, { 143, 9}, { 287, 8}, { 575,11}, \
+ { 79,10}, { 159, 9}, { 319,10}, { 175, 9}, \
+ { 351, 8}, { 703,11}, { 95,10}, { 191, 9}, \
+ { 383, 8}, { 767,10}, { 207, 9}, { 415,10}, \
+ { 223, 9}, { 447,12}, { 63,10}, { 255, 9}, \
+ { 511, 8}, { 1023, 9}, { 543,11}, { 143, 9}, \
+ { 575,10}, { 319, 9}, { 639,10}, { 351, 9}, \
+ { 703,12}, { 95,11}, { 191,10}, { 383,11}, \
+ { 207,10}, { 415,11}, { 223,10}, { 447, 9}, \
+ { 895,13}, { 63,11}, { 255,10}, { 511,11}, \
+ { 287,10}, { 575,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 351,10}, { 703, 9}, { 1407,12}, \
+ { 191,11}, { 383,10}, { 767,11}, { 415,12}, \
+ { 223,11}, { 447,10}, { 895,11}, { 479,10}, \
+ { 959,12}, { 255,11}, { 543,10}, { 1087,11}, \
+ { 575,12}, { 319,11}, { 639,12}, { 351,11}, \
+ { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 415,11}, { 831,12}, { 447,11}, { 895,12}, \
+ { 479,13}, { 255,12}, { 511,11}, { 1023,12}, \
+ { 575,13}, { 319,12}, { 703,13}, { 383,12}, \
+ { 831,13}, { 447,12}, { 959,14}, { 255,13}, \
+ { 511,12}, { 1023,13}, { 575,12}, { 1151,13}, \
+ { 703,12}, { 1407,14}, { 383,13}, { 831,12}, \
+ { 1663,13}, { 959,15}, { 255,14}, { 511,13}, \
+ { 1151,14}, { 639,13}, { 1407,14}, { 767,13}, \
+ { 1663,14}, { 895,13}, { 1791,15}, { 511,14}, \
+ { 1023,13}, { 2047,14}, { 1151,13}, { 2431,14}, \
+ { 1407,15}, { 767,14}, { 1791,16}, { 511,15}, \
+ { 1023,14}, { 2431,15}, { 1279,14}, { 2815,15}, \
+ { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 185
+#define MUL_FFT_THRESHOLD 3200
+
+#define SQR_FFT_MODF_THRESHOLD 244 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 244, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
+ { 17, 7}, { 9, 6}, { 19, 7}, { 17, 8}, \
+ { 9, 7}, { 20, 8}, { 11, 7}, { 23, 8}, \
+ { 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
+ { 25,10}, { 7, 9}, { 15, 8}, { 31, 9}, \
+ { 19, 8}, { 39, 9}, { 23, 8}, { 47,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 47,11}, \
+ { 15,10}, { 31, 9}, { 63,10}, { 39, 9}, \
+ { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
+ { 31,10}, { 63, 8}, { 255,10}, { 71, 9}, \
+ { 143, 8}, { 287,10}, { 79, 9}, { 159, 8}, \
+ { 319,11}, { 47,10}, { 95, 9}, { 191, 8}, \
+ { 383,12}, { 31,11}, { 63,10}, { 127, 9}, \
+ { 287, 8}, { 575,11}, { 79,10}, { 159, 9}, \
+ { 319, 8}, { 639,10}, { 175, 9}, { 351, 8}, \
+ { 703,11}, { 95, 9}, { 383, 8}, { 767,10}, \
+ { 207, 9}, { 415,10}, { 223, 8}, { 895,10}, \
+ { 239,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 287, 9}, { 575,11}, { 159,10}, \
+ { 319, 9}, { 639,11}, { 175,10}, { 351, 9}, \
+ { 703,11}, { 191,10}, { 383,11}, { 207,10}, \
+ { 415,11}, { 223,10}, { 479,11}, { 255,10}, \
+ { 511,11}, { 287,10}, { 575,12}, { 159,11}, \
+ { 351,12}, { 191,11}, { 383,10}, { 767,12}, \
+ { 223,11}, { 447,10}, { 895,11}, { 479,13}, \
+ { 127,12}, { 255,11}, { 511,12}, { 287,10}, \
+ { 1151,12}, { 319,11}, { 639,12}, { 351,11}, \
+ { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 415,11}, { 831,12}, { 447,11}, { 895,12}, \
+ { 479,11}, { 959,12}, { 511,11}, { 1023,12}, \
+ { 575,11}, { 1151,13}, { 319,12}, { 639,11}, \
+ { 1279,13}, { 383,12}, { 831,13}, { 447,12}, \
+ { 895,14}, { 255,13}, { 511,12}, { 1023,13}, \
+ { 703,14}, { 383,13}, { 831,12}, { 1663,13}, \
+ { 895,15}, { 255,14}, { 511,13}, { 1151,14}, \
+ { 639,13}, { 1407,14}, { 767,13}, { 1535,14}, \
+ { 895,15}, { 511,14}, { 1151,13}, { 2431,14}, \
+ { 1407,15}, { 767,14}, { 1791,16}, { 511,15}, \
+ { 1023,14}, { 2431,15}, { 1279,14}, { 2815,15}, \
+ { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 165
+#define SQR_FFT_THRESHOLD 2496
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 39
+#define MULLO_MUL_N_THRESHOLD 6253
+#define SQRLO_BASECASE_THRESHOLD 4
+#define SQRLO_DC_THRESHOLD 56
+#define SQRLO_SQR_THRESHOLD 4940
+
+#define DC_DIV_QR_THRESHOLD 36
+#define DC_DIVAPPR_Q_THRESHOLD 136
+#define DC_BDIV_QR_THRESHOLD 35
+#define DC_BDIV_Q_THRESHOLD 88
+
+#define INV_MULMOD_BNM1_THRESHOLD 30
+#define INV_NEWTON_THRESHOLD 149
+#define INV_APPR_THRESHOLD 139
+
+#define BINV_NEWTON_THRESHOLD 166
+#define REDC_1_TO_REDC_N_THRESHOLD 38
+
+#define MU_DIV_QR_THRESHOLD 1120
+#define MU_DIVAPPR_Q_THRESHOLD 1078
+#define MUPI_DIV_QR_THRESHOLD 68
+#define MU_BDIV_QR_THRESHOLD 889
+#define MU_BDIV_Q_THRESHOLD 942
+
+#define POWM_SEC_TABLE 4,22,102,473,1730
+
+#define GET_STR_DC_THRESHOLD 11
+#define GET_STR_PRECOMPUTE_THRESHOLD 22
+#define SET_STR_DC_THRESHOLD 381
+#define SET_STR_PRECOMPUTE_THRESHOLD 1042
+
+#define FAC_DSC_THRESHOLD 140
+#define FAC_ODD_THRESHOLD 23
+
+#define MATRIX22_STRASSEN_THRESHOLD 11
+#define HGCD2_DIV1_METHOD 1 /* 7.84% faster than 3 */
+#define HGCD_THRESHOLD 80
+#define HGCD_APPR_THRESHOLD 80
+#define HGCD_REDUCE_THRESHOLD 1679
+#define GCD_DC_THRESHOLD 273
+#define GCDEXT_DC_THRESHOLD 201
+#define JACOBI_BASE_METHOD 1 /* 1.03% faster than 4 */
+
+/* Tuneup completed successfully, took 64972 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_1.asm
deleted file mode 100644
index bc03d80ddf0..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_1.asm
+++ /dev/null
@@ -1,125 +0,0 @@
-dnl ARM v6t2 mpn_gcd_1.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for ARM by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011-2013 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/.
-
-include(`../config.m4')
-
-changecom(@&*$)
-
-C cycles/bit (approx)
-C Cortex-A53 ?
-C Cortex-A57 ?
-
-C TODO
-C * Optimise inner-loop better.
-C * Push saving/restoring of callee-user regs into call code
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 7)
-
-C INPUT PARAMETERS
-define(`up', `x0')
-define(`n', `x1')
-define(`v0', `x2')
-
-ifdef(`BMOD_1_TO_MOD_1_THRESHOLD',,
- `define(`BMOD_1_TO_MOD_1_THRESHOLD',30)')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- stp x29, x30, [sp,#-32]!
- ldr x3, [up] C U low limb
- stp x19, x20, [sp,#16]
-
- orr x3, x3, v0
- rbit x4, x3
- clz x20, x4 C min(ctz(u0),ctz(v0))
-
- rbit x12, v0
- clz x12, x12
- lsr v0, v0, x12
-
- mov x19, v0
-
- cmp n, #1
- b.ne L(nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- ldr x3, [up]
- cmp v0, x3, lsr #BMOD_THRES_LOG2
- b.hi L(red1)
-
-L(bmod):mov x3, #0 C carry argument
- bl mpn_modexact_1c_odd
- b L(red0)
-
-L(nby1):cmp n, #BMOD_1_TO_MOD_1_THRESHOLD
- b.lo L(bmod)
-
- bl mpn_mod_1
-
-L(red0):mov x3, x0
-L(red1):cmp x3, #0
- rbit x12, x3
- clz x12, x12
- b.ne L(mid)
- b L(end)
-
- ALIGN(8)
-L(top):
-ifelse(1,1,`
-C This shorter variant makes full use of armv8 insns
- csneg x3, x1, x1, cs C if x-y < 0
- csel x19, x4, x19, cs C use x,y-x
-L(mid): lsr x4, x3, x12 C
- subs x1, x19, x4 C
-',`
-C This variant is akin to the 32-bit v6t2 code
- csel x3, x1, x3, cs C if x-y < 0
- csel x19, x0, x19, cs C use x,y-x
-L(mid): lsr x3, x3, x12 C
- mov x0, x3 C
- subs x1, x19, x3 C
- sub x3, x3, x19 C
-')
- rbit x12, x1
- clz x12, x12 C
- b.ne L(top) C
-
-L(end): lsl x0, x19, x20
- ldp x19, x20, [sp,#16]
- ldp x29, x30, [sp],#32
- ret
-EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_11.asm
new file mode 100644
index 00000000000..d8cc3e2cf5d
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_11.asm
@@ -0,0 +1,70 @@
+dnl ARM v8a mpn_gcd_11.
+
+dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for ARM by Torbjorn
+dnl Granlund.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011-2013 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/.
+
+include(`../config.m4')
+
+changecom(blah)
+
+C cycles/bit (approx)
+C Cortex-A35 ?
+C Cortex-A53 ?
+C Cortex-A55 ?
+C Cortex-A57 ?
+C Cortex-A72 ?
+C Cortex-A73 ?
+C Cortex-A75 ?
+C Cortex-A76 ?
+C Cortex-A77 ?
+C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
+
+define(`u0', `x0')
+define(`v0', `x1')
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(mpn_gcd_11)
+ subs x3, u0, v0 C 0
+ b.eq L(end) C
+
+ ALIGN(16)
+L(top): rbit x12, x3 C 1,5
+ clz x12, x12 C 2
+ csneg x3, x3, x3, cs C v = abs(u-v), even 1
+ csel u0, v0, u0, cs C u = min(u,v) 1
+ lsr v0, x3, x12 C 3
+ subs x3, u0, v0 C 4
+ b.ne L(top) C
+
+L(end): ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_22.asm
new file mode 100644
index 00000000000..5367fea02c3
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/gcd_22.asm
@@ -0,0 +1,112 @@
+dnl ARM v8a mpn_gcd_22.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+changecom(blah)
+
+C cycles/bit (approx)
+C Cortex-A35 ?
+C Cortex-A53 7.26
+C Cortex-A55 ?
+C Cortex-A57 ?
+C Cortex-A72 5.72
+C Cortex-A73 6.43
+C Cortex-A75 ?
+C Cortex-A76 ?
+C Cortex-A77 ?
+
+
+define(`u1', `x0')
+define(`u0', `x1')
+define(`v1', `x2')
+define(`v0', `x3')
+
+define(`t0', `x5')
+define(`t1', `x6')
+define(`cnt', `x7')
+define(`tnc', `x8')
+
+ASM_START()
+PROLOGUE(mpn_gcd_22)
+
+ ALIGN(16)
+L(top): subs t0, u0, v0 C 0 6
+ cbz t0, L(lowz)
+ sbcs t1, u1, v1 C 1 7
+
+ rbit cnt, t0 C 1
+
+ cneg t0, t0, cc C 2
+ cinv t1, t1, cc C 2 u = |u - v|
+L(bck): csel v0, v0, u0, cs C 2
+ csel v1, v1, u1, cs C 2 v = min(u,v)
+
+ clz cnt, cnt C 2
+ sub tnc, xzr, cnt C 3
+
+ lsr u0, t0, cnt C 3
+ lsl x14, t1, tnc C 4
+ lsr u1, t1, cnt C 3
+ orr u0, u0, x14 C 5
+
+ orr x11, u1, v1
+ cbnz x11, L(top)
+
+
+ subs x4, u0, v0 C 0
+ b.eq L(end1) C
+
+ ALIGN(16)
+L(top1):rbit x12, x4 C 1,5
+ clz x12, x12 C 2
+ csneg x4, x4, x4, cs C v = abs(u-v), even 1
+ csel u0, v0, u0, cs C u = min(u,v) 1
+ lsr v0, x4, x12 C 3
+ subs x4, u0, v0 C 4
+ b.ne L(top1) C
+L(end1):mov x0, u0
+ mov x1, #0
+ ret
+
+L(lowz):C We come here when v0 - u0 = 0
+ C 1. If v1 - u1 = 0, then gcd is u = v.
+ C 2. Else compute gcd_21({v1,v0}, |u1-v1|)
+ subs t0, u1, v1
+ b.eq L(end)
+ mov t1, #0
+ rbit cnt, t0 C 1
+ cneg t0, t0, cc C 2
+ b L(bck) C FIXME: make conditional
+
+L(end): mov x0, v0
+ mov x1, v1
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm64/gmp-mparam.h
index 83309c68020..7c0c193294e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/gmp-mparam.h
@@ -1,6 +1,6 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 2015 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,211 +31,162 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 2400 MHz AppliedMicro X-Gene */
-/* FFT tuning limit = 100 M */
-/* Generated by tuneup.c, 2015-10-18, gcc 4.8 */
+/* 1536 MHz Cortex-A53 */
+/* FFT tuning limit = 0.5 M */
+/* Generated by tuneup.c, 2019-09-29, gcc 5.4 */
-#define DIVREM_1_NORM_THRESHOLD 0 /* always */
-#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1_1P_METHOD 1
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
+#define DIVREM_1_NORM_THRESHOLD 3
+#define DIVREM_1_UNNORM_THRESHOLD 4
+#define MOD_1_1P_METHOD 2 /* 2.08% faster than 1 */
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 4
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 28
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 13
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 20
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 21
#define USE_PREINV_DIVREM_1 1
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 1
-#define DIV_QR_1_UNNORM_THRESHOLD 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 38.26% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 13
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 30
+#define BMOD_1_TO_MOD_1_THRESHOLD 40
+
+#define DIV_1_VS_MUL_1_PERCENT 159
#define MUL_TOOM22_THRESHOLD 14
-#define MUL_TOOM33_THRESHOLD 57
-#define MUL_TOOM44_THRESHOLD 154
-#define MUL_TOOM6H_THRESHOLD 206
-#define MUL_TOOM8H_THRESHOLD 309
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 89
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 102
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 89
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 104
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 130
-
-#define SQR_BASECASE_THRESHOLD 6
-#define SQR_TOOM2_THRESHOLD 28
-#define SQR_TOOM3_THRESHOLD 93
-#define SQR_TOOM4_THRESHOLD 160
-#define SQR_TOOM6_THRESHOLD 197
-#define SQR_TOOM8_THRESHOLD 284
-
-#define MULMID_TOOM42_THRESHOLD 34
-
-#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 13
-
-#define MUL_FFT_MODF_THRESHOLD 308 /* k = 5 */
+#define MUL_TOOM33_THRESHOLD 49
+#define MUL_TOOM44_THRESHOLD 82
+#define MUL_TOOM6H_THRESHOLD 173
+#define MUL_TOOM8H_THRESHOLD 236
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 76
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 81
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 80
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 74
+
+#define SQR_BASECASE_THRESHOLD 0 /* always */
+#define SQR_TOOM2_THRESHOLD 18
+#define SQR_TOOM3_THRESHOLD 67
+#define SQR_TOOM4_THRESHOLD 166
+#define SQR_TOOM6_THRESHOLD 222
+#define SQR_TOOM8_THRESHOLD 333
+
+#define MULMID_TOOM42_THRESHOLD 20
+
+#define MULMOD_BNM1_THRESHOLD 10
+#define SQRMOD_BNM1_THRESHOLD 11
+
+#define MUL_FFT_MODF_THRESHOLD 316 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 308, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
- { 8, 5}, { 17, 6}, { 13, 7}, { 7, 6}, \
- { 15, 7}, { 8, 6}, { 17, 7}, { 17, 8}, \
- { 9, 7}, { 20, 8}, { 11, 7}, { 24, 8}, \
- { 13, 7}, { 27, 9}, { 7, 8}, { 15, 7}, \
- { 31, 8}, { 21, 9}, { 11, 8}, { 27, 9}, \
- { 15, 8}, { 35, 9}, { 19, 8}, { 39, 9}, \
- { 23, 8}, { 47, 9}, { 27,10}, { 15, 9}, \
- { 31, 8}, { 63, 9}, { 39,10}, { 23, 9}, \
- { 55,11}, { 15,10}, { 31, 9}, { 71,10}, \
- { 39, 9}, { 83,10}, { 47, 9}, { 99,10}, \
- { 55,11}, { 31,10}, { 63, 9}, { 127,10}, \
- { 79, 9}, { 159,11}, { 47,10}, { 95, 9}, \
- { 191, 8}, { 383,10}, { 103,12}, { 31,11}, \
- { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
- { 135, 9}, { 271,10}, { 143,11}, { 79,10}, \
+ { { 316, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
+ { 13, 7}, { 7, 6}, { 15, 7}, { 8, 6}, \
+ { 17, 7}, { 9, 6}, { 19, 7}, { 17, 8}, \
+ { 9, 7}, { 20, 8}, { 11, 7}, { 23, 8}, \
+ { 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 49, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 71,10}, { 39, 9}, \
+ { 83,10}, { 47, 9}, { 99,10}, { 55,11}, \
+ { 31,10}, { 63, 9}, { 127, 8}, { 255, 9}, \
+ { 131,10}, { 71, 8}, { 287,10}, { 79, 9}, \
+ { 159, 8}, { 319,10}, { 87,11}, { 47,10}, \
+ { 95, 9}, { 191, 8}, { 383,10}, { 103, 9}, \
+ { 207, 8}, { 415,10}, { 111, 9}, { 223,12}, \
+ { 31,11}, { 63, 9}, { 255, 8}, { 511,10}, \
+ { 135, 9}, { 287, 8}, { 575,11}, { 79,10}, \
{ 159, 9}, { 319, 8}, { 639,10}, { 175, 9}, \
{ 351, 8}, { 703,11}, { 95,10}, { 191, 9}, \
- { 383, 8}, { 767,10}, { 207, 9}, { 415, 8}, \
- { 831,11}, { 111,10}, { 223,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543,10}, { 287, 9}, { 575,11}, { 159,10}, \
+ { 383, 8}, { 767,10}, { 207, 9}, { 415,11}, \
+ { 111,10}, { 223, 9}, { 447,12}, { 63,10}, \
+ { 255, 9}, { 511, 8}, { 1023, 9}, { 543,10}, \
+ { 287, 9}, { 575, 8}, { 1151,11}, { 159,10}, \
{ 319, 9}, { 639,11}, { 175,10}, { 351, 9}, \
- { 703,12}, { 95,11}, { 191,10}, { 383, 9}, \
- { 767,11}, { 207,10}, { 415, 9}, { 831,11}, \
- { 223,10}, { 447,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
- { 287,10}, { 575,12}, { 159,11}, { 319,10}, \
- { 639,11}, { 351,10}, { 703,11}, { 383,10}, \
- { 767,11}, { 415,10}, { 831,12}, { 223,11}, \
- { 447,10}, { 895,11}, { 479,10}, { 959,13}, \
- { 127,11}, { 543,12}, { 287,11}, { 575,10}, \
- { 1151,12}, { 319,11}, { 639,12}, { 351,11}, \
- { 703,10}, { 1407, 9}, { 2815,12}, { 383,11}, \
- { 767,12}, { 415,11}, { 831,10}, { 1663,12}, \
- { 447,11}, { 895,10}, { 1791,12}, { 479,11}, \
- { 959,10}, { 1919,14}, { 127,13}, { 255,12}, \
- { 511,11}, { 1023,12}, { 543,11}, { 1087,12}, \
- { 575,11}, { 1151,13}, { 319,12}, { 639,11}, \
- { 1279,12}, { 703,11}, { 1407,13}, { 383,12}, \
- { 767,11}, { 1535,12}, { 831,11}, { 1663,13}, \
- { 447,12}, { 959,11}, { 1919,14}, { 255,13}, \
- { 511,12}, { 1087,13}, { 575,12}, { 1215,13}, \
- { 639,12}, { 1279,13}, { 703,12}, { 1407,14}, \
- { 383,13}, { 767,12}, { 1535,13}, { 831,12}, \
- { 1663,13}, { 895,12}, { 1791,13}, { 959,12}, \
- { 1919,15}, { 255,14}, { 511,13}, { 1087,12}, \
- { 2175,13}, { 1151,14}, { 639,13}, { 1407,12}, \
- { 2815,14}, { 767,13}, { 1663,14}, { 895,13}, \
- { 1919,15}, { 511,14}, { 1023,13}, { 2175,14}, \
- { 1151,13}, { 2431,14}, { 1407,13}, { 2815,15}, \
- { 767,14}, { 1919,16}, { 511,15}, { 1023,14}, \
- { 2431,15}, { 1279,14}, { 2943,15}, { 32768,16}, \
- { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
- {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 220
-#define MUL_FFT_THRESHOLD 3520
+ { 703, 8}, { 1407,12}, { 95,11}, { 191,10}, \
+ { 383, 9}, { 767,11}, { 207,10}, { 415, 9}, \
+ { 831,11}, { 223,10}, { 447,13}, { 8192,14}, \
+ { 16384,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
+ { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+ {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 118
+#define MUL_FFT_THRESHOLD 3200
#define SQR_FFT_MODF_THRESHOLD 272 /* k = 5 */
#define SQR_FFT_TABLE3 \
{ { 272, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
- { 17, 7}, { 9, 6}, { 19, 7}, { 17, 8}, \
- { 9, 7}, { 20, 8}, { 11, 7}, { 24, 8}, \
+ { 8, 5}, { 17, 6}, { 17, 7}, { 17, 8}, \
+ { 9, 7}, { 19, 8}, { 11, 7}, { 23, 8}, \
{ 13, 9}, { 7, 8}, { 15, 7}, { 31, 8}, \
- { 21, 9}, { 11, 8}, { 27,10}, { 7, 9}, \
- { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
- { 23, 8}, { 47, 9}, { 27,10}, { 15, 9}, \
- { 39,10}, { 23, 9}, { 51,11}, { 15,10}, \
- { 31, 9}, { 67,10}, { 39, 9}, { 79,10}, \
- { 47, 9}, { 95,10}, { 55,11}, { 31,10}, \
+ { 19, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
+ { 33, 9}, { 19, 8}, { 39, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 47,11}, { 15,10}, { 31, 9}, \
+ { 67,10}, { 39, 9}, { 79,10}, { 47, 9}, \
+ { 95, 8}, { 191,10}, { 55,11}, { 31,10}, \
{ 63, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
- { 287,10}, { 79,11}, { 47,10}, { 95, 9}, \
- { 191,12}, { 31,11}, { 63, 9}, { 255, 8}, \
- { 511,10}, { 143, 9}, { 287,11}, { 79,10}, \
- { 159, 9}, { 319, 8}, { 639,10}, { 175, 9}, \
- { 351, 8}, { 703,11}, { 95,10}, { 191, 9}, \
- { 383, 8}, { 767,10}, { 207, 9}, { 415,12}, \
- { 63,10}, { 255, 9}, { 511,11}, { 143,10}, \
- { 287, 9}, { 575,11}, { 159,10}, { 319, 9}, \
+ { 287,10}, { 79, 9}, { 159,11}, { 47,10}, \
+ { 95, 9}, { 191, 8}, { 383, 7}, { 767,10}, \
+ { 103, 9}, { 207,12}, { 31,11}, { 63, 9}, \
+ { 255, 8}, { 511, 7}, { 1023, 9}, { 271,10}, \
+ { 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
+ { 319, 8}, { 639,10}, { 175, 9}, { 351, 8}, \
+ { 703,11}, { 95,10}, { 191, 9}, { 383, 8}, \
+ { 767,10}, { 207, 9}, { 415, 8}, { 831,10}, \
+ { 223,12}, { 63,10}, { 255, 9}, { 511, 8}, \
+ { 1023,10}, { 271,11}, { 143,10}, { 287, 9}, \
+ { 575, 8}, { 1151,11}, { 159,10}, { 319, 9}, \
{ 639,11}, { 175,10}, { 351, 9}, { 703,12}, \
{ 95,11}, { 191,10}, { 383, 9}, { 767,11}, \
- { 207,10}, { 415, 9}, { 831,11}, { 223,13}, \
- { 63,11}, { 255,10}, { 511, 9}, { 1023,11}, \
- { 287,10}, { 575, 9}, { 1151,12}, { 159,11}, \
- { 319,10}, { 639,11}, { 351,10}, { 703, 9}, \
- { 1407,12}, { 191,11}, { 383,10}, { 767,11}, \
- { 415,10}, { 831,12}, { 223,11}, { 447,10}, \
- { 895,11}, { 479,10}, { 959,12}, { 255,11}, \
- { 511,10}, { 1023,12}, { 287,11}, { 575,10}, \
- { 1151,12}, { 319,11}, { 639,12}, { 351,11}, \
- { 703,10}, { 1407,12}, { 383,11}, { 767,12}, \
- { 415,11}, { 831,10}, { 1663,12}, { 447,11}, \
- { 895,12}, { 479,11}, { 959,10}, { 1919,13}, \
- { 255,12}, { 511,11}, { 1023,12}, { 543,11}, \
- { 1087,12}, { 575,11}, { 1151,13}, { 319,12}, \
- { 639,11}, { 1279,12}, { 703,11}, { 1407,10}, \
- { 2815,13}, { 383,12}, { 831,11}, { 1663,13}, \
- { 447,12}, { 895,11}, { 1791,12}, { 959,11}, \
- { 1919,14}, { 255,13}, { 511,12}, { 1087,13}, \
- { 575,12}, { 1215,13}, { 639,12}, { 1279,13}, \
- { 703,12}, { 1407,11}, { 2815,14}, { 383,13}, \
- { 831,12}, { 1663,13}, { 895,12}, { 1791,13}, \
- { 959,12}, { 1919,15}, { 255,14}, { 511,13}, \
- { 1087,12}, { 2175,13}, { 1215,14}, { 639,13}, \
- { 1407,12}, { 2815,14}, { 767,13}, { 1663,14}, \
- { 895,13}, { 1919,12}, { 3839,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
- { 4863,14}, { 1407,13}, { 2815,15}, { 767,14}, \
- { 1919,13}, { 3839,16}, { 511,15}, { 1023,14}, \
- { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
- { 5887,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
- { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
- {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 210
-#define SQR_FFT_THRESHOLD 2496
+ { 207,10}, { 415, 9}, { 831,11}, { 223,10}, \
+ { 447,13}, { 8192,14}, { 16384,15}, { 32768,16}, \
+ { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+ {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 112
+#define SQR_FFT_THRESHOLD 2688
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 45
-#define MULLO_MUL_N_THRESHOLD 7035
+#define MULLO_DC_THRESHOLD 38
+#define MULLO_MUL_N_THRESHOLD 6253
#define SQRLO_BASECASE_THRESHOLD 4
-#define SQRLO_DC_THRESHOLD 108
-#define SQRLO_SQR_THRESHOLD 4955
-
-#define DC_DIV_QR_THRESHOLD 51
-#define DC_DIVAPPR_Q_THRESHOLD 184
-#define DC_BDIV_QR_THRESHOLD 47
-#define DC_BDIV_Q_THRESHOLD 50
-
-#define INV_MULMOD_BNM1_THRESHOLD 26
-#define INV_NEWTON_THRESHOLD 228
-#define INV_APPR_THRESHOLD 204
-
-#define BINV_NEWTON_THRESHOLD 248
-#define REDC_1_TO_REDC_N_THRESHOLD 60
-
-#define MU_DIV_QR_THRESHOLD 1210
-#define MU_DIVAPPR_Q_THRESHOLD 1234
-#define MUPI_DIV_QR_THRESHOLD 116
-#define MU_BDIV_QR_THRESHOLD 889
-#define MU_BDIV_Q_THRESHOLD 1210
-
-#define POWM_SEC_TABLE 1,23,194,712,2177
-
-#define GET_STR_DC_THRESHOLD 10
-#define GET_STR_PRECOMPUTE_THRESHOLD 22
-#define SET_STR_DC_THRESHOLD 1105
-#define SET_STR_PRECOMPUTE_THRESHOLD 3109
-
-#define FAC_DSC_THRESHOLD 298
-#define FAC_ODD_THRESHOLD 27
-
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 134
-#define HGCD_APPR_THRESHOLD 166
-#define HGCD_REDUCE_THRESHOLD 2121
-#define GCD_DC_THRESHOLD 531
-#define GCDEXT_DC_THRESHOLD 386
-#define JACOBI_BASE_METHOD 4
-
-/* Tuneup completed successfully, took 65068 seconds */
+#define SQRLO_DC_THRESHOLD 67
+#define SQRLO_SQR_THRESHOLD 5240
+
+#define DC_DIV_QR_THRESHOLD 42
+#define DC_DIVAPPR_Q_THRESHOLD 152
+#define DC_BDIV_QR_THRESHOLD 39
+#define DC_BDIV_Q_THRESHOLD 93
+
+#define INV_MULMOD_BNM1_THRESHOLD 37
+#define INV_NEWTON_THRESHOLD 163
+#define INV_APPR_THRESHOLD 162
+
+#define BINV_NEWTON_THRESHOLD 194
+#define REDC_1_TO_REDC_N_THRESHOLD 43
+
+#define MU_DIV_QR_THRESHOLD 998
+#define MU_DIVAPPR_Q_THRESHOLD 998
+#define MUPI_DIV_QR_THRESHOLD 98
+#define MU_BDIV_QR_THRESHOLD 807
+#define MU_BDIV_Q_THRESHOLD 924
+
+#define POWM_SEC_TABLE 6,30,194,579,1730
+
+#define GET_STR_DC_THRESHOLD 15
+#define GET_STR_PRECOMPUTE_THRESHOLD 29
+#define SET_STR_DC_THRESHOLD 788
+#define SET_STR_PRECOMPUTE_THRESHOLD 1816
+
+#define FAC_DSC_THRESHOLD 236
+#define FAC_ODD_THRESHOLD 24
+
+#define MATRIX22_STRASSEN_THRESHOLD 10
+#define HGCD2_DIV1_METHOD 1 /* 7.05% faster than 3 */
+#define HGCD_THRESHOLD 101
+#define HGCD_APPR_THRESHOLD 104
+#define HGCD_REDUCE_THRESHOLD 1679
+#define GCD_DC_THRESHOLD 330
+#define GCDEXT_DC_THRESHOLD 242
+#define JACOBI_BASE_METHOD 4 /* 20.00% faster than 1 */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/hamdist.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/hamdist.asm
index d298b951cf6..c72ca55b3ea 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/hamdist.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/hamdist.asm
@@ -31,8 +31,9 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 4.5
+C Cortex-A57 1.9
+C X-Gene 4.36
C TODO
C * Consider greater unrolling.
@@ -42,7 +43,7 @@ C valgrind!)
C * Explore if explicit align directives, e.g., "[ptr:128]" help.
C * See rth's gmp-devel 2013-02/03 messages about final summation tricks.
-changecom(@&*$)
+changecom(blah)
C INPUT PARAMETERS
define(`ap', x0)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/logops_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/logops_n.asm
index 0f75700cfd5..ccaec9cace3 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/logops_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/logops_n.asm
@@ -32,11 +32,13 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C cycles/limb cycles/limb
+C nand,nior all other
+C Cortex-A53 3.25-3.5 2.75-3
+C Cortex-A57 2.0 1.5
+C X-Gene 2.14 2.0
-changecom(@&*$)
+changecom(blah)
define(`rp', `x0')
define(`up', `x1')
@@ -76,31 +78,62 @@ MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n
ASM_START()
PROLOGUE(func)
- tbz n, #0, L(b0)
-
- ldr x4, [up],#8
- ldr x6, [vp],#8
- sub n, n, #1
- LOGOP( x8, x4, x6)
- POSTOP( x8)
- str x8, [rp],#8
- cbz n, L(rtn)
-
-L(b0): ldp x4, x5, [up],#16
- ldp x6, x7, [vp],#16
- sub n, n, #2
+ lsr x18, n, #2
+ tbz n, #0, L(bx0)
+
+L(bx1): ldr x7, [up]
+ ldr x11, [vp]
+ LOGOP( x15, x7, x11)
+ POSTOP( x15)
+ str x15, [rp],#8
+ tbnz n, #1, L(b11)
+
+L(b01): cbz x18, L(ret)
+ ldp x4, x5, [up,#8]
+ ldp x8, x9, [vp,#8]
+ sub up, up, #8
+ sub vp, vp, #8
+ b L(mid)
+
+L(b11): ldp x6, x7, [up,#8]
+ ldp x10, x11, [vp,#8]
+ add up, up, #8
+ add vp, vp, #8
+ cbz x18, L(end)
+ b L(top)
+
+L(bx0): tbnz n, #1, L(b10)
+
+L(b00): ldp x4, x5, [up],#-16
+ ldp x8, x9, [vp],#-16
b L(mid)
-L(top): ldp x4, x5, [up],#16
- ldp x6, x7, [vp],#16
- sub n, n, #2
- stp x8, x9, [rp],#16
-L(mid): LOGOP( x8, x4, x6)
- LOGOP( x9, x5, x7)
- POSTOP( x8)
- POSTOP( x9)
- cbnz n, L(top)
-
- stp x8, x9, [rp],#16
-L(rtn): ret
+L(b10): ldp x6, x7, [up]
+ ldp x10, x11, [vp]
+ cbz x18, L(end)
+
+ ALIGN(16)
+L(top): ldp x4, x5, [up,#16]
+ ldp x8, x9, [vp,#16]
+ LOGOP( x12, x6, x10)
+ LOGOP( x13, x7, x11)
+ POSTOP( x12)
+ POSTOP( x13)
+ stp x12, x13, [rp],#16
+L(mid): ldp x6, x7, [up,#32]!
+ ldp x10, x11, [vp,#32]!
+ LOGOP( x12, x4, x8)
+ LOGOP( x13, x5, x9)
+ POSTOP( x12)
+ POSTOP( x13)
+ stp x12, x13, [rp],#16
+ sub x18, x18, #1
+ cbnz x18, L(top)
+
+L(end): LOGOP( x12, x6, x10)
+ LOGOP( x13, x7, x11)
+ POSTOP( x12)
+ POSTOP( x13)
+ stp x12, x13, [rp]
+L(ret): ret
EPILOGUE()
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 bf6f0ad0721..472b7ec00ea 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/lshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/lshift.asm
@@ -1,6 +1,6 @@
dnl ARM64 mpn_lshift.
-dnl Copyright 2013, 2014 Free Software Foundation, Inc.
+dnl Copyright 2013, 2014, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
@@ -19,11 +19,19 @@ dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C cycles/limb assumed optimal c/l
+C Cortex-A53 3.5-4.0 3.25
+C Cortex-A57 2.0 2.0
+C X-Gene 2.67 2.5
-changecom(@&*$)
+C TODO
+C * The feed-in code used 1 ldr for odd sized and 2 ldr for even sizes. These
+C numbers should be 1 and 0, respectively. The str in wind-down should also
+C go.
+C * Using extr and with 63 separate loops we might reach 1.25 c/l on A57.
+C * A53's speed depends on alignment, tune/speed -w1 gives 3.5, -w0 gives 4.0.
+
+changecom(blah)
define(`rp_arg', `x0')
define(`up', `x1')
@@ -34,46 +42,45 @@ define(`rp', `x16')
define(`tnc',`x8')
+define(`PSHIFT', lsl)
+define(`NSHIFT', lsr)
+
ASM_START()
PROLOGUE(mpn_lshift)
add rp, rp_arg, n, lsl #3
add up, up, n, lsl #3
sub tnc, xzr, cnt
+ lsr x18, n, #2
tbz n, #0, L(bx0)
L(bx1): ldr x4, [up,#-8]
tbnz n, #1, L(b11)
-L(b01): lsr x0, x4, tnc
- lsl x18, x4, cnt
- sub n, n, #1
- cbnz n, L(gt1)
- str x18, [rp,#-8]
+L(b01): NSHIFT x0, x4, tnc
+ PSHIFT x2, x4, cnt
+ cbnz x18, L(gt1)
+ str x2, [rp,#-8]
ret
L(gt1): ldp x4, x5, [up,#-24]
sub up, up, #8
add rp, rp, #16
b L(lo2)
-L(b11): lsr x0, x4, tnc
- lsl x9, x4, cnt
- ldp x6, x7, [up,#-24]
- add n, n, #1
- add up, up, #8
- add rp, rp, #32
- b L(lo0)
+L(b11): NSHIFT x0, x4, tnc
+ PSHIFT x2, x4, cnt
+ ldp x6, x7, [up,#-24]!
+ b L(lo3)
L(bx0): ldp x4, x5, [up,#-16]
tbz n, #1, L(b00)
-L(b10): lsr x0, x5, tnc
- lsl x13, x5, cnt
- lsr x10, x4, tnc
- lsl x18, x4, cnt
- sub n, n, #2
- cbnz n, L(gt2)
+L(b10): NSHIFT x0, x5, tnc
+ PSHIFT x13, x5, cnt
+ NSHIFT x10, x4, tnc
+ PSHIFT x2, x4, cnt
+ cbnz x18, L(gt2)
orr x10, x10, x13
- stp x18, x10, [rp,#-16]
+ stp x2, x10, [rp,#-16]
ret
L(gt2): ldp x4, x5, [up,#-32]
orr x10, x10, x13
@@ -82,41 +89,39 @@ L(gt2): ldp x4, x5, [up,#-32]
add rp, rp, #8
b L(lo2)
-L(b00): lsr x0, x5, tnc
- lsl x13, x5, cnt
- lsr x10, x4, tnc
- lsl x9, x4, cnt
- ldp x6, x7, [up,#-32]
+L(b00): NSHIFT x0, x5, tnc
+ PSHIFT x13, x5, cnt
+ NSHIFT x10, x4, tnc
+ PSHIFT x2, x4, cnt
+ ldp x6, x7, [up,#-32]!
orr x10, x10, x13
- str x10, [rp,#-8]
- add rp, rp, #24
+ str x10, [rp,#-8]!
b L(lo0)
ALIGN(16)
-L(top): ldp x4, x5, [up,#-48]
- sub rp, rp, #32 C integrate with stp?
- sub up, up, #32 C integrate with ldp?
- orr x11, x11, x9
+L(top): ldp x4, x5, [up,#-16]
orr x10, x10, x13
+ orr x11, x12, x2
stp x10, x11, [rp,#-16]
-L(lo2): lsr x11, x5, tnc
- lsl x13, x5, cnt
- lsr x10, x4, tnc
- lsl x9, x4, cnt
- ldp x6, x7, [up,#-32]
- orr x11, x11, x18
- orr x10, x10, x13
- stp x10, x11, [rp,#-32]
-L(lo0): sub n, n, #4
- lsr x11, x7, tnc
- lsl x13, x7, cnt
- lsr x10, x6, tnc
- lsl x18, x6, cnt
- cbnz n, L(top)
-
-L(end): orr x11, x11, x9
+ PSHIFT x2, x6, cnt
+L(lo2): NSHIFT x10, x4, tnc
+ PSHIFT x13, x5, cnt
+ NSHIFT x12, x5, tnc
+ ldp x6, x7, [up,#-32]!
orr x10, x10, x13
- stp x10, x11, [rp,#-48]
- str x18, [rp,#-56]
+ orr x11, x12, x2
+ stp x10, x11, [rp,#-32]!
+ PSHIFT x2, x4, cnt
+L(lo0): sub x18, x18, #1
+L(lo3): NSHIFT x10, x6, tnc
+ PSHIFT x13, x7, cnt
+ NSHIFT x12, x7, tnc
+ cbnz x18, L(top)
+
+L(end): orr x10, x10, x13
+ orr x11, x12, x2
+ PSHIFT x2, x6, cnt
+ stp x10, x11, [rp,#-16]
+ str x2, [rp,#-24]
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/lshiftc.asm
new file mode 100644
index 00000000000..dd4c4ce3353
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/lshiftc.asm
@@ -0,0 +1,130 @@
+dnl ARM64 mpn_lshiftc.
+
+dnl Copyright 2013, 2014, 2017 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+
+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 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/.
+
+include(`../config.m4')
+
+C cycles/limb assumed optimal c/l
+C Cortex-A53 3.5-4.0 3.25
+C Cortex-A57 2.0 2.0
+C X-Gene 2.67 2.5
+
+C TODO
+C * The feed-in code used 1 ldr for odd sized and 2 ldr for even sizes. These
+C numbers should be 1 and 0, respectively. The str in wind-down should also
+C go.
+C * Using extr and with 63 separate loops we might reach 1.5 c/l on A57.
+C * A53's speed depends on alignment, tune/speed -w1 gives 3.5, -w0 gives 4.0.
+
+changecom(blah)
+
+define(`rp_arg', `x0')
+define(`up', `x1')
+define(`n', `x2')
+define(`cnt', `x3')
+
+define(`rp', `x16')
+
+define(`tnc',`x8')
+
+define(`PSHIFT', lsl)
+define(`NSHIFT', lsr)
+
+ASM_START()
+PROLOGUE(mpn_lshiftc)
+ add rp, rp_arg, n, lsl #3
+ add up, up, n, lsl #3
+ sub tnc, xzr, cnt
+ lsr x18, n, #2
+ tbz n, #0, L(bx0)
+
+L(bx1): ldr x4, [up,#-8]
+ tbnz n, #1, L(b11)
+
+L(b01): NSHIFT x0, x4, tnc
+ PSHIFT x2, x4, cnt
+ cbnz x18, L(gt1)
+ mvn x2, x2
+ str x2, [rp,#-8]
+ ret
+L(gt1): ldp x4, x5, [up,#-24]
+ sub up, up, #8
+ add rp, rp, #16
+ b L(lo2)
+
+L(b11): NSHIFT x0, x4, tnc
+ PSHIFT x2, x4, cnt
+ ldp x6, x7, [up,#-24]!
+ b L(lo3)
+
+L(bx0): ldp x4, x5, [up,#-16]
+ tbz n, #1, L(b00)
+
+L(b10): NSHIFT x0, x5, tnc
+ PSHIFT x13, x5, cnt
+ NSHIFT x10, x4, tnc
+ PSHIFT x2, x4, cnt
+ cbnz x18, L(gt2)
+ eon x10, x10, x13
+ mvn x2, x2
+ stp x2, x10, [rp,#-16]
+ ret
+L(gt2): ldp x4, x5, [up,#-32]
+ eon x10, x10, x13
+ str x10, [rp,#-8]
+ sub up, up, #16
+ add rp, rp, #8
+ b L(lo2)
+
+L(b00): NSHIFT x0, x5, tnc
+ PSHIFT x13, x5, cnt
+ NSHIFT x10, x4, tnc
+ PSHIFT x2, x4, cnt
+ ldp x6, x7, [up,#-32]!
+ eon x10, x10, x13
+ str x10, [rp,#-8]!
+ b L(lo0)
+
+ ALIGN(16)
+L(top): ldp x4, x5, [up,#-16]
+ eon x10, x10, x13
+ eon x11, x12, x2
+ stp x10, x11, [rp,#-16]
+ PSHIFT x2, x6, cnt
+L(lo2): NSHIFT x10, x4, tnc
+ PSHIFT x13, x5, cnt
+ NSHIFT x12, x5, tnc
+ ldp x6, x7, [up,#-32]!
+ eon x10, x10, x13
+ eon x11, x12, x2
+ stp x10, x11, [rp,#-32]!
+ PSHIFT x2, x4, cnt
+L(lo0): sub x18, x18, #1
+L(lo3): NSHIFT x10, x6, tnc
+ PSHIFT x13, x7, cnt
+ NSHIFT x12, x7, tnc
+ cbnz x18, L(top)
+
+L(end): eon x10, x10, x13
+ eon x11, x12, x2
+ PSHIFT x2, x6, cnt
+ stp x10, x11, [rp,#-16]
+ mvn x2, x2
+ str x2, [rp,#-24]
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/mod_34lsub1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/mod_34lsub1.asm
index 96d38121f77..7945fe72c7d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/mod_34lsub1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/mod_34lsub1.asm
@@ -31,18 +31,19 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 2
+C Cortex-A57 1
+C X-Gene 1.45
define(`ap', x0)
define(`n', x1)
-changecom(@&*$)
+changecom(blah)
C mp_limb_t mpn_mod_34lsub1 (mp_srcptr up, mp_size_t n)
C TODO
-C * An alternative inner loop which could run at 0.722 c/l:
+C * An alternative inner loop which could run at 0.722 c/l on A57:
C adds x8, x8, x2
C adcs x9, x9, x3
C ldp x2, x3, [ap, #-32]
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/mul_1.asm
index c13869938c1..d1d3394aa45 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/mul_1.asm
@@ -2,7 +2,7 @@ dnl ARM64 mpn_mul_1
dnl Contributed to the GNU project by Torbjörn Granlund.
-dnl Copyright 2013 Free Software Foundation, Inc.
+dnl Copyright 2013, 2015, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -33,66 +33,95 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 7.5-8
+C Cortex-A57 7
+C Cortex-A72
+C X-Gene 4
+
+C TODO
+C * Start first multiply earlier.
+
+changecom(blah)
define(`rp', `x0')
define(`up', `x1')
define(`n', `x2')
define(`v0', `x3')
-ASM_START()
+
+PROLOGUE(mpn_mul_1c)
+ adds xzr, xzr, xzr C clear cy flag
+ b L(com)
+EPILOGUE()
+
PROLOGUE(mpn_mul_1)
- ldr x12, [up], #8
- and x6, n, #3
- and n, n, #-4
- cbz x6, L(fi0)
- cmp x6, #2
- b.cc L(fi1)
- b.eq L(fi2)
-
-L(fi3): mul x8, x12, v0
- umulh x13, x12, v0
- cmn xzr, xzr
- b L(L3)
-L(fi2): mul x7, x12, v0
- umulh x5, x12, v0
- cmn xzr, xzr
- b L(L2)
-L(fi0): mul x9, x12, v0
- umulh x5, x12, v0
- sub n, n, #4
- cmn xzr, xzr
- b L(L0)
-L(fi1): mul x10, x12, v0
- umulh x13, x12, v0
- cmn xzr, xzr
- cbz n, L(end)
-
-L(top): sub n, n, #4
- ldr x12, [up], #8
- mul x6, x12, v0
- umulh x5, x12, v0
- str x10, [rp], #8
- adcs x9, x6, x13
-L(L0): ldr x12, [up], #8
- mul x6, x12, v0
- umulh x13, x12, v0
- str x9, [rp] ,#8
- adcs x8, x6, x5
-L(L3): ldr x12, [up], #8
- mul x6, x12, v0
- umulh x5, x12, v0
- str x8, [rp], #8
- adcs x7, x6, x13
-L(L2): ldr x12, [up], #8
- mul x6, x12, v0
- umulh x13, x12, v0
- str x7, [rp], #8
- adcs x10, x6, x5
- cbnz n, L(top)
-
-L(end): str x10, [rp]
- adc x0, x13, xzr
+ adds x4, xzr, xzr C clear register and cy flag
+L(com): lsr x18, n, #2
+ tbnz n, #0, L(bx1)
+
+L(bx0): mov x11, x4
+ tbz n, #1, L(b00)
+
+L(b10): ldp x4, x5, [up]
+ mul x8, x4, v0
+ umulh x10, x4, v0
+ cbz x18, L(2)
+ ldp x6, x7, [up,#16]!
+ mul x9, x5, v0
+ b L(mid)-8
+
+L(2): mul x9, x5, v0
+ b L(2e)
+
+L(bx1): ldr x7, [up],#8
+ mul x9, x7, v0
+ umulh x11, x7, v0
+ adds x9, x9, x4
+ str x9, [rp],#8
+ tbnz n, #1, L(b10)
+
+L(b01): cbz x18, L(1)
+
+L(b00): ldp x6, x7, [up]
+ mul x8, x6, v0
+ umulh x10, x6, v0
+ ldp x4, x5, [up,#16]
+ mul x9, x7, v0
+ adcs x12, x8, x11
+ umulh x11, x7, v0
+ add rp, rp, #16
+ sub x18, x18, #1
+ cbz x18, L(end)
+
+ ALIGN(16)
+L(top): mul x8, x4, v0
+ ldp x6, x7, [up,#32]!
+ adcs x13, x9, x10
+ umulh x10, x4, v0
+ mul x9, x5, v0
+ stp x12, x13, [rp,#-16]
+ adcs x12, x8, x11
+ umulh x11, x5, v0
+L(mid): mul x8, x6, v0
+ ldp x4, x5, [up,#16]
+ adcs x13, x9, x10
+ umulh x10, x6, v0
+ mul x9, x7, v0
+ stp x12, x13, [rp],#32
+ adcs x12, x8, x11
+ umulh x11, x7, v0
+ sub x18, x18, #1
+ cbnz x18, L(top)
+
+L(end): mul x8, x4, v0
+ adcs x13, x9, x10
+ umulh x10, x4, v0
+ mul x9, x5, v0
+ stp x12, x13, [rp,#-16]
+L(2e): adcs x12, x8, x11
+ umulh x11, x5, v0
+ adcs x13, x9, x10
+ stp x12, x13, [rp]
+L(1): adc x0, x11, xzr
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/popcount.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/popcount.asm
index 8c95c1fcc5e..74de3fc01e1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/popcount.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/popcount.asm
@@ -31,8 +31,9 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 2.5
+C Cortex-A57 1.14
+C X-Gene 3
C TODO
C * Consider greater unrolling.
@@ -42,7 +43,7 @@ C valgrind!)
C * Explore if explicit align directives, e.g., "[ptr:128]" help.
C * See rth's gmp-devel 2013-02/03 messages about final summation tricks.
-changecom(@&*$)
+changecom(blah)
C INPUT PARAMETERS
define(`ap', x0)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/rsh1aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/rsh1aors_n.asm
new file mode 100644
index 00000000000..e0b760b3ce8
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/rsh1aors_n.asm
@@ -0,0 +1,168 @@
+dnl ARM64 mpn_rsh1add_n and mpn_rsh1sub_n.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb assumed optimal c/l
+C Cortex-A53 3.25-3.75 3.0 steady
+C Cortex-A57 2.15 1.75
+C X-Gene 2.75 2.5
+
+changecom(blah)
+
+define(`rp', `x0')
+define(`up', `x1')
+define(`vp', `x2')
+define(`n', `x3')
+
+ifdef(`OPERATION_rsh1add_n', `
+ define(`ADDSUB', adds)
+ define(`ADDSUBC', adcs)
+ define(`COND', `cs')
+ define(`func_n', mpn_rsh1add_n)')
+ifdef(`OPERATION_rsh1sub_n', `
+ define(`ADDSUB', subs)
+ define(`ADDSUBC', sbcs)
+ define(`COND', `cc')
+ define(`func_n', mpn_rsh1sub_n)')
+
+MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1sub_n)
+
+ASM_START()
+PROLOGUE(func_n)
+ lsr x18, n, #2
+
+ tbz n, #0, L(bx0)
+
+L(bx1): ldr x5, [up],#8
+ ldr x9, [vp],#8
+ tbnz n, #1, L(b11)
+
+L(b01): ADDSUB x13, x5, x9
+ and x10, x13, #1
+ cbz x18, L(1)
+ ldp x4, x5, [up],#48
+ ldp x8, x9, [vp],#48
+ ADDSUBC x14, x4, x8
+ ADDSUBC x15, x5, x9
+ ldp x4, x5, [up,#-32]
+ ldp x8, x9, [vp,#-32]
+ extr x17, x14, x13, #1
+ ADDSUBC x12, x4, x8
+ ADDSUBC x13, x5, x9
+ str x17, [rp], #24
+ sub x18, x18, #1
+ cbz x18, L(end)
+ b L(top)
+
+L(1): cset x14, COND
+ extr x17, x14, x13, #1
+ str x17, [rp]
+ mov x0, x10
+ ret
+
+L(b11): ADDSUB x15, x5, x9
+ and x10, x15, #1
+
+ ldp x4, x5, [up],#32
+ ldp x8, x9, [vp],#32
+ ADDSUBC x12, x4, x8
+ ADDSUBC x13, x5, x9
+ cbz x18, L(3)
+ ldp x4, x5, [up,#-16]
+ ldp x8, x9, [vp,#-16]
+ extr x17, x12, x15, #1
+ ADDSUBC x14, x4, x8
+ ADDSUBC x15, x5, x9
+ str x17, [rp], #8
+ b L(mid)
+
+L(3): extr x17, x12, x15, #1
+ str x17, [rp], #8
+ b L(2)
+
+L(bx0): tbz n, #1, L(b00)
+
+L(b10): ldp x4, x5, [up],#32
+ ldp x8, x9, [vp],#32
+ ADDSUB x12, x4, x8
+ ADDSUBC x13, x5, x9
+ and x10, x12, #1
+ cbz x18, L(2)
+ ldp x4, x5, [up,#-16]
+ ldp x8, x9, [vp,#-16]
+ ADDSUBC x14, x4, x8
+ ADDSUBC x15, x5, x9
+ b L(mid)
+
+L(b00): ldp x4, x5, [up],#48
+ ldp x8, x9, [vp],#48
+ ADDSUB x14, x4, x8
+ ADDSUBC x15, x5, x9
+ and x10, x14, #1
+ ldp x4, x5, [up,#-32]
+ ldp x8, x9, [vp,#-32]
+ ADDSUBC x12, x4, x8
+ ADDSUBC x13, x5, x9
+ add rp, rp, #16
+ sub x18, x18, #1
+ cbz x18, L(end)
+
+ ALIGN(16)
+L(top): ldp x4, x5, [up,#-16]
+ ldp x8, x9, [vp,#-16]
+ extr x16, x15, x14, #1
+ extr x17, x12, x15, #1
+ ADDSUBC x14, x4, x8
+ ADDSUBC x15, x5, x9
+ stp x16, x17, [rp,#-16]
+L(mid): ldp x4, x5, [up],#32
+ ldp x8, x9, [vp],#32
+ extr x16, x13, x12, #1
+ extr x17, x14, x13, #1
+ ADDSUBC x12, x4, x8
+ ADDSUBC x13, x5, x9
+ stp x16, x17, [rp],#32
+ sub x18, x18, #1
+ cbnz x18, L(top)
+
+L(end): extr x16, x15, x14, #1
+ extr x17, x12, x15, #1
+ stp x16, x17, [rp,#-16]
+L(2): cset x14, COND
+ extr x16, x13, x12, #1
+ extr x17, x14, x13, #1
+ stp x16, x17, [rp]
+
+L(ret): mov x0, x10
+ ret
+EPILOGUE()
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 010b4dce087..78ae9602b3d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/rshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/rshift.asm
@@ -1,6 +1,6 @@
dnl ARM64 mpn_rshift.
-dnl Copyright 2013, 2014 Free Software Foundation, Inc.
+dnl Copyright 2013, 2014, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
@@ -19,11 +19,19 @@ dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C cycles/limb assumed optimal c/l
+C Cortex-A53 3.5-4.0 3.25
+C Cortex-A57 2.0 2.0
+C X-Gene 2.67 2.5
-changecom(@&*$)
+C TODO
+C * The feed-in code used 1 ldr for odd sized and 2 ldr for even sizes. These
+C numbers should be 1 and 0, respectively. The str in wind-down should also
+C go.
+C * Using extr and with 63 separate loops we might reach 1.25 c/l on A57.
+C * A53's speed depends on alignment, but not as simply as for lshift/lshiftc.
+
+changecom(blah)
define(`rp_arg', `x0')
define(`up', `x1')
@@ -34,88 +42,84 @@ define(`rp', `x16')
define(`tnc',`x8')
+define(`PSHIFT', lsr)
+define(`NSHIFT', lsl)
+
ASM_START()
PROLOGUE(mpn_rshift)
mov rp, rp_arg
sub tnc, xzr, cnt
+ lsr x18, n, #2
tbz n, #0, L(bx0)
-L(bx1): ldr x4, [up,#0]
+L(bx1): ldr x5, [up]
tbnz n, #1, L(b11)
-L(b01): lsl x0, x4, tnc
- lsr x18, x4, cnt
- sub n, n, #1
- cbnz n, L(gt1)
- str x18, [rp,#0]
+L(b01): NSHIFT x0, x5, tnc
+ PSHIFT x2, x5, cnt
+ cbnz x18, L(gt1)
+ str x2, [rp]
ret
-L(gt1): ldp x5, x4, [up,#8]
+L(gt1): ldp x4, x5, [up,#8]
sub up, up, #8
sub rp, rp, #32
b L(lo2)
-L(b11): lsl x0, x4, tnc
- lsr x9, x4, cnt
- ldp x7, x6, [up,#8]
- add n, n, #1
- sub up, up, #24
- sub rp, rp, #48
- b L(lo0)
+L(b11): NSHIFT x0, x5, tnc
+ PSHIFT x2, x5, cnt
+ ldp x6, x7, [up,#8]!
+ sub rp, rp, #16
+ b L(lo3)
-L(bx0): ldp x5, x4, [up,#0]
+L(bx0): ldp x4, x5, [up]
tbz n, #1, L(b00)
-L(b10): lsl x0, x5, tnc
- lsr x13, x5, cnt
- lsl x10, x4, tnc
- lsr x18, x4, cnt
- sub n, n, #2
- cbnz n, L(gt2)
+L(b10): NSHIFT x0, x4, tnc
+ PSHIFT x13, x4, cnt
+ NSHIFT x10, x5, tnc
+ PSHIFT x2, x5, cnt
+ cbnz x18, L(gt2)
orr x10, x10, x13
- stp x10, x18, [rp,#0]
+ stp x10, x2, [rp]
ret
-L(gt2): ldp x5, x4, [up,#16]
+L(gt2): ldp x4, x5, [up,#16]
orr x10, x10, x13
- str x10, [rp,#0]
- sub rp, rp, #24
+ str x10, [rp],#-24
b L(lo2)
-L(b00): lsl x0, x5, tnc
- lsr x13, x5, cnt
- lsl x10, x4, tnc
- lsr x9, x4, cnt
- ldp x7, x6, [up,#16]
+L(b00): NSHIFT x0, x4, tnc
+ PSHIFT x13, x4, cnt
+ NSHIFT x10, x5, tnc
+ PSHIFT x2, x5, cnt
+ ldp x6, x7, [up,#16]!
orr x10, x10, x13
- str x10, [rp,#0]
- sub up, up, #16
- sub rp, rp, #40
+ str x10, [rp],#-8
b L(lo0)
ALIGN(16)
-L(top): ldp x5, x4, [up,#48]
- add rp, rp, #32 C integrate with stp?
- add up, up, #32 C integrate with ldp?
- orr x11, x11, x9
+L(top): ldp x4, x5, [up,#16]
orr x10, x10, x13
+ orr x11, x12, x2
stp x11, x10, [rp,#16]
-L(lo2): lsl x11, x5, tnc
- lsr x13, x5, cnt
- lsl x10, x4, tnc
- lsr x9, x4, cnt
- ldp x7, x6, [up,#32]
- orr x11, x11, x18
+ PSHIFT x2, x7, cnt
+L(lo2): NSHIFT x10, x5, tnc
+ NSHIFT x12, x4, tnc
+ PSHIFT x13, x4, cnt
+ ldp x6, x7, [up,#32]!
orr x10, x10, x13
- stp x11, x10, [rp,#32]
-L(lo0): sub n, n, #4
- lsl x11, x7, tnc
- lsr x13, x7, cnt
- lsl x10, x6, tnc
- lsr x18, x6, cnt
- cbnz n, L(top)
-
-L(end): orr x11, x11, x9
- orr x10, x10, x13
- stp x11, x10, [rp,#48]
- str x18, [rp,#64]
+ orr x11, x12, x2
+ stp x11, x10, [rp,#32]!
+ PSHIFT x2, x5, cnt
+L(lo0): sub x18, x18, #1
+L(lo3): NSHIFT x10, x7, tnc
+ NSHIFT x12, x6, tnc
+ PSHIFT x13, x6, cnt
+ cbnz x18, L(top)
+
+L(end): orr x10, x10, x13
+ orr x11, x12, x2
+ PSHIFT x2, x7, cnt
+ stp x11, x10, [rp,#16]
+ str x2, [rp,#32]
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/sec_tabselect.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/sec_tabselect.asm
index bf2962cfa1b..18a268ace6b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/arm64/sec_tabselect.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/sec_tabselect.asm
@@ -34,14 +34,15 @@ include(`../config.m4')
C cycles/limb
-C Cortex-A53 ?
-C Cortex-A57 ?
+C Cortex-A53 2.25
+C Cortex-A57 1.33
+C X-Gene 2
C void
C mpn_sec_tabselect (mp_ptr rp, mp_srcptr *tab,
C mp_size_t n, mp_size_t nents, mp_size_t which)
-changecom(@&*$)
+changecom(blah)
define(`rp', `x0')
define(`tp', `x1')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/sqr_diag_addlsh1.asm b/Build/source/libs/gmp/gmp-src/mpn/arm64/sqr_diag_addlsh1.asm
new file mode 100644
index 00000000000..55b5ac72ce3
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/sqr_diag_addlsh1.asm
@@ -0,0 +1,102 @@
+dnl ARM64 mpn_sqr_diag_addlsh1.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 2016, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C Cortex-A53 5.65
+C Cortex-A57 3.5
+C X-Gene 3.38
+
+changecom(blah)
+
+define(`rp', `x0')
+define(`tp', `x1')
+define(`up', `x2')
+define(`n', `x3')
+
+ASM_START()
+PROLOGUE(mpn_sqr_diag_addlsh1)
+ ldr x15, [up],#8
+ lsr x18, n, #1
+ tbz n, #0, L(bx0)
+
+L(bx1): adds x7, xzr, xzr
+ mul x12, x15, x15
+ ldr x16, [up],#8
+ ldp x4, x5, [tp],#16
+ umulh x11, x15, x15
+ b L(mid)
+
+L(bx0): adds x5, xzr, xzr
+ mul x12, x15, x15
+ ldr x17, [up],#16
+ ldp x6, x7, [tp],#32
+ umulh x11, x15, x15
+ sub x18, x18, #1
+ cbz x18, L(end)
+
+ ALIGN(16)
+L(top): extr x9, x6, x5, #63
+ mul x10, x17, x17
+ ldr x16, [up,#-8]
+ adcs x13, x9, x11
+ ldp x4, x5, [tp,#-16]
+ umulh x11, x17, x17
+ extr x8, x7, x6, #63
+ stp x12, x13, [rp],#16
+ adcs x12, x8, x10
+L(mid): extr x9, x4, x7, #63
+ mul x10, x16, x16
+ ldr x17, [up],#16
+ adcs x13, x9, x11
+ ldp x6, x7, [tp],#32
+ umulh x11, x16, x16
+ extr x8, x5, x4, #63
+ stp x12, x13, [rp],#16
+ adcs x12, x8, x10
+ sub x18, x18, #1
+ cbnz x18, L(top)
+
+L(end): extr x9, x6, x5, #63
+ mul x10, x17, x17
+ adcs x13, x9, x11
+ umulh x11, x17, x17
+ extr x8, x7, x6, #63
+ stp x12, x13, [rp]
+ adcs x12, x8, x10
+ extr x9, xzr, x7, #63
+ adcs x13, x9, x11
+ stp x12, x13, [rp,#16]
+
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/arm64/xgene1/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/arm64/xgene1/gmp-mparam.h
new file mode 100644
index 00000000000..7cc3cb3fdfc
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/arm64/xgene1/gmp-mparam.h
@@ -0,0 +1,181 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 2400 MHz AppliedMicro X-Gene */
+/* FFT tuning limit = 0.5 M */
+/* Generated by tuneup.c, 2019-09-28, gcc 4.8 */
+
+#define DIVREM_1_NORM_THRESHOLD 0 /* always */
+#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1P_METHOD 1 /* 2.00% faster than 2 */
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 22
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 13
+#define USE_PREINV_DIVREM_1 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 37.38% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_UNNORM_THRESHOLD 1
+#define DIV_QR_2_PI2_THRESHOLD 14
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define BMOD_1_TO_MOD_1_THRESHOLD 27
+
+#define DIV_1_VS_MUL_1_PERCENT 249
+
+#define MUL_TOOM22_THRESHOLD 18
+#define MUL_TOOM33_THRESHOLD 61
+#define MUL_TOOM44_THRESHOLD 112
+#define MUL_TOOM6H_THRESHOLD 242
+#define MUL_TOOM8H_THRESHOLD 321
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 99
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 109
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 72
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 106
+
+#define SQR_BASECASE_THRESHOLD 0 /* always */
+#define SQR_TOOM2_THRESHOLD 28
+#define SQR_TOOM3_THRESHOLD 81
+#define SQR_TOOM4_THRESHOLD 154
+#define SQR_TOOM6_THRESHOLD 214
+#define SQR_TOOM8_THRESHOLD 284
+
+#define MULMID_TOOM42_THRESHOLD 46
+
+#define MULMOD_BNM1_THRESHOLD 11
+#define SQRMOD_BNM1_THRESHOLD 13
+
+#define MUL_FFT_MODF_THRESHOLD 412 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 412, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \
+ { 19, 7}, { 12, 6}, { 25, 7}, { 17, 8}, \
+ { 9, 7}, { 20, 8}, { 11, 7}, { 25, 8}, \
+ { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
+ { 17, 7}, { 35, 8}, { 21, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 49, 9}, { 27,10}, \
+ { 15, 9}, { 31, 8}, { 63, 9}, { 39,10}, \
+ { 23, 9}, { 55,11}, { 15,10}, { 31, 9}, \
+ { 71,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 99,10}, { 55,11}, { 31,10}, { 63, 9}, \
+ { 127,10}, { 71, 9}, { 143,10}, { 79,11}, \
+ { 47,10}, { 103,12}, { 31,11}, { 63,10}, \
+ { 127, 9}, { 255,10}, { 135, 9}, { 271,10}, \
+ { 143,11}, { 79, 9}, { 319,10}, { 167, 9}, \
+ { 351,11}, { 95, 9}, { 383, 8}, { 767,10}, \
+ { 207, 9}, { 415,11}, { 111,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,11}, { 143,10}, { 287, 9}, { 575,10}, \
+ { 319, 9}, { 639,10}, { 351,12}, { 95,10}, \
+ { 383, 9}, { 767,11}, { 207,10}, { 415, 9}, \
+ { 831,11}, { 223,10}, { 447,13}, { 8192,14}, \
+ { 16384,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
+ { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+ {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 98
+#define MUL_FFT_THRESHOLD 4736
+
+#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 340, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
+ { 19, 7}, { 10, 6}, { 21, 7}, { 11, 6}, \
+ { 23, 7}, { 21, 8}, { 11, 7}, { 24, 8}, \
+ { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
+ { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 31, 8}, { 63, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 67,10}, { 39, 9}, { 79,10}, { 47, 9}, \
+ { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95, 9}, { 191,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
+ { 135, 9}, { 271,11}, { 79, 9}, { 319, 8}, \
+ { 639,10}, { 175,11}, { 95,10}, { 191, 9}, \
+ { 383,10}, { 207,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
+ { 287, 9}, { 575,10}, { 319, 9}, { 639,11}, \
+ { 175,10}, { 351,12}, { 95,11}, { 191,10}, \
+ { 383, 9}, { 767,11}, { 207,10}, { 415,13}, \
+ { 8192,14}, { 16384,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 87
+#define SQR_FFT_THRESHOLD 3264
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 45
+#define MULLO_MUL_N_THRESHOLD 8648
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 108
+#define SQRLO_SQR_THRESHOLD 6461
+
+#define DC_DIV_QR_THRESHOLD 64
+#define DC_DIVAPPR_Q_THRESHOLD 222
+#define DC_BDIV_QR_THRESHOLD 63
+#define DC_BDIV_Q_THRESHOLD 132
+
+#define INV_MULMOD_BNM1_THRESHOLD 38
+#define INV_NEWTON_THRESHOLD 242
+#define INV_APPR_THRESHOLD 222
+
+#define BINV_NEWTON_THRESHOLD 254
+#define REDC_1_TO_REDC_N_THRESHOLD 66
+
+#define MU_DIV_QR_THRESHOLD 1234
+#define MU_DIVAPPR_Q_THRESHOLD 1234
+#define MUPI_DIV_QR_THRESHOLD 122
+#define MU_BDIV_QR_THRESHOLD 1210
+#define MU_BDIV_Q_THRESHOLD 1234
+
+#define POWM_SEC_TABLE 3,23,194,712,2499
+
+#define GET_STR_DC_THRESHOLD 11
+#define GET_STR_PRECOMPUTE_THRESHOLD 22
+#define SET_STR_DC_THRESHOLD 381
+#define SET_STR_PRECOMPUTE_THRESHOLD 2503
+
+#define FAC_DSC_THRESHOLD 216
+#define FAC_ODD_THRESHOLD 26
+
+#define MATRIX22_STRASSEN_THRESHOLD 14
+#define HGCD2_DIV1_METHOD 5 /* 2.01% faster than 3 */
+#define HGCD_THRESHOLD 122
+#define HGCD_APPR_THRESHOLD 171
+#define HGCD_REDUCE_THRESHOLD 2479
+#define GCD_DC_THRESHOLD 541
+#define GCDEXT_DC_THRESHOLD 386
+#define JACOBI_BASE_METHOD 4 /* 7.46% faster than 1 */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/asm-defs.m4 b/Build/source/libs/gmp/gmp-src/mpn/asm-defs.m4
index e573cc4ca82..7b7e53e4179 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/asm-defs.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/asm-defs.m4
@@ -1394,6 +1394,8 @@ define_mpn(divrem_newton)
define_mpn(dump)
define_mpn(gcd)
define_mpn(gcd_1)
+define_mpn(gcd_11)
+define_mpn(gcd_22)
define_mpn(gcdext)
define_mpn(get_str)
define_mpn(hamdist)
@@ -1453,6 +1455,9 @@ define_mpn(rsh1sub_n)
define_mpn(rsh1sub_nc)
define_mpn(rshift)
define_mpn(rshiftc)
+define_mpn(sbpi1_bdiv_q)
+define_mpn(sbpi1_bdiv_qr)
+define_mpn(sbpi1_bdiv_r)
define_mpn(scan0)
define_mpn(scan1)
define_mpn(set_str)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/add_n.c b/Build/source/libs/gmp/gmp-src/mpn/cray/add_n.c
index 65b53bf87af..af49159edfc 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/add_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/add_n.c
@@ -32,7 +32,6 @@ see https://www.gnu.org/licenses/. */
/* This code runs at 4 cycles/limb. It may be possible to bring it down
to 3 cycles/limb. */
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/addmul_1.c b/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/addmul_1.c
index e1d52e4a5f4..9c7f383b0f2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/addmul_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/addmul_1.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/mul_1.c b/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/mul_1.c
index 611a9d2532d..33a6a053505 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/mul_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/mul_1.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/submul_1.c b/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/submul_1.c
index b44c97df455..622c2756d05 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/submul_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/cfp/submul_1.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/cray/gmp-mparam.h
index ea8c25b32e2..1baed1e6894 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/gmp-mparam.h
@@ -31,11 +31,6 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-#if 0
-#define UMUL_TIME 519
-#define UDIV_TIME 2360
-#endif
-
/* T90 Unicos 10.0.X in CFP mode */
/* Generated by tuneup.c, 2004-02-07, system compiler */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/hamdist.c b/Build/source/libs/gmp/gmp-src/mpn/cray/hamdist.c
index 8eb9ba018cd..e7f177adf15 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/hamdist.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/hamdist.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <intrinsics.h>
-#include "gmp.h"
#include "gmp-impl.h"
unsigned long int
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/addmul_1.c b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/addmul_1.c
index 6318b7c9c29..ce7dfbb0018 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/addmul_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/addmul_1.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
should bring it down to perhaps 7 cycles/limb. */
#include <intrinsics.h>
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/invert_limb.c b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/invert_limb.c
index f951a6e1384..774a27b9a63 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/invert_limb.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/invert_limb.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_1.c b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_1.c
index dad09fa8cfd..40139fb9830 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_1.c
@@ -33,7 +33,6 @@ see https://www.gnu.org/licenses/. */
be hard to improve upon, even with assembly code. */
#include <intrinsics.h>
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_basecase.c b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_basecase.c
index 6dc845dd997..72628f724dc 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_basecase.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/mul_basecase.c
@@ -32,7 +32,6 @@ see https://www.gnu.org/licenses/. */
That is not perfect, mainly due to vector register shortage. */
#include <intrinsics.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/sqr_basecase.c b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/sqr_basecase.c
index 840d3dd2607..5bd4e566bfe 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/sqr_basecase.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/sqr_basecase.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
/* This is just mpn_mul_basecase with trivial modifications. */
#include <intrinsics.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/submul_1.c b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/submul_1.c
index 27a1939019f..2b3ca21c4da 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/submul_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/ieee/submul_1.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
should bring it down to perhaps 7 cycles/limb. */
#include <intrinsics.h>
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/lshift.c b/Build/source/libs/gmp/gmp-src/mpn/cray/lshift.c
index 074f38041a1..8534e93a357 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/lshift.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/lshift.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <intrinsics.h>
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/mulww.f b/Build/source/libs/gmp/gmp-src/mpn/cray/mulww.f
index 9bddf05bc97..6885dfc6085 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/mulww.f
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/mulww.f
@@ -3,27 +3,27 @@ c Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP.
c Copyright 1996, 2000 Free Software Foundation, Inc.
c This file is part of the GNU MP Library.
-c
+c
c The GNU MP Library is free software; you can redistribute it and/or modify
c it under the terms of either:
-c
+c
c * the GNU Lesser General Public License as published by the Free
c Software Foundation; either version 3 of the License, or (at your
c option) any later version.
-c
+c
c or
-c
+c
c * the GNU General Public License as published by the Free Software
c Foundation; either version 2 of the License, or (at your option) any
c later version.
-c
+c
c or both in parallel, as here.
-c
+c
c The GNU MP Library is distributed in the hope that it will be useful, but
c WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
c or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
c for more details.
-c
+c
c You should have received copies of the GNU General Public License and the
c GNU Lesser General Public License along with the GNU MP Library. If not,
c see https://www.gnu.org/licenses/.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/popcount.c b/Build/source/libs/gmp/gmp-src/mpn/cray/popcount.c
index 48ddab875ed..a79211fc7f5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/popcount.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/popcount.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <intrinsics.h>
-#include "gmp.h"
#include "gmp-impl.h"
unsigned long int
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/rshift.c b/Build/source/libs/gmp/gmp-src/mpn/cray/rshift.c
index 424bede9db7..9c4aa2203dc 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/rshift.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/rshift.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <intrinsics.h>
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/cray/sub_n.c b/Build/source/libs/gmp/gmp-src/mpn/cray/sub_n.c
index 0cc9ad1e04a..f51876497ce 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/cray/sub_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/cray/sub_n.c
@@ -32,7 +32,6 @@ see https://www.gnu.org/licenses/. */
/* This code runs at 4 cycles/limb. It may be possible to bring it down
to 3 cycles/limb. */
-#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/add.c b/Build/source/libs/gmp/gmp-src/mpn/generic/add.c
index 559f26133cf..4a6e3ba1a97 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/add.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/add.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpn_add 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/add_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/add_1.c
index ca2d8668528..1745aed0ad5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/add_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/add_1.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpn_add_1 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/add_err1_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/add_err1_n.c
index b8cb75f6e89..b247f199fb2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/add_err1_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/add_err1_n.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/*
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/add_err2_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/add_err2_n.c
index 4b0242a32df..d584d6d64dc 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/add_err2_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/add_err2_n.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/*
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/add_err3_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/add_err3_n.c
index 28cd7facf93..a6ed4dc159d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/add_err3_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/add_err3_n.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/*
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/add_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/add_n.c
index 1a076709004..f62ac877d43 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/add_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/add_n.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/add_n_sub_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/add_n_sub_n.c
index 012eb3e33ad..1e72b5da811 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/add_n_sub_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/add_n_sub_n.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#ifndef L1_CACHE_SIZE
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/addmul_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/addmul_1.c
index d76b4ad1350..6140e8e585d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/addmul_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/addmul_1.c
@@ -3,7 +3,8 @@
pointed to by RP. Return the most significant limb of the product,
adjusted for carry-out from the addition.
-Copyright 1992-1994, 1996, 2000, 2002, 2004 Free Software Foundation, Inc.
+Copyright 1992-1994, 1996, 2000, 2002, 2004, 2016 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -31,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -39,30 +39,36 @@ see https://www.gnu.org/licenses/. */
#if GMP_NAIL_BITS == 0
mp_limb_t
-mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t v0)
{
- mp_limb_t ul, cl, hpl, lpl, rl;
+ mp_limb_t u0, crec, c, p1, p0, r0;
ASSERT (n >= 1);
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- cl = 0;
+ crec = 0;
do
{
- ul = *up++;
- umul_ppmm (hpl, lpl, ul, vl);
+ u0 = *up++;
+ umul_ppmm (p1, p0, u0, v0);
- lpl += cl;
- cl = (lpl < cl) + hpl;
+ r0 = *rp;
- rl = *rp;
- lpl = rl + lpl;
- cl += lpl < rl;
- *rp++ = lpl;
+ p0 = r0 + p0;
+ c = r0 > p0;
+
+ p1 = p1 + c;
+
+ r0 = p0 + crec; /* cycle 0, 3, ... */
+ c = p0 > r0; /* cycle 1, 4, ... */
+
+ crec = p1 + c; /* cycle 2, 5, ... */
+
+ *rp++ = r0;
}
while (--n != 0);
- return cl;
+ return crec;
}
#endif
@@ -70,35 +76,35 @@ mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
#if GMP_NAIL_BITS == 1
mp_limb_t
-mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t v0)
{
- mp_limb_t shifted_vl, ul, rl, lpl, hpl, prev_hpl, cl, xl, c1, c2, c3;
+ mp_limb_t shifted_v0, u0, r0, p0, p1, prev_p1, crec, xl, c1, c2, c3;
ASSERT (n >= 1);
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
ASSERT_MPN (rp, n);
ASSERT_MPN (up, n);
- ASSERT_LIMB (vl);
+ ASSERT_LIMB (v0);
- shifted_vl = vl << GMP_NAIL_BITS;
- cl = 0;
- prev_hpl = 0;
+ shifted_v0 = v0 << GMP_NAIL_BITS;
+ crec = 0;
+ prev_p1 = 0;
do
{
- ul = *up++;
- rl = *rp;
- umul_ppmm (hpl, lpl, ul, shifted_vl);
- lpl >>= GMP_NAIL_BITS;
- ADDC_LIMB (c1, xl, prev_hpl, lpl);
- ADDC_LIMB (c2, xl, xl, rl);
- ADDC_LIMB (c3, xl, xl, cl);
- cl = c1 + c2 + c3;
+ u0 = *up++;
+ r0 = *rp;
+ umul_ppmm (p1, p0, u0, shifted_v0);
+ p0 >>= GMP_NAIL_BITS;
+ ADDC_LIMB (c1, xl, prev_p1, p0);
+ ADDC_LIMB (c2, xl, xl, r0);
+ ADDC_LIMB (c3, xl, xl, crec);
+ crec = c1 + c2 + c3;
*rp++ = xl;
- prev_hpl = hpl;
+ prev_p1 = p1;
}
while (--n != 0);
- return prev_hpl + cl;
+ return prev_p1 + crec;
}
#endif
@@ -106,34 +112,34 @@ mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
#if GMP_NAIL_BITS >= 2
mp_limb_t
-mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t v0)
{
- mp_limb_t shifted_vl, ul, rl, lpl, hpl, prev_hpl, xw, cl, xl;
+ mp_limb_t shifted_v0, u0, r0, p0, p1, prev_p1, xw, crec, xl;
ASSERT (n >= 1);
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
ASSERT_MPN (rp, n);
ASSERT_MPN (up, n);
- ASSERT_LIMB (vl);
+ ASSERT_LIMB (v0);
- shifted_vl = vl << GMP_NAIL_BITS;
- cl = 0;
- prev_hpl = 0;
+ shifted_v0 = v0 << GMP_NAIL_BITS;
+ crec = 0;
+ prev_p1 = 0;
do
{
- ul = *up++;
- rl = *rp;
- umul_ppmm (hpl, lpl, ul, shifted_vl);
- lpl >>= GMP_NAIL_BITS;
- xw = prev_hpl + lpl + rl + cl;
- cl = xw >> GMP_NUMB_BITS;
+ u0 = *up++;
+ r0 = *rp;
+ umul_ppmm (p1, p0, u0, shifted_v0);
+ p0 >>= GMP_NAIL_BITS;
+ xw = prev_p1 + p0 + r0 + crec;
+ crec = xw >> GMP_NUMB_BITS;
xl = xw & GMP_NUMB_MASK;
*rp++ = xl;
- prev_hpl = hpl;
+ prev_p1 = p1;
}
while (--n != 0);
- return prev_hpl + cl;
+ return prev_p1 + crec;
}
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_dbm1c.c b/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_dbm1c.c
index 22c3cfd2c80..543bb6ef945 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_dbm1c.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_dbm1c.c
@@ -33,7 +33,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q.c
index 1fc1bb7c099..52aa473cc52 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q_1.c
index 74b247d5a9a..6beb9a02c45 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_q_1.c
@@ -5,7 +5,7 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2000-2003, 2005, 2009 Free Software Foundation, Inc.
+Copyright 2000-2003, 2005, 2009, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -33,7 +33,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -74,9 +73,10 @@ mpn_pi1_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d,
}
u = u >> shift;
- l = u - c;
+ SUBC_LIMB (c, l, u, c);
+
l = (l * di) & GMP_NUMB_MASK;
- rp[i] = l;
+ rp[n] = l;
}
else
{
@@ -113,13 +113,8 @@ mpn_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d)
ASSERT_MPN (up, n);
ASSERT_LIMB (d);
- if ((d & 1) == 0)
- {
- count_trailing_zeros (shift, d);
- d >>= shift;
- }
- else
- shift = 0;
+ count_trailing_zeros (shift, d);
+ d >>= shift;
binvert_limb (di, d);
return mpn_pi1_bdiv_q_1 (rp, up, n, d, di, shift);
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_qr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_qr.c
index 6a5eedbbc2f..a4f0f399145 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/bdiv_qr.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/binvert.c b/Build/source/libs/gmp/gmp-src/mpn/generic/binvert.c
index be27ea552e7..6c24ab74905 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/binvert.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/binvert.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 GMP RELEASE.
-Copyright (C) 2004-2007, 2009, 2012 Free Software Foundation, Inc.
+Copyright (C) 2004-2007, 2009, 2012, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -84,6 +83,8 @@ mpn_binvert (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr scratch)
else
mpn_dcpi1_bdiv_q (rp, xp, rn, up, rn, -di);
+ mpn_neg (rp, rp, rn);
+
/* Use Newton iterations to get the desired precision. */
for (; rn < n; rn = newrn)
{
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/broot.c b/Build/source/libs/gmp/gmp-src/mpn/generic/broot.c
index 6974ac8b9e8..02fe75a1e3f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/broot.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/broot.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* Computes a^e (mod B). Uses right-to-left binary algorithm, since
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/brootinv.c b/Build/source/libs/gmp/gmp-src/mpn/generic/brootinv.c
index b96c97f1d36..e91b5972a73 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/brootinv.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/brootinv.c
@@ -2,7 +2,7 @@
Contributed to the GNU project by Martin Boij (as part of perfpow.c).
-Copyright 2009, 2010, 2012, 2013 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012, 2013, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,19 +30,23 @@ 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 "gmp.h"
#include "gmp-impl.h"
-/* Computes a^e (mod B). Uses right-to-left binary algorithm, since
+/* Computes a^2e (mod B). Uses right-to-left binary algorithm, since
typical use will have e small. */
static mp_limb_t
-powlimb (mp_limb_t a, mp_limb_t e)
+powsquaredlimb (mp_limb_t a, mp_limb_t e)
{
mp_limb_t r;
- for (r = 1; e > 0; e >>= 1, a *= a)
+ r = 1;
+ /* if (LIKELY (e != 0)) */
+ do {
+ a *= a;
if (e & 1)
r *= a;
+ e >>= 1;
+ } while (e != 0);
return r;
}
@@ -67,7 +71,9 @@ powlimb (mp_limb_t a, mp_limb_t e)
(4) Use a small table to get starting value.
- Scratch need: 5*bn, where bn = ceil (bnb / GMP_NUMB_BITS).
+ Scratch need: bn + (((bn + 1) >> 1) + 1) + scratch for mpn_powlo
+ Currently mpn_powlo requires 3*bn
+ so that 5*bn is surely enough, where bn = ceil (bnb / GMP_NUMB_BITS).
*/
void
@@ -76,36 +82,36 @@ mpn_brootinv (mp_ptr rp, mp_srcptr yp, mp_size_t bn, mp_limb_t k, mp_ptr tp)
mp_ptr tp2, tp3;
mp_limb_t kinv, k2, r0, y0;
mp_size_t order[GMP_LIMB_BITS + 1];
- int i, d;
+ int d;
ASSERT (bn > 0);
ASSERT ((k & 1) != 0);
tp2 = tp + bn;
- tp3 = tp + 2 * bn;
- k2 = k + 1;
+ tp3 = tp + bn + ((bn + 3) >> 1);
+ k2 = (k >> 1) + 1; /* (k + 1) / 2 , but avoid k+1 overflow */
binvert_limb (kinv, k);
/* 4-bit initial approximation:
y%16 | 1 3 5 7 9 11 13 15,
- k%4 +-------------------------+k2%4
- 1 | 1 11 13 7 9 3 5 15 | 2
+ k%4 +-------------------------+k2%2
+ 1 | 1 11 13 7 9 3 5 15 | 1
3 | 1 3 5 7 9 11 13 15 | 0
*/
y0 = yp[0];
- r0 = y0 ^ (((y0 << 1) ^ (y0 << 2)) & (k2 << 2) & 8); /* 4 bits */
- r0 = kinv * (k2 * r0 - y0 * powlimb(r0, k2 & 0x7f)); /* 8 bits */
- r0 = kinv * (k2 * r0 - y0 * powlimb(r0, k2 & 0x7fff)); /* 16 bits */
+ r0 = y0 ^ (((y0 << 1) ^ (y0 << 2)) & (k2 << 3) & 8); /* 4 bits */
+ r0 = kinv * (k2 * r0 * 2 - y0 * powsquaredlimb(r0, k2 & 0x3f)); /* 8 bits */
+ r0 = kinv * (k2 * r0 * 2 - y0 * powsquaredlimb(r0, k2 & 0x3fff)); /* 16 bits */
#if GMP_NUMB_BITS > 16
{
unsigned prec = 16;
do
{
- r0 = kinv * (k2 * r0 - y0 * powlimb(r0, k2));
+ r0 = kinv * (k2 * r0 * 2 - y0 * powsquaredlimb(r0, k2));
prec *= 2;
}
while (prec < GMP_NUMB_BITS);
@@ -116,25 +122,38 @@ mpn_brootinv (mp_ptr rp, mp_srcptr yp, mp_size_t bn, mp_limb_t k, mp_ptr tp)
if (bn == 1)
return;
- /* This initialization doesn't matter for the result (any garbage is
- cancelled in the iteration), but proper initialization makes
- valgrind happier. */
- MPN_ZERO (rp+1, bn-1);
-
d = 0;
- for (; bn > 1; bn = (bn + 1) >> 1)
+ for (; bn != 2; bn = (bn + 1) >> 1)
order[d++] = bn;
- for (i = d - 1; i >= 0; i--)
+ order[d] = 2;
+ bn = 1;
+
+ do
{
- bn = order[i];
+ mpn_sqr (tp, rp, bn); /* Result may overlap tp2 */
+ tp2[bn] = mpn_mul_1 (tp2, rp, bn, k2 << 1);
- mpn_mul_1 (tp, rp, bn, k2);
+ bn = order[d];
- mpn_powlo (tp2, rp, &k2, 1, bn, tp3);
- mpn_mullo_n (rp, yp, tp2, bn);
+ mpn_powlo (rp, tp, &k2, 1, bn, tp3);
+ mpn_mullo_n (tp, yp, rp, bn);
- mpn_sub_n (tp2, tp, rp, bn);
- mpn_pi1_bdiv_q_1 (rp, tp2, bn, k, kinv, 0);
+ /* mpn_sub (tp, tp2, ((bn + 1) >> 1) + 1, tp, bn); */
+ /* The function above is not handled, ((bn + 1) >> 1) + 1 <= bn*/
+ {
+ mp_size_t pbn = (bn + 3) >> 1; /* Size of tp2 */
+ int borrow;
+ borrow = mpn_sub_n (tp, tp2, tp, pbn) != 0;
+ if (bn > pbn) /* 3 < bn */
+ {
+ if (borrow)
+ mpn_com (tp + pbn, tp + pbn, bn - pbn);
+ else
+ mpn_neg (tp + pbn, tp + pbn, bn - pbn);
+ }
+ }
+ mpn_pi1_bdiv_q_1 (rp, tp, bn, k, kinv, 0);
}
+ while (--d >= 0);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/bsqrt.c b/Build/source/libs/gmp/gmp-src/mpn/generic/bsqrt.c
index d900f67b17b..27184f0162f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/bsqrt.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/bsqrt.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/bsqrtinv.c b/Build/source/libs/gmp/gmp-src/mpn/generic/bsqrtinv.c
index b779b504d2d..c286773679a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/bsqrtinv.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/bsqrtinv.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* Compute r such that r^2 * y = 1 (mod 2^{b+1}).
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/cmp.c b/Build/source/libs/gmp/gmp-src/mpn/generic/cmp.c
index 18c7b428444..940314b4a84 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/cmp.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/cmp.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpn_cmp 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_add_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_add_n.c
index 443f9858da5..e6b1373864b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_add_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_add_n.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_sub_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_sub_n.c
index bd8e029a36f..d04ad8a6bf0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_sub_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_sub_n.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_swap.c b/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_swap.c
index 6b7419ffe78..83d856d62bb 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_swap.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/cnd_swap.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/com.c b/Build/source/libs/gmp/gmp-src/mpn/generic/com.c
index cd8551df5ba..4de58245c8e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/com.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/com.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#undef mpn_com
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/comb_tables.c b/Build/source/libs/gmp/gmp-src/mpn/generic/comb_tables.c
index 41bcb5f879d..dedb77b2e08 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/comb_tables.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/comb_tables.c
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* Entry i contains (i!/2^t) where t is chosen such that the parenthesis
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
new file mode 100644
index 00000000000..f4fbc64790f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/compute_powtab.c
@@ -0,0 +1,373 @@
+/* mpn_compute_powtab.
+
+ Contributed to the GNU project by Torbjorn Granlund.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY
+ 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 1991-2017 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+/*
+ CAVEATS:
+ * The exptab and powtab vectors are in opposite orders. Probably OK.
+ * Consider getting rid of exptab, doing bit ops on the un argument instead.
+ * Consider rounding greatest power slightly upwards to save adjustments.
+ * In powtab_decide, consider computing cost from just the 2-3 largest
+ operands, since smaller operand contribute little. This makes most sense
+ if exptab is suppressed.
+*/
+
+#include "gmp-impl.h"
+
+#ifndef DIV_1_VS_MUL_1_PERCENT
+#define DIV_1_VS_MUL_1_PERCENT 150
+#endif
+
+#define SET_powers_t(dest, ptr, size, dib, b, sh) \
+ do { \
+ dest.p = ptr; \
+ dest.n = size; \
+ dest.digits_in_base = dib; \
+ dest.base = b; \
+ dest.shift = sh; \
+ } while (0)
+
+#if DIV_1_VS_MUL_1_PERCENT > 120
+#define HAVE_mpn_compute_powtab_mul 1
+static void
+mpn_compute_powtab_mul (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un,
+ int base, const size_t *exptab, size_t n_pows)
+{
+ mp_size_t n;
+ mp_ptr p, t;
+ mp_limb_t cy;
+ long start_idx;
+ int c;
+
+ mp_limb_t big_base = mp_bases[base].big_base;
+ int chars_per_limb = mp_bases[base].chars_per_limb;
+
+ mp_ptr powtab_mem_ptr = powtab_mem;
+
+ size_t digits_in_base = chars_per_limb;
+
+ powers_t *pt = powtab;
+
+ p = powtab_mem_ptr;
+ powtab_mem_ptr += 1;
+ p[0] = big_base;
+
+ SET_powers_t (pt[0], p, 1, digits_in_base, base, 0);
+ pt++;
+
+ t = powtab_mem_ptr;
+ powtab_mem_ptr += 2;
+ t[1] = mpn_mul_1 (t, p, 1, big_base);
+ n = 2;
+
+ digits_in_base *= 2;
+
+ c = t[0] == 0;
+ t += c;
+ n -= c;
+ mp_size_t shift = c;
+
+ SET_powers_t (pt[0], t, n, digits_in_base, base, shift);
+ p = t;
+ pt++;
+
+ if (exptab[0] == ((size_t) chars_per_limb << n_pows))
+ {
+ start_idx = n_pows - 2;
+ }
+ else
+ {
+ if (((digits_in_base + chars_per_limb) << (n_pows-2)) <= exptab[0])
+ {
+ /* 3, sometimes adjusted to 4. */
+ t = powtab_mem_ptr;
+ powtab_mem_ptr += 4;
+ t[n] = cy = mpn_mul_1 (t, p, n, big_base);
+ n += cy != 0;;
+
+ digits_in_base += chars_per_limb;
+
+ c = t[0] == 0;
+ t += c;
+ n -= c;
+ shift += c;
+ }
+ else
+ {
+ /* 2 copy, will always become 3 with back-multiplication. */
+ t = powtab_mem_ptr;
+ powtab_mem_ptr += 3;
+ t[0] = p[0];
+ t[1] = p[1];
+ }
+
+ SET_powers_t (pt[0], t, n, digits_in_base, base, shift);
+ p = t;
+ pt++;
+ start_idx = n_pows - 3;
+ }
+
+ for (long pi = start_idx; pi >= 0; pi--)
+ {
+ t = powtab_mem_ptr;
+ powtab_mem_ptr += 2 * n + 2;
+
+ ASSERT (powtab_mem_ptr < powtab_mem + mpn_str_powtab_alloc (un));
+
+ mpn_sqr (t, p, n);
+
+ digits_in_base *= 2;
+ n *= 2;
+ n -= t[n - 1] == 0;
+ shift *= 2;
+
+ c = t[0] == 0;
+ t += c;
+ n -= c;
+ shift += c;
+
+ /* Adjust new value if it is too small as input to the next squaring. */
+ if (((digits_in_base + chars_per_limb) << pi) <= exptab[0])
+ {
+ t[n] = cy = mpn_mul_1 (t, t, n, big_base);
+ n += cy != 0;
+
+ digits_in_base += chars_per_limb;
+
+ c = t[0] == 0;
+ t += c;
+ n -= c;
+ shift += c;
+ }
+
+ SET_powers_t (pt[0], t, n, digits_in_base, base, shift);
+
+ /* Adjust previous value if it is not at its target power. */
+ if (pt[-1].digits_in_base < exptab[pi + 1])
+ {
+ mp_size_t n = pt[-1].n;
+ mp_ptr p = pt[-1].p;
+ p[n] = cy = mpn_mul_1 (p, p, n, big_base);
+ n += cy != 0;
+
+ ASSERT (pt[-1].digits_in_base + chars_per_limb == exptab[pi + 1]);
+ pt[-1].digits_in_base = exptab[pi + 1];
+
+ c = p[0] == 0;
+ pt[-1].p = p + c;
+ pt[-1].n = n - c;
+ pt[-1].shift += c;
+ }
+
+ p = t;
+ pt++;
+ }
+}
+#endif
+
+#if DIV_1_VS_MUL_1_PERCENT < 275
+#define HAVE_mpn_compute_powtab_div 1
+static void
+mpn_compute_powtab_div (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un,
+ int base, const size_t *exptab, size_t n_pows)
+{
+ mp_ptr p, t;
+
+ mp_limb_t big_base = mp_bases[base].big_base;
+ int chars_per_limb = mp_bases[base].chars_per_limb;
+
+ mp_ptr powtab_mem_ptr = powtab_mem;
+
+ size_t digits_in_base = chars_per_limb;
+
+ powers_t *pt = powtab;
+
+ p = powtab_mem_ptr;
+ powtab_mem_ptr += 1;
+ p[0] = big_base;
+
+ 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--)
+ {
+ t = powtab_mem_ptr;
+ powtab_mem_ptr += 2 * n;
+
+ ASSERT (powtab_mem_ptr < powtab_mem + mpn_str_powtab_alloc (un));
+
+ mpn_sqr (t, p, n);
+ n = 2 * n - 1; n += t[n] != 0;
+ digits_in_base *= 2;
+
+ if (digits_in_base != exptab[pi]) /* if ((((un - 1) >> pi) & 2) == 0) */
+ {
+#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 || ! HAVE_NATIVE_mpn_divexact_1
+ if (__GMP_LIKELY (base == 10))
+ mpn_pi1_bdiv_q_1 (t, t, n, big_base >> MP_BASES_BIG_BASE_CTZ_10,
+ MP_BASES_BIG_BASE_BINVERTED_10,
+ MP_BASES_BIG_BASE_CTZ_10);
+ else
+#endif
+ /* FIXME: We could use _pi1 here if we add big_base_binverted and
+ big_base_ctz fields to struct bases. That would add about 2 KiB
+ to mp_bases.c.
+ FIXME: Use mpn_bdiv_q_1 here when mpn_divexact_1 is converted to
+ mpn_bdiv_q_1 for more machines. */
+ mpn_divexact_1 (t, t, n, big_base);
+
+ n -= t[n - 1] == 0;
+ digits_in_base -= chars_per_limb;
+ }
+
+ shift *= 2;
+ /* Strip low zero limbs, but be careful to keep the result divisible by
+ big_base. */
+ while (t[0] == 0 && (t[1] & ((big_base & -big_base) - 1)) == 0)
+ {
+ t++;
+ n--;
+ shift++;
+ }
+ p = t;
+
+ SET_powers_t (pt[0], p, n, digits_in_base, base, shift);
+ pt++;
+ }
+
+ /* Strip any remaining low zero limbs. */
+ pt -= n_pows + 1;
+ for (long pi = n_pows; pi >= 0; pi--)
+ {
+ mp_ptr t = pt[pi].p;
+ mp_size_t shift = pt[pi].shift;
+ mp_size_t n = pt[pi].n;
+ int c;
+ c = t[0] == 0;
+ t += c;
+ n -= c;
+ shift += c;
+ pt[pi].p = t;
+ pt[pi].shift = shift;
+ pt[pi].n = n;
+ }
+}
+#endif
+
+static long
+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)
+ {
+ exptab[n_pows] = pn * chars_per_limb;
+ n_pows++;
+ }
+ 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--)
+ {
+ size_t pow = (pn >> (i + 1)) + 1;
+
+ if (pow & 1)
+ dcost += pow;
+
+ if (xn != (pow << i))
+ {
+ if (pow > 2 && (pow & 1) == 0)
+ mcost += 2 * pow;
+ else
+ mcost += pow;
+ }
+ else
+ {
+ if (pow & 1)
+ mcost += pow;
+ }
+ }
+
+ dcost = dcost * DIV_1_VS_MUL_1_PERCENT / 100;
+
+ if (mcost <= dcost)
+ return n_pows;
+ else
+ return -n_pows;
+#elif HAVE_mpn_compute_powtab_mul
+ return n_pows;
+#elif HAVE_mpn_compute_powtab_div
+ return -n_pows;
+#else
+#error "no powtab function available"
+#endif
+}
+
+size_t
+mpn_compute_powtab (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un, int base)
+{
+ size_t exptab[GMP_LIMB_BITS];
+
+ long n_pows = powtab_decide (exptab, un, base);
+
+#if HAVE_mpn_compute_powtab_mul && HAVE_mpn_compute_powtab_div
+ if (n_pows >= 0)
+ {
+ mpn_compute_powtab_mul (powtab, powtab_mem, un, base, exptab, n_pows);
+ return n_pows;
+ }
+ else
+ {
+ mpn_compute_powtab_div (powtab, powtab_mem, un, base, exptab, -n_pows);
+ return -n_pows;
+ }
+#elif HAVE_mpn_compute_powtab_mul
+ ASSERT (n_pows > 0);
+ mpn_compute_powtab_mul (powtab, powtab_mem, un, base, exptab, n_pows);
+ return n_pows;
+#elif HAVE_mpn_compute_powtab_div
+ ASSERT (n_pows < 0);
+ mpn_compute_powtab_div (powtab, powtab_mem, un, base, exptab, -n_pows);
+ return -n_pows;
+#else
+#error "no powtab function available"
+#endif
+}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/copyd.c b/Build/source/libs/gmp/gmp-src/mpn/generic/copyd.c
index ba3380a82bb..7def007d3bb 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/copyd.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/copyd.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/copyi.c b/Build/source/libs/gmp/gmp-src/mpn/generic/copyi.c
index 0c39b4534bb..736e0b56357 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/copyi.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/copyi.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
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 a7b86c96d44..1a4bd2a9e54 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
@@ -7,7 +7,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 2006, 2007, 2009-2011 Free Software Foundation, Inc.
+Copyright 2006, 2007, 2009-2011, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,24 +35,23 @@ 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 "gmp.h"
#include "gmp-impl.h"
-mp_size_t
+static mp_size_t
mpn_dcpi1_bdiv_q_n_itch (mp_size_t n)
{
- /* NOTE: Depends on mullo_n interface */
+ /* NOTE: Depends on mullo_n and mpn_dcpi1_bdiv_qr_n interface */
return n;
}
-/* Computes Q = N / D mod B^n, destroys N.
+/* Computes Q = - N / D mod B^n, destroys N.
N = {np,n}
D = {dp,n}
*/
-void
+static void
mpn_dcpi1_bdiv_q_n (mp_ptr qp,
mp_ptr np, mp_srcptr dp, mp_size_t n,
mp_limb_t dinv, mp_ptr tp)
@@ -68,12 +67,12 @@ mpn_dcpi1_bdiv_q_n (mp_ptr qp,
cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, lo, dinv, tp);
mpn_mullo_n (tp, qp, dp + hi, lo);
- mpn_sub_n (np + hi, np + hi, tp, lo);
+ mpn_add_n (np + hi, np + hi, tp, lo);
if (lo < hi)
{
- cy += mpn_submul_1 (np + lo, qp, lo, dp[lo]);
- np[n - 1] -= cy;
+ cy += mpn_addmul_1 (np + lo, qp, lo, dp[lo]);
+ np[n - 1] += cy;
}
qp += lo;
np += lo;
@@ -82,7 +81,7 @@ mpn_dcpi1_bdiv_q_n (mp_ptr qp,
mpn_sbpi1_bdiv_q (qp, np, n, dp, n, dinv);
}
-/* Computes Q = N / D mod B^nn, destroys N.
+/* Computes Q = - N / D mod B^nn, destroys N.
N = {np,nn}
D = {dp,dn}
@@ -130,7 +129,7 @@ mpn_dcpi1_bdiv_q (mp_ptr qp,
mpn_mul (tp, dp + qn, dn - qn, qp, qn);
mpn_incr_u (tp + qn, cy);
- mpn_sub (np + qn, np + qn, nn - qn, tp, dn);
+ mpn_add (np + qn, np + qn, nn - qn, tp, dn);
cy = 0;
}
@@ -140,7 +139,7 @@ mpn_dcpi1_bdiv_q (mp_ptr qp,
qn = nn - qn;
while (qn > dn)
{
- mpn_sub_1 (np + dn, np + dn, qn - dn, cy);
+ mpn_add_1 (np + dn, np + dn, qn - dn, cy);
cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, dn, dinv, tp);
qp += dn;
np += dn;
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_qr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_qr.c
index 8a251f8d9d8..11da44f3f1c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_bdiv_qr.c
@@ -7,7 +7,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2006, 2007, 2009, 2010, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -43,12 +42,12 @@ see https://www.gnu.org/licenses/. */
Output:
- q = n * d^{-1} mod 2^{qn * GMP_NUMB_BITS},
+ q = -n * d^{-1} mod 2^{qn * GMP_NUMB_BITS},
- r = (n - q * d) * 2^{-qn * GMP_NUMB_BITS}
+ r = (n + q * d) * 2^{-qn * GMP_NUMB_BITS}
Stores q at qp. Stores the n least significant limbs of r at the high half
- of np, and returns the borrow from the subtraction n - q*d.
+ of np, and returns the carry from the addition n + q*d.
d must be odd. dinv is (-d)^-1 mod 2^GMP_NUMB_BITS. */
@@ -77,7 +76,7 @@ mpn_dcpi1_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
mpn_mul (tp, dp + lo, hi, qp, lo);
mpn_incr_u (tp + lo, cy);
- rh = mpn_sub (np + lo, np + lo, n + hi, tp, n);
+ rh = mpn_add (np + lo, np + lo, n + hi, tp, n);
if (BELOW_THRESHOLD (hi, DC_BDIV_QR_THRESHOLD))
cy = mpn_sbpi1_bdiv_qr (qp + lo, np + lo, 2 * hi, dp, hi, dinv);
@@ -87,7 +86,7 @@ mpn_dcpi1_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
mpn_mul (tp, qp + lo, hi, dp + hi, lo);
mpn_incr_u (tp + hi, cy);
- rh += mpn_sub_n (np + n, np + n, tp, n);
+ rh += mpn_add_n (np + n, np + n, tp, n);
return rh;
}
@@ -133,7 +132,7 @@ mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
mpn_mul (tp, dp + qn, dn - qn, qp, qn);
mpn_incr_u (tp + qn, cy);
- rr = mpn_sub (np + qn, np + qn, nn - qn, tp, dn);
+ rr = mpn_add (np + qn, np + qn, nn - qn, tp, dn);
cy = 0;
}
@@ -143,7 +142,7 @@ mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
qn = nn - dn - qn;
do
{
- rr += mpn_sub_1 (np + dn, np + dn, qn, cy);
+ rr += mpn_add_1 (np + dn, np + dn, qn, cy);
cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, dn, dinv, tp);
qp += dn;
np += dn;
@@ -168,7 +167,7 @@ mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
mpn_mul (tp, dp + qn, dn - qn, qp, qn);
mpn_incr_u (tp + qn, cy);
- rr = mpn_sub (np + qn, np + qn, nn - qn, tp, dn);
+ rr = mpn_add (np + qn, np + qn, nn - qn, tp, dn);
cy = 0;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_q.c
index 2b5da523d4f..1905c98d94e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_q.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_qr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_qr.c
index 9583ec3fe06..d7a65f89984 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_div_qr.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_divappr_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_divappr_q.c
index c7b03c7f496..0abe04eff5d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_divappr_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/dcpi1_divappr_q.c
@@ -35,12 +35,11 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
-mp_limb_t
+static mp_limb_t
mpn_dcpi1_divappr_q_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
gmp_pi1_t *dinv, mp_ptr tp)
{
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/div_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/div_q.c
index a4fe0e369e5..18c4ecf9e42 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/div_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/div_q.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 GMP RELEASE.
-Copyright 2009, 2010 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2015, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -119,9 +118,10 @@ mpn_div_q (mp_ptr qp,
ASSERT_ALWAYS (FUDGE >= 2);
+ dh = dp[dn - 1];
if (dn == 1)
{
- mpn_divrem_1 (qp, 0L, np, nn, dp[dn - 1]);
+ mpn_divrem_1 (qp, 0L, np, nn, dh);
return;
}
@@ -133,7 +133,6 @@ mpn_div_q (mp_ptr qp,
|_______| */
new_np = scratch;
- dh = dp[dn - 1];
if (LIKELY ((dh & GMP_NUMB_HIGHBIT) == 0))
{
count_leading_zeros (cnt, dh);
@@ -171,16 +170,8 @@ mpn_div_q (mp_ptr qp,
}
if (cy == 0)
qp[qn - 1] = qh;
- else if (UNLIKELY (qh != 0))
- {
- /* This happens only when the quotient is close to B^n and
- mpn_*_divappr_q returned B^n. */
- mp_size_t i, n;
- n = new_nn - dn;
- for (i = 0; i < n; i++)
- qp[i] = GMP_NUMB_MAX;
- qh = 0; /* currently ignored */
- }
+ else
+ ASSERT (qh == 0);
}
else /* divisor is already normalised */
{
@@ -228,7 +219,6 @@ mpn_div_q (mp_ptr qp,
new_np = TMP_ALLOC_LIMBS (new_nn + 1);
- dh = dp[dn - 1];
if (LIKELY ((dh & GMP_NUMB_HIGHBIT) == 0))
{
count_leading_zeros (cnt, dh);
@@ -315,7 +305,7 @@ mpn_div_q (mp_ptr qp,
rn -= rp[rn - 1] == 0;
if (rn > nn || mpn_cmp (np, rp, nn) < 0)
- mpn_decr_u (qp, 1);
+ MPN_DECR_U (qp, qn, 1);
}
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1.c
index 09401ac5358..8f80d376a7f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1.c
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -47,7 +46,7 @@ see https://www.gnu.org/licenses/. */
#endif
/* Divides {up, n} by d. Writes the n-1 low quotient limbs at {qp,
- * n-1}, and the high quote limb at *qh. Returns remainder. */
+ * n-1}, and the high quotient limb at *qh. Returns remainder. */
mp_limb_t
mpn_div_qr_1 (mp_ptr qp, mp_limb_t *qh, mp_srcptr up, mp_size_t n,
mp_limb_t d)
@@ -100,7 +99,7 @@ mpn_div_qr_1 (mp_ptr qp, mp_limb_t *qh, mp_srcptr up, mp_size_t n,
count_leading_zeros (cnt, d);
d <<= cnt;
-#if HAVE_NATIVE_div_qr_1u_pi1
+#if HAVE_NATIVE_mpn_div_qr_1u_pi1
/* FIXME: Call loop doing on-the-fly normalization */
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi1.c
index 2656e9aef9c..5c3281000fa 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi1.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -115,7 +114,8 @@ see https://www.gnu.org/licenses/. */
"subfe %0, %0, %0\n\t" \
"nor %0, %0, %0" \
: "=r" (m), "=r" (s1), "=&r" (s0) \
- : "r" (a1), "r" (b1), "%r" (a0), "rI" (b0))
+ : "r" (a1), "r" (b1), "%r" (a0), "rI" (b0) \
+ __CLOBBER_CC)
#endif
#if defined (__s390x__) && W_TYPE_SIZE == 64
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi2.c
index e311fd2f519..d8834eaf418 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1n_pi2.c
@@ -1,10 +1,10 @@
-/* mpn_div_qr_1u_pi2.
+/* mpn_div_qr_1n_pi2.
THIS FILE CONTAINS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS
ONLY SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2013 Free Software Foundation, Inc.
+Copyright 2013, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -42,13 +42,12 @@ see https://www.gnu.org/licenses/. */
* Not yet adequately tested.
*/
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
/* Define some longlong.h-style macros, but for wider operations.
- * add_sssaaaa is like longlong.h's add_ssaaaa but propagating
- carry-out into an additional sum operand.
+ * add_sssaaaa is like longlong.h's add_ssaaaa but propagating carry-out into
+ an additional sum operand.
*/
#if defined (__GNUC__) && ! defined (__INTEL_COMPILER) && ! defined (NO_ASM)
@@ -70,14 +69,23 @@ see https://www.gnu.org/licenses/. */
"%2" ((UDItype)(a0)), "rme" ((UDItype)(b0)))
#endif
+#if defined (__aarch64__) && W_TYPE_SIZE == 64
+#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0) \
+ __asm__ ("adds\t%2, %x6, %7\n\tadcs\t%1, %x4, %x5\n\tadc\t%0, %3, xzr"\
+ : "=r" (s2), "=&r" (s1), "=&r" (s0) \
+ : "rZ" (s2), "%rZ" (a1), "rZ" (b1), "%rZ" (a0), "rI" (b0) \
+ __CLOBBER_CC)
+#endif
+
#if HAVE_HOST_CPU_FAMILY_powerpc && !defined (_LONG_LONG_LIMB)
/* This works fine for 32-bit and 64-bit limbs, except for 64-bit limbs with a
processor running in 32-bit mode, since the carry flag then gets the 32-bit
carry. */
#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0) \
- __asm__ ("add%I7c\t%2,%6,%7\n\tadde\t%1,%4,%5\n\taddze\t%0,%0" \
+ __asm__ ("add%I7c\t%2,%6,%7\n\tadde\t%1,%4,%5\n\taddze\t%0,%3" \
: "=r" (s2), "=&r" (s1), "=&r" (s0) \
- : "r" (s2), "r" (a1), "r" (b1), "%r" (a0), "rI" (b0))
+ : "r" (s2), "r" (a1), "r" (b1), "%r" (a0), "rI" (b0) \
+ __CLOBBER_CC)
#endif
#endif /* __GNUC__ */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1u_pi2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1u_pi2.c
index 4c92eab7ada..047662f9d34 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1u_pi2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_1u_pi2.c
@@ -4,7 +4,7 @@
ONLY SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2013 Free Software Foundation, Inc.
+Copyright 2013, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -42,13 +42,12 @@ see https://www.gnu.org/licenses/. */
* Not yet adequately tested.
*/
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
/* Define some longlong.h-style macros, but for wider operations.
- * add_sssaaaa is like longlong.h's add_ssaaaa but propagating
- carry-out into an additional sum operand.
+ * add_sssaaaa is like longlong.h's add_ssaaaa but propagating carry-out into
+ an additional sum operand.
*/
#if defined (__GNUC__) && ! defined (__INTEL_COMPILER) && ! defined (NO_ASM)
@@ -70,14 +69,22 @@ see https://www.gnu.org/licenses/. */
"%2" ((UDItype)(a0)), "rme" ((UDItype)(b0)))
#endif
+#if defined (__aarch64__) && W_TYPE_SIZE == 64
+#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0) \
+ __asm__ ("adds\t%2, %x6, %7\n\tadcs\t%1, %x4, %x5\n\tadc\t%0, %3, xzr"\
+ : "=r" (s2), "=&r" (s1), "=&r" (s0) \
+ : "rZ" (s2), "%rZ" (a1), "rZ" (b1), "%rZ" (a0), "rI" (b0) __CLOBBER_CC)
+#endif
+
#if HAVE_HOST_CPU_FAMILY_powerpc && !defined (_LONG_LONG_LIMB)
/* This works fine for 32-bit and 64-bit limbs, except for 64-bit limbs with a
processor running in 32-bit mode, since the carry flag then gets the 32-bit
carry. */
#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0) \
- __asm__ ("add%I7c\t%2,%6,%7\n\tadde\t%1,%4,%5\n\taddze\t%0,%0" \
+ __asm__ ("add%I7c\t%2,%6,%7\n\tadde\t%1,%4,%5\n\taddze\t%0,%3" \
: "=r" (s2), "=&r" (s1), "=&r" (s0) \
- : "r" (s2), "r" (a1), "r" (b1), "%r" (a0), "rI" (b0))
+ : "r" (s2), "r" (a1), "r" (b1), "%r" (a0), "rI" (b0) \
+ __CLOBBER_CC)
#endif
#endif /* __GNUC__ */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2.c
index a60a2e24494..f7add44edd1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2.c
@@ -8,7 +8,7 @@
GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 1993-1996, 1999-2002, 2011 Free Software Foundation, Inc.
+Copyright 1993-1996, 1999-2002, 2011, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -36,7 +36,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -50,10 +49,10 @@ see https://www.gnu.org/licenses/. */
#endif
/* Define some longlong.h-style macros, but for wider operations.
- * add_sssaaaa is like longlong.h's add_ssaaaa but the propagating
- carry-out into an additional sum operand.
- * add_csaac accepts two addends and a carry in, and generates a sum
- and a carry out. A little like a "full adder".
+ * add_sssaaaa is like longlong.h's add_ssaaaa but propagating carry-out into
+ an additional sum operand.
+ * add_csaac accepts two addends and a carry in, and generates a sum and a
+ carry out. A little like a "full adder".
*/
#if defined (__GNUC__) && ! defined (__INTEL_COMPILER) && ! defined (NO_ASM)
@@ -64,11 +63,6 @@ see https://www.gnu.org/licenses/. */
: "0" ((USItype)(s2)), \
"1" ((USItype)(a1)), "g" ((USItype)(b1)), \
"%2" ((USItype)(a0)), "g" ((USItype)(b0)))
-#define add_csaac(co, s, a, b, ci) \
- __asm__ ("bt\t$0, %2\n\tadc\t%5, %k1\n\tadc\t%k0, %k0" \
- : "=r" (co), "=r" (s) \
- : "rm" ((USItype)(ci)), "0" (CNST_LIMB(0)), \
- "%1" ((USItype)(a)), "g" ((USItype)(b)))
#endif
#if defined (__amd64__) && W_TYPE_SIZE == 64
@@ -78,11 +72,14 @@ see https://www.gnu.org/licenses/. */
: "0" ((UDItype)(s2)), \
"1" ((UDItype)(a1)), "rme" ((UDItype)(b1)), \
"%2" ((UDItype)(a0)), "rme" ((UDItype)(b0)))
-#define add_csaac(co, s, a, b, ci) \
- __asm__ ("bt\t$0, %2\n\tadc\t%5, %q1\n\tadc\t%q0, %q0" \
- : "=r" (co), "=r" (s) \
- : "rm" ((UDItype)(ci)), "0" (CNST_LIMB(0)), \
- "%1" ((UDItype)(a)), "g" ((UDItype)(b)))
+#endif
+
+#if defined (__aarch64__) && W_TYPE_SIZE == 64
+#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0) \
+ __asm__ ("adds\t%2, %x6, %7\n\tadcs\t%1, %x4, %x5\n\tadc\t%0, %3, xzr"\
+ : "=r" (s2), "=&r" (s1), "=&r" (s0) \
+ : "rZ" (s2), "%rZ" (a1), "rZ" (b1), "%rZ" (a0), "rI" (b0) \
+ __CLOBBER_CC)
#endif
#if HAVE_HOST_CPU_FAMILY_powerpc && !defined (_LONG_LONG_LIMB)
@@ -90,9 +87,10 @@ see https://www.gnu.org/licenses/. */
processor running in 32-bit mode, since the carry flag then gets the 32-bit
carry. */
#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0) \
- __asm__ ("add%I7c\t%2,%6,%7\n\tadde\t%1,%4,%5\n\taddze\t%0,%0" \
+ __asm__ ("add%I7c\t%2,%6,%7\n\tadde\t%1,%4,%5\n\taddze\t%0,%3" \
: "=r" (s2), "=&r" (s1), "=&r" (s0) \
- : "r" (s2), "r" (a1), "r" (b1), "%r" (a0), "rI" (b0))
+ : "r" (s2), "r" (a1), "r" (b1), "%r" (a0), "rI" (b0) \
+ __CLOBBER_CC)
#endif
#endif /* __GNUC__ */
@@ -112,40 +110,24 @@ see https://www.gnu.org/licenses/. */
} while (0)
#endif
-#ifndef add_csaac
-#define add_csaac(co, s, a, b, ci) \
- do { \
- UWtype __s, __c; \
- __s = (a) + (b); \
- __c = __s < (a); \
- __s = __s + (ci); \
- (s) = __s; \
- (co) = __c + (__s < (ci)); \
- } while (0)
-#endif
-
/* Typically used with r1, r0 same as n3, n2. Other types of overlap
between inputs and outputs are not supported. */
#define udiv_qr_4by2(q1,q0, r1,r0, n3,n2,n1,n0, d1,d0, di1,di0) \
do { \
mp_limb_t _q3, _q2a, _q2, _q1, _q2c, _q1c, _q1d, _q0; \
mp_limb_t _t1, _t0; \
- mp_limb_t _c, _mask; \
+ mp_limb_t _mask; \
\
- umul_ppmm (_q3,_q2a, n3, di1); \
+ /* [q3,q2,q1,q0] = [n3,n2]*[di1,di0] + [n3,n2,n1,n0] + [0,1,0,0] */ \
umul_ppmm (_q2,_q1, n2, di1); \
+ umul_ppmm (_q3,_q2a, n3, di1); \
+ ++_q2; /* _q2 cannot overflow */ \
+ add_ssaaaa (_q3,_q2, _q3,_q2, n3,_q2a); \
umul_ppmm (_q2c,_q1c, n3, di0); \
- add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2c,_q1c); \
+ add_sssaaaa (_q3,_q2,_q1, _q2,_q1, n2,_q1c); \
umul_ppmm (_q1d,_q0, n2, di0); \
- add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2a,_q1d); \
- \
- add_ssaaaa (r1, r0, n3, n2, CNST_LIMB(0), CNST_LIMB(1)); \
- \
- /* [q3,q2,q1,q0] += [n3,n3,n1,n0] */ \
- add_csaac (_c, _q0, _q0, n0, CNST_LIMB(0)); \
- add_csaac (_c, _q1, _q1, n1, _c); \
- add_csaac (_c, _q2, _q2, r0, _c); \
- _q3 = _q3 + r1 + _c; \
+ add_sssaaaa (_q2c,_q1,_q0, _q1,_q0, n1,n0); /* _q2c cannot overflow */ \
+ add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2c,_q1d); \
\
umul_ppmm (_t1,_t0, _q2, d0); \
_t1 += _q2 * d1 + _q3 * d0; \
@@ -283,9 +265,9 @@ mpn_div_qr_2n_pi2 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
Return the most significant limb of the quotient.
Preconditions:
- 1. qp must either not overlap with the input operands at all, or
+ 1. qp must either not overlap with the other operands at all, or
qp >= np + 2 must hold true. (This means that it's possible to put
- the quotient in the high part of {np,nn}, right above the remainder.
+ the quotient in the high part of {np,nn}, right above the remainder.)
2. nn >= 2. */
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2n_pi1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2n_pi1.c
index da500e2170e..131a81135af 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2n_pi1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2n_pi1.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2u_pi1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2u_pi1.c
index 0b9ddf57532..70e617b4da7 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2u_pi1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/div_qr_2u_pi1.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/dive_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/dive_1.c
index 2eaaf694e33..056f5b9beec 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/dive_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/dive_1.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/diveby3.c b/Build/source/libs/gmp/gmp-src/mpn/generic/diveby3.c
index 2ffd9fe777d..7dee0bcd95c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/diveby3.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/diveby3.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#if DIVEXACT_BY3_METHOD == 0
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/divexact.c b/Build/source/libs/gmp/gmp-src/mpn/generic/divexact.c
index 47a47e3d80a..ec417dfc266 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/divexact.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/divexact.c
@@ -8,7 +8,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 2006, 2007, 2009 Free Software Foundation, Inc.
+Copyright 2006, 2007, 2009, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -37,7 +37,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -99,6 +98,9 @@ mpn_divexact (mp_ptr qp,
tp = TMP_ALLOC_LIMBS (mpn_bdiv_q_itch (qn, dn));
mpn_bdiv_q (qp, np, qn, dp, dn, tp);
TMP_FREE;
+
+ /* Since bdiv_q computes -N/D (mod B^{qn}), we must negate now. */
+ mpn_neg (qp, qp, qn);
}
#else
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/divis.c b/Build/source/libs/gmp/gmp-src/mpn/generic/divis.c
index c7fd41e10ee..f989ddb6517 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/divis.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/divis.c
@@ -4,7 +4,8 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001, 2002, 2005, 2009, 2014 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2005, 2009, 2014, 2017, 2018 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +33,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -62,9 +62,9 @@ mpn_divisible_p (mp_srcptr ap, mp_size_t an,
{
mp_limb_t alow, dlow, dmask;
mp_ptr qp, rp, tp;
- mp_size_t i;
mp_limb_t di;
unsigned twos;
+ int c;
TMP_DECL;
ASSERT (an >= 0);
@@ -182,18 +182,13 @@ mpn_divisible_p (mp_srcptr ap, mp_size_t an,
mpn_mu_bdiv_qr (qp, rp, rp, an, dp, dn, tp);
}
- /* test for {rp,dn} zero or non-zero */
- i = 0;
- do
- {
- if (rp[i] != 0)
- {
- TMP_FREE;
- return 0;
- }
- }
- while (++i < dn);
+ /* In general, bdiv may return either R = 0 or R = D when D divides
+ A. But R = 0 can happen only when A = 0, which we already have
+ excluded. Furthermore, R == D (mod B^{dn}) implies no carry, so
+ we don't need to check the carry returned from bdiv. */
+
+ MPN_CMP (c, rp, dp, dn);
TMP_FREE;
- return 1;
+ return c == 0;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/divrem.c b/Build/source/libs/gmp/gmp-src/mpn/generic/divrem.c
index f420992746e..1da84a8e1ac 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/divrem.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/divrem.c
@@ -1,7 +1,7 @@
/* mpn_divrem -- Divide natural numbers, producing both remainder and
quotient. This is now just a middle layer calling mpn_tdiv_qr.
-Copyright 1993-1997, 1999-2002, 2005 Free Software Foundation, Inc.
+Copyright 1993-1997, 1999-2002, 2005, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -72,7 +71,7 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn,
}
else
{
- mp_ptr rp, q2p;
+ mp_ptr q2p;
mp_limb_t qhl;
mp_size_t qn;
TMP_DECL;
@@ -81,13 +80,11 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn,
if (UNLIKELY (qxn != 0))
{
mp_ptr n2p;
- n2p = TMP_ALLOC_LIMBS (nn + qxn);
+ TMP_ALLOC_LIMBS_2 (n2p, nn + qxn,
+ q2p, nn - dn + qxn + 1);
MPN_ZERO (n2p, qxn);
MPN_COPY (n2p + qxn, np, nn);
- q2p = TMP_ALLOC_LIMBS (nn - dn + qxn + 1);
- rp = TMP_ALLOC_LIMBS (dn);
- mpn_tdiv_qr (q2p, rp, 0L, n2p, nn + qxn, dp, dn);
- MPN_COPY (np, rp, dn);
+ mpn_tdiv_qr (q2p, np, 0L, n2p, nn + qxn, dp, dn);
qn = nn - dn + qxn;
MPN_COPY (qp, q2p, qn);
qhl = q2p[qn];
@@ -95,9 +92,7 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn,
else
{
q2p = TMP_ALLOC_LIMBS (nn - dn + 1);
- rp = TMP_ALLOC_LIMBS (dn);
- mpn_tdiv_qr (q2p, rp, 0L, np, nn, dp, dn);
- MPN_COPY (np, rp, dn); /* overwrite np area with remainder */
+ mpn_tdiv_qr (q2p, np, 0L, np, nn, dp, dn);
qn = nn - dn;
MPN_COPY (qp, q2p, qn);
qhl = q2p[qn];
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/divrem_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/divrem_1.c
index 9157b5735e2..c13aa7915f3 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/divrem_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/divrem_1.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/divrem_2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/divrem_2.c
index 30d24bb1025..217f2f69bfd 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/divrem_2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/divrem_2.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/dump.c b/Build/source/libs/gmp/gmp-src/mpn/generic/dump.c
index 3a73fe49e31..9a4ddf41f53 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/dump.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/dump.c
@@ -32,7 +32,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
#if GMP_NUMB_BITS % 4 == 0
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/fib2_ui.c b/Build/source/libs/gmp/gmp-src/mpn/generic/fib2_ui.c
index 336e6db15b2..0b815713291 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/fib2_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/fib2_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, 2009 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2005, 2009, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -33,7 +33,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
/* change this to "#define TRACE(x) x" for diagnostics */
@@ -48,19 +47,13 @@ see https://www.gnu.org/licenses/. */
fp[0] is 0 and f1p[0] is 1. f1p[size-1] can be zero, since F[n-1]<F[n]
(for n>0).
- Notes:
+ Notes: F[2k+1] = 4*F[k]^2 - F[k-1]^2 + 2*(-1)^k.
In F[2k+1] with k even, +2 is applied to 4*F[k]^2 just by ORing into the
low limb.
- In F[2k+1] with k odd, -2 is applied to the low limb of 4*F[k]^2 -
- F[k-1]^2. This F[2k+1] is an F[4m+3] and such numbers are congruent to
- 1, 2 or 5 mod 8, which means no underflow reaching it with a -2 (since
- that would leave 6 or 7 mod 8).
-
- This property of F[4m+3] can be verified by induction on F[4m+3] =
- 7*F[4m-1] - F[4m-5], that formula being a standard lucas sequence
- identity U[i+j] = U[i]*V[j] - U[i-j]*Q^j.
+ In F[2k+1] with k odd, -2 is applied to F[k-1]^2 just by ORing into the
+ low limb.
*/
mp_size_t
@@ -132,15 +125,13 @@ mpn_fib2_ui (mp_ptr fp, mp_ptr f1p, unsigned long int n)
/* Calculate F[2k+1] = 4*F[k]^2 - F[k-1]^2 + 2*(-1)^k.
n&mask is the low bit of our implied k. */
+
+ ASSERT ((fp[0] & 2) == 0);
+ /* fp is F[k-1]^2 == 0 or 1 mod 4, like all squares. */
+ fp[0] |= (n & mask ? 2 : 0); /* possible -2 */
#if HAVE_NATIVE_mpn_rsblsh2_n
fp[size] = mpn_rsblsh2_n (fp, fp, xp, size);
- if ((n & mask) == 0)
- MPN_INCR_U(fp, size + 1, 2); /* possible +2 */
- else
- {
- ASSERT (fp[0] >= 2);
- fp[0] -= 2; /* possible -2 */
- }
+ MPN_INCR_U(fp, size + 1, (n & mask ? 0 : 2)); /* possible +2 */
#else
{
mp_limb_t c;
@@ -148,8 +139,6 @@ mpn_fib2_ui (mp_ptr fp, mp_ptr f1p, unsigned long int n)
c = mpn_lshift (xp, xp, size, 2);
xp[0] |= (n & mask ? 0 : 2); /* possible +2 */
c -= mpn_sub_n (fp, xp, fp, size);
- ASSERT (n & mask ? fp[0] != 0 && fp[0] != 1 : 1);
- fp[0] -= (n & mask ? 2 : 0); /* possible -2 */
fp[size] = c;
}
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/fib2m.c b/Build/source/libs/gmp/gmp-src/mpn/generic/fib2m.c
new file mode 100644
index 00000000000..89d2b869b62
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/fib2m.c
@@ -0,0 +1,252 @@
+/* mpn_fib2m -- calculate Fibonacci numbers, modulo m.
+
+Contributed to the GNU project by Marco Bodrato, based on the previous
+fib2_ui.c file.
+
+ THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
+ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
+ FUTURE GNU MP RELEASES.
+
+Copyright 2001, 2002, 2005, 2009, 2018 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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 <stdio.h>
+#include "gmp-impl.h"
+#include "longlong.h"
+
+
+/* Stores |{ap,n}-{bp,n}| in {rp,n},
+ returns the sign of {ap,n}-{bp,n}. */
+static int
+abs_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+ mp_limb_t x, y;
+ while (--n >= 0)
+ {
+ x = ap[n];
+ y = bp[n];
+ if (x != y)
+ {
+ ++n;
+ if (x > y)
+ {
+ ASSERT_NOCARRY (mpn_sub_n (rp, ap, bp, n));
+ return 1;
+ }
+ else
+ {
+ ASSERT_NOCARRY (mpn_sub_n (rp, bp, ap, n));
+ return -1;
+ }
+ }
+ rp[n] = 0;
+ }
+ return 0;
+}
+
+/* Store F[n] at fp and F[n-1] at f1p. Both are computed modulo m.
+ fp and f1p should have room for mn*2+1 limbs.
+
+ The sign of one or both the values may be flipped (n-F, instead of F),
+ the return value is 0 (zero) if the signs are coherent (both positive
+ or both negative) and 1 (one) otherwise.
+
+ Notes:
+
+ In F[2k+1] with k even, +2 is applied to 4*F[k]^2 just by ORing into the
+ low limb.
+
+ In F[2k+1] with k odd, -2 is applied to F[k-1]^2 just by ORing into the
+ low limb.
+
+ TODO: Should {tp, 2 * mn} be passed as a scratch pointer?
+ Should the call to mpn_fib2_ui() obtain (up to) 2*mn limbs?
+*/
+
+int
+mpn_fib2m (mp_ptr fp, mp_ptr f1p, mp_srcptr np, mp_size_t nn, mp_srcptr mp, mp_size_t mn)
+{
+ unsigned long nfirst;
+ mp_limb_t nh;
+ mp_bitcnt_t nbi;
+ mp_size_t sn, fn;
+ int fcnt, ncnt;
+
+ ASSERT (! MPN_OVERLAP_P (fp, MAX(2*mn+1,5), f1p, MAX(2*mn+1,5)));
+ ASSERT (nn > 0 && np[nn - 1] != 0);
+
+ /* Estimate the maximal n such that fibonacci(n) fits in mn limbs. */
+#if GMP_NUMB_BITS % 16 == 0
+ if (UNLIKELY (ULONG_MAX / (23 * (GMP_NUMB_BITS / 16)) <= mn))
+ nfirst = ULONG_MAX;
+ else
+ nfirst = mn * (23 * (GMP_NUMB_BITS / 16));
+#else
+ {
+ mp_bitcnt_t mbi;
+ mbi = (mp_bitcnt_t) mn * GMP_NUMB_BITS;
+
+ if (UNLIKELY (ULONG_MAX / 23 < mbi))
+ {
+ if (UNLIKELY (ULONG_MAX / 23 * 16 <= mbi))
+ nfirst = ULONG_MAX;
+ else
+ nfirst = mbi / 16 * 23;
+ }
+ else
+ nfirst = mbi * 23 / 16;
+ }
+#endif
+
+ sn = nn - 1;
+ nh = np[sn];
+ count_leading_zeros (ncnt, nh);
+ count_leading_zeros (fcnt, nfirst);
+
+ if (fcnt >= ncnt)
+ {
+ ncnt = fcnt - ncnt;
+ nh >>= ncnt;
+ }
+ else if (sn > 0)
+ {
+ ncnt -= fcnt;
+ nh <<= ncnt;
+ ncnt = GMP_NUMB_BITS - ncnt;
+ --sn;
+ nh |= np[sn] >> ncnt;
+ }
+ else
+ ncnt = 0;
+
+ nbi = sn * GMP_NUMB_BITS + ncnt;
+ if (nh > nfirst)
+ {
+ nh >>= 1;
+ ++nbi;
+ }
+
+ ASSERT (nh <= nfirst);
+ /* Take a starting pair from mpn_fib2_ui. */
+ fn = mpn_fib2_ui (fp, f1p, nh);
+ MPN_ZERO (fp + fn, mn - fn);
+ MPN_ZERO (f1p + fn, mn - fn);
+
+ if (nbi == 0)
+ {
+ if (fn == mn)
+ {
+ mp_limb_t qp[2];
+ mpn_tdiv_qr (qp, fp, 0, fp, fn, mp, mn);
+ mpn_tdiv_qr (qp, f1p, 0, f1p, fn, mp, mn);
+ }
+
+ return 0;
+ }
+ else
+ {
+ mp_ptr tp;
+ unsigned pb = nh & 1;
+ int neg;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ tp = TMP_ALLOC_LIMBS (2 * mn + (mn < 2));
+
+ do
+ {
+ mp_ptr rp;
+ /* Here fp==F[k] and f1p==F[k-1], with k being the bits of n from
+ nbi upwards.
+
+ Based on the next bit of n, we'll double to the pair
+ fp==F[2k],f1p==F[2k-1] or fp==F[2k+1],f1p==F[2k], according as
+ that bit is 0 or 1 respectively. */
+
+ mpn_sqr (tp, fp, mn);
+ mpn_sqr (fp, f1p, mn);
+
+ /* Calculate F[2k-1] = F[k]^2 + F[k-1]^2. */
+ f1p[2 * mn] = mpn_add_n (f1p, tp, fp, 2 * mn);
+
+ /* Calculate F[2k+1] = 4*F[k]^2 - F[k-1]^2 + 2*(-1)^k.
+ pb is the low bit of our implied k. */
+
+ /* fp is F[k-1]^2 == 0 or 1 mod 4, like all squares. */
+ ASSERT ((fp[0] & 2) == 0);
+ ASSERT (pb == (pb & 1));
+ ASSERT ((fp[0] + (pb ? 2 : 0)) == (fp[0] | (pb << 1)));
+ fp[0] |= pb << 1; /* possible -2 */
+#if HAVE_NATIVE_mpn_rsblsh2_n
+ fp[2 * mn] = 1 + mpn_rsblsh2_n (fp, fp, tp, 2 * mn);
+ MPN_INCR_U(fp, 2 * mn + 1, (1 ^ pb) << 1); /* possible +2 */
+ fp[2 * mn] = (fp[2 * mn] - 1) & GMP_NUMB_MAX;
+#else
+ {
+ mp_limb_t c;
+
+ c = mpn_lshift (tp, tp, 2 * mn, 2);
+ tp[0] |= (1 ^ pb) << 1; /* possible +2 */
+ c -= mpn_sub_n (fp, tp, fp, 2 * mn);
+ fp[2 * mn] = c & GMP_NUMB_MAX;
+ }
+#endif
+ neg = fp[2 * mn] == GMP_NUMB_MAX;
+
+ /* Calculate F[2k-1] = F[k]^2 + F[k-1]^2 */
+ /* Calculate F[2k+1] = 4*F[k]^2 - F[k-1]^2 + 2*(-1)^k */
+
+ /* Calculate F[2k] = F[2k+1] - F[2k-1], replacing the unwanted one of
+ F[2k+1] and F[2k-1]. */
+ --nbi;
+ pb = (np [nbi / GMP_NUMB_BITS] >> (nbi % GMP_NUMB_BITS)) & 1;
+ rp = pb ? f1p : fp;
+ if (neg)
+ {
+ /* Calculate -(F[2k+1] - F[2k-1]) */
+ rp[2 * mn] = f1p[2 * mn] + 1 - mpn_sub_n (rp, f1p, fp, 2 * mn);
+ neg = ! pb;
+ if (pb) /* fp not overwritten, negate it. */
+ fp [2 * mn] = 1 ^ mpn_neg (fp, fp, 2 * mn);
+ }
+ else
+ {
+ neg = abs_sub_n (rp, fp, f1p, 2 * mn + 1) < 0;
+ }
+
+ mpn_tdiv_qr (tp, fp, 0, fp, 2 * mn + 1, mp, mn);
+ mpn_tdiv_qr (tp, f1p, 0, f1p, 2 * mn + 1, mp, mn);
+ }
+ while (nbi != 0);
+
+ TMP_FREE;
+
+ return neg;
+ }
+}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/gcd.c b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd.c
index b14e1ad888f..3f92cbf0d1f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/gcd.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd.c
@@ -1,6 +1,6 @@
/* mpn/gcd.c: mpn_gcd for gcd of two odd integers.
-Copyright 1991, 1993-1998, 2000-2005, 2008, 2010, 2012 Free Software
+Copyright 1991, 1993-1998, 2000-2005, 2008, 2010, 2012, 2019 Free Software
Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -77,61 +76,6 @@ gcd_hook (void *p, mp_srcptr gp, mp_size_t gn,
ctx->gn = gn;
}
-#if GMP_NAIL_BITS > 0
-/* Nail supports should be easy, replacing the sub_ddmmss with nails
- * logic. */
-#error Nails not supported.
-#endif
-
-/* Use binary algorithm to compute G <-- GCD (U, V) for usize, vsize == 2.
- Both U and V must be odd. */
-static inline mp_size_t
-gcd_2 (mp_ptr gp, mp_srcptr up, mp_srcptr vp)
-{
- mp_limb_t u0, u1, v0, v1;
- mp_size_t gn;
-
- u0 = up[0];
- u1 = up[1];
- v0 = vp[0];
- v1 = vp[1];
-
- ASSERT (u0 & 1);
- ASSERT (v0 & 1);
-
- /* Check for u0 != v0 needed to ensure that argument to
- * count_trailing_zeros is non-zero. */
- while (u1 != v1 && u0 != v0)
- {
- unsigned long int r;
- if (u1 > v1)
- {
- sub_ddmmss (u1, u0, u1, u0, v1, v0);
- count_trailing_zeros (r, u0);
- u0 = ((u1 << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK) | (u0 >> r);
- u1 >>= r;
- }
- else /* u1 < v1. */
- {
- sub_ddmmss (v1, v0, v1, v0, u1, u0);
- count_trailing_zeros (r, v0);
- v0 = ((v1 << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK) | (v0 >> r);
- v1 >>= r;
- }
- }
-
- gp[0] = u0, gp[1] = u1, gn = 1 + (u1 != 0);
-
- /* If U == V == GCD, done. Otherwise, compute GCD (V, |U - V|). */
- if (u1 == v1 && u0 == v0)
- return gn;
-
- v0 = (u0 == v0) ? ((u1 > v1) ? u1-v1 : v1-u1) : ((u0 > v0) ? u0-v0 : v0-u0);
- gp[0] = mpn_gcd_1 (gp, gn, v0);
-
- return 1;
-}
-
mp_size_t
mpn_gcd (mp_ptr gp, mp_ptr up, mp_size_t usize, mp_ptr vp, mp_size_t n)
{
@@ -273,37 +217,49 @@ mpn_gcd (mp_ptr gp, mp_ptr up, mp_size_t usize, mp_ptr vp, mp_size_t n)
ASSERT(up[n-1] | vp[n-1]);
- if (n == 1)
- {
- *gp = mpn_gcd_1(up, 1, vp[0]);
- ctx.gn = 1;
- goto done;
- }
-
- /* Due to the calling convention for mpn_gcd, at most one can be
- even. */
-
- if (! (up[0] & 1))
+ /* Due to the calling convention for mpn_gcd, at most one can be even. */
+ if ((up[0] & 1) == 0)
MP_PTR_SWAP (up, vp);
-
- ASSERT (up[0] & 1);
-
- if (vp[0] == 0)
- {
- *gp = mpn_gcd_1 (up, 2, vp[1]);
- ctx.gn = 1;
- goto done;
- }
- else if (! (vp[0] & 1))
- {
- int r;
- count_trailing_zeros (r, vp[0]);
- vp[0] = ((vp[1] << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK) | (vp[0] >> r);
- vp[1] >>= r;
- }
-
- ctx.gn = gcd_2(gp, up, vp);
-
+ ASSERT ((up[0] & 1) != 0);
+
+ {
+ mp_limb_t u0, u1, v0, v1;
+ mp_double_limb_t g;
+
+ u0 = up[0];
+ v0 = vp[0];
+
+ if (n == 1)
+ {
+ int cnt;
+ count_trailing_zeros (cnt, v0);
+ *gp = mpn_gcd_11 (u0, v0 >> cnt);
+ ctx.gn = 1;
+ goto done;
+ }
+
+ v1 = vp[1];
+ if (UNLIKELY (v0 == 0))
+ {
+ v0 = v1;
+ v1 = 0;
+ /* FIXME: We could invoke a mpn_gcd_21 here, just like mpn_gcd_22 could
+ when this situation occurs internally. */
+ }
+ if ((v0 & 1) == 0)
+ {
+ int cnt;
+ count_trailing_zeros (cnt, v0);
+ v0 = ((v1 << (GMP_NUMB_BITS - cnt)) & GMP_NUMB_MASK) | (v0 >> cnt);
+ v1 >>= cnt;
+ }
+
+ u1 = up[1];
+ g = mpn_gcd_22 (u1, u0, v1, v0);
+ gp[0] = g.d0;
+ gp[1] = g.d1;
+ ctx.gn = 1 + (g.d1 > 0);
+ }
done:
TMP_FREE;
return ctx.gn;
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_1.c
index f6dcb4a2eb8..22b1422b1ed 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_1.c
@@ -1,6 +1,6 @@
/* mpn_gcd_1 -- mpn and limb greatest common divisor.
-Copyright 1994, 1996, 2000, 2001, 2009, 2012 Free Software Foundation, Inc.
+Copyright 1994, 1996, 2000, 2001, 2009, 2012, 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,28 +28,9 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
-#ifndef GCD_1_METHOD
-#define GCD_1_METHOD 2
-#endif
-
-#define USE_ZEROTAB 0
-
-#if USE_ZEROTAB
-#define MAXSHIFT 4
-#define MASK ((1 << MAXSHIFT) - 1)
-static const unsigned char zerotab[1 << MAXSHIFT] =
-{
-#if MAXSHIFT > 4
- 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-#endif
- 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
-};
-#endif
-
/* Does not work for U == 0 or V == 0. It would be tough to make it work for
V == 0 since gcd(x,0) = x, and U does not generally fit in an mp_limb_t.
@@ -62,6 +43,7 @@ mpn_gcd_1 (mp_srcptr up, mp_size_t size, mp_limb_t vlimb)
{
mp_limb_t ulimb;
unsigned long zero_bits, u_low_zero_bits;
+ int c;
ASSERT (size >= 1);
ASSERT (vlimb != 0);
@@ -87,112 +69,34 @@ mpn_gcd_1 (mp_srcptr up, mp_size_t size, mp_limb_t vlimb)
if (ulimb == 0)
goto done;
- goto strip_u_maybe;
+ count_trailing_zeros (c, ulimb);
+ ulimb >>= c;
}
-
- /* size==1, so up[0]!=0 */
- count_trailing_zeros (u_low_zero_bits, ulimb);
- ulimb >>= u_low_zero_bits;
- zero_bits = MIN (zero_bits, u_low_zero_bits);
-
- /* make u bigger */
- if (vlimb > ulimb)
- MP_LIMB_T_SWAP (ulimb, vlimb);
-
- /* if u is much bigger than v, reduce using a division rather than
- chipping away at it bit-by-bit */
- if ((ulimb >> 16) > vlimb)
+ else
{
- ulimb %= vlimb;
- if (ulimb == 0)
- goto done;
- goto strip_u_maybe;
- }
-
- ASSERT (ulimb & 1);
- ASSERT (vlimb & 1);
-
-#if GCD_1_METHOD == 1
- while (ulimb != vlimb)
- {
- ASSERT (ulimb & 1);
- ASSERT (vlimb & 1);
-
- if (ulimb > vlimb)
+ /* size==1, so up[0]!=0 */
+ count_trailing_zeros (u_low_zero_bits, ulimb);
+ ulimb >>= u_low_zero_bits;
+ zero_bits = MIN (zero_bits, u_low_zero_bits);
+
+ /* make u bigger */
+ if (vlimb > ulimb)
+ MP_LIMB_T_SWAP (ulimb, vlimb);
+
+ /* if u is much bigger than v, reduce using a division rather than
+ chipping away at it bit-by-bit */
+ if ((ulimb >> 16) > vlimb)
{
- ulimb -= vlimb;
- do
- {
- ulimb >>= 1;
- ASSERT (ulimb != 0);
- strip_u_maybe:
- ;
- }
- while ((ulimb & 1) == 0);
- }
- else /* vlimb > ulimb. */
- {
- vlimb -= ulimb;
- do
- {
- vlimb >>= 1;
- ASSERT (vlimb != 0);
- }
- while ((vlimb & 1) == 0);
- }
- }
-#else
-# if GCD_1_METHOD == 2
-
- ulimb >>= 1;
- vlimb >>= 1;
-
- while (ulimb != vlimb)
- {
- int c;
- mp_limb_t t;
- mp_limb_t vgtu;
-
- t = ulimb - vlimb;
- vgtu = LIMB_HIGHBIT_TO_MASK (t);
+ ulimb %= vlimb;
+ if (ulimb == 0)
+ goto done;
- /* v <-- min (u, v) */
- vlimb += (vgtu & t);
-
- /* u <-- |u - v| */
- ulimb = (t ^ vgtu) - vgtu;
-
-#if USE_ZEROTAB
- /* Number of trailing zeros is the same no matter if we look at
- * t or ulimb, but using t gives more parallelism. */
- c = zerotab[t & MASK];
-
- while (UNLIKELY (c == MAXSHIFT))
- {
- ulimb >>= MAXSHIFT;
- if (0)
- strip_u_maybe:
- vlimb >>= 1;
-
- c = zerotab[ulimb & MASK];
- }
-#else
- if (0)
- {
- strip_u_maybe:
- vlimb >>= 1;
- t = ulimb;
+ count_trailing_zeros (c, ulimb);
+ ulimb >>= c;
}
- count_trailing_zeros (c, t);
-#endif
- ulimb >>= (c + 1);
}
- vlimb = (vlimb << 1) | 1;
-# else
-# error Unknown GCD_1_METHOD
-# endif
-#endif
+ vlimb = mpn_gcd_11 (ulimb, vlimb);
done:
return vlimb << zero_bits;
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_11.c b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_11.c
new file mode 100644
index 00000000000..214e45ce60d
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_11.c
@@ -0,0 +1,74 @@
+/* mpn_gcd_11 -- limb greatest common divisor.
+
+Copyright 1994, 1996, 2000, 2001, 2009, 2012, 2019 Free Software Foundation,
+Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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 "gmp-impl.h"
+#include "longlong.h"
+
+mp_limb_t
+mpn_gcd_11 (mp_limb_t u, mp_limb_t v)
+{
+ ASSERT (u & v & 1);
+
+ /* In this loop, we represent the odd numbers ulimb and vlimb
+ without the redundant least significant one bit. This reduction
+ in size by one bit ensures that the high bit of t, below, is set
+ if and only if vlimb > ulimb. */
+
+ u >>= 1;
+ v >>= 1;
+
+ while (u != v)
+ {
+ mp_limb_t t;
+ mp_limb_t vgtu;
+ int c;
+
+ t = u - v;
+ vgtu = LIMB_HIGHBIT_TO_MASK (t);
+
+ /* v <-- min (u, v) */
+ v += (vgtu & t);
+
+ /* u <-- |u - v| */
+ u = (t ^ vgtu) - vgtu;
+
+ count_trailing_zeros (c, t);
+ /* We have c <= GMP_LIMB_BITS - 2 here, so that
+
+ ulimb >>= (c + 1);
+
+ would be safe. But unlike the addition c + 1, a separate
+ shift by 1 is independent of c, and can be executed in
+ parallel with count_trailing_zeros. */
+ u = (u >> 1) >> c;
+ }
+ return (u << 1) + 1;
+}
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
new file mode 100644
index 00000000000..d97f0968277
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_22.c
@@ -0,0 +1,131 @@
+/* mpn_gcd_22 -- double limb greatest common divisor.
+
+Copyright 1994, 1996, 2000, 2001, 2009, 2012, 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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 "gmp-impl.h"
+#include "longlong.h"
+
+#if GMP_NAIL_BITS > 0
+#error Nails not supported.
+#endif
+
+mp_double_limb_t
+mpn_gcd_22 (mp_limb_t u1, mp_limb_t u0, mp_limb_t v1, mp_limb_t v0)
+{
+ mp_double_limb_t g;
+ ASSERT (u0 & v0 & 1);
+
+ /* Implicit least significant bit */
+ u0 = (u0 >> 1) | (u1 << (GMP_LIMB_BITS - 1));
+ u1 >>= 1;
+
+ v0 = (v0 >> 1) | (v1 << (GMP_LIMB_BITS - 1));
+ v1 >>= 1;
+
+ while (u1 || v1) /* u1 == 0 can happen at most twice per call */
+ {
+ mp_limb_t vgtu, t1, t0;
+ sub_ddmmss (t1, t0, u1, u0, v1, v0);
+ vgtu = LIMB_HIGHBIT_TO_MASK(t1);
+
+ if (UNLIKELY (t0 == 0))
+ {
+ 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) */
+ v1 += (vgtu & t1);
+ /* u0 = |u1 - v1| */
+ u0 = (t1 ^ vgtu) - vgtu;
+ ASSERT (c < GMP_LIMB_BITS - 1);
+ u0 >>= c + 1;
+ u1 = 0;
+ }
+ else
+ {
+ int c;
+ count_trailing_zeros (c, t0);
+ c++;
+ /* V <-- min (U, V).
+
+ Assembly version should use cmov. Another alternative,
+ avoiding carry propagation, would be
+
+ v0 += vgtu & t0; v1 += vtgu & (u1 - v1);
+ */
+ add_ssaaaa (v1, v0, v1, v0, vgtu & t1, vgtu & t0);
+ /* U <-- |U - V|
+ No carry handling needed in this conditional negation,
+ since t0 != 0. */
+ u0 = (t0 ^ vgtu) - vgtu;
+ u1 = t1 ^ vgtu;
+ if (UNLIKELY (c == GMP_LIMB_BITS))
+ {
+ u0 = u1;
+ u1 = 0;
+ }
+ else
+ {
+ u0 = (u0 >> c) | (u1 << (GMP_LIMB_BITS - c));
+ u1 >>= c;
+ }
+ }
+ }
+ while ((v0 | u0) & GMP_LIMB_HIGHBIT)
+ { /* At most two iterations */
+ mp_limb_t vgtu, t0;
+ int c;
+ sub_ddmmss (vgtu, t0, 0, u0, 0, v0);
+ if (UNLIKELY (t0 == 0))
+ {
+ g.d1 = u0 >> (GMP_LIMB_BITS - 1);
+ g.d0 = (u0 << 1) | 1;
+ return g;
+ }
+
+ /* v <-- min (u, v) */
+ v0 += (vgtu & t0);
+
+ /* u <-- |u - v| */
+ u0 = (t0 ^ vgtu) - vgtu;
+
+ count_trailing_zeros (c, t0);
+ u0 = (u0 >> 1) >> c;
+ }
+
+ g.d0 = mpn_gcd_11 ((u0 << 1) + 1, (v0 << 1) + 1);
+ g.d1 = 0;
+ return g;
+}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_subdiv_step.c b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_subdiv_step.c
index 18634bec9fa..9c3b88d3af1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_subdiv_step.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/gcd_subdiv_step.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
#include <stdlib.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext.c b/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext.c
index 1c4ff75aab8..55014807eff 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_1.c
index ea46cceb729..b221a92680c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_1.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -40,21 +39,8 @@ see https://www.gnu.org/licenses/. */
#define GCDEXT_1_BINARY_METHOD 2
#endif
-#ifndef USE_ZEROTAB
-#define USE_ZEROTAB 1
-#endif
-
#if GCDEXT_1_USE_BINARY
-#if USE_ZEROTAB
-static unsigned char zerotab[0x40] = {
- 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
- 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
- 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
- 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
-};
-#endif
-
mp_limb_t
mpn_gcdext_1 (mp_limb_signed_t *sp, mp_limb_signed_t *tp,
mp_limb_t u, mp_limb_t v)
@@ -111,48 +97,20 @@ mpn_gcdext_1 (mp_limb_signed_t *sp, mp_limb_signed_t *tp,
if (u > v)
{
u -= v;
-#if USE_ZEROTAB
- count = zerotab [u & 0x3f];
- u >>= count;
- if (UNLIKELY (count == 6))
- {
- unsigned c;
- do
- {
- c = zerotab[u & 0x3f];
- u >>= c;
- count += c;
- }
- while (c == 6);
- }
-#else
+
count_trailing_zeros (count, u);
u >>= count;
-#endif
+
t0 += t1; t1 <<= count;
s0 += s1; s1 <<= count;
}
else
{
v -= u;
-#if USE_ZEROTAB
- count = zerotab [v & 0x3f];
- v >>= count;
- if (UNLIKELY (count == 6))
- {
- unsigned c;
- do
- {
- c = zerotab[v & 0x3f];
- v >>= c;
- count += c;
- }
- while (c == 6);
- }
-#else
+
count_trailing_zeros (count, v);
v >>= count;
-#endif
+
t1 += t0; t0 <<= count;
s1 += s0; s0 <<= count;
}
@@ -194,22 +152,8 @@ mpn_gcdext_1 (mp_limb_signed_t *sp, mp_limb_signed_t *tp,
/* Number of trailing zeros is the same no matter if we look at
* d or u, but using d gives more parallelism. */
-#if USE_ZEROTAB
- count = zerotab[d & 0x3f];
- if (UNLIKELY (count == 6))
- {
- unsigned c = 6;
- do
- {
- d >>= c;
- c = zerotab[d & 0x3f];
- count += c;
- }
- while (c == 6);
- }
-#else
count_trailing_zeros (count, d);
-#endif
+
det_sign ^= vgtu;
tx = vgtu & (t0 - t1);
@@ -238,7 +182,7 @@ mpn_gcdext_1 (mp_limb_signed_t *sp, mp_limb_signed_t *tp,
ugh = ug/2 + (ug & 1);
vgh = vg/2 + (vg & 1);
- /* Now ±2^{shift} g = s0 U - t0 V. Get rid of the power of two, using
+ /* Now 2^{shift} g = s0 U - t0 V. Get rid of the power of two, using
s0 U - t0 V = (s0 + V/g) U - (t0 + U/g) V. */
for (i = 0; i < shift; i++)
{
@@ -249,8 +193,11 @@ mpn_gcdext_1 (mp_limb_signed_t *sp, mp_limb_signed_t *tp,
s0 += mask & vgh;
t0 += mask & ugh;
}
- /* FIXME: Try simplifying this condition. */
- if ( (s0 > 1 && 2*s0 >= vg) || (t0 > 1 && 2*t0 >= ug) )
+
+ ASSERT_ALWAYS (s0 <= vg);
+ ASSERT_ALWAYS (t0 <= ug);
+
+ if (s0 > vg - s0)
{
s0 -= vg;
t0 -= ug;
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_lehmer.c b/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_lehmer.c
index 547f69a4098..ea4e86d451e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_lehmer.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/gcdext_lehmer.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
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 d73d314856c..9784f215444 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
@@ -4,7 +4,8 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2003, 2004, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2007, 2009, 2010, 2012, 2018 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +33,12 @@ 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 "gmp.h"
+#include "config.h"
+
+#if HAVE_FLOAT_H
+#include <float.h> /* for DBL_MANT_DIG and FLT_RADIX */
+#endif
+
#include "gmp-impl.h"
#include "longlong.h"
@@ -355,21 +361,41 @@ mpn_get_d (mp_srcptr up, mp_size_t size, mp_size_t sign, long exp)
#endif
#if ! FORMAT_RECOGNIZED
- { /* Non-IEEE or strange limb size, do something generic. */
+
+#if !defined(GMP_DBL_MANT_BITS)
+#if defined(DBL_MANT_DIG) && FLT_RADIX == 2
+#define GMP_DBL_MANT_BITS DBL_MANT_DIG
+#else
+/* FIXME: Chose a smarter default value. */
+#define GMP_DBL_MANT_BITS (16 * sizeof (double))
+#endif
+#endif
+
+ { /* Non-IEEE or strange limb size, generically convert
+ GMP_DBL_MANT_BITS bits. */
+ mp_limb_t l;
+ int m;
mp_size_t i;
double d, weight;
unsigned long uexp;
/* First generate an fp number disregarding exp, instead keeping things
within the numb base factor from 1, which should prevent overflow and
- underflow even for the most exponent limited fp formats. The
- termination criteria should be refined, since we now include too many
- limbs. */
- weight = 1/MP_BASE_AS_DOUBLE;
- d = up[size - 1];
- for (i = size - 2; i >= 0; i--)
+ underflow even for the most exponent limited fp formats. */
+ i = size - 1;
+ l = up[i];
+ count_leading_zeros (m, l);
+ m = m + GMP_DBL_MANT_BITS - GMP_LIMB_BITS;
+ if (m < 0)
+ l &= GMP_NUMB_MAX << -m;
+ d = l;
+ for (weight = 1/MP_BASE_AS_DOUBLE; m > 0 && --i >= 0;)
{
- d += up[i] * weight;
+ l = up[i];
+ m -= GMP_NUMB_BITS;
+ if (m < 0)
+ l &= GMP_NUMB_MAX << -m;
+ d += l * weight;
weight /= MP_BASE_AS_DOUBLE;
if (weight == 0)
break;
@@ -385,7 +411,7 @@ mpn_get_d (mp_srcptr up, mp_size_t size, mp_size_t sign, long exp)
else
{
weight = 0.5;
- uexp = 1 - (unsigned long) (exp + 1);
+ uexp = NEG_CAST (unsigned long, exp);
}
#if 1
/* Square-and-multiply exponentiation. */
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 42e93c9cee4..19cc581aecb 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
@@ -2,13 +2,12 @@
Contributed to the GNU project by Torbjorn Granlund.
- THE FUNCTIONS IN THIS FILE, EXCEPT mpn_get_str, ARE INTERNAL WITH A MUTABLE
- INTERFACE. IT IS ONLY 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.
+ THE FUNCTIONS IN THIS FILE, EXCEPT mpn_get_str, ARE INTERNAL WITH MUTABLE
+ INTERFACES. IT IS ONLY 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 1991-1994, 1996, 2000-2002, 2004, 2006-2008, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991-2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -36,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -45,7 +43,7 @@ see https://www.gnu.org/licenses/. */
A) Divide U repeatedly by B, generating a quotient and remainder, until the
quotient becomes zero. The remainders hold the converted digits. Digits
- come out from right to left. (Used in mpn_sb_get_str.)
+ come out from right to left. (Used in mpn_bc_get_str.)
B) Divide U by b^g, for g such that 1/b <= U/b^g < 1, generating a fraction.
Then develop digits by multiplying the fraction repeatedly by b. Digits
@@ -90,7 +88,7 @@ see https://www.gnu.org/licenses/. */
...
else
if (un < GET_STR_PRECOMPUTE_THRESHOLD)
- mpn_sb_get_str (str, base, up, un);
+ mpn_bx_get_str (str, base, up, un);
else
precompute_power_tables
mpn_dc_get_str
@@ -98,18 +96,18 @@ see https://www.gnu.org/licenses/. */
mpn_dc_get_str:
mpn_tdiv_qr
if (qn < GET_STR_DC_THRESHOLD)
- mpn_sb_get_str
+ mpn_bc_get_str
else
mpn_dc_get_str
if (rn < GET_STR_DC_THRESHOLD)
- mpn_sb_get_str
+ mpn_bc_get_str
else
mpn_dc_get_str
The reason for the two threshold values is the cost of
- precompute_power_tables. GET_STR_PRECOMPUTE_THRESHOLD will be considerably
- larger than GET_STR_PRECOMPUTE_THRESHOLD. */
+ precompute_power_tables. GET_STR_PRECOMPUTE_THRESHOLD will be
+ considerably larger than GET_STR_DC_THRESHOLD. */
/* The x86s and m68020 have a quotient and remainder "div" instruction and
@@ -147,7 +145,7 @@ see https://www.gnu.org/licenses/. */
after the last digit of the result string. Complexity is O(un^2); intended
for small conversions. */
static unsigned char *
-mpn_sb_get_str (unsigned char *str, size_t len,
+mpn_bc_get_str (unsigned char *str, size_t len,
mp_ptr up, mp_size_t un, int base)
{
mp_limb_t rl, ul;
@@ -315,7 +313,7 @@ mpn_dc_get_str (unsigned char *str, size_t len,
if (BELOW_THRESHOLD (un, GET_STR_DC_THRESHOLD))
{
if (un != 0)
- str = mpn_sb_get_str (str, len, up, un, powtab->base);
+ str = mpn_bc_get_str (str, len, up, un, powtab->base);
else
{
while (len != 0)
@@ -359,7 +357,6 @@ mpn_dc_get_str (unsigned char *str, size_t len,
return str;
}
-
/* There are no leading zeros on the digits generated at str, but that's not
currently a documented feature. The current mpz_out_str and mpz_get_str
rely on it. */
@@ -367,13 +364,9 @@ mpn_dc_get_str (unsigned char *str, size_t len,
size_t
mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
{
- mp_ptr powtab_mem, powtab_mem_ptr;
- mp_limb_t big_base;
- size_t digits_in_base;
+ mp_ptr powtab_mem;
powers_t powtab[GMP_LIMB_BITS];
int pi;
- mp_size_t n;
- mp_ptr p, t;
size_t out_len;
mp_ptr tmp;
TMP_DECL;
@@ -434,115 +427,20 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
/* General case. The base is not a power of 2. */
if (BELOW_THRESHOLD (un, GET_STR_PRECOMPUTE_THRESHOLD))
- return mpn_sb_get_str (str, (size_t) 0, up, un, base) - str;
+ return mpn_bc_get_str (str, (size_t) 0, up, un, base) - str;
TMP_MARK;
/* Allocate one large block for the powers of big_base. */
- powtab_mem = TMP_BALLOC_LIMBS (mpn_dc_get_str_powtab_alloc (un));
- powtab_mem_ptr = powtab_mem;
+ 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 */
- big_base = mp_bases[base].big_base;
- digits_in_base = mp_bases[base].chars_per_limb;
-
- {
- mp_size_t n_pows, xn, pn, exptab[GMP_LIMB_BITS], bexp;
- mp_limb_t cy;
- mp_size_t shift;
- size_t ndig;
-
- DIGITS_IN_BASE_PER_LIMB (ndig, un, base);
- xn = 1 + ndig / mp_bases[base].chars_per_limb; /* FIXME: scalar integer division */
-
- n_pows = 0;
- for (pn = xn; pn != 1; pn = (pn + 1) >> 1)
- {
- exptab[n_pows] = pn;
- n_pows++;
- }
- exptab[n_pows] = 1;
-
- powtab[0].p = &big_base;
- powtab[0].n = 1;
- powtab[0].digits_in_base = digits_in_base;
- powtab[0].base = base;
- powtab[0].shift = 0;
-
- powtab[1].p = powtab_mem_ptr; powtab_mem_ptr += 2;
- powtab[1].p[0] = big_base;
- powtab[1].n = 1;
- powtab[1].digits_in_base = digits_in_base;
- powtab[1].base = base;
- powtab[1].shift = 0;
-
- n = 1;
- p = &big_base;
- bexp = 1;
- shift = 0;
- for (pi = 2; pi < n_pows; pi++)
- {
- t = powtab_mem_ptr;
- powtab_mem_ptr += 2 * n + 2;
-
- ASSERT_ALWAYS (powtab_mem_ptr < powtab_mem + mpn_dc_get_str_powtab_alloc (un));
-
- mpn_sqr (t, p, n);
-
- digits_in_base *= 2;
- n *= 2; n -= t[n - 1] == 0;
- bexp *= 2;
-
- if (bexp + 1 < exptab[n_pows - pi])
- {
- digits_in_base += mp_bases[base].chars_per_limb;
- cy = mpn_mul_1 (t, t, n, big_base);
- t[n] = cy;
- n += cy != 0;
- bexp += 1;
- }
- shift *= 2;
- /* Strip low zero limbs. */
- while (t[0] == 0)
- {
- t++;
- n--;
- shift++;
- }
- p = t;
- powtab[pi].p = p;
- powtab[pi].n = n;
- powtab[pi].digits_in_base = digits_in_base;
- powtab[pi].base = base;
- powtab[pi].shift = shift;
- }
-
- for (pi = 1; pi < n_pows; pi++)
- {
- t = powtab[pi].p;
- n = powtab[pi].n;
- cy = mpn_mul_1 (t, t, n, big_base);
- t[n] = cy;
- n += cy != 0;
- if (t[0] == 0)
- {
- powtab[pi].p = t + 1;
- n--;
- powtab[pi].shift++;
- }
- powtab[pi].n = n;
- powtab[pi].digits_in_base += mp_bases[base].chars_per_limb;
- }
-
-#if 0
- { int i;
- printf ("Computed table values for base=%d, un=%d, xn=%d:\n", base, un, xn);
- for (i = 0; i < n_pows; i++)
- printf ("%2d: %10ld %10ld %11ld %ld\n", i, exptab[n_pows-i], powtab[i].n, powtab[i].digits_in_base, powtab[i].shift);
- }
-#endif
- }
+ pi = 1 + mpn_compute_powtab (powtab, powtab_mem, xn, base);
/* Using our precomputed powers, now in powtab[], convert our number. */
tmp = TMP_BALLOC_LIMBS (mpn_dc_get_str_itch (un));
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd.c b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd.c
index e27a9bdd820..e3e9c669522 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
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 129637063f9..3fa40122e42 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2.c
@@ -4,7 +4,8 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 1996, 1998, 2000-2004, 2008, 2012 Free Software Foundation, Inc.
+Copyright 1996, 1998, 2000-2004, 2008, 2012, 2019 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -32,181 +33,466 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
-#if GMP_NAIL_BITS == 0
+#ifndef HGCD2_DIV1_METHOD
+#define HGCD2_DIV1_METHOD 3
+#endif
+
+#ifndef HGCD2_DIV2_METHOD
+#define HGCD2_DIV2_METHOD 2
+#endif
+
+#if GMP_NAIL_BITS != 0
+#error Nails not implemented
+#endif
+
+#if HAVE_NATIVE_mpn_div_11
+
+#define div1 mpn_div_11
+/* Single-limb division optimized for small quotients.
+ Returned value holds d0 = r, d1 = q. */
+mp_double_limb_t div1 (mp_limb_t, mp_limb_t);
-/* Copied from the old mpn/generic/gcdext.c, and modified slightly to return
- the remainder. */
+#elif HGCD2_DIV1_METHOD == 1
-/* Single-limb division optimized for small quotients. */
-static inline mp_limb_t
-div1 (mp_ptr rp,
- mp_limb_t n0,
- mp_limb_t d0)
+static inline mp_double_limb_t
+div1 (mp_limb_t n0, mp_limb_t d0)
{
- mp_limb_t q = 0;
+ mp_double_limb_t res;
+ res.d1 = n0 / d0;
+ res.d0 = n0 - res.d1 * d0;
+
+ return res;
+}
+
+#elif HGCD2_DIV1_METHOD == 2
+
+static mp_double_limb_t
+div1 (mp_limb_t n0, mp_limb_t d0)
+{
+ mp_double_limb_t res;
+ int ncnt, dcnt, cnt;
+ mp_limb_t q;
+ mp_limb_t mask;
+
+ ASSERT (n0 >= d0);
- if ((mp_limb_signed_t) n0 < 0)
+ count_leading_zeros (ncnt, n0);
+ count_leading_zeros (dcnt, d0);
+ cnt = dcnt - ncnt;
+
+ d0 <<= cnt;
+
+ q = -(mp_limb_t) (n0 >= d0);
+ n0 -= d0 & q;
+ d0 >>= 1;
+ q = -q;
+
+ while (--cnt >= 0)
{
- int cnt;
- for (cnt = 1; (mp_limb_signed_t) d0 >= 0; cnt++)
- {
- d0 = d0 << 1;
- }
+ mask = -(mp_limb_t) (n0 >= d0);
+ n0 -= d0 & mask;
+ d0 >>= 1;
+ q = (q << 1) - mask;
+ }
- q = 0;
- while (cnt)
- {
- q <<= 1;
- if (n0 >= d0)
- {
- n0 = n0 - d0;
- q |= 1;
- }
- d0 = d0 >> 1;
- cnt--;
- }
+ res.d0 = n0;
+ res.d1 = q;
+ return res;
+}
+
+#elif HGCD2_DIV1_METHOD == 3
+
+static inline mp_double_limb_t
+div1 (mp_limb_t n0, mp_limb_t d0)
+{
+ mp_double_limb_t res;
+ if (UNLIKELY ((d0 >> (GMP_LIMB_BITS - 3)) != 0)
+ || UNLIKELY (n0 >= (d0 << 3)))
+ {
+ res.d1 = n0 / d0;
+ res.d0 = n0 - res.d1 * d0;
}
else
{
- int cnt;
- for (cnt = 0; n0 >= d0; cnt++)
- {
- d0 = d0 << 1;
- }
+ mp_limb_t q, mask;
- q = 0;
- while (cnt)
- {
- d0 = d0 >> 1;
- q <<= 1;
- if (n0 >= d0)
- {
- n0 = n0 - d0;
- q |= 1;
- }
- cnt--;
- }
+ d0 <<= 2;
+
+ mask = -(mp_limb_t) (n0 >= d0);
+ n0 -= d0 & mask;
+ q = 4 & mask;
+
+ d0 >>= 1;
+ mask = -(mp_limb_t) (n0 >= d0);
+ n0 -= d0 & mask;
+ q += 2 & mask;
+
+ d0 >>= 1;
+ mask = -(mp_limb_t) (n0 >= d0);
+ n0 -= d0 & mask;
+ q -= mask;
+
+ res.d0 = n0;
+ res.d1 = q;
}
- *rp = n0;
- return q;
+ return res;
+}
+
+#elif HGCD2_DIV1_METHOD == 4
+
+/* Table quotients. We extract the NBITS most significant bits of the
+ numerator limb, and the corresponding bits from the divisor limb, and use
+ these to form an index into the table. This method is probably only useful
+ for short pipelines with slow multiplication.
+
+ Possible improvements:
+
+ * Perhaps extract the highest NBITS of the divisor instead of the same bits
+ as from the numerator. That would require another count_leading_zeros,
+ and a post-multiply shift of the quotient.
+
+ * Compress tables? Their values are tiny, and there are lots of zero
+ entries (which are never used).
+
+ * Round the table entries more cleverly?
+*/
+
+#ifndef NBITS
+#define NBITS 5
+#endif
+
+#if NBITS == 5
+/* This needs full division about 13.2% of the time. */
+static const unsigned char tab[512] = {
+17, 9, 5,4,3,2,2,2,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+18, 9, 6,4,3,2,2,2,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+19,10, 6,4,3,3,2,2,2,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+20,10, 6,5,3,3,2,2,2,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+21,11, 7,5,4,3,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
+22,11, 7,5,4,3,3,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
+23,12, 7,5,4,3,3,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
+24,12, 8,6,4,3,3,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
+25,13, 8,6,5,4,3,3,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,
+26,13, 8,6,5,4,3,3,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
+27,14, 9,6,5,4,3,3,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,
+28,14, 9,7,5,4,3,3,3,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,
+29,15,10,7,5,4,4,3,3,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,
+30,15,10,7,6,5,4,3,3,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,
+31,16,10,7,6,5,4,3,3,3,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
+32,16,11,8,6,5,4,3,3,3,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+};
+#elif NBITS == 6
+/* This needs full division about 9.8% of the time. */
+static const unsigned char tab[2048] = {
+33,17,11, 8, 6, 5,4,4,3,3,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+34,17,11, 8, 6, 5,4,4,3,3,3,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+35,18,12, 9, 7, 5,5,4,3,3,3,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+36,18,12, 9, 7, 6,5,4,3,3,3,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+37,19,13, 9, 7, 6,5,4,4,3,3,3,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+38,19,13, 9, 7, 6,5,4,4,3,3,3,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+39,20,13,10, 7, 6,5,4,4,3,3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+40,20,14,10, 8, 6,5,5,4,3,3,3,3,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+41,21,14,10, 8, 6,5,5,4,4,3,3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+42,21,14,10, 8, 7,6,5,4,4,3,3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+43,22,15,11, 8, 7,6,5,4,4,3,3,3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+44,22,15,11, 9, 7,6,5,4,4,3,3,3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+45,23,15,11, 9, 7,6,5,5,4,4,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+46,23,16,11, 9, 7,6,5,5,4,4,3,3,3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+47,24,16,12, 9, 7,6,5,5,4,4,3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+48,24,16,12, 9, 8,6,6,5,4,4,3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+49,25,17,12,10, 8,7,6,5,4,4,4,3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+50,25,17,13,10, 8,7,6,5,5,4,4,3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+51,26,18,13,10, 8,7,6,5,5,4,4,3,3,3,3,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+52,26,18,13,10, 8,7,6,5,5,4,4,3,3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+53,27,18,13,10, 9,7,6,5,5,4,4,4,3,3,3,3,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
+54,27,19,14,11, 9,7,6,6,5,4,4,4,3,3,3,3,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
+55,28,19,14,11, 9,7,6,6,5,5,4,4,3,3,3,3,3,2,2,2,2,2,2,2,2,2,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
+56,28,19,14,11, 9,8,7,6,5,5,4,4,3,3,3,3,3,2,2,2,2,2,2,2,2,2,1,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
+57,29,20,14,11, 9,8,7,6,5,5,4,4,4,3,3,3,3,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,
+58,29,20,15,11, 9,8,7,6,5,5,4,4,4,3,3,3,3,3,2,2,2,2,2,2,2,2,2,1,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
+59,30,20,15,12,10,8,7,6,5,5,4,4,4,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,
+60,30,21,15,12,10,8,7,6,6,5,5,4,4,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,1,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,
+61,31,21,15,12,10,8,7,6,6,5,5,4,4,4,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,
+62,31,22,16,12,10,9,7,6,6,5,5,4,4,4,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,1,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,
+63,32,22,16,13,10,9,7,7,6,5,5,4,4,4,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
+64,32,22,16,13,10,9,8,7,6,5,5,4,4,4,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,1,
+ 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+};
+#else
+#error No table for provided NBITS
+#endif
+
+static const unsigned char *tabp = tab - (1 << (NBITS - 1) << NBITS);
+
+static inline mp_double_limb_t
+div1 (mp_limb_t n0, mp_limb_t d0)
+{
+ int ncnt;
+ size_t nbi, dbi;
+ mp_limb_t q0;
+ mp_limb_t r0;
+ mp_limb_t mask;
+ mp_double_limb_t res;
+
+ ASSERT (n0 >= d0); /* Actually only msb position is critical. */
+
+ count_leading_zeros (ncnt, n0);
+ nbi = n0 << ncnt >> (GMP_LIMB_BITS - NBITS);
+ dbi = d0 << ncnt >> (GMP_LIMB_BITS - NBITS);
+
+ q0 = tabp[(nbi << NBITS) + dbi];
+ r0 = n0 - q0 * d0;
+ mask = -(mp_limb_t) (r0 >= d0);
+ q0 -= mask;
+ r0 -= d0 & mask;
+
+ if (UNLIKELY (r0 >= d0))
+ {
+ q0 = n0 / d0;
+ r0 = n0 - q0 * d0;
+ }
+
+ res.d1 = q0;
+ res.d0 = r0;
+ return res;
+}
+
+#elif HGCD2_DIV1_METHOD == 5
+
+/* Table inverses of divisors. We don't bother with suppressing the msb from
+ the tables. We index with the NBITS most significant divisor bits,
+ including the always-set highest bit, but use addressing trickery via tabp
+ to suppress it.
+
+ Possible improvements:
+
+ * Do first multiply using 32-bit operations on 64-bit computers. At least
+ on most Arm64 cores, that uses 3 times less resources. It also saves on
+ many x86-64 processors.
+*/
+
+#ifndef NBITS
+#define NBITS 7
+#endif
+
+#if NBITS == 5
+/* This needs full division about 1.63% of the time. */
+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] = {
+255,251,247,243,239,236,233,229,226,223,220,217,214,211,209,206,
+203,201,198,196,194,191,189,187,185,183,181,179,177,175,173,171,
+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] = {
+511,507,503,499,495,491,488,484,480,477,473,470,467,463,460,457,
+454,450,447,444,441,438,435,433,430,427,424,421,419,416,413,411,
+408,406,403,401,398,396,393,391,389,386,384,382,380,377,375,373,
+371,369,367,365,363,361,359,357,355,353,351,349,347,345,343,342,
+340,338,336,335,333,331,329,328,326,325,323,321,320,318,317,315,
+314,312,311,309,308,306,305,303,302,301,299,298,296,295,294,292,
+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
+
+static inline mp_double_limb_t
+div1 (mp_limb_t n0, mp_limb_t d0)
+{
+ int ncnt, dcnt;
+ size_t dbi;
+ mp_limb_t inv;
+ mp_limb_t q0;
+ mp_limb_t r0;
+ mp_limb_t mask;
+ mp_double_limb_t res;
+
+ count_leading_zeros (ncnt, n0);
+ count_leading_zeros (dcnt, d0);
+
+ dbi = d0 << dcnt >> (GMP_LIMB_BITS - NBITS);
+ inv = tabp[dbi];
+ q0 = ((n0 << ncnt) >> (NBITS + 1)) * inv >> (GMP_LIMB_BITS - 1 + ncnt - dcnt);
+ r0 = n0 - q0 * d0;
+ mask = -(mp_limb_t) (r0 >= d0);
+ q0 -= mask;
+ r0 -= d0 & mask;
+
+ if (UNLIKELY (r0 >= d0))
+ {
+ q0 = n0 / d0;
+ r0 = n0 - q0 * d0;
+ }
+
+ res.d1 = q0;
+ res.d0 = r0;
+ return res;
}
+#else
+#error Unknown HGCD2_DIV1_METHOD
+#endif
+
+#if HAVE_NATIVE_mpn_div_22
+
+#define div2 mpn_div_22
/* Two-limb division optimized for small quotients. */
-static inline mp_limb_t
+mp_limb_t div2 (mp_ptr, mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t);
+
+#elif HGCD2_DIV2_METHOD == 1
+
+static mp_limb_t
div2 (mp_ptr rp,
- mp_limb_t nh, mp_limb_t nl,
- mp_limb_t dh, mp_limb_t dl)
+ mp_limb_t n1, mp_limb_t n0,
+ mp_limb_t d1, mp_limb_t d0)
{
- mp_limb_t q = 0;
-
- if ((mp_limb_signed_t) nh < 0)
+ mp_double_limb_t rq = div1 (n1, d1);
+ if (UNLIKELY (rq.d1 > d1))
{
- int cnt;
- for (cnt = 1; (mp_limb_signed_t) dh >= 0; cnt++)
+ mp_limb_t n2, q, t1, t0;
+ int c;
+
+ /* Normalize */
+ count_leading_zeros (c, d1);
+ ASSERT (c > 0);
+
+ n2 = n1 >> (GMP_LIMB_BITS - c);
+ n1 = (n1 << c) | (n0 >> (GMP_LIMB_BITS - c));
+ n0 <<= c;
+ d1 = (d1 << c) | (d0 >> (GMP_LIMB_BITS - c));
+ d0 <<= c;
+
+ udiv_qrnnd (q, n1, n2, n1, d1);
+ umul_ppmm (t1, t0, q, d0);
+ if (t1 > n1 || (t1 == n1 && t0 > n0))
{
- dh = (dh << 1) | (dl >> (GMP_LIMB_BITS - 1));
- dl = dl << 1;
+ ASSERT (q > 0);
+ q--;
+ sub_ddmmss (t1, t0, t1, t0, d1, d0);
}
+ sub_ddmmss (n1, n0, n1, n0, t1, t0);
- while (cnt)
- {
- q <<= 1;
- if (nh > dh || (nh == dh && nl >= dl))
- {
- sub_ddmmss (nh, nl, nh, nl, dh, dl);
- q |= 1;
- }
- dl = (dh << (GMP_LIMB_BITS - 1)) | (dl >> 1);
- dh = dh >> 1;
- cnt--;
- }
+ /* Undo normalization */
+ rp[0] = (n0 >> c) | (n1 << (GMP_LIMB_BITS - c));
+ rp[1] = n1 >> c;
+
+ return q;
}
else
{
- int cnt;
- for (cnt = 0; nh > dh || (nh == dh && nl >= dl); cnt++)
+ mp_limb_t q, t1, t0;
+ n1 = rq.d0;
+ q = rq.d1;
+ umul_ppmm (t1, t0, q, d0);
+ if (UNLIKELY (t1 >= n1) && (t1 > n1 || t0 > n0))
{
- dh = (dh << 1) | (dl >> (GMP_LIMB_BITS - 1));
- dl = dl << 1;
- }
-
- while (cnt)
- {
- dl = (dh << (GMP_LIMB_BITS - 1)) | (dl >> 1);
- dh = dh >> 1;
- q <<= 1;
- if (nh > dh || (nh == dh && nl >= dl))
- {
- sub_ddmmss (nh, nl, nh, nl, dh, dl);
- q |= 1;
- }
- cnt--;
+ ASSERT (q > 0);
+ q--;
+ sub_ddmmss (t1, t0, t1, t0, d1, d0);
}
+ sub_ddmmss (rp[1], rp[0], n1, n0, t1, t0);
+ return q;
}
-
- rp[0] = nl;
- rp[1] = nh;
-
- return q;
}
-#if 0
-/* This div2 uses less branches, but it seems to nevertheless be
- slightly slower than the above code. */
-static inline mp_limb_t
+#elif HGCD2_DIV2_METHOD == 2
+
+/* Bit-wise div2. Relies on fast count_leading_zeros. */
+static mp_limb_t
div2 (mp_ptr rp,
- mp_limb_t nh, mp_limb_t nl,
- mp_limb_t dh, mp_limb_t dl)
+ mp_limb_t n1, mp_limb_t n0,
+ mp_limb_t d1, mp_limb_t d0)
{
mp_limb_t q = 0;
int ncnt;
int dcnt;
- count_leading_zeros (ncnt, nh);
- count_leading_zeros (dcnt, dh);
+ count_leading_zeros (ncnt, n1);
+ count_leading_zeros (dcnt, d1);
dcnt -= ncnt;
- dh = (dh << dcnt) + (-(dcnt > 0) & (dl >> (GMP_LIMB_BITS - dcnt)));
- dl <<= dcnt;
+ d1 = (d1 << dcnt) + (d0 >> 1 >> (GMP_LIMB_BITS - 1 - dcnt));
+ d0 <<= dcnt;
do
{
- mp_limb_t bit;
+ mp_limb_t mask;
q <<= 1;
- if (UNLIKELY (nh == dh))
- bit = (nl >= dl);
+ if (UNLIKELY (n1 == d1))
+ mask = -(n0 >= d0);
else
- bit = (nh > dh);
+ mask = -(n1 > d1);
- q |= bit;
+ q -= mask;
- sub_ddmmss (nh, nl, nh, nl, (-bit) & dh, (-bit) & dl);
+ sub_ddmmss (n1, n0, n1, n0, mask & d1, mask & d0);
- dl = (dh << (GMP_LIMB_BITS - 1)) | (dl >> 1);
- dh = dh >> 1;
+ d0 = (d1 << (GMP_LIMB_BITS - 1)) | (d0 >> 1);
+ d1 = d1 >> 1;
}
while (dcnt--);
- rp[0] = nl;
- rp[1] = nh;
+ rp[0] = n0;
+ rp[1] = n1;
return q;
}
+#else
+#error Unknown HGCD2_DIV2_METHOD
#endif
-#else /* GMP_NAIL_BITS != 0 */
-/* Check all functions for nail support. */
-/* hgcd2 should be defined to take inputs including nail bits, and
- produce a matrix with elements also including nail bits. This is
- necessary, for the matrix elements to be useful with mpn_mul_1,
- mpn_addmul_1 and friends. */
-#error Not implemented
-#endif /* GMP_NAIL_BITS != 0 */
-
/* Reduces a,b until |a-b| (almost) fits in one limb + 1 bit. Constructs
matrix M. Returns 1 if we make progress, i.e. can perform at least
one subtraction. Otherwise returns zero. */
@@ -341,9 +627,8 @@ mpn_hgcd2 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
}
}
- /* NOTE: Since we discard the least significant half limb, we don't
- get a truly maximal M (corresponding to |a - b| <
- 2^{GMP_LIMB_BITS +1}). */
+ /* NOTE: Since we discard the least significant half limb, we don't get a
+ truly maximal M (corresponding to |a - b| < 2^{GMP_LIMB_BITS +1}). */
/* Single precision loop */
for (;;)
{
@@ -361,9 +646,10 @@ mpn_hgcd2 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
}
else
{
- mp_limb_t r;
- mp_limb_t q = div1 (&r, ah, bh);
- ah = r;
+ mp_double_limb_t rq = div1 (ah, bh);
+ mp_limb_t q = rq.d1;
+ ah = rq.d0;
+
if (ah < (CNST_LIMB(1) << (GMP_LIMB_BITS / 2 + 1)))
{
/* A is too small, but q is correct. */
@@ -390,9 +676,10 @@ mpn_hgcd2 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
}
else
{
- mp_limb_t r;
- mp_limb_t q = div1 (&r, bh, ah);
- bh = r;
+ mp_double_limb_t rq = div1 (bh, ah);
+ mp_limb_t q = rq.d1;
+ bh = rq.d0;
+
if (bh < (CNST_LIMB(1) << (GMP_LIMB_BITS / 2 + 1)))
{
/* B is too small, but q is correct. */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2_jacobi.c b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2_jacobi.c
index e59c32a3414..98e079bf1bf 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2_jacobi.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd2_jacobi.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_appr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_appr.c
index 660219372f8..bb017382509 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_appr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_appr.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_jacobi.c b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_jacobi.c
index 0a49e5b3a78..24014cefb13 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_jacobi.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_jacobi.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_matrix.c b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_matrix.c
index d9db331603b..54c795d3630 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_matrix.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_matrix.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_reduce.c b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_reduce.c
index 68b33c9ea70..3aee77d4761 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_reduce.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_reduce.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_step.c b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_step.c
index e58894ff3b4..a978a8802ef 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_step.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/hgcd_step.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/invert.c b/Build/source/libs/gmp/gmp-src/mpn/generic/invert.c
index ba6364e1875..157ff2bea1c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/invert.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/invert.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 GMP RELEASE.
-Copyright (C) 2007, 2009, 2010, 2012, 2014-2015 Free Software Foundation, Inc.
+Copyright (C) 2007, 2009, 2010, 2012, 2014-2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -52,15 +51,11 @@ mpn_invert (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
else if (BELOW_THRESHOLD (n, INV_APPR_THRESHOLD))
{
/* Maximum scratch needed by this branch: 2*n */
- mp_size_t i;
mp_ptr xp;
xp = scratch; /* 2 * n limbs */
/* n > 1 here */
- i = n;
- do
- xp[--i] = GMP_NUMB_MAX;
- while (i);
+ MPN_FILL (xp, n, GMP_NUMB_MAX);
mpn_com (xp + n, dp, n);
if (n == 2) {
mpn_divrem_2 (ip, 0, xp, 4, dp);
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/invertappr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/invertappr.c
index c9d34758fae..3be5596bf70 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/invertappr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/invertappr.c
@@ -12,7 +12,8 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright (C) 2007, 2009, 2010, 2012, 2015 Free Software Foundation, Inc.
+Copyright (C) 2007, 2009, 2010, 2012, 2015, 2016 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -40,7 +41,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -97,13 +97,8 @@ mpn_bc_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr xp)
if (n == 1)
invert_limb (*ip, *dp);
else {
- mp_size_t i;
-
/* n > 1 here */
- i = n;
- do
- xp[--i] = GMP_NUMB_MAX;
- while (i);
+ MPN_FILL (xp, n, GMP_NUMB_MAX);
mpn_com (xp + n, dp, n);
/* Now xp contains B^2n - {dp,n}*B^n - 1 */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/jacbase.c b/Build/source/libs/gmp/gmp-src/mpn/generic/jacbase.c
index cd52bc95133..735ad7a0b57 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/jacbase.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/jacbase.c
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/jacobi.c b/Build/source/libs/gmp/gmp-src/mpn/generic/jacobi.c
index bdc3ec67da1..d98b126040c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/jacobi.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/jacobi.c
@@ -33,7 +33,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -175,7 +174,7 @@ mpn_jacobi_n (mp_ptr ap, mp_ptr bp, mp_size_t n, unsigned bits)
storage etc. */
scratch = MPN_GCD_SUBDIV_STEP_ITCH(n);
- if (ABOVE_THRESHOLD (n, GCD_DC_THRESHOLD))
+ if (ABOVE_THRESHOLD (n, JACOBI_DC_THRESHOLD))
{
mp_size_t hgcd_scratch;
mp_size_t update_scratch;
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/jacobi_2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/jacobi_2.c
index 9f480f7834a..028b8a4140e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/jacobi_2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/jacobi_2.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/logops_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/logops_n.c
index 1b534ff4ba5..3adba2cdc14 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/logops_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/logops_n.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#ifdef OPERATION_and_n
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/lshift.c b/Build/source/libs/gmp/gmp-src/mpn/generic/lshift.c
index 5182632976c..7e1fdefccba 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/lshift.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/lshift.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* Shift U (pointed to by up and n limbs long) cnt bits to the left
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/lshiftc.c b/Build/source/libs/gmp/gmp-src/mpn/generic/lshiftc.c
index e8051b7b931..a583602ff3e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/lshiftc.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/lshiftc.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* Shift U (pointed to by up and n limbs long) cnt bits to the left
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul.c
index 59531eb1b26..6a1299ad029 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -127,7 +126,7 @@ mpn_matrix22_mul_itch (mp_size_t rn, mp_size_t mn)
* Resulting elements are of size up to rn + mn + 1.
*
* Temporary storage: 3 rn + 3 mn + 5. */
-void
+static void
mpn_matrix22_mul_strassen (mp_ptr r0, mp_ptr r1, mp_ptr r2, mp_ptr r3, mp_size_t rn,
mp_srcptr m0, mp_srcptr m1, mp_srcptr m2, mp_srcptr m3, mp_size_t mn,
mp_ptr tp)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul1_inverse_vector.c b/Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul1_inverse_vector.c
index 83b2fb51343..68d50b7784b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul1_inverse_vector.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/matrix22_mul1_inverse_vector.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1.c
index 0212020201f..8e415df33a6 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
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 62e2daaf408..f6342d68167 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
@@ -36,7 +36,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -114,7 +113,8 @@ see https://www.gnu.org/licenses/. */
"subfe %0, %0, %0\n\t" \
"nor %0, %0, %0" \
: "=r" (m), "=r" (s1), "=&r" (s0) \
- : "r" (a1), "r" (b1), "%r" (a0), "rI" (b0))
+ : "r" (a1), "r" (b1), "%r" (a0), "rI" (b0) \
+ __CLOBBER_CC)
#endif
#if defined (__s390x__) && W_TYPE_SIZE == 64
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_2.c
index 7acf3dbdd10..b00d19eb046 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_2.c
@@ -37,7 +37,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_3.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_3.c
index f4137f43155..4d4be5d24ae 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_3.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_3.c
@@ -1,6 +1,6 @@
/* mpn_mod_1s_3p (ap, n, b, cps)
Divide (ap,,n) by b. Return the single-limb remainder.
- Requires that d < B / 3.
+ Requires that b < B / 3.
Contributed to the GNU project by Torbjorn Granlund.
Based on a suggestion by Peter L. Montgomery.
@@ -37,7 +37,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_4.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_4.c
index 716a0c66de4..80b42ba1e6f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_4.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_1_4.c
@@ -1,6 +1,6 @@
/* mpn_mod_1s_4p (ap, n, b, cps)
Divide (ap,,n) by b. Return the single-limb remainder.
- Requires that d < B / 4.
+ Requires that b < B / 4.
Contributed to the GNU project by Torbjorn Granlund.
Based on a suggestion by Peter L. Montgomery.
@@ -37,7 +37,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_34lsub1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_34lsub1.c
index 7c07af7acc2..af9c6c63b6e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mod_34lsub1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mod_34lsub1.c
@@ -33,7 +33,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
@@ -97,9 +96,7 @@ see https://www.gnu.org/licenses/. */
mp_limb_t
mpn_mod_34lsub1 (mp_srcptr p, mp_size_t n)
{
- mp_limb_t c0 = 0;
- mp_limb_t c1 = 0;
- mp_limb_t c2 = 0;
+ mp_limb_t c0, c1, c2;
mp_limb_t a0, a1, a2;
ASSERT (n >= 1);
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mode1o.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mode1o.c
index ec91da223d4..9ba0ae1ccf9 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mode1o.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mode1o.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_q.c
index 6f5f3166caa..0ef3bd818eb 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_q.c
@@ -8,7 +8,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 2005-2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2005-2007, 2009, 2010, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -44,7 +44,6 @@ see https://www.gnu.org/licenses/. */
for developing quotient bits. This algorithm was presented at ICMS 2006.
*/
-#include "gmp.h"
#include "gmp-impl.h"
@@ -66,8 +65,8 @@ see https://www.gnu.org/licenses/. */
particular, when dn==in, tp and rp could use the same space.
FIXME: Trim final quotient calculation to qn limbs of precision.
*/
-void
-mpn_mu_bdiv_q (mp_ptr qp,
+static void
+mpn_mu_bdiv_q_old (mp_ptr qp,
mp_srcptr np, mp_size_t nn,
mp_srcptr dp, mp_size_t dn,
mp_ptr scratch)
@@ -225,6 +224,16 @@ mpn_mu_bdiv_q (mp_ptr qp,
}
}
+void
+mpn_mu_bdiv_q (mp_ptr qp,
+ mp_srcptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_ptr scratch)
+{
+ mpn_mu_bdiv_q_old (qp, np, nn, dp, dn, scratch);
+ mpn_neg (qp, qp, nn);
+}
+
mp_size_t
mpn_mu_bdiv_q_itch (mp_size_t nn, mp_size_t dn)
{
@@ -270,4 +279,3 @@ mpn_mu_bdiv_q_itch (mp_size_t nn, mp_size_t dn)
itch_binvert = mpn_binvert_itch (in);
return in + MAX (itches, itch_binvert);
}
-
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_qr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_qr.c
index 54da5b0bfe1..540ad73cc40 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_bdiv_qr.c
@@ -8,7 +8,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 2005-2007, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2005-2007, 2009, 2010, 2012, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -44,7 +44,6 @@ see https://www.gnu.org/licenses/. */
for developing quotient bits. This algorithm was presented at ICMS 2006.
*/
-#include "gmp.h"
#include "gmp-impl.h"
@@ -65,12 +64,12 @@ see https://www.gnu.org/licenses/. */
FIXME: Trim allocation for (qn > dn) case, 3*dn might be possible. In
particular, when dn==in, tp and rp could use the same space.
*/
-mp_limb_t
-mpn_mu_bdiv_qr (mp_ptr qp,
- mp_ptr rp,
- mp_srcptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- mp_ptr scratch)
+static mp_limb_t
+mpn_mu_bdiv_qr_old (mp_ptr qp,
+ mp_ptr rp,
+ mp_srcptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_ptr scratch)
{
mp_size_t qn;
mp_size_t in;
@@ -243,6 +242,39 @@ mpn_mu_bdiv_qr (mp_ptr qp,
}
}
+mp_limb_t
+mpn_mu_bdiv_qr (mp_ptr qp,
+ mp_ptr rp,
+ mp_srcptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_ptr scratch)
+{
+ mp_limb_t cy = mpn_mu_bdiv_qr_old (qp, rp, np, nn, dp, dn, scratch);
+
+ /* R' B^{qn} = U - Q' D
+ *
+ * Q = B^{qn} - Q' (assuming Q' != 0)
+ *
+ * R B^{qn} = U + Q D = U + B^{qn} D - Q' D
+ * = B^{qn} D + R'
+ */
+
+ if (UNLIKELY (!mpn_neg (qp, qp, nn - dn)))
+ {
+ /* Zero quotient. */
+ ASSERT (cy == 0);
+ return 0;
+ }
+ else
+ {
+ mp_limb_t cy2 = mpn_add_n (rp, rp, dp, dn);
+ ASSERT (cy2 >= cy);
+
+ return cy2 - cy;
+ }
+}
+
+
mp_size_t
mpn_mu_bdiv_qr_itch (mp_size_t nn, mp_size_t dn)
{
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_q.c
index 7fc94353233..44cfb4066d7 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_q.c
@@ -59,7 +59,6 @@ see https://www.gnu.org/licenses/. */
*/
#include <stdlib.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_qr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_qr.c
index 2a22af495c2..8b9c702b9ef 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_div_qr.c
@@ -72,7 +72,6 @@ see https://www.gnu.org/licenses/. */
#endif
#include <stdlib.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
@@ -91,6 +90,7 @@ see https://www.gnu.org/licenses/. */
static mp_limb_t mpn_mu_div_qr2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+static mp_size_t mpn_mu_div_qr_choose_in (mp_size_t, mp_size_t, int);
mp_limb_t
@@ -363,7 +363,7 @@ mpn_preinv_mu_div_qr (mp_ptr qp,
(c) qn < dn/3: in = qn
In all cases we have in <= dn.
*/
-mp_size_t
+static mp_size_t
mpn_mu_div_qr_choose_in (mp_size_t qn, mp_size_t dn, int k)
{
mp_size_t in;
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_divappr_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_divappr_q.c
index 970c86245c9..c022b4f10a0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mu_divappr_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mu_divappr_q.c
@@ -68,9 +68,11 @@ see https://www.gnu.org/licenses/. */
#endif
#include <stdlib.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
+static mp_limb_t mpn_preinv_mu_divappr_q (mp_ptr, mp_srcptr, mp_size_t,
+ mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+static mp_size_t mpn_mu_divappr_q_choose_in (mp_size_t, mp_size_t, int);
mp_limb_t
mpn_mu_divappr_q (mp_ptr qp,
@@ -156,7 +158,7 @@ mpn_mu_divappr_q (mp_ptr qp,
return qh;
}
-mp_limb_t
+static mp_limb_t
mpn_preinv_mu_divappr_q (mp_ptr qp,
mp_srcptr np,
mp_size_t nn,
@@ -312,7 +314,7 @@ mpn_preinv_mu_divappr_q (mp_ptr qp,
(c) qn < dn/3: in = qn
In all cases we have in <= dn.
*/
-mp_size_t
+static mp_size_t
mpn_mu_divappr_q_choose_in (mp_size_t qn, mp_size_t dn, int k)
{
mp_size_t in;
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mul.c
index 2819f61ed8d..37444e91b47 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mul.c
@@ -3,7 +3,7 @@
Contributed to the GNU project by Torbjorn Granlund.
Copyright 1991, 1993, 1994, 1996, 1997, 1999-2003, 2005-2007, 2009, 2010, 2012,
-2014 Free Software Foundation, Inc.
+2014, 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -109,12 +108,8 @@ see https://www.gnu.org/licenses/. */
* That problem is even more prevalent for toomX3. We therefore use special
THRESHOLD variables there.
-
- * Is our ITCH allocation correct?
*/
-#define ITCH (16*vn + 100)
-
mp_limb_t
mpn_mul (mp_ptr prodp,
mp_srcptr up, mp_size_t un,
@@ -125,12 +120,17 @@ mpn_mul (mp_ptr prodp,
ASSERT (! MPN_OVERLAP_P (prodp, un+vn, up, un));
ASSERT (! MPN_OVERLAP_P (prodp, un+vn, vp, vn));
- if (un == vn)
+ if (BELOW_THRESHOLD (un, MUL_TOOM22_THRESHOLD))
{
- if (up == vp)
- mpn_sqr (prodp, up, un);
- else
- mpn_mul_n (prodp, up, vp, un);
+ /* When un (and thus vn) is below the toom22 range, do mul_basecase.
+ Test un and not vn here not to thwart the un >> vn code below.
+ This special case is not necessary, but cuts the overhead for the
+ smallest operands. */
+ mpn_mul_basecase (prodp, up, un, vp, vn);
+ }
+ else if (un == vn)
+ {
+ mpn_mul_n (prodp, up, vp, un);
}
else if (vn < MUL_TOOM22_THRESHOLD)
{ /* plain schoolbook multiplication */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mul_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mul_1.c
index 6b2ee59a2c9..52d46da0ab6 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mul_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mul_1.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mul_basecase.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mul_basecase.c
index 9309ef72c88..2487fbac75a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mul_basecase.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mul_basecase.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
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 d3c0b7bf220..df8ee63a5fc 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 Free Software Foundation, Inc.
+Copyright 1998-2010, 2012, 2013, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -66,7 +66,6 @@ see https://www.gnu.org/licenses/. */
#define TRACE(x)
#endif
-#include "gmp.h"
#include "gmp-impl.h"
#ifdef WANT_ADDSUB
@@ -289,6 +288,26 @@ mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, mp_bitcnt_t d, mp_size_t n)
}
}
+#if HAVE_NATIVE_mpn_add_n_sub_n
+static inline void
+mpn_fft_add_sub_modF (mp_ptr A0, mp_ptr Ai, mp_srcptr tp, mp_size_t n)
+{
+ mp_limb_t cyas, c, x;
+
+ cyas = mpn_add_n_sub_n (A0, Ai, A0, tp, n);
+
+ c = A0[n] - tp[n] - (cyas & 1);
+ x = (-c) & -((c & GMP_LIMB_HIGHBIT) != 0);
+ Ai[n] = x + c;
+ MPN_INCR_U (Ai, n + 1, x);
+
+ c = A0[n] + tp[n] + (cyas >> 1);
+ x = (c - 1) & -(c != 0);
+ A0[n] = c - x;
+ MPN_DECR_U (A0, n + 1, x);
+}
+
+#else /* ! HAVE_NATIVE_mpn_add_n_sub_n */
/* r <- a+b mod 2^(n*GMP_NUMB_BITS)+1.
Assumes a and b are semi-normalized.
@@ -351,6 +370,7 @@ mpn_fft_sub_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, mp_size_t n)
}
#endif
}
+#endif /* HAVE_NATIVE_mpn_add_n_sub_n */
/* input: A[0] ... A[inc*(K-1)] are residues mod 2^N+1 where
N=n*GMP_NUMB_BITS, and 2^omega is a primitive root mod 2^N+1
@@ -389,8 +409,12 @@ mpn_fft_fft (mp_ptr *Ap, mp_size_t K, int **ll,
/* Ap[inc] <- Ap[0] + Ap[inc] * 2^(lk[1] * omega)
Ap[0] <- Ap[0] + Ap[inc] * 2^(lk[0] * omega) */
mpn_fft_mul_2exp_modF (tp, Ap[inc], lk[0] * omega, n);
+#if HAVE_NATIVE_mpn_add_n_sub_n
+ mpn_fft_add_sub_modF (Ap[0], Ap[inc], tp, n);
+#else
mpn_fft_sub_modF (Ap[inc], Ap[0], tp, n);
mpn_fft_add_modF (Ap[0], Ap[0], tp, n);
+#endif
}
}
}
@@ -576,8 +600,12 @@ mpn_fft_fftinv (mp_ptr *Ap, mp_size_t K, mp_size_t omega, mp_size_t n, mp_ptr tp
/* Ap[K2] <- Ap[0] + Ap[K2] * 2^((j + K2) * omega)
Ap[0] <- Ap[0] + Ap[K2] * 2^(j * omega) */
mpn_fft_mul_2exp_modF (tp, Ap[K2], j * omega, n);
+#if HAVE_NATIVE_mpn_add_n_sub_n
+ mpn_fft_add_sub_modF (Ap[0], Ap[K2], tp, n);
+#else
mpn_fft_sub_modF (Ap[K2], Ap[0], tp, n);
mpn_fft_add_modF (Ap[0], Ap[0], tp, n);
+#endif
}
}
}
@@ -966,7 +994,6 @@ mpn_mul_fft_full (mp_ptr op,
oldcc = cc;
#if HAVE_NATIVE_mpn_add_n_sub_n
c2 = mpn_add_n_sub_n (pad_op + l, pad_op, pad_op, pad_op + l, l);
- /* c2 & 1 is the borrow, c2 & 2 is the carry */
cc += c2 >> 1; /* carry out from high <- low + high */
c2 = c2 & 1; /* borrow out from low <- low - high */
#else
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mul_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mul_n.c
index 5df8b16fa01..36bd923decf 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mul_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mul_n.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mullo_basecase.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mullo_basecase.c
index 37d9018a493..9a4cd3d82b1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mullo_basecase.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mullo_basecase.c
@@ -33,7 +33,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* FIXME: Should optionally use mpn_mul_2/mpn_addmul_2. */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mullo_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mullo_n.c
index a8483d94399..6f4e7ae0fc5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mullo_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mullo_n.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid.c
index 6b4ea3253dc..f35c5fb5def 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_basecase.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_basecase.c
index 400e9764240..d5434ea8b66 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_basecase.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_basecase.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_n.c
index 2280ba3a366..ac7e8f12f16 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mulmid_n.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/mulmod_bnm1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/mulmod_bnm1.c
index 67dc2044438..769bdbc30e6 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/mulmod_bnm1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/mulmod_bnm1.c
@@ -36,7 +36,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -77,7 +76,7 @@ mpn_bc_mulmod_bnp1 (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t rn,
ASSERT (tp[2*rn] < GMP_NUMB_MAX);
cy = tp[2*rn] + mpn_sub_n (rp, tp, tp+rn, rn);
rp[rn] = 0;
- MPN_INCR_U (rp, rn+1, cy );
+ MPN_INCR_U (rp, rn+1, cy);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/neg.c b/Build/source/libs/gmp/gmp-src/mpn/generic/neg.c
index 2d752e912d1..bec2a32ed49 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/neg.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/neg.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpn_neg 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/nussbaumer_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/nussbaumer_mul.c
index d2bf19ad56a..3e0cf279a1f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/nussbaumer_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/nussbaumer_mul.c
@@ -36,7 +36,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Multiply {ap,an} by {bp,bn}, and put the result in {pp, an+bn} */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/perfpow.c b/Build/source/libs/gmp/gmp-src/mpn/generic/perfpow.c
index 5d5a80e941f..9d464777891 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/perfpow.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/perfpow.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/perfsqr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/perfsqr.c
index bdd82ccd96e..38a1a91ed1d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/perfsqr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/perfsqr.c
@@ -31,7 +31,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/popham.c b/Build/source/libs/gmp/gmp-src/mpn/generic/popham.c
index 13e529b7cda..87974d71044 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/popham.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/popham.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#if OPERATION_popcount
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/pow_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/pow_1.c
index 2333206554c..de11cd2c57d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/pow_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/pow_1.c
@@ -33,7 +33,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -79,21 +78,23 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)
if (bn == 1)
{
- mp_limb_t bl = bp[0];
+ mp_limb_t rl, rh, bl = bp[0];
if ((cnt & 1) != 0)
MP_PTR_SWAP (rp, tp);
- mpn_sqr (rp, bp, bn);
- rn = 2 * bn; rn -= rp[rn - 1] == 0;
+ umul_ppmm (rh, rl, bl, bl << GMP_NAIL_BITS);
+ rp[0] = rl >> GMP_NAIL_BITS;
+ rp[1] = rh;
+ rn = 1 + (rh != 0);
for (i = GMP_LIMB_BITS - cnt - 1;;)
{
exp <<= 1;
if ((exp & GMP_LIMB_HIGHBIT) != 0)
{
- rp[rn] = mpn_mul_1 (rp, rp, rn, bl);
- rn += rp[rn] != 0;
+ rp[rn] = rh = mpn_mul_1 (rp, rp, rn, bl);
+ rn += rh != 0;
}
if (--i == 0)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/powlo.c b/Build/source/libs/gmp/gmp-src/mpn/generic/powlo.c
index bdd5e1703bc..3b26bcaf769 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/powlo.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/powlo.c
@@ -1,6 +1,6 @@
/* mpn_powlo -- Compute R = U^E mod B^n, where B is the limb base.
-Copyright 2007-2009, 2012, 2015 Free Software Foundation, Inc.
+Copyright 2007-2009, 2012, 2015, 2016, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -38,9 +37,9 @@ see https://www.gnu.org/licenses/. */
((p[(bi - 1) / GMP_LIMB_BITS] >> (bi - 1) % GMP_LIMB_BITS) & 1)
static inline mp_limb_t
-getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
+getbits (const mp_limb_t *p, mp_bitcnt_t bi, unsigned nbits)
{
- int nbits_in_r;
+ unsigned nbits_in_r;
mp_limb_t r;
mp_size_t i;
@@ -61,13 +60,13 @@ getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
}
}
-static inline int
+static inline unsigned
win_size (mp_bitcnt_t eb)
{
- int k;
- static mp_bitcnt_t x[] = {1,7,25,81,241,673,1793,4609,11521,28161,~(mp_bitcnt_t)0};
+ unsigned k;
+ static mp_bitcnt_t x[] = {7,25,81,241,673,1793,4609,11521,28161,~(mp_bitcnt_t)0};
ASSERT (eb > 1);
- for (k = 1; eb > x[k]; ++k)
+ for (k = 0; eb > x[k++];)
;
return k;
}
@@ -82,12 +81,13 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
mp_srcptr ep, mp_size_t en,
mp_size_t n, mp_ptr tp)
{
- int cnt;
+ unsigned cnt;
mp_bitcnt_t ebi;
- int windowsize, this_windowsize;
+ unsigned windowsize, this_windowsize;
mp_limb_t expbits;
- mp_limb_t *pp, *this_pp, *last_pp;
+ mp_limb_t *pp;
long i;
+ int flipflop;
TMP_DECL;
ASSERT (en > 1 || (en == 1 && ep[0] > 1));
@@ -97,41 +97,56 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
MPN_SIZEINBASE_2EXP(ebi, ep, en, 1);
windowsize = win_size (ebi);
- ASSERT (windowsize < ebi);
+ if (windowsize > 1)
+ {
+ mp_limb_t *this_pp, *last_pp;
+ ASSERT (windowsize < ebi);
- pp = TMP_ALLOC_LIMBS ((n << (windowsize - 1)));
+ pp = TMP_ALLOC_LIMBS ((n << (windowsize - 1)));
- this_pp = pp;
+ this_pp = pp;
- MPN_COPY (this_pp, bp, n);
+ MPN_COPY (this_pp, bp, n);
- /* Store b^2 in tp. */
- mpn_sqrlo (tp, bp, n);
+ /* Store b^2 in tp. */
+ mpn_sqrlo (tp, bp, n);
- /* Precompute odd powers of b and put them in the temporary area at pp. */
- for (i = (1 << (windowsize - 1)) - 1; i > 0; i--)
- {
- last_pp = this_pp;
- this_pp += n;
- mpn_mullo_n (this_pp, last_pp, tp, n);
- }
+ /* Precompute odd powers of b and put them in the temporary area at pp. */
+ i = (1 << (windowsize - 1)) - 1;
+ do
+ {
+ last_pp = this_pp;
+ this_pp += n;
+ mpn_mullo_n (this_pp, last_pp, tp, n);
+ } while (--i != 0);
- expbits = getbits (ep, ebi, windowsize);
+ expbits = getbits (ep, ebi, windowsize);
- /* FIXME: for even expbits, we can init with a mullo. */
- count_trailing_zeros (cnt, expbits);
- ebi -= windowsize;
- ebi += cnt;
- expbits >>= cnt;
+ /* THINK: Should we initialise the case expbits % 4 == 0 with a mullo? */
+ count_trailing_zeros (cnt, expbits);
+ ebi -= windowsize;
+ ebi += cnt;
+ expbits >>= cnt;
- MPN_COPY (rp, pp + n * (expbits >> 1), n);
+ MPN_COPY (rp, pp + n * (expbits >> 1), n);
+ }
+ else
+ {
+ pp = tp + n;
+ MPN_COPY (pp, bp, n);
+ MPN_COPY (rp, bp, n);
+ --ebi;
+ }
+
+ flipflop = 0;
do
{
while (getbit (ep, ebi) == 0)
{
mpn_sqrlo (tp, rp, n);
- MPN_COPY (rp, tp, n);
+ MP_PTR_SWAP (rp, tp);
+ flipflop = ! flipflop;
if (--ebi == 0)
goto done;
}
@@ -140,14 +155,8 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
bits <= windowsize, and such that the least significant bit is 1. */
expbits = getbits (ep, ebi, windowsize);
- this_windowsize = windowsize;
- if (ebi < windowsize)
- {
- this_windowsize -= windowsize - ebi;
- ebi = 0;
- }
- else
- ebi -= windowsize;
+ this_windowsize = MIN (windowsize, ebi);
+ ebi -= this_windowsize;
count_trailing_zeros (cnt, expbits);
this_windowsize -= cnt;
@@ -164,11 +173,16 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
if (this_windowsize != 0)
mpn_sqrlo (tp, rp, n);
else
- MPN_COPY (tp, rp, n);
-
+ {
+ MP_PTR_SWAP (rp, tp);
+ flipflop = ! flipflop;
+ }
+
mpn_mullo_n (rp, tp, pp + n * (expbits >> 1), n);
} while (ebi != 0);
done:
+ if (flipflop)
+ MPN_COPY (tp, rp, n);
TMP_FREE;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/powm.c b/Build/source/libs/gmp/gmp-src/mpn/generic/powm.c
index 0cd0da46ea9..28281030b7c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/powm.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/powm.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 2007-2012 Free Software Foundation, Inc.
+Copyright 2007-2012, 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -81,11 +81,35 @@ see https://www.gnu.org/licenses/. */
mod M.
*/
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
+#undef MPN_REDC_0
+#define MPN_REDC_0(rp, up, mp, invm) \
+ do { \
+ mp_limb_t p1, r0, u0, _dummy; \
+ u0 = *(up); \
+ umul_ppmm (p1, _dummy, *(mp), (u0 * (invm)) & GMP_NUMB_MASK); \
+ ASSERT (((u0 + _dummy) & GMP_NUMB_MASK) == 0); \
+ p1 += (u0 != 0); \
+ r0 = (up)[1] + p1; \
+ if (p1 > r0) \
+ r0 -= *(mp); \
+ *(rp) = r0; \
+ } while (0)
+
#undef MPN_REDC_1
+#if HAVE_NATIVE_mpn_sbpi1_bdiv_r
+#define MPN_REDC_1(rp, up, mp, n, invm) \
+ do { \
+ mp_limb_t cy; \
+ cy = mpn_sbpi1_bdiv_r (up, 2 * n, mp, n, invm); \
+ if (cy != 0) \
+ mpn_sub_n (rp, up + n, mp, n); \
+ else \
+ MPN_COPY (rp, up + n, n); \
+ } while (0)
+#else
#define MPN_REDC_1(rp, up, mp, n, invm) \
do { \
mp_limb_t cy; \
@@ -93,6 +117,7 @@ see https://www.gnu.org/licenses/. */
if (cy != 0) \
mpn_sub_n (rp, rp, mp, n); \
} while (0)
+#endif
#undef MPN_REDC_2
#define MPN_REDC_2(rp, up, mp, n, mip) \
@@ -130,7 +155,7 @@ getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
nbits_in_r = GMP_NUMB_BITS - bi; /* number of bits now in r */
if (nbits_in_r < nbits) /* did we get enough bits? */
r += p[i + 1] << nbits_in_r; /* prepend bits from higher word */
- return r & (((mp_limb_t ) 1 << nbits) - 1);
+ return r & (((mp_limb_t) 1 << nbits) - 1);
}
}
@@ -237,6 +262,11 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
/* Store b^2 at rp. */
mpn_sqr (tp, this_pp, n);
+#if 0
+ if (n == 1) {
+ MPN_REDC_0 (rp, tp, mp, mip[0]);
+ } else
+#endif
#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
MPN_REDC_1 (rp, tp, mp, n, mip[0]);
@@ -251,6 +281,13 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
/* Precompute odd powers of b and put them in the temporary area at pp. */
for (i = (1 << (windowsize - 1)) - 1; i > 0; i--)
+#if 1
+ if (n == 1) {
+ umul_ppmm((tp)[1], *(tp), *(this_pp), *(rp));
+ ++this_pp ;
+ MPN_REDC_0 (this_pp, tp, mp, mip[0]);
+ } else
+#endif
{
mpn_mul_n (tp, this_pp, rp, n);
this_pp += n;
@@ -286,8 +323,7 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
{ \
MPN_SQR (tp, rp, n); \
MPN_REDUCE (rp, tp, mp, n, mip); \
- ebi--; \
- if (ebi == 0) \
+ if (--ebi == 0) \
goto done; \
} \
\
@@ -314,15 +350,25 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
{ \
MPN_SQR (tp, rp, n); \
MPN_REDUCE (rp, tp, mp, n, mip); \
- this_windowsize--; \
} \
- while (this_windowsize != 0); \
+ while (--this_windowsize != 0); \
\
MPN_MUL_N (tp, rp, pp + n * (expbits >> 1), n); \
MPN_REDUCE (rp, tp, mp, n, mip); \
}
+ if (n == 1)
+ {
+#undef MPN_MUL_N
+#undef MPN_SQR
+#undef MPN_REDUCE
+#define MPN_MUL_N(r,a,b,n) umul_ppmm((r)[1], *(r), *(a), *(b))
+#define MPN_SQR(r,a,n) umul_ppmm((r)[1], *(r), *(a), *(a))
+#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_0(rp, tp, mp, mip[0])
+ INNERLOOP;
+ }
+ else
#if WANT_REDC_2
if (REDC_1_TO_REDC_2_THRESHOLD < MUL_TOOM22_THRESHOLD)
{
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/pre_divrem_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/pre_divrem_1.c
index 8027f0216e5..3b29d7720e4 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/pre_divrem_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/pre_divrem_1.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/pre_mod_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/pre_mod_1.c
index cb38f4a48f4..78ae3084e47 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/pre_mod_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/pre_mod_1.c
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/random.c b/Build/source/libs/gmp/gmp-src/mpn/generic/random.c
index 5489becf4dc..485f9ebcea0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/random.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/random.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/random2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/random2.c
index 980b15367fc..1eede6710d4 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/random2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/random2.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
static void gmp_rrandomb (mp_ptr, gmp_randstate_t, mp_bitcnt_t);
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/redc_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/redc_1.c
index 0d33421f634..eab128f96a8 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/redc_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/redc_1.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mp_limb_t
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/redc_2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/redc_2.c
index 187a8f7d624..8d155899a99 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/redc_2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/redc_2.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/redc_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/redc_n.c
index c3d0cfe7fa3..0c94b7c3aa4 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/redc_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/redc_n.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/*
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/remove.c b/Build/source/libs/gmp/gmp-src/mpn/generic/remove.c
index e1c535966b3..cbb0742f28b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/remove.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/remove.c
@@ -7,7 +7,7 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 2009, 2012-2014 Free Software Foundation, Inc.
+Copyright 2009, 2012-2014, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#if GMP_LIMB_BITS > 50
@@ -114,10 +113,15 @@ mpn_remove (mp_ptr wp, mp_size_t *wn,
qp[qn] = 0;
mpn_bdiv_qr_wrap (qp2, tp, qp, qn + 1, pp, pn);
if (!mpn_zero_p (tp, pn))
- break; /* could not divide by V^npowers */
+ {
+ if (mpn_cmp (tp, pp, pn) != 0)
+ break; /* could not divide by V^npowers */
+ }
MP_PTR_SWAP (qp, qp2);
qn = qn - pn;
+ mpn_neg (qp, qp, qn+1);
+
qn += qp[qn] != 0;
pwpsp[npowers] = pp;
@@ -155,10 +159,15 @@ mpn_remove (mp_ptr wp, mp_size_t *wn,
qp[qn] = 0;
mpn_bdiv_qr_wrap (qp2, tp, qp, qn + 1, pwpsp[i], pn);
if (!mpn_zero_p (tp, pn))
- continue; /* could not divide by V^i */
+ {
+ if (mpn_cmp (tp, pwpsp[i], pn) != 0)
+ continue; /* could not divide by V^i */
+ }
MP_PTR_SWAP (qp, qp2);
qn = qn - pn;
+ mpn_neg (qp, qp, qn+1);
+
qn += qp[qn] != 0;
pwr += (mp_bitcnt_t) 1 << i;
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/rootrem.c b/Build/source/libs/gmp/gmp-src/mpn/generic/rootrem.c
index d7dd375f013..a79099e1317 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/rootrem.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/rootrem.c
@@ -3,7 +3,7 @@
Contributed by Paul Zimmermann (algorithm) and
Paul Zimmermann and Torbjorn Granlund (implementation).
- Marco Bodrato wrote logbased_root to seed the loop.
+ Marco Bodrato wrote logbased_root to seed the loop.
THE FUNCTIONS IN THIS FILE ARE INTERNAL, AND HAVE MUTABLE INTERFACES. IT'S
ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT'S ALMOST
@@ -44,7 +44,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -479,7 +478,7 @@ mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un,
/* 8: current buffer: {sp,sn} */
- };
+ }
/* otherwise we have rn > 0, thus the return value is ok */
if (!approx || sp[0] <= CNST_LIMB (1))
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/rshift.c b/Build/source/libs/gmp/gmp-src/mpn/generic/rshift.c
index ec61f2f7e24..15d427ddc15 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/rshift.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/rshift.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* Shift U (pointed to by up and N limbs long) cnt bits to the right
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_q.c
index 645b1d9b6a4..850e593776d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_q.c
@@ -1,13 +1,13 @@
/* mpn_sbpi1_bdiv_q -- schoolbook Hensel division with precomputed inverse,
returning quotient only.
- Contributed to the GNU project by Niels Möller.
+ Contributed to the GNU project by Niels Möller and Torbjörn Granlund.
THE FUNCTIONS IN THIS FILE ARE INTERNAL FUNCTIONS WITH MUTABLE INTERFACES.
IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 2005, 2006, 2009, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2005, 2006, 2009, 2011, 2012, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,66 +35,62 @@ 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 "gmp.h"
#include "gmp-impl.h"
-
-/* Computes Q = N / D mod B^nn, destroys N.
+/* Computes Q = - U / D mod B^un, destroys U.
D must be odd. dinv is (-D)^-1 mod B.
-
- The straightforward way to compute Q is to cancel one limb at a time, using
-
- qp[i] = D^{-1} * np[i] (mod B)
- N -= B^i * qp[i] * D
-
- But we prefer addition to subtraction, since mpn_addmul_1 is often faster
- than mpn_submul_1. Q = - N / D can be computed by iterating
-
- qp[i] = (-D)^{-1} * np[i] (mod B)
- N += B^i * qp[i] * D
-
- And then we flip the sign, -Q = (not Q) + 1. */
+*/
void
mpn_sbpi1_bdiv_q (mp_ptr qp,
- mp_ptr np, mp_size_t nn,
+ mp_ptr up, mp_size_t un,
mp_srcptr dp, mp_size_t dn,
mp_limb_t dinv)
{
mp_size_t i;
- mp_limb_t cy, q;
+ mp_limb_t q;
ASSERT (dn > 0);
- ASSERT (nn >= dn);
+ ASSERT (un >= dn);
ASSERT ((dp[0] & 1) != 0);
- /* FIXME: Add ASSERTs for allowable overlapping; i.e., that qp = np is OK,
- but some over N/Q overlaps will not work. */
+ ASSERT (-(dp[0] * dinv) == 1);
+ ASSERT (up == qp || !MPN_OVERLAP_P (up, un, qp, un - dn));
- for (i = nn - dn; i > 0; i--)
+ if (un > dn)
{
- q = dinv * np[0];
- cy = mpn_addmul_1 (np, dp, dn, q);
- mpn_add_1 (np + dn, np + dn, i, cy);
- ASSERT (np[0] == 0);
- qp[0] = ~q;
- qp++;
- np++;
+ mp_limb_t cy, hi;
+ for (i = un - dn - 1, cy = 0; i > 0; i--)
+ {
+ q = dinv * up[0];
+ hi = mpn_addmul_1 (up, dp, dn, q);
+
+ ASSERT (up[0] == 0);
+ *qp++ = q;
+ hi += cy;
+ cy = hi < cy;
+ hi += up[dn];
+ cy += hi < up[dn];
+ up[dn] = hi;
+ up++;
+ }
+ q = dinv * up[0];
+ hi = cy + mpn_addmul_1 (up, dp, dn, q);
+ ASSERT (up[0] == 0);
+ *qp++ = q;
+ up[dn] += hi;
+ up++;
}
-
for (i = dn; i > 1; i--)
{
- q = dinv * np[0];
- mpn_addmul_1 (np, dp, i, q);
- ASSERT (np[0] == 0);
- qp[0] = ~q;
- qp++;
- np++;
+ mp_limb_t q = dinv * up[0];
+ mpn_addmul_1 (up, dp, i, q);
+ ASSERT (up[0] == 0);
+ *qp++ = q;
+ up++;
}
/* Final limb */
- q = dinv * np[0];
- qp[0] = ~q;
- mpn_add_1 (qp - nn + 1, qp - nn + 1, nn, 1);
+ *qp = dinv * up[0];
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_qr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_qr.c
index 0e56f581487..6146c45ad8d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_qr.c
@@ -1,13 +1,13 @@
/* mpn_sbpi1_bdiv_qr -- schoolbook Hensel division with precomputed inverse,
returning quotient and remainder.
- Contributed to the GNU project by Niels Möller.
+ Contributed to the GNU project by Niels Möller and Torbjörn Granlund.
THE FUNCTIONS IN THIS FILE ARE INTERNAL FUNCTIONS WITH MUTABLE INTERFACES.
IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 2006, 2009, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2006, 2009, 2011, 2012, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,85 +35,48 @@ 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 "gmp.h"
#include "gmp-impl.h"
-/* Computes a binary quotient of size qn = nn - dn.
+/* Computes a binary quotient of size qn = un - dn.
Output:
- Q = N * D^{-1} mod B^qn,
+ Q = -U * D^{-1} mod B^qn,
- R = (N - Q * D) * B^(-qn)
+ R = (U + Q * D) * B^(-qn)
- Stores the dn least significant limbs of R at {np + nn - dn, dn},
- and returns the borrow from the subtraction N - Q*D.
+ Stores the dn least significant limbs of R at {up + un - dn, dn},
+ and returns the carry from the addition N + Q*D.
D must be odd. dinv is (-D)^-1 mod B. */
mp_limb_t
mpn_sbpi1_bdiv_qr (mp_ptr qp,
- mp_ptr np, mp_size_t nn,
+ mp_ptr up, mp_size_t un,
mp_srcptr dp, mp_size_t dn, mp_limb_t dinv)
{
- mp_size_t qn;
mp_size_t i;
- mp_limb_t rh;
- mp_limb_t ql;
+ mp_limb_t cy;
ASSERT (dn > 0);
- ASSERT (nn > dn);
+ ASSERT (un > dn);
ASSERT ((dp[0] & 1) != 0);
- /* FIXME: Add ASSERTs for allowable overlapping; i.e., that qp = np is OK,
- but some over N/Q overlaps will not work. */
+ ASSERT (-(dp[0] * dinv) == 1);
+ ASSERT (up == qp || !MPN_OVERLAP_P (up, un, qp, un - dn));
- qn = nn - dn;
-
- rh = 0;
-
- /* To complete the negation, this value is added to q. */
- ql = 1;
- while (qn > dn)
- {
- for (i = 0; i < dn; i++)
- {
- mp_limb_t q;
-
- q = dinv * np[i];
- np[i] = mpn_addmul_1 (np + i, dp, dn, q);
- qp[i] = ~q;
- }
- rh += mpn_add (np + dn, np + dn, qn, np, dn);
- ql = mpn_add_1 (qp, qp, dn, ql);
-
- qp += dn; qn -= dn;
- np += dn; nn -= dn;
- }
-
- for (i = 0; i < qn; i++)
- {
- mp_limb_t q;
-
- q = dinv * np[i];
- np[i] = mpn_addmul_1 (np + i, dp, dn, q);
- qp[i] = ~q;
- }
-
- rh += mpn_add_n (np + dn, np + dn, np, qn);
- ql = mpn_add_1 (qp, qp, qn, ql);
-
- if (UNLIKELY (ql > 0))
+ for (i = un - dn, cy = 0; i != 0; i--)
{
- /* q == 0 */
- ASSERT (rh == 0);
- return 0;
+ mp_limb_t q = dinv * up[0];
+ mp_limb_t hi = mpn_addmul_1 (up, dp, dn, q);
+ *qp++ = q;
+
+ hi += cy;
+ cy = hi < cy;
+ hi += up[dn];
+ cy += hi < up[dn];
+ up[dn] = hi;
+ up++;
}
- else
- {
- mp_limb_t cy;
- cy = mpn_sub_n (np + qn, np + qn, dp, dn);
- ASSERT (cy >= rh);
- return cy - rh;
- }
+ return cy;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_r.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_r.c
new file mode 100644
index 00000000000..a609951e4fd
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_bdiv_r.c
@@ -0,0 +1,79 @@
+/* mpn_sbpi1_bdiv_r -- schoolbook Hensel division with precomputed inverse,
+ returning remainder.
+
+ Contributed to the GNU project by Niels Möller and Torbjörn Granlund.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL FUNCTIONS WITH MUTABLE INTERFACES.
+ IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
+
+Copyright 2006, 2009, 2011, 2012, 2017 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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 "gmp-impl.h"
+
+
+/* Computes a binary quotient of size qn = un - dn.
+ Output:
+
+ Q = -U * D^{-1} mod B^qn,
+
+ R = (U + Q * D) * B^(-qn)
+
+ Stores the dn least significant limbs of R at {up + un - dn, dn},
+ and returns the carry from the addition N + Q*D.
+
+ D must be odd. dinv is (-D)^-1 mod B. */
+
+mp_limb_t
+mpn_sbpi1_bdiv_r (mp_ptr up, mp_size_t un,
+ mp_srcptr dp, mp_size_t dn, mp_limb_t dinv)
+{
+ mp_size_t i;
+ mp_limb_t cy;
+
+ ASSERT (dn > 0);
+ ASSERT (un > dn);
+ ASSERT ((dp[0] & 1) != 0);
+ ASSERT (-(dp[0] * dinv) == 1);
+
+ for (i = un - dn, cy = 0; i != 0; i--)
+ {
+ mp_limb_t q = dinv * up[0];
+ mp_limb_t hi = mpn_addmul_1 (up, dp, dn, q);
+
+ hi += cy;
+ cy = hi < cy;
+ hi += up[dn];
+ cy += hi < up[dn];
+ up[dn] = hi;
+ up++;
+ }
+
+ return cy;
+}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_q.c
index 3abbd579336..a9975ebc93b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_q.c
@@ -36,7 +36,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_qr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_qr.c
index 0c3e4cb7298..7330a77fb7a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_div_qr.c
@@ -36,7 +36,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_divappr_q.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_divappr_q.c
index 3e7cf91ba61..ef7ca26a147 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_divappr_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sbpi1_divappr_q.c
@@ -37,7 +37,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/scan0.c b/Build/source/libs/gmp/gmp-src/mpn/generic/scan0.c
index 8171fd5afee..d71832e6473 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/scan0.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/scan0.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/scan1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/scan1.c
index e22ad5d827a..09e8060bf91 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/scan1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/scan1.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_aors_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_aors_1.c
index d789a5792e8..6480fa1bf63 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_aors_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_aors_1.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#if OPERATION_sec_add_1
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_div.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_div.c
index 483b118d0dd..1f08649c20d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_div.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_div.c
@@ -4,7 +4,7 @@
Contributed to the GNU project by Torbjörn Granlund.
-Copyright 2011-2014 Free Software Foundation, Inc.
+Copyright 2011-2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -73,7 +72,6 @@ FNAME (Q(mp_ptr qp)
{
mp_limb_t d1, d0;
unsigned int cnt;
- gmp_pi1_t dinv;
mp_limb_t inv32;
ASSERT (dn >= 1);
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_invert.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_invert.c
index 72d447a9802..07665d1b9af 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_invert.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_invert.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#if 0
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_mul.c
index 2cd87fab1de..4bbfa61b7bc 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_mul.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_pi1_div.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_pi1_div.c
index 1e075daf732..29d01e757ff 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_pi1_div.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_pi1_div.c
@@ -36,7 +36,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_powm.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_powm.c
index 315c7d5ba54..3a78c660be7 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_powm.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_powm.c
@@ -3,7 +3,7 @@
Contributed to the GNU project by Torbjörn Granlund.
-Copyright 2007-2009, 2011-2014 Free Software Foundation, Inc.
+Copyright 2007-2009, 2011-2014, 2018-2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,13 +35,16 @@ see https://www.gnu.org/licenses/. */
/*
BASIC ALGORITHM, Compute U^E mod M, where M < B^n is odd.
- 1. T <- (B^n * U) mod M Convert to REDC form
+ 1. T <- (B^n * U) mod M; convert to REDC form
- 2. Compute table U^0, U^1, U^2... of E-dependent size
+ 2. Compute table U^0, U^1, U^2... of floor(log(E))-dependent size
3. While there are more bits in E
W <- power left-to-right base-k
+ The article "Defeating modexp side-channel attacks with data-independent
+ execution traces", https://gmplib.org/~tege/modexp-silent.pdf, has details.
+
TODO:
@@ -56,18 +59,27 @@ see https://www.gnu.org/licenses/. */
slowdown.
*/
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
#undef MPN_REDC_1_SEC
+#if HAVE_NATIVE_mpn_sbpi1_bdiv_r
+#define MPN_REDC_1_SEC(rp, up, mp, n, invm) \
+ do { \
+ mp_limb_t cy; \
+ cy = mpn_sbpi1_bdiv_r (up, 2 * n, mp, n, invm); \
+ mpn_cnd_sub_n (cy, rp, up + n, mp, n); \
+ } while (0)
+#else
#define MPN_REDC_1_SEC(rp, up, mp, n, invm) \
do { \
mp_limb_t cy; \
cy = mpn_redc_1 (rp, up, mp, n, invm); \
mpn_cnd_sub_n (cy, rp, rp, mp, n); \
} while (0)
+#endif
+#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2
#undef MPN_REDC_2_SEC
#define MPN_REDC_2_SEC(rp, up, mp, n, mip) \
do { \
@@ -75,9 +87,10 @@ see https://www.gnu.org/licenses/. */
cy = mpn_redc_2 (rp, up, mp, n, mip); \
mpn_cnd_sub_n (cy, rp, rp, mp, n); \
} while (0)
-
-#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2
-#define WANT_REDC_2 1
+#else
+#define MPN_REDC_2_SEC(rp, up, mp, n, mip) /* empty */
+#undef REDC_1_TO_REDC_2_THRESHOLD
+#define REDC_1_TO_REDC_2_THRESHOLD MP_SIZE_T_MAX
#endif
/* Define our own mpn squaring function. We do this since we cannot use a
@@ -85,24 +98,6 @@ see https://www.gnu.org/licenses/. */
SQR_TOOM2_THRESHOLD. This is so because of fixed size stack allocations
made inside mpn_sqr_basecase. */
-#if HAVE_NATIVE_mpn_sqr_diagonal
-#define MPN_SQR_DIAGONAL(rp, up, n) \
- mpn_sqr_diagonal (rp, up, n)
-#else
-#define MPN_SQR_DIAGONAL(rp, up, n) \
- do { \
- mp_size_t _i; \
- for (_i = 0; _i < (n); _i++) \
- { \
- mp_limb_t ul, lpl; \
- ul = (up)[_i]; \
- umul_ppmm ((rp)[2 * _i + 1], lpl, ul, ul << GMP_NAIL_BITS); \
- (rp)[2 * _i] = lpl >> GMP_NAIL_BITS; \
- } \
- } while (0)
-#endif
-
-
#if ! HAVE_NATIVE_mpn_sqr_basecase
/* The limit of the generic code is SQR_TOOM2_THRESHOLD. */
#define SQR_BASECASE_LIM SQR_TOOM2_THRESHOLD
@@ -128,17 +123,17 @@ see https://www.gnu.org/licenses/. */
#ifndef SQR_BASECASE_LIM
/* If SQR_BASECASE_LIM is now not defined, use mpn_sqr_basecase for any operand
size. */
-#define mpn_local_sqr(rp,up,n,tp) mpn_sqr_basecase(rp,up,n)
-#else
-/* Else use mpn_sqr_basecase for its allowed sizes, else mpn_mul_basecase. */
-#define mpn_local_sqr(rp,up,n,tp) \
+#define SQR_BASECASE_LIM MP_SIZE_T_MAX
+#endif
+
+#define mpn_local_sqr(rp,up,n) \
do { \
- if (BELOW_THRESHOLD (n, SQR_BASECASE_LIM)) \
+ if (ABOVE_THRESHOLD (n, SQR_BASECASE_THRESHOLD) \
+ && BELOW_THRESHOLD (n, SQR_BASECASE_LIM)) \
mpn_sqr_basecase (rp, up, n); \
else \
mpn_mul_basecase(rp, up, n, up, n); \
} while (0)
-#endif
#define getbit(p,bi) \
((p[(bi - 1) / GMP_NUMB_BITS] >> (bi - 1) % GMP_NUMB_BITS) & 1)
@@ -222,7 +217,7 @@ mpn_sec_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
mp_limb_t ip[2], *mip;
int windowsize, this_windowsize;
mp_limb_t expbits;
- mp_ptr pp, this_pp;
+ mp_ptr pp, this_pp, ps;
long i;
int cnd;
@@ -235,7 +230,6 @@ mpn_sec_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
windowsize = win_size (enb);
-#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
{
mip = ip;
@@ -248,11 +242,6 @@ mpn_sec_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
mpn_binvert (mip, mp, 2, tp);
mip[0] = -mip[0]; mip[1] = ~mip[1];
}
-#else
- mip = ip;
- binvert_limb (mip[0], mp[0]);
- mip[0] = -mip[0];
-#endif
pp = tp;
tp += (n << windowsize); /* put tp after power table */
@@ -275,18 +264,34 @@ mpn_sec_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
/* Precompute powers of b and put them in the temporary area at pp. */
/* scratch: | n | n | ... | | 2n | */
/* | pp[0] | pp[1] | ... | pp[2^windowsize-1] | product | */
- for (i = (1 << windowsize) - 2; i > 0; i--)
+ ps = pp + n; /* initially B^1 */
+ if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
{
- mpn_mul_basecase (tp, this_pp, n, pp + n, n);
- this_pp += n;
-#if WANT_REDC_2
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
- MPN_REDC_1_SEC (this_pp, tp, mp, n, mip[0]);
- else
- MPN_REDC_2_SEC (this_pp, tp, mp, n, mip);
-#else
- MPN_REDC_1_SEC (this_pp, tp, mp, n, mip[0]);
-#endif
+ for (i = (1 << windowsize) - 2; i > 0; i -= 2)
+ {
+ mpn_local_sqr (tp, ps, n);
+ ps += n;
+ this_pp += n;
+ MPN_REDC_1_SEC (this_pp, tp, mp, n, mip[0]);
+
+ mpn_mul_basecase (tp, this_pp, n, pp + n, n);
+ this_pp += n;
+ MPN_REDC_1_SEC (this_pp, tp, mp, n, mip[0]);
+ }
+ }
+ else
+ {
+ for (i = (1 << windowsize) - 2; i > 0; i -= 2)
+ {
+ mpn_local_sqr (tp, ps, n);
+ ps += n;
+ this_pp += n;
+ MPN_REDC_2_SEC (this_pp, tp, mp, n, mip);
+
+ mpn_mul_basecase (tp, this_pp, n, pp + n, n);
+ this_pp += n;
+ MPN_REDC_2_SEC (this_pp, tp, mp, n, mip);
+ }
}
expbits = getbits (ep, enb, windowsize);
@@ -314,7 +319,7 @@ mpn_sec_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
\
do \
{ \
- mpn_local_sqr (tp, rp, n, tp + 2 * n); \
+ mpn_local_sqr (tp, rp, n); \
MPN_REDUCE (rp, tp, mp, n, mip); \
this_windowsize--; \
} \
@@ -326,48 +331,27 @@ mpn_sec_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
MPN_REDUCE (rp, tp, mp, n, mip); \
}
-#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
{
-#undef MPN_MUL_N
-#undef MPN_SQR
#undef MPN_REDUCE
-#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n)
#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1_SEC (rp, tp, mp, n, mip[0])
INNERLOOP;
}
else
{
-#undef MPN_MUL_N
-#undef MPN_SQR
#undef MPN_REDUCE
-#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n)
#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_2_SEC (rp, tp, mp, n, mip)
INNERLOOP;
}
-#else
-#undef MPN_MUL_N
-#undef MPN_SQR
-#undef MPN_REDUCE
-#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1_SEC (rp, tp, mp, n, mip[0])
- INNERLOOP;
-#endif
MPN_COPY (tp, rp, n);
MPN_ZERO (tp + n, n);
-#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
MPN_REDC_1_SEC (rp, tp, mp, n, mip[0]);
else
MPN_REDC_2_SEC (rp, tp, mp, n, mip);
-#else
- MPN_REDC_1_SEC (rp, tp, mp, n, mip[0]);
-#endif
+
cnd = mpn_sub_n (tp, rp, mp, n); /* we need just retval */
mpn_cnd_sub_n (!cnd, rp, rp, mp, n);
}
@@ -378,6 +362,7 @@ mpn_sec_powm_itch (mp_size_t bn, mp_bitcnt_t enb, mp_size_t n)
int windowsize;
mp_size_t redcify_itch, itch;
+ /* FIXME: no more _local/_basecase difference. */
/* The top scratch usage will either be when reducing B in the 2nd redcify
call, or more typically n*2^windowsize + 3n or 4n, in the main loop. (It
is 3n or 4n depending on if we use mpn_local_sqr or a native
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_sqr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_sqr.c
index 82073cb323d..83fc7d96a93 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_sqr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_sqr.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#if ! HAVE_NATIVE_mpn_sqr_basecase
@@ -65,7 +64,7 @@ mpn_sec_sqr (mp_ptr rp,
size. */
mpn_sqr_basecase (rp, ap, an);
#else
-/* Else use mpn_sqr_basecase for its allowed sizes, else mpn_mul_basecase. */
+/* Else use mpn_mul_basecase. */
mpn_mul_basecase (rp, ap, an, ap, an);
#endif
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_tabselect.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_tabselect.c
index 7ea2ffda63b..5767e27350c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sec_tabselect.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sec_tabselect.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
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 71034e34bf9..2bd584c0b36 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
@@ -4,13 +4,12 @@
Contributed to the GNU project by Torbjorn Granlund.
- THE FUNCTIONS IN THIS FILE, EXCEPT mpn_set_str, ARE INTERNAL WITH A MUTABLE
- INTERFACE. IT IS ONLY 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.
+ THE FUNCTIONS IN THIS FILE, EXCEPT mpn_set_str, ARE INTERNAL WITH MUTABLE
+ INTERFACES. IT IS ONLY 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 1991-1994, 1996, 2000-2002, 2004, 2006-2008, 2012, 2013 Free
-Software Foundation, Inc.
+Copyright 1991-2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -64,9 +63,7 @@ see https://www.gnu.org/licenses/. */
cubes, not squares.
*/
-#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
mp_size_t
mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
@@ -120,103 +117,22 @@ mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
chars_per_limb = mp_bases[base].chars_per_limb;
- un = str_len / chars_per_limb + 1;
+ un = str_len / chars_per_limb + 1; /* FIXME: scalar integer division */
/* Allocate one large block for the powers of big_base. */
- powtab_mem = TMP_BALLOC_LIMBS (mpn_dc_set_str_powtab_alloc (un));
+ powtab_mem = TMP_BALLOC_LIMBS (mpn_str_powtab_alloc (un));
- mpn_set_str_compute_powtab (powtab, powtab_mem, un, base);
+ size_t n_pows = mpn_compute_powtab (powtab, powtab_mem, un, base);
+ powers_t *pt = powtab + n_pows;
tp = TMP_BALLOC_LIMBS (mpn_dc_set_str_itch (un));
- size = mpn_dc_set_str (rp, str, str_len, powtab, tp);
+ size = mpn_dc_set_str (rp, str, str_len, pt, tp);
TMP_FREE;
return size;
}
}
-void
-mpn_set_str_compute_powtab (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un, int base)
-{
- mp_ptr powtab_mem_ptr;
- long i, pi;
- mp_size_t n;
- mp_ptr p, t;
- mp_limb_t big_base;
- int chars_per_limb;
- size_t digits_in_base;
- mp_size_t shift;
-
- powtab_mem_ptr = powtab_mem;
-
- chars_per_limb = mp_bases[base].chars_per_limb;
- big_base = mp_bases[base].big_base;
-
- p = powtab_mem_ptr;
- powtab_mem_ptr += 1;
-
- digits_in_base = chars_per_limb;
-
- p[0] = big_base;
- n = 1;
-
- count_leading_zeros (i, un - 1);
- i = GMP_LIMB_BITS - 1 - i;
-
- powtab[i].p = p;
- powtab[i].n = n;
- powtab[i].digits_in_base = digits_in_base;
- powtab[i].base = base;
- powtab[i].shift = 0;
-
- shift = 0;
- for (pi = i - 1; pi >= 0; pi--)
- {
- t = powtab_mem_ptr;
- powtab_mem_ptr += 2 * n;
-
- ASSERT_ALWAYS (powtab_mem_ptr < powtab_mem + mpn_dc_set_str_powtab_alloc (un));
-
- mpn_sqr (t, p, n);
- n = 2 * n - 1; n += t[n] != 0;
- digits_in_base *= 2;
-#if 1
- if ((((un - 1) >> pi) & 2) == 0)
- {
- mpn_divexact_1 (t, t, n, big_base);
- n -= t[n - 1] == 0;
- digits_in_base -= chars_per_limb;
- }
-#else
- if (CLEVER_CONDITION_1 ())
- {
- /* perform adjustment operation of previous */
- cy = mpn_mul_1 (p, p, n, big_base);
- }
- if (CLEVER_CONDITION_2 ())
- {
- /* perform adjustment operation of new */
- cy = mpn_mul_1 (t, t, n, big_base);
- }
-#endif
- shift *= 2;
- /* Strip low zero limbs, but be careful to keep the result divisible by
- big_base. */
- while (t[0] == 0 && (t[1] & ((big_base & -big_base) - 1)) == 0)
- {
- t++;
- n--;
- shift++;
- }
- p = t;
- powtab[pi].p = p;
- powtab[pi].n = n;
- powtab[pi].digits_in_base = digits_in_base;
- powtab[pi].base = base;
- powtab[pi].shift = shift;
- }
-}
-
mp_size_t
mpn_dc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len,
const powers_t *powtab, mp_ptr tp)
@@ -232,7 +148,7 @@ mpn_dc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len,
if (BELOW_THRESHOLD (str_len, SET_STR_DC_THRESHOLD))
return mpn_bc_set_str (rp, str, str_len, powtab->base);
else
- return mpn_dc_set_str (rp, str, str_len, powtab + 1, tp);
+ return mpn_dc_set_str (rp, str, str_len, powtab - 1, tp);
}
len_hi = str_len - len_lo;
@@ -241,7 +157,7 @@ mpn_dc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len,
if (BELOW_THRESHOLD (len_hi, SET_STR_DC_THRESHOLD))
hn = mpn_bc_set_str (tp, str, len_hi, powtab->base);
else
- hn = mpn_dc_set_str (tp, str, len_hi, powtab + 1, rp);
+ hn = mpn_dc_set_str (tp, str, len_hi, powtab - 1, rp);
sn = powtab->shift;
@@ -264,7 +180,7 @@ mpn_dc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len,
if (BELOW_THRESHOLD (len_lo, SET_STR_DC_THRESHOLD))
ln = mpn_bc_set_str (tp, str, len_lo, powtab->base);
else
- ln = mpn_dc_set_str (tp, str, len_lo, powtab + 1, tp + powtab->n + sn + 1);
+ ln = mpn_dc_set_str (tp, str, len_lo, powtab - 1, tp + powtab->n + sn + 1);
if (ln != 0)
{
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sizeinbase.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sizeinbase.c
index 16633569ec2..faee947fdac 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sizeinbase.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sizeinbase.c
@@ -33,7 +33,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sqr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sqr.c
index 3743761f784..74fbff05c6e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sqr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sqr.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sqr_basecase.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sqr_basecase.c
index fc6a043a946..2645badfa37 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sqr_basecase.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sqr_basecase.c
@@ -5,8 +5,8 @@
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-Copyright 1991-1994, 1996, 1997, 2000-2005, 2008, 2010, 2011 Free Software
-Foundation, Inc.
+Copyright 1991-1994, 1996, 1997, 2000-2005, 2008, 2010, 2011, 2017 Free
+Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -283,10 +282,45 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
#endif
+#if ! defined (READY_WITH_mpn_sqr_basecase) && HAVE_NATIVE_mpn_sqr_diag_addlsh1
+
+/* mpn_sqr_basecase using mpn_addmul_1 and mpn_sqr_diag_addlsh1, avoiding stack
+ allocation. */
+void
+mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
+{
+ if (n == 1)
+ {
+ mp_limb_t ul, lpl;
+ ul = up[0];
+ umul_ppmm (rp[1], lpl, ul, ul << GMP_NAIL_BITS);
+ rp[0] = lpl >> GMP_NAIL_BITS;
+ }
+ else
+ {
+ mp_size_t i;
+ mp_ptr xp;
+
+ rp += 1;
+ rp[n - 1] = mpn_mul_1 (rp, up + 1, n - 1, up[0]);
+ for (i = n - 2; i != 0; i--)
+ {
+ up += 1;
+ rp += 2;
+ rp[i] = mpn_addmul_1 (rp, up + 1, i, up[0]);
+ }
+
+ xp = rp - 2 * n + 3;
+ mpn_sqr_diag_addlsh1 (xp, xp + 1, up - n + 2, n);
+ }
+}
+#define READY_WITH_mpn_sqr_basecase
+#endif
+
+
#if ! defined (READY_WITH_mpn_sqr_basecase)
/* Default mpn_sqr_basecase using mpn_addmul_1. */
-
void
mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
{
@@ -295,13 +329,14 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
ASSERT (n >= 1);
ASSERT (! MPN_OVERLAP_P (rp, 2*n, up, n));
- {
- mp_limb_t ul, lpl;
- ul = up[0];
- umul_ppmm (rp[1], lpl, ul, ul << GMP_NAIL_BITS);
- rp[0] = lpl >> GMP_NAIL_BITS;
- }
- if (n > 1)
+ if (n == 1)
+ {
+ mp_limb_t ul, lpl;
+ ul = up[0];
+ umul_ppmm (rp[1], lpl, ul, ul << GMP_NAIL_BITS);
+ rp[0] = lpl >> GMP_NAIL_BITS;
+ }
+ else
{
mp_limb_t tarr[2 * SQR_TOOM2_THRESHOLD];
mp_ptr tp = tarr;
@@ -322,4 +357,5 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
MPN_SQR_DIAG_ADDLSH1 (rp, tp, up, n);
}
}
+#define READY_WITH_mpn_sqr_basecase
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo.c
index 26e53ea59e8..71530b6d6dd 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#if TUNE_PROGRAM_BUILD || WANT_FAT_BINARY
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo_basecase.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo_basecase.c
index c3159938f28..3148609da0f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo_basecase.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sqrlo_basecase.c
@@ -5,8 +5,8 @@
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-Copyright 1991-1994, 1996, 1997, 2000-2005, 2008, 2010, 2011, 2015
-Free Software Foundation, Inc.
+Copyright 1991-1994, 1996, 1997, 2000-2005, 2008, 2010, 2011, 2015,
+2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -99,6 +98,14 @@ see https://www.gnu.org/licenses/. */
#ifndef SQRLO_SPECIAL_CASES
#define SQRLO_SPECIAL_CASES 2
#endif
+
+#if TUNE_PROGRAM_BUILD || WANT_FAT_BINARY
+#define MAYBE_special_cases 1
+#else
+#define MAYBE_special_cases \
+ ((SQRLO_BASECASE_THRESHOLD <= SQRLO_SPECIAL_CASES) && (SQRLO_DC_THRESHOLD != 0))
+#endif
+
void
mpn_sqrlo_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
{
@@ -109,7 +116,7 @@ mpn_sqrlo_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
ul = up[0];
- if (n <= SQRLO_SPECIAL_CASES)
+ if (MAYBE_special_cases && n <= SQRLO_SPECIAL_CASES)
{
#if SQRLO_SPECIAL_CASES == 1
rp[0] = (ul * ul) & GMP_NUMB_MASK;
@@ -179,3 +186,9 @@ mpn_sqrlo_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
}
}
#undef SQRLO_SPECIAL_CASES
+#undef MAYBE_special_cases
+#undef SQRLO_BASECASE_ALLOC
+#undef SQRLO_SHORTCUT_MULTIPLICATIONS
+#undef MPN_SQR_DIAGONAL
+#undef MPN_SQRLO_DIAGONAL
+#undef MPN_SQRLO_DIAG_ADDLSH1
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sqrmod_bnm1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sqrmod_bnm1.c
index fd0868b90b7..0a27d7b1447 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sqrmod_bnm1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sqrmod_bnm1.c
@@ -36,7 +36,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -75,7 +74,7 @@ mpn_bc_sqrmod_bnp1 (mp_ptr rp, mp_srcptr ap, mp_size_t rn, mp_ptr tp)
ASSERT (tp[2*rn] < GMP_NUMB_MAX);
cy = tp[2*rn] + mpn_sub_n (rp, tp, tp+rn, rn);
rp[rn] = 0;
- MPN_INCR_U (rp, rn+1, cy );
+ MPN_INCR_U (rp, rn+1, cy);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sqrtrem.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sqrtrem.c
index 4835e8e5954..cc6dd9c88d7 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sqrtrem.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sqrtrem.c
@@ -3,12 +3,12 @@
Contributed to the GNU project by Paul Zimmermann (most code),
Torbjorn Granlund (mpn_sqrtrem1) and Marco Bodrato (mpn_dc_sqrt).
- THE FUNCTIONS IN THIS FILE EXCEPT mpn_sqrtrem ARE INTERNAL WITH A
- MUTABLE INTERFACE. IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED
- INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR
- DISAPPEAR IN A FUTURE GMP RELEASE.
+ THE FUNCTIONS IN THIS FILE EXCEPT mpn_sqrtrem ARE INTERNAL WITH MUTABLE
+ INTERFACES. IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.
+ IN FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A
+ FUTURE GMP RELEASE.
-Copyright 1999-2002, 2004, 2005, 2008, 2010, 2012, 2015 Free Software
+Copyright 1999-2002, 2004, 2005, 2008, 2010, 2012, 2015, 2017 Free Software
Foundation, Inc.
This file is part of the GNU MP Library.
@@ -44,7 +44,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <stdlib.h>
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
#define USE_DIVAPPR_Q 1
@@ -167,12 +166,24 @@ mpn_sqrtrem1 (mp_ptr rp, mp_limb_t a0)
#define Prec (GMP_NUMB_BITS >> 1)
+#if ! defined(SQRTREM2_INPLACE)
+#define SQRTREM2_INPLACE 0
+#endif
/* same as mpn_sqrtrem, but for size=2 and {np, 2} normalized
return cc such that {np, 2} = sp[0]^2 + cc*2^GMP_NUMB_BITS + rp[0] */
+#if SQRTREM2_INPLACE
+#define CALL_SQRTREM2_INPLACE(sp,rp) mpn_sqrtrem2 (sp, rp)
+static mp_limb_t
+mpn_sqrtrem2 (mp_ptr sp, mp_ptr rp)
+{
+ mp_srcptr np = rp;
+#else
+#define CALL_SQRTREM2_INPLACE(sp,rp) mpn_sqrtrem2 (sp, rp, rp)
static mp_limb_t
mpn_sqrtrem2 (mp_ptr sp, mp_ptr rp, mp_srcptr np)
{
+#endif
mp_limb_t q, u, np0, sp0, rp0, q2;
int cc;
@@ -223,44 +234,43 @@ mpn_dc_sqrtrem (mp_ptr sp, mp_ptr np, mp_size_t n, mp_limb_t approx, mp_ptr scra
int c, b; /* carry out of remainder */
mp_size_t l, h;
+ ASSERT (n > 1);
ASSERT (np[2 * n - 1] >= GMP_NUMB_HIGHBIT / 2);
- if (n == 1)
- c = mpn_sqrtrem2 (sp, np, np);
+ l = n / 2;
+ h = n - l;
+ if (h == 1)
+ q = CALL_SQRTREM2_INPLACE (sp + l, np + 2 * l);
else
+ q = mpn_dc_sqrtrem (sp + l, np + 2 * l, h, 0, scratch);
+ if (q != 0)
+ ASSERT_CARRY (mpn_sub_n (np + 2 * l, np + 2 * l, sp + l, h));
+ TRACE(printf("tdiv_qr(,,,,%u,,%u) -> %u\n", (unsigned) n, (unsigned) h, (unsigned) (n - h + 1)));
+ mpn_tdiv_qr (scratch, np + l, 0, np + l, n, sp + l, h);
+ q += scratch[l];
+ c = scratch[0] & 1;
+ mpn_rshift (sp, scratch, l, 1);
+ sp[l - 1] |= (q << (GMP_NUMB_BITS - 1)) & GMP_NUMB_MASK;
+ if (UNLIKELY ((sp[0] & approx) != 0)) /* (sp[0] & mask) > 1 */
+ return 1; /* Remainder is non-zero */
+ q >>= 1;
+ if (c != 0)
+ c = mpn_add_n (np + l, np + l, sp + l, h);
+ TRACE(printf("sqr(,,%u)\n", (unsigned) l));
+ mpn_sqr (np + n, sp, l);
+ b = q + mpn_sub_n (np, np, np + n, 2 * l);
+ c -= (l == h) ? b : mpn_sub_1 (np + 2 * l, np + 2 * l, 1, (mp_limb_t) b);
+
+ if (c < 0)
{
- l = n / 2;
- h = n - l;
- q = mpn_dc_sqrtrem (sp + l, np + 2 * l, h, 0, scratch);
- if (q != 0)
- ASSERT_CARRY (mpn_sub_n (np + 2 * l, np + 2 * l, sp + l, h));
- TRACE(printf("tdiv_qr(,,,,%u,,%u) -> %u\n", (unsigned) n, (unsigned) h, (unsigned) (n - h + 1)));
- mpn_tdiv_qr (scratch, np + l, 0, np + l, n, sp + l, h);
- q += scratch[l];
- c = scratch[0] & 1;
- mpn_rshift (sp, scratch, l, 1);
- sp[l - 1] |= (q << (GMP_NUMB_BITS - 1)) & GMP_NUMB_MASK;
- if (UNLIKELY ((sp[0] & approx) != 0)) /* (sp[0] & mask) > 1 */
- return 1; /* Remainder is non-zero */
- q >>= 1;
- if (c != 0)
- c = mpn_add_n (np + l, np + l, sp + l, h);
- TRACE(printf("sqr(,,%u)\n", (unsigned) l));
- mpn_sqr (np + n, sp, l);
- b = q + mpn_sub_n (np, np, np + n, 2 * l);
- c -= (l == h) ? b : mpn_sub_1 (np + 2 * l, np + 2 * l, 1, (mp_limb_t) b);
-
- if (c < 0)
- {
- q = mpn_add_1 (sp + l, sp + l, h, q);
+ q = mpn_add_1 (sp + l, sp + l, h, q);
#if HAVE_NATIVE_mpn_addlsh1_n_ip1 || HAVE_NATIVE_mpn_addlsh1_n
- c += mpn_addlsh1_n_ip1 (np, sp, n) + 2 * q;
+ c += mpn_addlsh1_n_ip1 (np, sp, n) + 2 * q;
#else
- c += mpn_addmul_1 (np, sp, n, CNST_LIMB(2)) + 2 * q;
+ c += mpn_addmul_1 (np, sp, n, CNST_LIMB(2)) + 2 * q;
#endif
- c -= mpn_sub_1 (np, np, n, CNST_LIMB(1));
- q -= mpn_sub_1 (sp, sp, n, CNST_LIMB(1));
- }
+ c -= mpn_sub_1 (np, np, n, CNST_LIMB(1));
+ q -= mpn_sub_1 (sp, sp, n, CNST_LIMB(1));
}
return c;
@@ -420,7 +430,7 @@ mpn_dc_sqrt (mp_ptr sp, mp_srcptr np, mp_size_t n, unsigned nsh, unsigned odd)
mp_size_t
mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr np, mp_size_t nn)
{
- mp_limb_t *tp, s0[1], cc, high, rl;
+ mp_limb_t cc, high, rl;
int c;
mp_size_t rn, tn;
TMP_DECL;
@@ -459,6 +469,32 @@ mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr np, mp_size_t nn)
}
return rl != 0;
}
+ if (nn == 2) {
+ mp_limb_t tp [2];
+ if (rp == NULL) rp = tp;
+ if (c == 0)
+ {
+#if SQRTREM2_INPLACE
+ rp[1] = high;
+ rp[0] = np[0];
+ cc = CALL_SQRTREM2_INPLACE (sp, rp);
+#else
+ cc = mpn_sqrtrem2 (sp, rp, np);
+#endif
+ rp[1] = cc;
+ return ((rp[0] | cc) != 0) + cc;
+ }
+ else
+ {
+ rl = np[0];
+ rp[1] = (high << (2*c)) | (rl >> (GMP_NUMB_BITS - 2*c));
+ rp[0] = rl << (2*c);
+ CALL_SQRTREM2_INPLACE (sp, rp);
+ cc = sp[0] >>= c; /* c != 0, the highest bit of the root cc is 0. */
+ rp[0] = rl -= cc*cc; /* Computed modulo 2^GMP_LIMB_BITS, because it's smaller. */
+ return rl != 0;
+ }
+ }
tn = (nn + 1) / 2; /* 2*tn is the smallest even integer >= nn */
if ((rp == NULL) && (nn > 8))
@@ -466,8 +502,8 @@ mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr np, mp_size_t nn)
TMP_MARK;
if (((nn & 1) | c) != 0)
{
- mp_limb_t mask;
- mp_ptr scratch;
+ mp_limb_t s0[1], mask;
+ mp_ptr tp, scratch;
TMP_ALLOC_LIMBS_2 (tp, 2 * tn, scratch, tn / 2 + 1);
tp[0] = 0; /* needed only when 2*tn > nn, but saves a test */
if (c != 0)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/strongfibo.c b/Build/source/libs/gmp/gmp-src/mpn/generic/strongfibo.c
new file mode 100644
index 00000000000..ffd038a2b7b
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/strongfibo.c
@@ -0,0 +1,216 @@
+/* mpn_fib2m -- calculate Fibonacci numbers, modulo m.
+
+Contributed to the GNU project by Marco Bodrato.
+
+ THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
+ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
+ FUTURE GNU MP RELEASES.
+
+Copyright 2001, 2002, 2005, 2009, 2018 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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 <stdio.h>
+#include "gmp-impl.h"
+
+/* Stores |{ap,n}-{bp,n}| in {rp,n},
+ returns the sign of {ap,n}-{bp,n}. */
+static int
+abs_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+ mp_limb_t x, y;
+ while (--n >= 0)
+ {
+ x = ap[n];
+ y = bp[n];
+ if (x != y)
+ {
+ ++n;
+ if (x > y)
+ {
+ ASSERT_NOCARRY (mpn_sub_n (rp, ap, bp, n));
+ return 1;
+ }
+ else
+ {
+ ASSERT_NOCARRY (mpn_sub_n (rp, bp, ap, n));
+ return -1;
+ }
+ }
+ rp[n] = 0;
+ }
+ return 0;
+}
+
+/* Computes at most count terms of the sequence needed by the
+ Lucas-Lehmer-Riesel test, indexing backward:
+ L_i = L_{i+1}^2 - 2
+
+ The sequence is computed modulo M = {mp, mn}.
+ The starting point is given in L_{count+1} = {lp, mn}.
+ The scratch pointed by sp, needs a space of at least 3 * mn + 1 limbs.
+
+ Returns the index i>0 if L_i = 0 (mod M) is found within the
+ computed count terms of the sequence. Otherwise it returns zero.
+
+ Note: (+/-2)^2-2=2, (+/-1)^2-2=-1, 0^2-2=-2
+ */
+
+static mp_bitcnt_t
+mpn_llriter (mp_ptr lp, mp_srcptr mp, mp_size_t mn, mp_bitcnt_t count, mp_ptr sp)
+{
+ do
+ {
+ mpn_sqr (sp, lp, mn);
+ mpn_tdiv_qr (sp + 2 * mn, lp, 0, sp, 2 * mn, mp, mn);
+ if (lp[0] < 5)
+ {
+ /* If L^2 % M < 5, |L^2 % M - 2| <= 2 */
+ if (mn == 1 || mpn_zero_p (lp + 1, mn - 1))
+ return (lp[0] == 2) ? count : 0;
+ else
+ MPN_DECR_U (lp, mn, 2);
+ }
+ else
+ lp[0] -= 2;
+ } while (--count != 0);
+ return 0;
+}
+
+/* Store the Lucas' number L[n] at lp (maybe), computed modulo m. lp
+ and scratch should have room for mn*2+1 limbs.
+
+ Returns the size of L[n] normally.
+
+ If F[n] is zero modulo m, or L[n] is, returns 0 and lp is
+ undefined.
+*/
+
+static mp_size_t
+mpn_lucm (mp_ptr lp, mp_srcptr np, mp_size_t nn, mp_srcptr mp, mp_size_t mn, mp_ptr scratch)
+{
+ int neg;
+ mp_limb_t cy;
+
+ ASSERT (! MPN_OVERLAP_P (lp, MAX(2*mn+1,5), scratch, MAX(2*mn+1,5)));
+ ASSERT (nn > 0);
+
+ neg = mpn_fib2m (lp, scratch, np, nn, mp, mn);
+
+ /* F[n] = +/-{lp, mn}, F[n-1] = +/-{scratch, mn} */
+ if (mpn_zero_p (lp, mn))
+ return 0;
+
+ if (neg) /* One sign is opposite, use sub instead of add. */
+ {
+#if HAVE_NATIVE_mpn_rsblsh1_n || HAVE_NATIVE_mpn_sublsh1_n
+#if HAVE_NATIVE_mpn_rsblsh1_n
+ cy = mpn_rsblsh1_n (lp, lp, scratch, mn); /* L[n] = +/-(2F[n-1]-(-F[n])) */
+#else
+ cy = mpn_sublsh1_n (lp, lp, scratch, mn); /* L[n] = -/+(F[n]-(-2F[n-1])) */
+ if (cy != 0)
+ cy = mpn_add_n (lp, lp, mp, mn) - cy;
+#endif
+ if (cy > 1)
+ cy += mpn_add_n (lp, lp, mp, mn);
+#else
+ cy = mpn_lshift (scratch, scratch, mn, 1); /* 2F[n-1] */
+ if (UNLIKELY (cy))
+ cy -= mpn_sub_n (lp, scratch, lp, mn); /* L[n] = +/-(2F[n-1]-(-F[n])) */
+ else
+ abs_sub_n (lp, lp, scratch, mn);
+#endif
+ ASSERT (cy <= 1);
+ }
+ else
+ {
+#if HAVE_NATIVE_mpn_addlsh1_n
+ cy = mpn_addlsh1_n (lp, lp, scratch, mn); /* L[n] = +/-(2F[n-1]+F[n])) */
+#else
+ cy = mpn_lshift (scratch, scratch, mn, 1);
+ cy+= mpn_add_n (lp, lp, scratch, mn);
+#endif
+ ASSERT (cy <= 2);
+ }
+ while (cy || mpn_cmp (lp, mp, mn) >= 0)
+ cy -= mpn_sub_n (lp, lp, mp, mn);
+ MPN_NORMALIZE (lp, mn);
+ return mn;
+}
+
+int
+mpn_strongfibo (mp_srcptr mp, mp_size_t mn, mp_ptr scratch)
+{
+ mp_ptr lp, sp;
+ mp_size_t en;
+ mp_bitcnt_t b0;
+ TMP_DECL;
+
+#if GMP_NUMB_BITS % 4 == 0
+ b0 = mpn_scan0 (mp, 0);
+#else
+ {
+ mpz_t m = MPZ_ROINIT_N(mp, mn);
+ b0 = mpz_scan0 (m, 0);
+ }
+ if (UNLIKELY (b0 == mn * GMP_NUMB_BITS))
+ {
+ en = 1;
+ scratch [0] = 1;
+ }
+ else
+#endif
+ {
+ int cnt = b0 % GMP_NUMB_BITS;
+ en = b0 / GMP_NUMB_BITS;
+ if (LIKELY (cnt != 0))
+ mpn_rshift (scratch, mp + en, mn - en, cnt);
+ else
+ MPN_COPY (scratch, mp + en, mn - en);
+ en = mn - en;
+ scratch [0] |= 1;
+ en -= scratch [en - 1] == 0;
+ }
+ TMP_MARK;
+
+ lp = TMP_ALLOC_LIMBS (4 * mn + 6);
+ sp = lp + 2 * mn + 3;
+ en = mpn_lucm (sp, scratch, en, mp, mn, lp);
+ if (en != 0 && LIKELY (--b0 != 0))
+ {
+ mpn_sqr (lp, sp, en);
+ lp [0] |= 2; /* V^2 + 2 */
+ if (LIKELY (2 * en >= mn))
+ mpn_tdiv_qr (sp, lp, 0, lp, 2 * en, mp, mn);
+ else
+ MPN_ZERO (lp + 2 * en, mn - 2 * en);
+ if (! mpn_zero_p (lp, mn) && LIKELY (--b0 != 0))
+ b0 = mpn_llriter (lp, mp, mn, b0, lp + mn + 1);
+ }
+ TMP_FREE;
+ return (b0 != 0);
+}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sub.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sub.c
index 3fbcbbe98b4..df0afd69d5f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sub.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sub.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpn_sub 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_1.c
index db2e6f948f5..a20f1916d84 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_1.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpn_sub_1 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err1_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err1_n.c
index 340313a323a..beca57ece9e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err1_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err1_n.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/*
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err2_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err2_n.c
index 63ea2451b49..1edf8d6d959 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err2_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err2_n.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/*
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err3_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err3_n.c
index a80e05d0d96..2db3c634fb3 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err3_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_err3_n.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/*
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_n.c b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_n.c
index 29de2d2d891..b192c965591 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/sub_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/sub_n.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/submul_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/submul_1.c
index fbc3501389d..47442746d5a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/submul_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/submul_1.c
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -39,30 +38,36 @@ see https://www.gnu.org/licenses/. */
#if GMP_NAIL_BITS == 0
mp_limb_t
-mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t v0)
{
- mp_limb_t ul, cl, hpl, lpl, rl;
+ mp_limb_t u0, crec, c, p1, p0, r0;
ASSERT (n >= 1);
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- cl = 0;
+ crec = 0;
do
{
- ul = *up++;
- umul_ppmm (hpl, lpl, ul, vl);
+ u0 = *up++;
+ umul_ppmm (p1, p0, u0, v0);
+
+ r0 = *rp;
+
+ p0 = r0 - p0;
+ c = r0 < p0;
+
+ p1 = p1 + c;
+
+ r0 = p0 - crec; /* cycle 0, 3, ... */
+ c = p0 < r0; /* cycle 1, 4, ... */
- lpl += cl;
- cl = (lpl < cl) + hpl;
+ crec = p1 + c; /* cycle 2, 5, ... */
- rl = *rp;
- lpl = rl - lpl;
- cl += lpl > rl;
- *rp++ = lpl;
+ *rp++ = r0;
}
while (--n != 0);
- return cl;
+ return crec;
}
#endif
@@ -70,35 +75,35 @@ mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
#if GMP_NAIL_BITS == 1
mp_limb_t
-mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t v0)
{
- mp_limb_t shifted_vl, ul, rl, lpl, hpl, prev_hpl, cl, xl, c1, c2, c3;
+ mp_limb_t shifted_v0, u0, r0, p0, p1, prev_p1, cl, xl, c1, c2, c3;
ASSERT (n >= 1);
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
ASSERT_MPN (rp, n);
ASSERT_MPN (up, n);
- ASSERT_LIMB (vl);
+ ASSERT_LIMB (v0);
- shifted_vl = vl << GMP_NAIL_BITS;
+ shifted_v0 = v0 << GMP_NAIL_BITS;
cl = 0;
- prev_hpl = 0;
+ prev_p1 = 0;
do
{
- ul = *up++;
- rl = *rp;
- umul_ppmm (hpl, lpl, ul, shifted_vl);
- lpl >>= GMP_NAIL_BITS;
- SUBC_LIMB (c1, xl, rl, prev_hpl);
- SUBC_LIMB (c2, xl, xl, lpl);
+ u0 = *up++;
+ r0 = *rp;
+ umul_ppmm (p1, p0, u0, shifted_v0);
+ p0 >>= GMP_NAIL_BITS;
+ SUBC_LIMB (c1, xl, r0, prev_p1);
+ SUBC_LIMB (c2, xl, xl, p0);
SUBC_LIMB (c3, xl, xl, cl);
cl = c1 + c2 + c3;
*rp++ = xl;
- prev_hpl = hpl;
+ prev_p1 = p1;
}
while (--n != 0);
- return prev_hpl + cl;
+ return prev_p1 + cl;
}
#endif
@@ -106,34 +111,34 @@ mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
#if GMP_NAIL_BITS >= 2
mp_limb_t
-mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t v0)
{
- mp_limb_t shifted_vl, ul, rl, lpl, hpl, prev_hpl, xw, cl, xl;
+ mp_limb_t shifted_v0, u0, r0, p0, p1, prev_p1, xw, cl, xl;
ASSERT (n >= 1);
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
ASSERT_MPN (rp, n);
ASSERT_MPN (up, n);
- ASSERT_LIMB (vl);
+ ASSERT_LIMB (v0);
- shifted_vl = vl << GMP_NAIL_BITS;
+ shifted_v0 = v0 << GMP_NAIL_BITS;
cl = 0;
- prev_hpl = 0;
+ prev_p1 = 0;
do
{
- ul = *up++;
- rl = *rp;
- umul_ppmm (hpl, lpl, ul, shifted_vl);
- lpl >>= GMP_NAIL_BITS;
- xw = rl - (prev_hpl + lpl) + cl;
+ u0 = *up++;
+ r0 = *rp;
+ umul_ppmm (p1, p0, u0, shifted_v0);
+ p0 >>= GMP_NAIL_BITS;
+ xw = r0 - (prev_p1 + p0) + cl;
cl = (mp_limb_signed_t) xw >> GMP_NUMB_BITS; /* FIXME: non-portable */
xl = xw & GMP_NUMB_MASK;
*rp++ = xl;
- prev_hpl = hpl;
+ prev_p1 = p1;
}
while (--n != 0);
- return prev_hpl - cl;
+ return prev_p1 - cl;
}
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/tdiv_qr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/tdiv_qr.c
index 0d87663513d..92ff33cffaa 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/tdiv_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/tdiv_qr.c
@@ -5,13 +5,13 @@
operands are unaffected.
Preconditions:
- 1. The most significant limb of of the divisor must be non-zero.
+ 1. The most significant limb of the divisor must be non-zero.
2. nn >= dn, even if qxn is non-zero. (??? relax this ???)
The time complexity of this is O(qn*qn+M(dn,qn)), where M(m,n) is the time
complexity of multiplication.
-Copyright 1997, 2000-2002, 2005, 2009 Free Software Foundation, Inc.
+Copyright 1997, 2000-2002, 2005, 2009, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -39,7 +39,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -69,17 +68,16 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
case 2:
{
- mp_ptr n2p, d2p;
+ mp_ptr n2p;
mp_limb_t qhl, cy;
TMP_DECL;
TMP_MARK;
if ((dp[1] & GMP_NUMB_HIGHBIT) == 0)
{
int cnt;
- mp_limb_t dtmp[2];
+ mp_limb_t d2p[2];
count_leading_zeros (cnt, dp[1]);
cnt -= GMP_NAIL_BITS;
- d2p = dtmp;
d2p[1] = (dp[1] << cnt) | (dp[0] >> (GMP_NUMB_BITS - cnt));
d2p[0] = (dp[0] << cnt) & GMP_NUMB_MASK;
n2p = TMP_ALLOC_LIMBS (nn + 1);
@@ -94,10 +92,9 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
}
else
{
- d2p = (mp_ptr) dp;
n2p = TMP_ALLOC_LIMBS (nn);
MPN_COPY (n2p, np, nn);
- qhl = mpn_divrem_2 (qp, 0L, n2p, nn, d2p);
+ qhl = mpn_divrem_2 (qp, 0L, n2p, nn, dp);
qp[nn - 2] = qhl; /* always store nn-2+1 quotient limbs */
rp[0] = n2p[0];
rp[1] = n2p[1];
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom22_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom22_mul.c
index aa4232b6187..64f024aaced 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom22_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom22_mul.c
@@ -7,7 +7,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 2006-2010, 2012, 2014 Free Software Foundation, Inc.
+Copyright 2006-2010, 2012, 2014, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -36,7 +36,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -1, 0, +inf
@@ -196,16 +195,27 @@ mpn_toom22_mul (mp_ptr pp,
if (vm1_neg)
cy += mpn_add_n (pp + n, pp + n, vm1, 2 * n);
- else
+ else {
cy -= mpn_sub_n (pp + n, pp + n, vm1, 2 * n);
+ if (UNLIKELY (cy + 1 == 0)) { /* cy is negative */
+ /* The total contribution of v0+vinf-vm1 can not be negative. */
+#if WANT_ASSERT
+ /* The borrow in cy stops the propagation of the carry cy2, */
+ ASSERT (cy2 == 1);
+ cy += mpn_add_1 (pp + 2 * n, pp + 2 * n, n, cy2);
+ ASSERT (cy == 0);
+#else
+ /* we simply fill the area with zeros. */
+ MPN_FILL (pp + 2 * n, n, 0);
+#endif
+ return;
+ }
+ }
- ASSERT (cy + 1 <= 3);
+ ASSERT (cy <= 2);
ASSERT (cy2 <= 2);
MPN_INCR_U (pp + 2 * n, s + t, cy2);
- if (LIKELY (cy <= 2))
- /* if s+t==n, cy is zero, but we should not acces pp[3*n] at all. */
- MPN_INCR_U (pp + 3 * n, s + t - n, cy);
- else
- MPN_DECR_U (pp + 3 * n, s + t - n, 1);
+ /* if s+t==n, cy is zero, but we should not access pp[3*n] at all. */
+ MPN_INCR_U (pp + 3 * n, s + t - n, cy);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom2_sqr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom2_sqr.c
index df83e9e926c..4eaa1417abb 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom2_sqr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom2_sqr.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 2006-2010, 2012, 2014 Free Software Foundation, Inc.
+Copyright 2006-2010, 2012, 2014, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -1, 0, +inf
@@ -135,12 +134,22 @@ mpn_toom2_sqr (mp_ptr pp,
cy -= mpn_sub_n (pp + n, pp + n, vm1, 2 * n);
- ASSERT (cy + 1 <= 3);
+ ASSERT (cy + 1 <= 3);
ASSERT (cy2 <= 2);
- MPN_INCR_U (pp + 2 * n, s + s, cy2);
- if (LIKELY (cy <= 2))
+ if (LIKELY (cy <= 2)) {
+ MPN_INCR_U (pp + 2 * n, s + s, cy2);
MPN_INCR_U (pp + 3 * n, s + s - n, cy);
- else
- MPN_DECR_U (pp + 3 * n, s + s - n, 1);
+ } else { /* cy is negative */
+ /* The total contribution of v0+vinf-vm1 can not be negative. */
+#if WANT_ASSERT
+ /* The borrow in cy stops the propagation of the carry cy2, */
+ ASSERT (cy2 == 1);
+ cy += mpn_add_1 (pp + 2 * n, pp + 2 * n, n, cy2);
+ ASSERT (cy == 0);
+#else
+ /* we simply fill the area with zeros. */
+ MPN_FILL (pp + 2 * n, n, 0);
+#endif
+ }
}
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom32_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom32_mul.c
index 0b05669cc4e..f03ba568f2a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom32_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom32_mul.c
@@ -40,7 +40,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -1, 0, +1, +inf
@@ -105,7 +104,7 @@ mpn_toom32_mul (mp_ptr pp,
/* FIXME: Keep v1[2*n] and vm1[2*n] in scalar variables? */
- /* Compute ap1 = a0 + a1 + a3, am1 = a0 - a1 + a3 */
+ /* Compute ap1 = a0 + a1 + a2, am1 = a0 - a1 + a2 */
ap1_hi = mpn_add (ap1, a0, n, a2, s);
#if HAVE_NATIVE_mpn_add_n_sub_n
if (ap1_hi == 0 && mpn_cmp (ap1, a1, n) < 0)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom33_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom33_mul.c
index 655355c39a3..8f49f427c1c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom33_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom33_mul.c
@@ -8,7 +8,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 2006-2008, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2006-2008, 2010, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -37,7 +37,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -1, 0, +1, +2, +inf
@@ -283,8 +282,8 @@ mpn_toom33_mul (mp_ptr pp,
}
else if (as1[n] != 0)
{
-#if HAVE_NATIVE_mpn_addlsh1_n
- cy = 2 * bs1[n] + mpn_addlsh1_n (v1 + n, v1 + n, bs1, n);
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+ cy = 2 * bs1[n] + mpn_addlsh1_n_ip1 (v1 + n, bs1, n);
#else
cy = 2 * bs1[n] + mpn_addmul_1 (v1 + n, bs1, n, CNST_LIMB(2));
#endif
@@ -297,8 +296,8 @@ mpn_toom33_mul (mp_ptr pp,
}
else if (bs1[n] != 0)
{
-#if HAVE_NATIVE_mpn_addlsh1_n
- cy += mpn_addlsh1_n (v1 + n, v1 + n, as1, n);
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+ cy += mpn_addlsh1_n_ip1 (v1 + n, as1, n);
#else
cy += mpn_addmul_1 (v1 + n, as1, n, CNST_LIMB(2));
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom3_sqr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom3_sqr.c
index 6117c67ca68..7be15bff396 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom3_sqr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom3_sqr.c
@@ -7,7 +7,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 2006-2010, 2012 Free Software Foundation, Inc.
+Copyright 2006-2010, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -36,7 +36,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -1, 0, +1, +2, +inf
@@ -193,8 +192,8 @@ mpn_toom3_sqr (mp_ptr pp,
}
else if (as1[n] != 0)
{
-#if HAVE_NATIVE_mpn_addlsh1_n
- cy = 2 * as1[n] + mpn_addlsh1_n (v1 + n, v1 + n, as1, n);
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+ cy = 2 * as1[n] + mpn_addlsh1_n_ip1 (v1 + n, as1, n);
#else
cy = 2 * as1[n] + mpn_addmul_1 (v1 + n, as1, n, CNST_LIMB(2));
#endif
@@ -207,8 +206,8 @@ mpn_toom3_sqr (mp_ptr pp,
}
else if (as1[n] != 0)
{
-#if HAVE_NATIVE_mpn_addlsh1_n
- cy += mpn_addlsh1_n (v1 + n, v1 + n, as1, n);
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+ cy += mpn_addlsh1_n_ip1 (v1 + n, as1, n);
#else
cy += mpn_addmul_1 (v1 + n, as1, n, CNST_LIMB(2));
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mul.c
index 525b5094bde..2dfba9b2f9a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mul.c
@@ -40,7 +40,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -1, 0, +1, +2, +inf
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mulmid.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mulmid.c
index 0251a6d7ed3..f581b101a27 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mulmid.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom42_mulmid.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom43_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom43_mul.c
index cb1dbcdc75c..065013819c2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom43_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom43_mul.c
@@ -39,7 +39,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -2, -1, 0, +1, +2, +inf
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom44_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom44_mul.c
index fbde633c300..77d5083cffa 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom44_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom44_mul.c
@@ -36,7 +36,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: 0, +1, -1, +2, -2, 1/2, +inf
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom4_sqr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom4_sqr.c
index b4154ba83fb..aec84c1834c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom4_sqr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom4_sqr.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -1, -1/2, 0, +1/2, +1, +2, +inf
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom52_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom52_mul.c
index efe9a0f6899..974059b65b0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom52_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom52_mul.c
@@ -39,7 +39,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -2, -1, 0, +1, +2, +inf
@@ -161,7 +160,7 @@ mpn_toom52_mul (mp_ptr pp,
/* Compute bs2 and bsm2, recycling bs1 and bsm1. bs2=bs1+b1; bsm2=bsm1-b1 */
mpn_add (bs2, bs1, n+1, b1, t);
- if (flags & toom6_vm1_neg )
+ if (flags & toom6_vm1_neg)
{
bsm2[n] = mpn_add (bsm2, bsm1, n, b1, t);
flags = (enum toom6_flags) (flags ^ toom6_vm2_neg);
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom53_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom53_mul.c
index e7c287089b1..c9342972aaf 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom53_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom53_mul.c
@@ -10,7 +10,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 2006-2008, 2012, 2014 Free Software Foundation, Inc.
+Copyright 2006-2008, 2012, 2014, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -39,7 +39,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: 0, +1, -1, +2, -2, 1/2, +inf
@@ -264,8 +263,8 @@ mpn_toom53_mul (mp_ptr pp,
}
else if (asm1[n] == 2)
{
-#if HAVE_NATIVE_mpn_addlsh1_n
- cy = 2 * bsm1[n] + mpn_addlsh1_n (vm1 + n, vm1 + n, bsm1, n);
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+ cy = 2 * bsm1[n] + mpn_addlsh1_n_ip1 (vm1 + n, bsm1, n);
#else
cy = 2 * bsm1[n] + mpn_addmul_1 (vm1 + n, bsm1, n, CNST_LIMB(2));
#endif
@@ -289,8 +288,8 @@ mpn_toom53_mul (mp_ptr pp,
}
else if (as1[n] == 2)
{
-#if HAVE_NATIVE_mpn_addlsh1_n
- cy = 2 * bs1[n] + mpn_addlsh1_n (v1 + n, v1 + n, bs1, n);
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+ cy = 2 * bs1[n] + mpn_addlsh1_n_ip1 (v1 + n, bs1, n);
#else
cy = 2 * bs1[n] + mpn_addmul_1 (v1 + n, bs1, n, CNST_LIMB(2));
#endif
@@ -307,8 +306,8 @@ mpn_toom53_mul (mp_ptr pp,
}
else if (bs1[n] == 2)
{
-#if HAVE_NATIVE_mpn_addlsh1_n
- cy += mpn_addlsh1_n (v1 + n, v1 + n, as1, n);
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+ cy += mpn_addlsh1_n_ip1 (v1 + n, as1, n);
#else
cy += mpn_addmul_1 (v1 + n, as1, n, CNST_LIMB(2));
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom54_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom54_mul.c
index 939bb53ab68..343b02e9487 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom54_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom54_mul.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom62_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom62_mul.c
index afc6a1002a5..d971cc02555 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom62_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom62_mul.c
@@ -39,7 +39,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in:
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom63_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom63_mul.c
index 57c5d3e3dd8..181996d0ae8 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom63_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom63_mul.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Stores |{ap,n}-{bp,n}| in {rp,n}, returns the sign. */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom6_sqr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom6_sqr.c
index e5ab7dcd1d2..336eef9d63d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom6_sqr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom6_sqr.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom6h_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom6h_mul.c
index 420895be8f9..637f2a549cd 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom6h_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom6h_mul.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom8_sqr.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom8_sqr.c
index 0c936788159..03e5c64505a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom8_sqr.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom8_sqr.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#if GMP_NUMB_BITS < 29
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom8h_mul.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom8h_mul.c
index 8f593903f59..5ba259af5a4 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom8h_mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom8h_mul.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_couple_handling.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_couple_handling.c
index 9e62bcba1c9..cd253f7a887 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_couple_handling.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_couple_handling.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Gets {pp,n} and (sign?-1:1)*{np,n}. Computes at once:
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm1.c
index 50411bd3ca6..5f491b651aa 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm1.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm2.c
index 3ba6d15f3dd..55e6b89bf8e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_dgr3_pm2.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Needs n+1 limbs of temporary storage. */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm1.c
index 2334b0aff4a..a8cfa936048 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm1.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluates a polynomial of degree k > 3, in the points +1 and -1. */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2.c
index 67afcc638ef..be682c75c4e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* DO_addlsh2(d,a,b,n,cy) computes cy,{d,n} <- {a,n} + 4*(cy,{b,n}), it
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2exp.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2exp.c
index b178fcac244..c3c4651009d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2exp.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
/* Evaluates a polynomial of degree k > 2, in the points +2^shift and -2^shift. */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2rexp.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2rexp.c
index 3cac46bd905..6cd62fb5cd9 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2rexp.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_eval_pm2rexp.c
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#if HAVE_NATIVE_mpn_addlsh_n
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 180b0329a36..347e3410da2 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 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
@@ -170,7 +169,7 @@ do { \
we want to compute f(2^(GMP_NUMB_BITS * n)) for a polynomial f of
degree 11 (or 10), given the 12 (rsp. 11) values:
- r0 = limit at infinity of f(x) / x^7,
+ r0 = limit at infinity of f(x) / x^11,
r1 = f(4),f(-4),
r2 = f(2),f(-2),
r3 = f(1),f(-1),
@@ -287,12 +286,22 @@ mpn_toom_interpolate_12pts (mp_ptr pp, mp_ptr r1, mp_ptr r3, mp_ptr r5,
ASSERT_NOCARRY(mpn_sub_n (r3, r3, r2, n3p1));
+#ifdef HAVE_NATIVE_mpn_rsh1sub_n
+ mpn_rsh1sub_n (r4, r2, r4, n3p1);
+ r4 [n3p1 - 1] &= GMP_NUMB_MASK >> 1;
+#else
mpn_sub_n (r4, r2, r4, n3p1);
ASSERT_NOCARRY(mpn_rshift(r4, r4, n3p1, 1));
+#endif
ASSERT_NOCARRY(mpn_sub_n (r2, r2, r4, n3p1));
+#ifdef HAVE_NATIVE_mpn_rsh1add_n
+ mpn_rsh1add_n (r5, r5, r1, n3p1);
+ r5 [n3p1 - 1] &= GMP_NUMB_MASK >> 1;
+#else
mpn_add_n (r5, r5, r1, n3p1);
ASSERT_NOCARRY(mpn_rshift(r5, r5, n3p1, 1));
+#endif
/* last interpolation steps... */
ASSERT_NOCARRY(mpn_sub_n (r3, r3, r1, n3p1));
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 5afe6641f67..5d76bba8c21 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 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,7 +35,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#if GMP_NUMB_BITS < 29
@@ -254,7 +253,7 @@ do { \
f(2^(GMP_NUMB_BITS * n)) for a polynomial f of degree 15 (or
14), given the 16 (rsp. 15) values:
- r0 = limit at infinity of f(x) / x^7,
+ r0 = limit at infinity of f(x) / x^15,
r1 = f(8),f(-8),
r2 = f(4),f(-4),
r3 = f(2),f(-2),
@@ -439,16 +438,31 @@ mpn_toom_interpolate_16pts (mp_ptr pp, mp_ptr r1, mp_ptr r3, mp_ptr r5, mp_ptr r
ASSERT_NOCARRY(mpn_sub_n (r4, r4, r3, n3p1));
ASSERT_NOCARRY(mpn_sub_n (r4, r4, r2, n3p1));
+#ifdef HAVE_NATIVE_mpn_rsh1add_n
+ mpn_rsh1add_n (r6, r2, r6, n3p1);
+ r6 [n3p1 - 1] &= GMP_NUMB_MASK >> 1;
+#else
mpn_add_n (r6, r2, r6, n3p1);
ASSERT_NOCARRY(mpn_rshift(r6, r6, n3p1, 1));
+#endif
ASSERT_NOCARRY(mpn_sub_n (r2, r2, r6, n3p1));
+#ifdef HAVE_NATIVE_mpn_rsh1sub_n
+ mpn_rsh1sub_n (r5, r3, r5, n3p1);
+ r5 [n3p1 - 1] &= GMP_NUMB_MASK >> 1;
+#else
mpn_sub_n (r5, r3, r5, n3p1);
ASSERT_NOCARRY(mpn_rshift(r5, r5, n3p1, 1));
+#endif
ASSERT_NOCARRY(mpn_sub_n (r3, r3, r5, n3p1));
+#ifdef HAVE_NATIVE_mpn_rsh1add_n
+ mpn_rsh1add_n (r7, r1, r7, n3p1);
+ r7 [n3p1 - 1] &= GMP_NUMB_MASK >> 1;
+#else
mpn_add_n (r7, r1, r7, n3p1);
ASSERT_NOCARRY(mpn_rshift(r7, r7, n3p1, 1));
+#endif
ASSERT_NOCARRY(mpn_sub_n (r1, r1, r7, n3p1));
/* last interpolation steps... */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_5pts.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_5pts.c
index 9fa5f0b7a60..466ab8531df 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_5pts.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_5pts.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_6pts.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_6pts.c
index bdb2e95b892..eb2366130dc 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_6pts.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_6pts.c
@@ -34,13 +34,14 @@ 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 "gmp.h"
#include "gmp-impl.h"
+#define BINVERT_3 MODLIMB_INVERSE_3
+
/* For odd divisors, mpn_divexact_1 works fine with two's complement. */
#ifndef mpn_divexact_by3
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && MODLIMB_INVERSE_3
-#define mpn_divexact_by3(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,3,MODLIMB_INVERSE_3,0)
+#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
+#define mpn_divexact_by3(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,3,BINVERT_3,0)
#else
#define mpn_divexact_by3(dst,src,size) mpn_divexact_1(dst,src,size,3)
#endif
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_7pts.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_7pts.c
index 8a101496fa1..167c45be83d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_7pts.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_7pts.c
@@ -7,7 +7,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 2006, 2007, 2009, 2014 Free Software Foundation, Inc.
+Copyright 2006, 2007, 2009, 2014, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#define BINVERT_3 MODLIMB_INVERSE_3
@@ -211,8 +210,14 @@ mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom7_flags flags,
mpn_sub_n (w3, w3, w5, m);
mpn_divexact_by15 (w1, w1, m);
+#ifdef HAVE_NATIVE_mpn_rsh1add_n
+ mpn_rsh1add_n (w1, w1, w5, m);
+ w1[m - 1] &= GMP_NUMB_MASK >> 1;
+#else
mpn_add_n (w1, w1, w5, m); ASSERT (!(w1[0] & 1));
mpn_rshift (w1, w1, m, 1); /* w1>=0 now */
+#endif
+
mpn_sub_n (w5, w5, w1, m);
/* These bounds are valid for the 4x4 polynomial product of toom44,
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_8pts.c b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_8pts.c
index bba4a3b8124..5e65fab7717 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_8pts.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/toom_interpolate_8pts.c
@@ -34,7 +34,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#define BINVERT_3 MODLIMB_INVERSE_3
@@ -184,12 +183,12 @@ mpn_toom_interpolate_8pts (mp_ptr pp, mp_size_t n,
cy = mpn_add_n (pp + n, pp + n, r7, n); /* Hr8+Lr7-Lr5 */
cy-= mpn_sub_n (pp + n, pp + n, r5, n);
- if (0 > cy)
- MPN_DECR_U (r7 + n, 2*n + 1, 1);
- else
- MPN_INCR_U (r7 + n, 2*n + 1, cy);
+ if (cy > 0) {
+ MPN_INCR_U (r7 + n, 2*n + 1, 1);
+ cy = 0;
+ }
- cy = mpn_sub_n (pp + 2*n, r7 + n, r5 + n, n); /* Mr7-Mr5 */
+ cy = mpn_sub_nc (pp + 2*n, r7 + n, r5 + n, n, -cy); /* Mr7-Mr5 */
MPN_DECR_U (r7 + 2*n, n + 1, cy);
cy = mpn_add_n (pp + 3*n, r5, r7+ 2*n, n+1); /* Hr7+Lr5 */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/trialdiv.c b/Build/source/libs/gmp/gmp-src/mpn/generic/trialdiv.c
index 6e83c996fed..65e089f7d0c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/trialdiv.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/trialdiv.c
@@ -54,7 +54,6 @@ see https://www.gnu.org/licenses/. */
of the return value.
*/
-#include "gmp.h"
#include "gmp-impl.h"
struct gmp_primes_dtab {
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/udiv_w_sdiv.c b/Build/source/libs/gmp/gmp-src/mpn/generic/udiv_w_sdiv.c
index 7136429f0f8..7907135a882 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/udiv_w_sdiv.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/udiv_w_sdiv.c
@@ -37,7 +37,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/zero.c b/Build/source/libs/gmp/gmp-src/mpn/generic/zero.c
index e6e7fd3101e..1a05453bad8 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/zero.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/zero.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/zero_p.c b/Build/source/libs/gmp/gmp-src/mpn/generic/zero_p.c
index 44c1ff20305..c92f9b8ceff 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/generic/zero_p.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/generic/zero_p.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpn_zero_p 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/ia64/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/ia64/gcd_1.asm
deleted file mode 100644
index 3afabd706fa..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/ia64/gcd_1.asm
+++ /dev/null
@@ -1,238 +0,0 @@
-dnl Itanium-2 mpn_gcd_1 -- mpn by 1 gcd.
-
-dnl Contributed to the GNU project by Kevin Ryde, innerloop by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2002-2005, 2012, 2013, 2015 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/.
-
-include(`../config.m4')
-
-
-C cycles/bitpair (1x1 gcd)
-C Itanium: ?
-C Itanium 2: 5.1
-
-
-C mpn_gcd_1 (mp_srcptr xp, mp_size_t xsize, mp_limb_t y);
-C
-C The entry sequence is designed to expect xsize>1 and hence a modexact
-C call. This ought to be more common than a 1x1 operation. Our critical
-C path is thus stripping factors of 2 from y, calling modexact, then
-C stripping factors of 2 from the x remainder returned.
-C
-C The common factors of 2 between x and y must be determined using the
-C original x, not the remainder from the modexact. This is done with
-C x_orig which is xp[0]. There's plenty of time to do this while the rest
-C of the modexact etc is happening.
-C
-C It's possible xp[0] is zero. In this case the trailing zeros calculation
-C popc((x-1)&~x) gives 63, and that's clearly no less than what y will
-C have, making min(x_twos,y_twos) == y_twos.
-C
-C The main loop consists of transforming x,y to abs(x-y),min(x,y), and then
-C stripping factors of 2 from abs(x-y). Those factors of two are
-C determined from just y-x, without the abs(), since there's the same
-C number of trailing zeros on n or -n in twos complement. That makes the
-C dependent chain 8 cycles deep.
-C
-C The selection of x-y versus y-x for abs(x-y), and the selection of the
-C minimum of x and y, is done in parallel with the critical path.
-C
-C The algorithm takes about 0.68 iterations per bit (two N bit operands) on
-C average, hence the final 5.8 cycles/bitpair.
-C
-C Not done:
-C
-C An alternate algorithm which didn't strip all twos, but instead applied
-C tbit and predicated extr on x, and then y, was attempted. The loop was 6
-C cycles, but the algorithm is an average 1.25 iterations per bitpair for a
-C total 7.25 c/bp, which is slower than the current approach.
-C
-C Alternatives:
-C
-C Perhaps we could do something tricky by extracting a few high bits and a
-C few low bits from the operands, and looking up a table which would give a
-C set of predicates to control some shifts or subtracts or whatever. That
-C could knock off multiple bits per iteration.
-C
-C The right shifts are a bit of a bottleneck (shr at 2 or 3 cycles, or extr
-C only going down I0), perhaps it'd be possible to shift left instead,
-C using add. That would mean keeping track of the lowest not-yet-zeroed
-C bit, using some sort of mask.
-C
-C TODO:
-C * Once mod_1_N exists in assembly for Itanium, add conditional calls.
-C * Call bmod_1 even for n=1 when up[0] >> v0 (like other gcd_1 impls).
-C * Probably avoid popcnt also outside of loop, instead use ctz_table.
-
-ASM_START()
- .explicit C What does this mean?
-
-C HP's assembler requires these declarations for importing mpn_modexact_1c_odd
- .global mpn_modexact_1c_odd
- .type mpn_modexact_1c_odd,@function
-
-C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
-
-deflit(MAXSHIFT, 7)
-deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
-
-C .section ".rodata"
- .rodata
- ALIGN(m4_lshift(1,MAXSHIFT)) C align table to allow using dep
-ctz_table:
- data1 MAXSHIFT
-forloop(i,1,MASK,
-` data1 m4_count_trailing_zeros(i)
-')
-
-PROLOGUE(mpn_gcd_1)
-
- C r32 xp
- C r33 xsize
- C r34 y
-
-define(x, r8)
-define(xp_orig, r32)
-define(xsize, r33)
-define(y, r34) define(inputs, 3)
-define(save_rp, r35)
-define(save_pfs, r36)
-define(x_orig, r37)
-define(x_orig_one, r38)
-define(y_twos, r39) define(locals, 5)
-define(out_xp, r40)
-define(out_xsize, r41)
-define(out_divisor, r42)
-define(out_carry, r43) define(outputs, 4)
-
- .prologue
- {.mmi;
-ifdef(`HAVE_ABI_32',
-` addp4 r9 = 0, xp_orig define(xp,r9)', C M0
-` define(xp,xp_orig)')
- .save ar.pfs, save_pfs
- alloc save_pfs = ar.pfs, inputs, locals, outputs, 0 C M2
- .save rp, save_rp
- mov save_rp = b0 C I0
-}{.mbb; .body
- add r10 = -1, y C M3 y-1
- nop.b 0 C B0
- nop.b 0 C B1
- ;;
-
-}{.mmi; ld8 x = [xp] C M0 x = xp[0] if no modexact
- ld8 x_orig = [xp] C M1 orig x for common twos
- cmp.ne p6,p0 = 1, xsize C I0
-}{.mmi; andcm y_twos = r10, y C M2 (y-1)&~y
- mov out_xp = xp_orig C M3
- mov out_xsize = xsize C I1
- ;;
-}{.mmi; mov out_carry = 0 C M0
- nop.m 0 C M1
- popcnt y_twos = y_twos C I0 y twos
- ;;
-}{.mmi; add x_orig_one = -1, x_orig C M0 orig x-1
- nop.m 0 C M1
- shr.u out_divisor = y, y_twos C I0 y without twos
-}{.mib; nop.m 0 C M2
- shr.u y = y, y_twos C I1 y without twos
- (p6) br.call.sptk.many b0 = mpn_modexact_1c_odd C if xsize>1
- ;;
-}
- C modexact can leave x==0
- {.mmi; cmp.eq p6,p0 = 0, x C M0 if {xp,xsize} % y == 0
- andcm x_orig = x_orig_one, x_orig C M1 orig (x-1)&~x
- add r9 = -1, x C I0 x-1
- ;;
-}{.mmi; andcm r9 = r9, x C M0 (x-1)&~x
- nop.m 0 C M1
- mov b0 = save_rp C I0
- ;;
-}{.mii; nop.m 0 C M0
- popcnt x_orig = x_orig C I0 orig x twos
- popcnt r9 = r9 C I0 x twos
- ;;
-}{.mmi; cmp.lt p7,p0 = x_orig, y_twos C M0 orig x_twos < y_twos
- addl r22 = @ltoff(ctz_table), r1
- shr.u x = x, r9 C I0 x odd
- ;;
-}{.mib;
- (p7) mov y_twos = x_orig C M0 common twos
- add r10 = -1, y C I0 y-1
- (p6) br.dpnt.few L(done_y) C B0 x%y==0 then result y
- ;;
-}
- mov r25 = m4_lshift(MASK, MAXSHIFT)
- ld8 r22 = [r22]
- br L(ent)
- ;;
-
- ALIGN(32)
-L(top):
- .pred.rel "mutex", p6,p7
- {.mmi; (p7) mov y = x
- (p6) sub x = x, y
- dep r21 = r19, r22, 0, MAXSHIFT C concat(table,lowbits)
-}{.mmi; and r20 = MASK, r19
- (p7) mov x = r19
- nop 0
- ;;
-}
-L(mid):
-{.mmb; ld1 r16 = [r21]
- cmp.eq p10,p0 = 0, r20
- (p10) br.spnt.few.clr L(shift_alot)
- ;;
-}{.mmi; nop 0
- nop 0
- shr.u x = x, r16
- ;;
-}
-L(ent):
- {.mmi; sub r19 = y, x
- cmp.gtu p6,p7 = x, y
- cmp.ne p8,p0 = x, y
-}{.mmb; nop 0
- nop 0
- (p8) br.sptk.few.clr L(top)
-}
-
-L(done_y): C result is y
- mov ar.pfs = save_pfs C I0
- shl r8 = y, y_twos C I common factors of 2
- br.ret.sptk.many b0
-
-L(shift_alot):
- and r20 = x, r25
- shr.u x = x, MAXSHIFT
- ;;
- dep r21 = x, r22, 0, MAXSHIFT
- br L(mid)
-EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/ia64/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/ia64/gcd_11.asm
new file mode 100644
index 00000000000..61372270806
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/ia64/gcd_11.asm
@@ -0,0 +1,110 @@
+dnl Itanium-2 mpn_gcd_11
+
+dnl Copyright 2002-2005, 2012, 2013, 2015, 2019 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/.
+
+include(`../config.m4')
+
+
+C cycles/bitpair (1x1 gcd)
+C Itanium: ?
+C Itanium 2: 4.5
+
+
+ASM_START()
+
+C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
+
+deflit(MAXSHIFT, 7)
+deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
+
+ .rodata
+ ALIGN(m4_lshift(1,MAXSHIFT)) C align table to allow using dep
+ctz_table:
+ data1 MAXSHIFT
+forloop(i,1,MASK,
+` data1 m4_count_trailing_zeros(i)-1
+')
+
+define(`x0', r32)
+define(`y0', r33)
+
+PROLOGUE(mpn_gcd_11)
+ .prologue
+ .body
+ addl r22 = @ltoff(ctz_table), r1
+ ;;
+ ld8 r22 = [r22]
+ br L(ent)
+ ;;
+
+ ALIGN(32)
+L(top):
+ .pred.rel "mutex", p6,p7
+ {.mmi; (p7) mov y0 = x0
+ (p6) sub x0 = x0, y0
+ dep r21 = r19, r22, 0, MAXSHIFT C concat(table,lowbits)
+}{.mmi; and r20 = MASK, r19
+ (p7) mov x0 = r19
+ and r23 = 6, r19
+ ;;
+}{.mmi; cmp.eq p6,p0 = 4, r23
+ cmp.eq p7,p0 = 0, r23
+ shr.u x0 = x0, 1 C shift-by-1, always OK
+}{.mmb; ld1 r16 = [r21]
+ cmp.eq p10,p0 = 0, r20
+ (p10) br.spnt.few.clr L(count_better)
+ ;;
+}
+L(bck):
+ .pred.rel "mutex", p6,p7
+ {.mii; nop 0
+ (p6) shr.u x0 = x0, 1 C u was ...100 before shift-by-1 above
+ (p7) shr.u x0 = x0, r16 C u was ...000 before shift-by-1 above
+ ;;
+}
+L(ent):
+ {.mmi; sub r19 = y0, x0
+ cmp.gtu p6,p7 = x0, y0
+ cmp.ne p8,p0 = x0, y0
+}{.mmb; nop 0
+ nop 0
+ (p8) br.sptk.few.clr L(top)
+}
+
+L(end): mov r8 = y0
+ br.ret.sptk.many b0
+
+L(count_better):
+ add r20 = -1, x0
+ ;;
+ andcm r23 = r20, x0
+ ;;
+ popcnt r16 = r23
+ br L(bck)
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/ia64/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/ia64/gmp-mparam.h
index cda7573a1bd..34d2bf318a1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/ia64/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/ia64/gmp-mparam.h
@@ -1,6 +1,6 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 2000-2005, 2009-2011, 2014, 2015 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,174 +31,182 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 900MHz Itanium2 (titanic.gmplib.org) */
-/* FFT tuning limit = 60 M */
-/* Generated by tuneup.c, 2015-10-11, gcc 4.4 */
+/* 900MHz Itanium2 (olympic.gmplib.org) */
+/* FFT tuning limit = 59,194,709 */
+/* Generated by tuneup.c, 2019-10-13, gcc 4.2 */
-#define MOD_1_1P_METHOD 2
+#define MOD_1_1P_METHOD 2 /* 17.40% faster than 1 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 26
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 18
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 13
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 1.35% faster than 2 */
#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD 12
+#define DIV_QR_2_PI2_THRESHOLD 10
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
-#define MUL_TOOM22_THRESHOLD 39
-#define MUL_TOOM33_THRESHOLD 129
-#define MUL_TOOM44_THRESHOLD 214
-#define MUL_TOOM6H_THRESHOLD 318
-#define MUL_TOOM8H_THRESHOLD 430
+#define DIV_1_VS_MUL_1_PERCENT 316
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 121
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 145
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 124
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 151
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 201
+#define MUL_TOOM22_THRESHOLD 47
+#define MUL_TOOM33_THRESHOLD 89
+#define MUL_TOOM44_THRESHOLD 220
+#define MUL_TOOM6H_THRESHOLD 327
+#define MUL_TOOM8H_THRESHOLD 454
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 153
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 143
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 153
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 226
#define SQR_BASECASE_THRESHOLD 11
-#define SQR_TOOM2_THRESHOLD 85
-#define SQR_TOOM3_THRESHOLD 131
-#define SQR_TOOM4_THRESHOLD 494
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 0 /* always */
+#define SQR_TOOM2_THRESHOLD 98
+#define SQR_TOOM3_THRESHOLD 135
+#define SQR_TOOM4_THRESHOLD 272
+#define SQR_TOOM6_THRESHOLD 354
+#define SQR_TOOM8_THRESHOLD 490
-#define MULMID_TOOM42_THRESHOLD 98
+#define MULMID_TOOM42_THRESHOLD 99
#define MULMOD_BNM1_THRESHOLD 23
-#define SQRMOD_BNM1_THRESHOLD 25
+#define SQRMOD_BNM1_THRESHOLD 27
-#define MUL_FFT_MODF_THRESHOLD 500 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 840 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 500, 5}, { 29, 6}, { 35, 7}, { 18, 6}, \
- { 37, 7}, { 19, 6}, { 39, 7}, { 33, 8}, \
- { 17, 7}, { 37, 8}, { 19, 7}, { 39, 8}, \
- { 21, 7}, { 43, 8}, { 37, 9}, { 19, 8}, \
- { 43, 9}, { 23, 8}, { 49, 9}, { 27, 8}, \
- { 57, 9}, { 43,10}, { 23, 9}, { 59,10}, \
- { 31, 9}, { 71,10}, { 39, 9}, { 87,10}, \
+ { { 840, 5}, { 30, 6}, { 16, 5}, { 33, 6}, \
+ { 17, 5}, { 36, 6}, { 35, 7}, { 18, 6}, \
+ { 37, 7}, { 19, 6}, { 42, 7}, { 37, 8}, \
+ { 19, 7}, { 43, 8}, { 23, 7}, { 47, 8}, \
+ { 43, 9}, { 23, 8}, { 51, 9}, { 27, 8}, \
+ { 57, 9}, { 31, 8}, { 63, 9}, { 35, 8}, \
+ { 71, 9}, { 43,10}, { 23, 9}, { 55,10}, \
+ { 31, 9}, { 71,10}, { 39, 9}, { 83,10}, \
{ 47, 9}, { 99,10}, { 55,11}, { 31,10}, \
{ 87,11}, { 47,10}, { 111,12}, { 31,11}, \
- { 63,10}, { 143,11}, { 79,10}, { 167,11}, \
+ { 63,10}, { 135,11}, { 79,10}, { 167,11}, \
{ 95,10}, { 191,11}, { 111,12}, { 63,11}, \
{ 143,10}, { 287,11}, { 159,12}, { 95,11}, \
- { 191,10}, { 399,11}, { 207,10}, { 431,13}, \
- { 63,12}, { 127,11}, { 271,10}, { 543,11}, \
- { 287,10}, { 575,11}, { 303,12}, { 159,11}, \
- { 335,10}, { 671,11}, { 367,12}, { 191,11}, \
- { 431,12}, { 223,13}, { 127,12}, { 255,11}, \
- { 543,12}, { 287,11}, { 607,12}, { 351,11}, \
- { 703,13}, { 191,12}, { 415,11}, { 863,12}, \
- { 447,14}, { 127,13}, { 255,12}, { 607,13}, \
- { 319,12}, { 735,13}, { 383,12}, { 863,13}, \
- { 447,12}, { 927,11}, { 1855,12}, { 959,14}, \
- { 255,13}, { 575,12}, { 1247,13}, { 703,14}, \
- { 383,13}, { 831,12}, { 1727,13}, { 895,12}, \
- { 1791,15}, { 255,14}, { 511,13}, { 1087,12}, \
- { 2175,13}, { 1151,14}, { 639,13}, { 1343,12}, \
- { 2687,13}, { 1471,14}, { 767,13}, { 1599,12}, \
- { 3199,13}, { 1663,14}, { 895,13}, { 1855,15}, \
- { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
- { 2431,14}, { 1279,13}, { 2687,14}, { 1407,15}, \
- { 767,14}, { 1663,13}, { 3455,14}, { 1791,16}, \
- { 511,15}, { 1023,14}, { 2431,15}, { 1279,14}, \
- { 2943,15}, { 1535,14}, { 3455,15}, { 1791,14}, \
- { 16384,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
- { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
- {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 142
-#define MUL_FFT_THRESHOLD 5760
-
-#define SQR_FFT_MODF_THRESHOLD 464 /* k = 5 */
+ { 207,13}, { 63,12}, { 127,11}, { 271,12}, \
+ { 159,11}, { 335,10}, { 671,12}, { 191,10}, \
+ { 799,12}, { 223,13}, { 127,12}, { 287,11}, \
+ { 607,12}, { 319,11}, { 671,13}, { 191,12}, \
+ { 383,11}, { 799,10}, { 1599,12}, { 415,11}, \
+ { 863,14}, { 127,13}, { 255,12}, { 543,11}, \
+ { 1119,12}, { 607,13}, { 319,12}, { 735,11}, \
+ { 1471,12}, { 863,13}, { 447,12}, { 927,11}, \
+ { 1855,12}, { 959,14}, { 255,13}, { 511,12}, \
+ { 1055,11}, { 2111,12}, { 1119,13}, { 575,12}, \
+ { 1247,13}, { 639,12}, { 1311,13}, { 703,12}, \
+ { 1471,13}, { 831,12}, { 1727,13}, { 895,12}, \
+ { 1791,13}, { 959,15}, { 255,14}, { 511,13}, \
+ { 1087,12}, { 2239,13}, { 1215,14}, { 639,13}, \
+ { 1471,14}, { 767,13}, { 1727,14}, { 895,13}, \
+ { 1855,12}, { 3711,13}, { 1919,15}, { 511,14}, \
+ { 1023,13}, { 2111,12}, { 4223,13}, { 2175,14}, \
+ { 1151,13}, { 2495,14}, { 1279,13}, { 2623,14}, \
+ { 1407,15}, { 767,14}, { 1663,13}, { 3455,14}, \
+ { 1919,16}, { 511,15}, { 1023,14}, { 2175,13}, \
+ { 4479,14}, { 2431,15}, { 1279,14}, { 2943,15}, \
+ { 1535,14}, { 3455,15}, { 1791,14}, { 16384,15}, \
+ { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 149
+#define MUL_FFT_THRESHOLD 8576
+
+#define SQR_FFT_MODF_THRESHOLD 765 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 464, 5}, { 29, 6}, { 15, 5}, { 31, 6}, \
- { 35, 7}, { 18, 6}, { 37, 7}, { 33, 8}, \
- { 17, 7}, { 37, 8}, { 19, 7}, { 40, 8}, \
- { 29, 9}, { 15, 8}, { 37, 9}, { 19, 8}, \
+ { { 765, 5}, { 36, 6}, { 37, 7}, { 19, 6}, \
+ { 42, 7}, { 43, 8}, { 37, 9}, { 19, 8}, \
{ 43, 9}, { 23, 8}, { 49, 9}, { 27, 8}, \
{ 57, 9}, { 43,10}, { 23, 9}, { 55,10}, \
{ 31, 9}, { 71,10}, { 39, 9}, { 83,10}, \
{ 47, 9}, { 99,10}, { 55,11}, { 31,10}, \
{ 87,11}, { 47,10}, { 111,12}, { 31,11}, \
- { 63,10}, { 135,11}, { 79,10}, { 167,11}, \
- { 95,10}, { 191,11}, { 111,12}, { 63,11}, \
- { 143,10}, { 287,11}, { 159,10}, { 319,12}, \
- { 95,11}, { 191,10}, { 399,11}, { 207,10}, \
- { 415,13}, { 63,12}, { 127,11}, { 255,10}, \
- { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
- { 575,11}, { 303,12}, { 159,11}, { 335,10}, \
- { 671,11}, { 367,10}, { 735,12}, { 191,11}, \
- { 399,10}, { 799,11}, { 431,12}, { 223,11}, \
- { 463,13}, { 127,12}, { 255,11}, { 543,12}, \
- { 287,11}, { 607,12}, { 319,11}, { 671,12}, \
- { 351,11}, { 735,13}, { 191,12}, { 415,11}, \
- { 863,12}, { 447,14}, { 127,13}, { 255,12}, \
- { 607,13}, { 319,12}, { 735,13}, { 383,12}, \
- { 863,13}, { 447,12}, { 959,14}, { 255,13}, \
- { 575,12}, { 1183,13}, { 703,14}, { 383,13}, \
- { 831,12}, { 1663,13}, { 895,12}, { 1791,15}, \
- { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1151,14}, { 639,13}, { 1343,12}, { 2687,13}, \
- { 1407,14}, { 767,13}, { 1599,12}, { 3199,13}, \
- { 1663,14}, { 895,13}, { 1855,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2431,14}, \
- { 1279,13}, { 2687,14}, { 1407,15}, { 767,14}, \
- { 1663,13}, { 3327,14}, { 1791,16}, { 511,15}, \
- { 1023,14}, { 2431,15}, { 1279,14}, { 2943,15}, \
- { 1535,14}, { 3327,15}, { 1791,14}, { 16384,15}, \
+ { 63,10}, { 135,11}, { 79,10}, { 175,11}, \
+ { 95,10}, { 199,11}, { 111,12}, { 63,11}, \
+ { 159,12}, { 95,11}, { 191,10}, { 399,11}, \
+ { 207,13}, { 63,12}, { 127,10}, { 511, 9}, \
+ { 1023,10}, { 527,11}, { 271,12}, { 159,10}, \
+ { 703,12}, { 191,11}, { 399,10}, { 799,11}, \
+ { 431,12}, { 223,13}, { 127,12}, { 255,11}, \
+ { 527,10}, { 1055,11}, { 559,12}, { 287,11}, \
+ { 607,10}, { 1215,11}, { 703,13}, { 191,12}, \
+ { 383,11}, { 799,12}, { 415,11}, { 863,12}, \
+ { 447,14}, { 127,13}, { 255,12}, { 511,11}, \
+ { 1055,12}, { 543,11}, { 1119,12}, { 607,11}, \
+ { 1215,12}, { 735,13}, { 383,12}, { 799,11}, \
+ { 1599,12}, { 863,13}, { 447,12}, { 991,14}, \
+ { 255,13}, { 511,12}, { 1055,11}, { 2111,12}, \
+ { 1119,13}, { 575,12}, { 1215,13}, { 639,12}, \
+ { 1311,13}, { 703,12}, { 1407,14}, { 383,13}, \
+ { 767,12}, { 1599,13}, { 831,12}, { 1727,13}, \
+ { 895,12}, { 1791,13}, { 959,12}, { 1919,15}, \
+ { 255,14}, { 511,13}, { 1023,12}, { 2047,13}, \
+ { 1087,12}, { 2239,13}, { 1151,12}, { 2303,13}, \
+ { 1215,14}, { 639,13}, { 1279,12}, { 2559,13}, \
+ { 1471,14}, { 767,13}, { 1727,14}, { 895,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2239,14}, \
+ { 1151,13}, { 2495,14}, { 1279,13}, { 2623,14}, \
+ { 1407,15}, { 767,14}, { 1663,13}, { 3455,14}, \
+ { 1919,16}, { 511,15}, { 1023,14}, { 2175,13}, \
+ { 4479,14}, { 2431,15}, { 1279,14}, { 2943,15}, \
+ { 1535,14}, { 3455,15}, { 1791,14}, { 16384,15}, \
{ 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
{ 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
{8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 149
-#define SQR_FFT_THRESHOLD 4032
+#define SQR_FFT_TABLE3_SIZE 153
+#define SQR_FFT_THRESHOLD 6272
-#define MULLO_BASECASE_THRESHOLD 36
+#define MULLO_BASECASE_THRESHOLD 39
#define MULLO_DC_THRESHOLD 0 /* never mpn_mullo_basecase */
-#define MULLO_MUL_N_THRESHOLD 11278
+#define MULLO_MUL_N_THRESHOLD 17050
#define SQRLO_BASECASE_THRESHOLD 0 /* always */
-#define SQRLO_DC_THRESHOLD 11
-#define SQRLO_SQR_THRESHOLD 7916
+#define SQRLO_DC_THRESHOLD 134
+#define SQRLO_SQR_THRESHOLD 12322
-#define DC_DIV_QR_THRESHOLD 59
-#define DC_DIVAPPR_Q_THRESHOLD 222
-#define DC_BDIV_QR_THRESHOLD 94
-#define DC_BDIV_Q_THRESHOLD 264
+#define DC_DIV_QR_THRESHOLD 73
+#define DC_DIVAPPR_Q_THRESHOLD 262
+#define DC_BDIV_QR_THRESHOLD 111
+#define DC_BDIV_Q_THRESHOLD 315
-#define INV_MULMOD_BNM1_THRESHOLD 78
-#define INV_NEWTON_THRESHOLD 133
-#define INV_APPR_THRESHOLD 133
+#define INV_MULMOD_BNM1_THRESHOLD 92
+#define INV_NEWTON_THRESHOLD 15
+#define INV_APPR_THRESHOLD 17
-#define BINV_NEWTON_THRESHOLD 250
+#define BINV_NEWTON_THRESHOLD 280
#define REDC_1_TO_REDC_2_THRESHOLD 0 /* always */
-#define REDC_2_TO_REDC_N_THRESHOLD 148
+#define REDC_2_TO_REDC_N_THRESHOLD 172
-#define MU_DIV_QR_THRESHOLD 1187
-#define MU_DIVAPPR_Q_THRESHOLD 1120
+#define MU_DIV_QR_THRESHOLD 1470
+#define MU_DIVAPPR_Q_THRESHOLD 1210
#define MUPI_DIV_QR_THRESHOLD 0 /* always */
-#define MU_BDIV_QR_THRESHOLD 1210
-#define MU_BDIV_Q_THRESHOLD 1470
+#define MU_BDIV_QR_THRESHOLD 1566
+#define MU_BDIV_Q_THRESHOLD 1787
-#define POWM_SEC_TABLE 1,34,321,1985
+#define POWM_SEC_TABLE 3,22,139,1867
-#define GET_STR_DC_THRESHOLD 15
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 1216
-#define SET_STR_PRECOMPUTE_THRESHOLD 3170
+#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_PRECOMPUTE_THRESHOLD 42
+#define SET_STR_DC_THRESHOLD 1339
+#define SET_STR_PRECOMPUTE_THRESHOLD 3934
-#define FAC_DSC_THRESHOLD 746
+#define FAC_DSC_THRESHOLD 866
#define FAC_ODD_THRESHOLD 0 /* always */
-#define MATRIX22_STRASSEN_THRESHOLD 24
-#define HGCD_THRESHOLD 117
-#define HGCD_APPR_THRESHOLD 111
-#define HGCD_REDUCE_THRESHOLD 3389
-#define GCD_DC_THRESHOLD 460
-#define GCDEXT_DC_THRESHOLD 411
-#define JACOBI_BASE_METHOD 2
+#define MATRIX22_STRASSEN_THRESHOLD 20
+#define HGCD2_DIV1_METHOD 3 /* 13.73% faster than 1 */
+#define HGCD_THRESHOLD 129
+#define HGCD_APPR_THRESHOLD 202
+#define HGCD_REDUCE_THRESHOLD 4455
+#define GCD_DC_THRESHOLD 658
+#define GCDEXT_DC_THRESHOLD 469
+#define JACOBI_BASE_METHOD 2 /* 0.62% faster than 4 */
+
+/* Tuneup completed successfully, took 199042 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/lisp/gmpasm-mode.el b/Build/source/libs/gmp/gmp-src/mpn/lisp/gmpasm-mode.el
index 06b74bd6ce7..6f2fea00d05 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/lisp/gmpasm-mode.el
+++ b/Build/source/libs/gmp/gmp-src/mpn/lisp/gmpasm-mode.el
@@ -4,27 +4,27 @@
;; Copyright 1999-2002 Free Software Foundation, Inc.
;; This file is part of the GNU MP Library.
-;;
+;;
;; The GNU MP Library is free software; you can redistribute it and/or modify
;; it under the terms of either:
-;;
+;;
;; * the GNU Lesser General Public License as published by the Free
;; Software Foundation; either version 3 of the License, or (at your
;; option) any later version.
-;;
+;;
;; or
-;;
+;;
;; * the GNU General Public License as published by the Free Software
;; Foundation; either version 2 of the License, or (at your option) any
;; later version.
-;;
+;;
;; or both in parallel, as here.
-;;
+;;
;; The GNU MP Library is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
;; for more details.
-;;
+;;
;; 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/.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/mips64/addmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/addmul_1.asm
index 8ff0976e252..8ff0976e252 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/mips64/addmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/addmul_1.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/mips64/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/mul_1.asm
index 77acf0ac257..77acf0ac257 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/mips64/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/mul_1.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/mips64/sqr_diagonal.asm b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/sqr_diagonal.asm
index dcb87dc21f1..dcb87dc21f1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/mips64/sqr_diagonal.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/sqr_diagonal.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/mips64/submul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/submul_1.asm
index 089589cd736..089589cd736 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/mips64/submul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/submul_1.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/mips64/umul.asm b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/umul.asm
index b9aac575912..b9aac575912 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/mips64/umul.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/mips64/hilo/umul.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/pa64/umul.asm b/Build/source/libs/gmp/gmp-src/mpn/pa64/umul.asm
index c3341ecfe60..bd5a71f3280 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/pa64/umul.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/pa64/umul.asm
@@ -95,4 +95,3 @@ ifdef(`HAVE_ABI_2_0w',
bve (%r2)
ldo -128(%r30),%r30
EPILOGUE(mpn_umul_ppmm_r)
-
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc32/divrem_2.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc32/divrem_2.asm
index c6e64efe233..74423f44133 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc32/divrem_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc32/divrem_2.asm
@@ -1,6 +1,6 @@
dnl PPC-32 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
-dnl Copyright 2007, 2008, 2012 Free Software Foundation, Inc.
+dnl Copyright 2007, 2008, 2012, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -98,7 +98,7 @@ C Compute di from d1
cmplw cr6, r6, r0
addi r31, r31, -1 C q1--
crorc 28, 28, 25
- bc+ 12, 28, L(9)
+ blt+ cr7, L(9)
addi r31, r31, -1 C q1--
add r0, r0, r10
L(9): subf r0, r6, r0
@@ -115,7 +115,7 @@ L(9): subf r0, r6, r0
cmplw cr6, r11, r0
addi r6, r6, -1 C q0--
crorc 28, 28, 25
- bc+ 12, 28, L(13)
+ blt+ cr7, L(13)
C add r0, r0, r10 C final remainder
addi r6, r6, -1 C q0--
L(13): rlwimi r6, r31, 16, 0, 15 C assemble final quotient
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc32/p4/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/powerpc32/p4/gmp-mparam.h
index 20830a0bd72..7ac59f586ff 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc32/p4/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc32/p4/gmp-mparam.h
@@ -51,6 +51,8 @@ see https://www.gnu.org/licenses/. */
#define DIVEXACT_1_THRESHOLD 0 /* always */
#define BMOD_1_TO_MOD_1_THRESHOLD 45
+#define DIV_1_VS_MUL_1_PERCENT 225
+
#define MUL_TOOM22_THRESHOLD 20
#define MUL_TOOM33_THRESHOLD 73
#define MUL_TOOM44_THRESHOLD 130
@@ -166,6 +168,9 @@ see https://www.gnu.org/licenses/. */
#define MULLO_BASECASE_THRESHOLD 0 /* always */
#define MULLO_DC_THRESHOLD 55
#define MULLO_MUL_N_THRESHOLD 13463
+#define SQRLO_BASECASE_THRESHOLD 4
+#define SQRLO_DC_THRESHOLD 169
+#define SQRLO_SQR_THRESHOLD 9335
#define DC_DIV_QR_THRESHOLD 50
#define DC_DIVAPPR_Q_THRESHOLD 196
@@ -187,14 +192,6 @@ see https://www.gnu.org/licenses/. */
#define POWM_SEC_TABLE 3,28,78,480,1099
-#define MATRIX22_STRASSEN_THRESHOLD 9
-#define HGCD_THRESHOLD 93
-#define HGCD_APPR_THRESHOLD 109
-#define HGCD_REDUCE_THRESHOLD 2479
-#define GCD_DC_THRESHOLD 379
-#define GCDEXT_DC_THRESHOLD 273
-#define JACOBI_BASE_METHOD 4
-
#define GET_STR_DC_THRESHOLD 11
#define GET_STR_PRECOMPUTE_THRESHOLD 24
#define SET_STR_DC_THRESHOLD 381
@@ -202,3 +199,11 @@ see https://www.gnu.org/licenses/. */
#define FAC_DSC_THRESHOLD 179
#define FAC_ODD_THRESHOLD 28
+
+#define MATRIX22_STRASSEN_THRESHOLD 9
+#define HGCD_THRESHOLD 93
+#define HGCD_APPR_THRESHOLD 109
+#define HGCD_REDUCE_THRESHOLD 2479
+#define GCD_DC_THRESHOLD 379
+#define GCDEXT_DC_THRESHOLD 273
+#define JACOBI_BASE_METHOD 4
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc32/p7/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/powerpc32/p7/gmp-mparam.h
index 35bb61dca26..ad48dac1591 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc32/p7/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc32/p7/gmp-mparam.h
@@ -1,6 +1,6 @@
/* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2004, 2008-2011 Free Software Foundation, Inc.
+Copyright 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,129 +31,140 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 3550 MHz POWER7/T4 */
+/* 4150 MHz POWER8/T4 */
+/* FFT tuning limit = 0.5 M */
+/* Generated by tuneup.c, 2017-02-18, gcc 6.1 */
#define DIVREM_1_NORM_THRESHOLD 0 /* always */
#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1_1P_METHOD 1
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 8
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 34
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 15
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 22
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 11
#define USE_PREINV_DIVREM_1 1
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_1N_PI1_METHOD 2
+#define DIV_QR_1_NORM_THRESHOLD 4
+#define DIV_QR_1_UNNORM_THRESHOLD 3
+#define DIV_QR_2_PI2_THRESHOLD 15
#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 34
+#define BMOD_1_TO_MOD_1_THRESHOLD 39
+
+#define DIV_1_VS_MUL_1_PERCENT 343
#define MUL_TOOM22_THRESHOLD 20
-#define MUL_TOOM33_THRESHOLD 89
-#define MUL_TOOM44_THRESHOLD 130
+#define MUL_TOOM33_THRESHOLD 73
+#define MUL_TOOM44_THRESHOLD 202
#define MUL_TOOM6H_THRESHOLD 286
-#define MUL_TOOM8H_THRESHOLD 363
+#define MUL_TOOM8H_THRESHOLD 430
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 121
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 114
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 89
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 137
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 140
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 128
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 145
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 121
-#define SQR_BASECASE_THRESHOLD 4
-#define SQR_TOOM2_THRESHOLD 50
-#define SQR_TOOM3_THRESHOLD 89
-#define SQR_TOOM4_THRESHOLD 154
-#define SQR_TOOM6_THRESHOLD 222
-#define SQR_TOOM8_THRESHOLD 381
+#define SQR_BASECASE_THRESHOLD 0 /* always */
+#define SQR_TOOM2_THRESHOLD 26
+#define SQR_TOOM3_THRESHOLD 97
+#define SQR_TOOM4_THRESHOLD 236
+#define SQR_TOOM6_THRESHOLD 318
+#define SQR_TOOM8_THRESHOLD 478
-#define MULMID_TOOM42_THRESHOLD 40
+#define MULMID_TOOM42_THRESHOLD 34
#define MULMOD_BNM1_THRESHOLD 18
-#define SQRMOD_BNM1_THRESHOLD 17
-
-#define POWM_SEC_TABLE 4,35,225,780,2212
+#define SQRMOD_BNM1_THRESHOLD 18
-#define MUL_FFT_MODF_THRESHOLD 476 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 444 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 476, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 12, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 14, 5}, { 29, 6}, { 21, 7}, { 11, 6}, \
- { 25, 7}, { 13, 6}, { 29, 7}, { 15, 6}, \
- { 31, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 21, 8}, { 11, 7}, { 27, 8}, \
+ { { 444, 5}, { 21, 6}, { 12, 5}, { 25, 6}, \
+ { 13, 5}, { 27, 6}, { 21, 7}, { 11, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 17, 6}, \
+ { 35, 7}, { 21, 8}, { 11, 7}, { 27, 8}, \
{ 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
{ 27, 9}, { 15, 8}, { 39, 9}, { 23, 8}, \
- { 51,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
- { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
- { 95,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 159,10}, { 95,11}, { 63,10}, \
- { 159,11}, { 95,12}, { 63,11}, { 127,10}, \
+ { 51,10}, { 15, 9}, { 31, 8}, { 63, 9}, \
+ { 39, 8}, { 79, 9}, { 47,10}, { 31, 9}, \
+ { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
+ { 191,10}, { 111,11}, { 63,10}, { 127, 9}, \
+ { 255,10}, { 143, 9}, { 287,10}, { 159,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
{ 255, 9}, { 511,10}, { 271, 9}, { 543, 8}, \
- { 1087,11}, { 159,10}, { 319, 9}, { 639,10}, \
- { 335, 9}, { 671, 8}, { 1343,10}, { 351,11}, \
- { 191,10}, { 415, 9}, { 831,10}, { 431,11}, \
- { 223,12}, { 4096,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 77
-#define MUL_FFT_THRESHOLD 5312
-
-#define SQR_FFT_MODF_THRESHOLD 344 /* k = 5 */
+ { 1087,10}, { 287,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 351,11}, { 191,10}, { 415, 9}, \
+ { 831,11}, { 223,12}, { 4096,13}, { 8192,14}, \
+ { 16384,15}, { 32768,16} }
+#define MUL_FFT_TABLE3_SIZE 70
+#define MUL_FFT_THRESHOLD 4544
+
+#define SQR_FFT_MODF_THRESHOLD 332 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 344, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { { 332, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
{ 21, 7}, { 11, 6}, { 24, 7}, { 13, 6}, \
{ 27, 7}, { 15, 6}, { 31, 7}, { 21, 8}, \
{ 11, 7}, { 27, 8}, { 15, 7}, { 33, 8}, \
{ 19, 7}, { 39, 8}, { 27, 9}, { 15, 8}, \
{ 39, 9}, { 23, 8}, { 47,10}, { 15, 9}, \
- { 31, 8}, { 63, 9}, { 39, 8}, { 79, 9}, \
- { 47,10}, { 31, 9}, { 79,10}, { 47,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 159,10}, { 95, 9}, { 191,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511, 9}, { 271,10}, \
- { 143, 9}, { 287, 8}, { 575, 9}, { 303,10}, \
- { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543, 8}, { 1087,10}, { 287, 9}, { 575,10}, \
- { 303,11}, { 159,10}, { 319, 9}, { 639,10}, \
- { 335, 9}, { 671,10}, { 351, 9}, { 703,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 415, 9}, \
- { 831,11}, { 223,10}, { 447,12}, { 4096,13}, \
+ { 31, 8}, { 63, 9}, { 47,10}, { 31, 9}, \
+ { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
+ { 127, 8}, { 255, 9}, { 135,10}, { 95, 9}, \
+ { 191,11}, { 63,10}, { 127, 9}, { 255, 8}, \
+ { 511, 9}, { 271,10}, { 143, 9}, { 287, 8}, \
+ { 575, 9}, { 303, 8}, { 607,10}, { 159,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
+ { 287, 9}, { 575,10}, { 303, 9}, { 607,11}, \
+ { 159,10}, { 319, 9}, { 639,10}, { 351, 9}, \
+ { 703,11}, { 191,10}, { 383, 9}, { 767,10}, \
+ { 415,11}, { 223,10}, { 447,12}, { 4096,13}, \
{ 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 79
-#define SQR_FFT_THRESHOLD 3712
+#define SQR_FFT_TABLE3_SIZE 75
+#define SQR_FFT_THRESHOLD 3520
-#define MULLO_BASECASE_THRESHOLD 2
-#define MULLO_DC_THRESHOLD 34
-#define MULLO_MUL_N_THRESHOLD 10323
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 36
+#define MULLO_MUL_N_THRESHOLD 8648
+#define SQRLO_BASECASE_THRESHOLD 5
+#define SQRLO_DC_THRESHOLD 193
+#define SQRLO_SQR_THRESHOLD 6675
-#define DC_DIV_QR_THRESHOLD 52
-#define DC_DIVAPPR_Q_THRESHOLD 202
-#define DC_BDIV_QR_THRESHOLD 68
-#define DC_BDIV_Q_THRESHOLD 152
+#define DC_DIV_QR_THRESHOLD 33
+#define DC_DIVAPPR_Q_THRESHOLD 134
+#define DC_BDIV_QR_THRESHOLD 51
+#define DC_BDIV_Q_THRESHOLD 134
#define INV_MULMOD_BNM1_THRESHOLD 66
-#define INV_NEWTON_THRESHOLD 226
-#define INV_APPR_THRESHOLD 189
+#define INV_NEWTON_THRESHOLD 132
+#define INV_APPR_THRESHOLD 131
#define BINV_NEWTON_THRESHOLD 292
-#define REDC_1_TO_REDC_N_THRESHOLD 79
+#define REDC_1_TO_REDC_N_THRESHOLD 67
+
+#define MU_DIV_QR_THRESHOLD 1334
+#define MU_DIVAPPR_Q_THRESHOLD 1334
+#define MUPI_DIV_QR_THRESHOLD 62
+#define MU_BDIV_QR_THRESHOLD 1142
+#define MU_BDIV_Q_THRESHOLD 1470
-#define MU_DIV_QR_THRESHOLD 1442
-#define MU_DIVAPPR_Q_THRESHOLD 1442
-#define MUPI_DIV_QR_THRESHOLD 91
-#define MU_BDIV_QR_THRESHOLD 1308
-#define MU_BDIV_Q_THRESHOLD 1442
+#define POWM_SEC_TABLE 3,25,114,480,1486
+
+#define GET_STR_DC_THRESHOLD 8
+#define GET_STR_PRECOMPUTE_THRESHOLD 14
+#define SET_STR_DC_THRESHOLD 644
+#define SET_STR_PRECOMPUTE_THRESHOLD 1365
+
+#define FAC_DSC_THRESHOLD 107
+#define FAC_ODD_THRESHOLD 29
#define MATRIX22_STRASSEN_THRESHOLD 16
-#define HGCD_THRESHOLD 126
-#define HGCD_APPR_THRESHOLD 139
+#define HGCD_THRESHOLD 95
+#define HGCD_APPR_THRESHOLD 121
#define HGCD_REDUCE_THRESHOLD 2681
-#define GCD_DC_THRESHOLD 573
-#define GCDEXT_DC_THRESHOLD 448
+#define GCD_DC_THRESHOLD 456
+#define GCDEXT_DC_THRESHOLD 386
#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 9
-#define GET_STR_PRECOMPUTE_THRESHOLD 20
-#define SET_STR_DC_THRESHOLD 834
-#define SET_STR_PRECOMPUTE_THRESHOLD 1888
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc32/powerpc-defs.m4 b/Build/source/libs/gmp/gmp-src/mpn/powerpc32/powerpc-defs.m4
index 0c142a2e0cf..8a1451cd8ed 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc32/powerpc-defs.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc32/powerpc-defs.m4
@@ -2,7 +2,7 @@ divert(-1)
dnl m4 macros for PowerPC assembler (32 and 64 bit).
-dnl Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
+dnl Copyright 2000, 2002, 2003, 2017, 2018 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -100,5 +100,22 @@ define(`ASSERT_counter',incr(ASSERT_counter))
define(ASSERT_counter,1)
+dnl Manually assemble some new instructions
+dnl
+
+define(`maddld',m4_assert_numargs(4)`dnl
+.long eval(0x10000033+m4_lshift($1,21)+m4_lshift($2,16)+m4_lshift($3,11)+m4_lshift($4,6))')
+
+define(`maddhdu',m4_assert_numargs(4)`dnl
+.long eval(0x10000031+m4_lshift($1,21)+m4_lshift($2,16)+m4_lshift($3,11)+m4_lshift($4,6))')
+
+define(`popcntd',m4_assert_numargs(2)`dnl
+.long eval(0x7c0003f4+m4_lshift($2,21)+m4_lshift($1,16))')
+
+define(`divdeu',m4_assert_numargs(3)`dnl
+.long eval(0x7c000312+m4_lshift($1,21)+m4_lshift($2,16)+m4_lshift($3,11))')
+
+define(`addex',m4_assert_numargs(4)`dnl
+.long eval(0x7c000154+m4_lshift($1,21)+m4_lshift($2,16)+m4_lshift($3,11)+m4_lshift($4,9))')
divert
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/aix.m4 b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/aix.m4
index bf6517d69d9..04378b8fb3c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/aix.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/aix.m4
@@ -29,6 +29,8 @@ 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/.
+define(`AIX')
+
define(`ASM_START',
`.machine "any"
.toc')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/darwin.m4 b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/darwin.m4
index a3180e48fd7..2c995e70678 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/darwin.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/darwin.m4
@@ -29,14 +29,14 @@ 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/.
+define(`DARWIN')
+
define(`ASM_START',`')
dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
dnl EPILOGUE_cpu(GSYM_PREFIX`'foo)
dnl
-define(`DARWIN')
-
define(`PROLOGUE_cpu',
m4_assert_numargs_range(1,2)
`ifelse(`$2',toc,,
@@ -46,8 +46,7 @@ m4_assert_numargs_range(1,2)
.align 5
$1:')
-define(`EPILOGUE_cpu',
-m4_assert_numargs(1))
+define(`lea_list', `')
dnl LEAL -- Load Effective Address Local. This is to be used for symbols
dnl defined in the same file. It will not work for externally defined
@@ -74,7 +73,7 @@ dnl another file. It will not work for locally defined symbols.
define(`LEA',
m4_assert_numargs(2)
`ifdef(`PIC',
-`define(`EPILOGUE_cpu',
+`define(`lea_list',
` .non_lazy_symbol_pointer
`L'$2`'$non_lazy_ptr:
.indirect_symbol $2
@@ -112,6 +111,10 @@ m4_assert_numargs(1))
define(`CALL',
`bl GSYM_PREFIX`'$1')
+define(`EPILOGUE_cpu',
+`lea_list'
+`define(`lea_list', `')')
+
define(`ASM_END', `dnl')
define(`EXTRA_REGISTER', r2)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/p4/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/p4/gmp-mparam.h
index a7271381c5c..4e805a00aa8 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/p4/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/p4/gmp-mparam.h
@@ -1,6 +1,6 @@
/* PowerPC-64 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 2008, 2009, 2011 Free Software Foundation, Inc.
+Copyright 2008, 2009, 2011, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,6 +29,8 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
/* 1800 MHz PPC970 */
+/* FFT tuning limit = 0.5 M */
+/* Generated by tuneup.c, 2017-01-01, gcc 4.0 */
#define DIVREM_1_NORM_THRESHOLD 0 /* always */
#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
@@ -39,135 +41,142 @@ see https://www.gnu.org/licenses/. */
#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 6
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 46
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 14
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 15
#define USE_PREINV_DIVREM_1 1
-#define DIV_QR_2_PI2_THRESHOLD 12
+#define DIV_QR_1N_PI1_METHOD 1
+#define DIV_QR_1_NORM_THRESHOLD 2
+#define DIV_QR_1_UNNORM_THRESHOLD 2
+#define DIV_QR_2_PI2_THRESHOLD 15
#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 90
+#define BMOD_1_TO_MOD_1_THRESHOLD 88
-#define MUL_TOOM22_THRESHOLD 16
-#define MUL_TOOM33_THRESHOLD 57
-#define MUL_TOOM44_THRESHOLD 94
-#define MUL_TOOM6H_THRESHOLD 125
+#define DIV_1_VS_MUL_1_PERCENT 269
+
+#define MUL_TOOM22_THRESHOLD 18
+#define MUL_TOOM33_THRESHOLD 60
+#define MUL_TOOM44_THRESHOLD 88
+#define MUL_TOOM6H_THRESHOLD 124
#define MUL_TOOM8H_THRESHOLD 187
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 65
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 99
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 61
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 91
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 61
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 56
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 70
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 60
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 74
#define SQR_BASECASE_THRESHOLD 4
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 98
-#define SQR_TOOM4_THRESHOLD 136
-#define SQR_TOOM6_THRESHOLD 180
+#define SQR_TOOM2_THRESHOLD 28
+#define SQR_TOOM3_THRESHOLD 90
+#define SQR_TOOM4_THRESHOLD 143
+#define SQR_TOOM6_THRESHOLD 181
#define SQR_TOOM8_THRESHOLD 272
#define MULMID_TOOM42_THRESHOLD 34
-#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 13
+#define MULMOD_BNM1_THRESHOLD 10
+#define SQRMOD_BNM1_THRESHOLD 15
-#define MUL_FFT_MODF_THRESHOLD 244 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 252 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 244, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
+ { { 252, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
+ { 7, 5}, { 15, 6}, { 13, 5}, { 27, 6}, \
{ 15, 7}, { 8, 6}, { 17, 7}, { 9, 6}, \
- { 19, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 20, 8}, { 11, 7}, { 23, 8}, \
- { 13, 7}, { 29, 8}, { 19, 9}, { 11, 8}, \
- { 27,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
- { 19, 8}, { 39, 9}, { 23, 8}, { 47, 9}, \
- { 27,10}, { 15, 9}, { 39,10}, { 23, 9}, \
- { 47,11}, { 15,10}, { 31, 9}, { 67,10}, \
- { 39, 9}, { 83,10}, { 47, 9}, { 95, 8}, \
- { 191, 9}, { 99,10}, { 55,11}, { 31,10}, \
- { 63, 9}, { 127, 8}, { 255,10}, { 71, 9}, \
- { 143, 8}, { 287,10}, { 79, 9}, { 159, 8}, \
- { 319,11}, { 47,10}, { 95, 9}, { 191, 8}, \
- { 383,10}, { 103,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511,10}, { 143, 9}, \
- { 287,11}, { 79,10}, { 159, 9}, { 319, 8}, \
- { 639,10}, { 175, 9}, { 351, 8}, { 703,11}, \
- { 95,10}, { 191, 9}, { 383, 8}, { 767,10}, \
- { 207, 9}, { 415,10}, { 223, 9}, { 447,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,11}, \
- { 143,10}, { 287, 9}, { 575, 8}, { 1151,11}, \
+ { 19, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
+ { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
+ { 21, 9}, { 11, 8}, { 27,10}, { 7, 9}, \
+ { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
+ { 23, 8}, { 47, 9}, { 27,10}, { 15, 9}, \
+ { 39,10}, { 23, 9}, { 47,11}, { 15,10}, \
+ { 31, 9}, { 67,10}, { 39, 9}, { 83,10}, \
+ { 47, 9}, { 95, 8}, { 191,10}, { 55,11}, \
+ { 31,10}, { 63, 9}, { 127, 8}, { 255,10}, \
+ { 71, 9}, { 143, 8}, { 287,10}, { 79, 9}, \
+ { 159, 8}, { 319,11}, { 47,10}, { 95, 9}, \
+ { 191, 8}, { 383,10}, { 103,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
+ { 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
+ { 319, 8}, { 639,10}, { 175, 9}, { 351, 8}, \
+ { 703,11}, { 95,10}, { 191, 9}, { 383, 8}, \
+ { 767,10}, { 207, 9}, { 415,10}, { 223, 9}, \
+ { 447,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,11}, { 143,10}, { 287, 9}, { 575,11}, \
{ 159,10}, { 319, 9}, { 639,11}, { 175,10}, \
{ 351, 9}, { 703,12}, { 95,11}, { 191,10}, \
- { 383, 9}, { 767,11}, { 207,10}, { 415, 9}, \
- { 831,11}, { 223,10}, { 447,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 106
-#define MUL_FFT_THRESHOLD 2688
+ { 383, 9}, { 767,11}, { 207,10}, { 415,11}, \
+ { 223,10}, { 447,13}, { 8192,14}, { 16384,15}, \
+ { 32768,16} }
+#define MUL_FFT_TABLE3_SIZE 105
+#define MUL_FFT_THRESHOLD 5248
-#define SQR_FFT_MODF_THRESHOLD 212 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 236 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 212, 5}, { 13, 6}, { 15, 7}, { 8, 6}, \
- { 17, 7}, { 9, 6}, { 19, 7}, { 13, 8}, \
- { 7, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
- { 11, 7}, { 23, 8}, { 13, 7}, { 27, 9}, \
- { 7, 8}, { 21, 9}, { 11, 8}, { 25,10}, \
- { 7, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
- { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 47,11}, \
- { 15,10}, { 31, 9}, { 63, 8}, { 127, 9}, \
- { 67,10}, { 39, 9}, { 79, 8}, { 159,10}, \
- { 47, 9}, { 95, 8}, { 191,11}, { 31,10}, \
- { 63, 9}, { 127, 8}, { 255,10}, { 71, 9}, \
- { 143, 8}, { 287,10}, { 79, 9}, { 159, 8}, \
- { 319,11}, { 47, 9}, { 191, 8}, { 383,12}, \
+ { { 236, 5}, { 13, 6}, { 15, 7}, { 8, 6}, \
+ { 17, 7}, { 9, 6}, { 19, 7}, { 17, 8}, \
+ { 9, 7}, { 20, 8}, { 11, 7}, { 24, 8}, \
+ { 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
+ { 25,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
+ { 19, 8}, { 39, 9}, { 23, 8}, { 47, 9}, \
+ { 27,10}, { 15, 9}, { 39,10}, { 23, 9}, \
+ { 47,11}, { 15,10}, { 31, 9}, { 67,10}, \
+ { 39, 9}, { 79, 8}, { 159,10}, { 47, 9}, \
+ { 95, 8}, { 191,11}, { 31,10}, { 63, 9}, \
+ { 127, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
+ { 287,10}, { 79, 9}, { 159, 8}, { 319,11}, \
+ { 47,10}, { 95, 9}, { 191, 8}, { 383,12}, \
{ 31,11}, { 63,10}, { 127, 9}, { 255, 8}, \
{ 511,10}, { 143, 9}, { 287, 8}, { 575,11}, \
{ 79,10}, { 159, 9}, { 319, 8}, { 639,10}, \
- { 175, 9}, { 351, 8}, { 703,10}, { 191, 9}, \
- { 383, 8}, { 767,10}, { 207, 9}, { 415,11}, \
- { 111,10}, { 223,12}, { 63,11}, { 127,10}, \
+ { 175, 9}, { 351, 8}, { 703,11}, { 95,10}, \
+ { 191, 9}, { 383, 8}, { 767,10}, { 207, 9}, \
+ { 415,10}, { 223,12}, { 63,11}, { 127,10}, \
{ 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
{ 575,11}, { 159,10}, { 319, 9}, { 639,11}, \
- { 175,10}, { 351, 9}, { 703, 8}, { 1407,11}, \
- { 191,10}, { 383, 9}, { 767,11}, { 207,10}, \
- { 415,11}, { 223,10}, { 447,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 102
-#define SQR_FFT_THRESHOLD 1984
+ { 175,10}, { 351, 9}, { 703,11}, { 191,10}, \
+ { 383, 9}, { 767,11}, { 207,10}, { 415,11}, \
+ { 223,10}, { 447,13}, { 8192,14}, { 16384,15}, \
+ { 32768,16} }
+#define SQR_FFT_TABLE3_SIZE 97
+#define SQR_FFT_THRESHOLD 3200
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 55
-#define MULLO_MUL_N_THRESHOLD 5240
-
-#define DC_DIV_QR_THRESHOLD 27
-#define DC_DIVAPPR_Q_THRESHOLD 108
+#define MULLO_DC_THRESHOLD 56
+#define MULLO_MUL_N_THRESHOLD 8648
+#define SQRLO_BASECASE_THRESHOLD 2
+#define SQRLO_DC_THRESHOLD 106
+#define SQRLO_SQR_THRESHOLD 6293
+
+#define DC_DIV_QR_THRESHOLD 28
+#define DC_DIVAPPR_Q_THRESHOLD 102
#define DC_BDIV_QR_THRESHOLD 51
-#define DC_BDIV_Q_THRESHOLD 126
+#define DC_BDIV_Q_THRESHOLD 124
-#define INV_MULMOD_BNM1_THRESHOLD 38
-#define INV_NEWTON_THRESHOLD 129
-#define INV_APPR_THRESHOLD 116
+#define INV_MULMOD_BNM1_THRESHOLD 34
+#define INV_NEWTON_THRESHOLD 123
+#define INV_APPR_THRESHOLD 109
-#define BINV_NEWTON_THRESHOLD 198
+#define BINV_NEWTON_THRESHOLD 206
#define REDC_1_TO_REDC_N_THRESHOLD 51
#define MU_DIV_QR_THRESHOLD 807
#define MU_DIVAPPR_Q_THRESHOLD 807
-#define MUPI_DIV_QR_THRESHOLD 54
+#define MUPI_DIV_QR_THRESHOLD 53
#define MU_BDIV_QR_THRESHOLD 748
#define MU_BDIV_Q_THRESHOLD 872
-#define POWM_SEC_TABLE 4,35,152,780,2145
+#define POWM_SEC_TABLE 2,23,66,440,1555
+
+#define GET_STR_DC_THRESHOLD 7
+#define GET_STR_PRECOMPUTE_THRESHOLD 17
+#define SET_STR_DC_THRESHOLD 1035
+#define SET_STR_PRECOMPUTE_THRESHOLD 2170
+
+#define FAC_DSC_THRESHOLD 542
+#define FAC_ODD_THRESHOLD 24
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 104
-#define HGCD_APPR_THRESHOLD 118
-#define HGCD_REDUCE_THRESHOLD 1329
+#define MATRIX22_STRASSEN_THRESHOLD 10
+#define HGCD_THRESHOLD 108
+#define HGCD_APPR_THRESHOLD 116
+#define HGCD_REDUCE_THRESHOLD 1437
#define GCD_DC_THRESHOLD 268
#define GCDEXT_DC_THRESHOLD 241
#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 9
-#define GET_STR_PRECOMPUTE_THRESHOLD 18
-#define SET_STR_DC_THRESHOLD 996
-#define SET_STR_PRECOMPUTE_THRESHOLD 2170
-
-#define FAC_DSC_THRESHOLD 442
-#define FAC_ODD_THRESHOLD 26
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/submul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/submul_1.asm
index 22601c417e2..996eda2d5b3 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/submul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode32/submul_1.asm
@@ -79,4 +79,3 @@ L(oop): ldu r0, 8(r4)
srdi r3, r4, 32
blr
EPILOGUE()
-
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/bdiv_q_1.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/bdiv_q_1.asm
new file mode 100644
index 00000000000..307aafc4b3f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/bdiv_q_1.asm
@@ -0,0 +1,146 @@
+dnl PowerPC-64 mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- Hensel division by 1-limb
+dnl divisor.
+
+dnl Copyright 2006, 2010, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C norm unorm
+C POWER3/PPC630 13-19
+C POWER4/PPC970 16
+C POWER5 16 16
+C POWER6 37 46
+C POWER7 12 12
+C POWER8 12 12
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`n', `r5')
+define(`d', `r6')
+define(`di', `r7')
+define(`cnt',`r8')
+
+define(`tnc',`r10')
+
+ASM_START()
+
+EXTERN(binvert_limb_table)
+
+PROLOGUE(mpn_bdiv_q_1,toc)
+ addi r7, n, -1
+ cmpdi cr1, n, 1
+ ld r12, 0(up)
+ li cnt, 0
+ neg r0, d
+ and r0, d, r0
+ cntlzd r0, r0
+ subfic cnt, r0, 63
+ srd d, d, cnt
+L(7):
+ mtctr r7
+ LEA( r10, binvert_limb_table)
+ rldicl r11, d, 63, 57
+ lbzx r0, r10, r11
+ mulld r9, r0, r0
+ sldi r0, r0, 1
+ mulld r9, d, r9
+ subf r0, r9, r0
+ mulld r10, r0, r0
+ sldi r0, r0, 1
+ mulld r10, d, r10
+ subf r0, r10, r0
+ mulld r9, r0, r0
+ sldi r0, r0, 1
+ mulld r9, d, r9
+ subf di, r9, r0 C di = 1/d mod 2^64
+ifdef(`AIX',
+` C For AIX it is not clear how to jump into another function.
+ b .mpn_pi1_bdiv_q_1
+',`
+ C For non-AIX, dispatch into the pi1 variant.
+ bne cr0, L(norm)
+ b L(unorm)
+')
+EPILOGUE()
+
+PROLOGUE(mpn_pi1_bdiv_q_1)
+ cmpdi cr0, cnt, 0
+ ld r12, 0(up)
+ addic r0, n, -1 C set carry as side effect
+ cmpdi cr1, n, 1
+ mtctr r0
+ beq cr0, L(norm)
+
+L(unorm):
+ subfic tnc, cnt, 64 C set carry as side effect
+ li r5, 0
+ srd r11, r12, cnt
+ beq cr1, L(ed1)
+
+ ALIGN(16)
+L(tpu): ld r12, 8(up)
+ nop
+ addi up, up, 8
+ sld r0, r12, tnc
+ or r11, r11, r0
+ subfe r9, r5, r11
+ srd r11, r12, cnt
+ mulld r0, di, r9
+ mulhdu r5, r0, d
+ std r0, 0(rp)
+ addi rp, rp, 8
+ bdnz L(tpu)
+
+ subfe r11, r5, r11
+L(ed1): mulld r0, di, r11
+ std r0, 0(rp)
+ blr
+
+ ALIGN(16)
+L(norm):
+ mulld r11, r12, di
+ mulhdu r5, r11, d
+ std r11, 0(rp)
+ beqlr cr1
+
+ ALIGN(16)
+L(tpn): ld r9, 8(up)
+ addi up, up, 8
+ subfe r5, r5, r9
+ mulld r11, di, r5
+ mulhdu r5, r11, d C result not used in last iteration
+ std r11, 8(rp)
+ addi rp, rp, 8
+ bdnz L(tpn)
+
+ blr
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/dive_1.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/dive_1.asm
index 434dde9145c..c2d10bd3056 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/dive_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/dive_1.asm
@@ -30,13 +30,14 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C norm unorm
-C POWER3/PPC630 13-19
-C POWER4/PPC970 16
-C POWER5 16 16
-C POWER6 37 46
-C POWER7 12 12
+C cycles/limb
+C norm unorm
+C POWER3/PPC630 13-19
+C POWER4/PPC970 16
+C POWER5 16 16
+C POWER6 37 46
+C POWER7 12 12
+C POWER8 12 12
C TODO
C * Check if n=1 code is really an improvement. It probably isn't.
@@ -87,6 +88,7 @@ L(7):
sldi r0, r0, 1
mulld r9, d, r9
subf r7, r9, r0 C r7 = 1/d mod 2^64
+
bne cr0, L(norm)
subfic r8, r10, 64 C set carry as side effect
li r5, 0
@@ -123,10 +125,11 @@ L(loop1):
addi up, up, 8
subfe r5, r5, r9
mulld r11, r7, r5
- mulhdu r5, r11, d C result not used
+ mulhdu r5, r11, d C result not used in last iteration
std r11, 8(rp)
addi rp, rp, 8
bdnz L(loop1)
+
blr
EPILOGUE()
ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/divrem_2.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/divrem_2.asm
index 73ec23c94d5..752c3d690b2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/divrem_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/divrem_2.asm
@@ -91,7 +91,7 @@ L(9): subfc r31, r28, r31
cmpld cr7, r29, r30
blt cr7, L(8)
mfcr r0
- rlwinm r0, r0, 30, 1
+ rlwinm r0, r0, 30, 31, 31
subfc r9, r28, r31
addze. r0, r0
nop
@@ -176,7 +176,7 @@ L(18):
blr
L(fix):
mfcr r0
- rlwinm r0, r0, 30, 1
+ rlwinm r0, r0, 30, 31, 31
subfc r9, r28, r31
addze. r0, r0
beq cr0, L(bck)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/gcd_11.asm
index a2073441684..f9792e56a90 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/gcd_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/gcd_11.asm
@@ -1,4 +1,4 @@
-dnl PowerPC-64 mpn_gcd_1.
+dnl PowerPC-64 mpn_gcd_11.
dnl Copyright 2000-2002, 2005, 2009, 2011-2013 Free Software Foundation, Inc.
@@ -32,54 +32,16 @@ include(`../config.m4')
C cycles/bit (approx)
C POWER3/PPC630 ?
-C POWER4/PPC970 8.5
+C POWER4/PPC970 8.5 obsolete
C POWER5 ?
-C POWER6 10.1
-C POWER7 9.4
+C POWER6 ?
+C POWER7 9.4 obsolete
+C POWER8 ?
+C POWER9 ?
C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
-C INPUT PARAMETERS
-define(`up', `r3')
-define(`n', `r4')
-define(`v0', `r5')
-
-ifdef(`BMOD_1_TO_MOD_1_THRESHOLD',,
- `define(`BMOD_1_TO_MOD_1_THRESHOLD',30)')
-
-EXTERN_FUNC(mpn_mod_1)
-EXTERN_FUNC(mpn_modexact_1c_odd)
-
-ASM_START()
-PROLOGUE(mpn_gcd_1,toc)
- mflr r0
- std r30, -16(r1)
- std r31, -8(r1)
- std r0, 16(r1)
- stdu r1, -128(r1)
-
- ld r7, 0(up) C U low limb
- or r0, r5, r7 C x | y
-
- neg r6, r0
- and r6, r6, r0
- cntlzd r31, r6 C common twos
- subfic r31, r31, 63
-
- neg r6, r5
- and r6, r6, r5
- cntlzd r8, r6
- subfic r8, r8, 63
- srd r5, r5, r8
- mr r30, r5 C v0 saved
-
- cmpdi r4, BMOD_1_TO_MOD_1_THRESHOLD
- blt L(bmod)
- CALL( mpn_mod_1)
- b L(reduced)
-L(bmod):
- li r6, 0
- CALL( mpn_modexact_1c_odd)
-L(reduced):
+define(`u0', `r3')
+define(`v0', `r4')
define(`mask', `r0')dnl
define(`a1', `r4')dnl
@@ -88,38 +50,28 @@ define(`d1', `r6')dnl
define(`d2', `r7')dnl
define(`cnt', `r9')dnl
- neg. r6, r3
- and r6, r6, r3
- cntlzd cnt, r6
- subfic cnt, cnt, 63
+ASM_START()
+PROLOGUE(mpn_gcd_11)
li r12, 63
- bne L(mid)
- b L(end)
+ mr r8, v0
+ subf. r10, u0, v0 C r10 = d - a
+ beq L(end)
ALIGN(16)
-L(top):
+L(top): subfc r11, r8, r3 C r11 = a - d
+ and d2, r11, r10
+ subfe mask, mask, mask
+ cntlzd cnt, d2
and a1, r10, mask C d - a
andc a2, r11, mask C a - d
and d1, r3, mask C a
- andc d2, r30, mask C d
+ andc d2, r8, mask C d
or r3, a1, a2 C new a
subf cnt, cnt, r12
- or r30, d1, d2 C new d
-L(mid): srd r3, r3, cnt
- sub. r10, r30, r3 C r10 = d - a
- subc r11, r3, r30 C r11 = a - d
- neg r8, r10
- and r8, r8, r10
- subfe mask, mask, mask
- cntlzd cnt, r8
+ or r8, d1, d2 C new d
+ srd r3, r3, cnt
+ subf. r10, r3, r8 C r10 = d - a
bne L(top)
-L(end): sld r3, r30, r31
-
- addi r1, r1, 128
- ld r0, 16(r1)
- ld r30, -16(r1)
- ld r31, -8(r1)
- mtlr r0
- blr
+L(end): blr
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p4/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p4/gmp-mparam.h
index d5eff84b741..3c40fb964e2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p4/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p4/gmp-mparam.h
@@ -50,6 +50,8 @@ see https://www.gnu.org/licenses/. */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD 35
+#define DIV_1_VS_MUL_1_PERCENT 218
+
#define MUL_TOOM22_THRESHOLD 14
#define MUL_TOOM33_THRESHOLD 53
#define MUL_TOOM44_THRESHOLD 136
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_11.asm
index 47cb40bdc55..f04e896b06a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_11.asm
@@ -1,4 +1,4 @@
-dnl PowerPC-64 mpn_gcd_1.
+dnl PowerPC-64 mpn_gcd_11.
dnl Copyright 2000-2002, 2005, 2009, 2011-2013 Free Software Foundation, Inc.
@@ -35,76 +35,33 @@ C POWER3/PPC630 -
C POWER4/PPC970 -
C POWER5 -
C POWER6 -
-C POWER7 7.6
+C POWER7 7.6 obsolete
+C POWER8 ?
+C POWER9 ?
C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
C INPUT PARAMETERS
-define(`up', `r3')
-define(`n', `r4')
-define(`v0', `r5')
-
-EXTERN_FUNC(mpn_mod_1)
-EXTERN_FUNC(mpn_modexact_1c_odd)
-
-ASM_START()
-PROLOGUE(mpn_gcd_1,toc)
- mflr r0
- std r30, -16(r1)
- std r31, -8(r1)
- std r0, 16(r1)
- stdu r1, -128(r1)
-
- ld r7, 0(up) C U low limb
- or r0, r5, r7 C x | y
-
- neg r6, r0
- and r6, r6, r0
- cntlzd r31, r6 C common twos
- subfic r31, r31, 63
-
- neg r6, r5
- and r6, r6, r5
- cntlzd r8, r6
- subfic r8, r8, 63
- srd r5, r5, r8
- mr r30, r5 C v0 saved
-
- cmpdi r4, BMOD_1_TO_MOD_1_THRESHOLD
- blt L(bmod)
- CALL( mpn_mod_1)
- b L(reduced)
-L(bmod):
- li r6, 0
- CALL( mpn_modexact_1c_odd)
-L(reduced):
+define(`u0', `r3')
+define(`v0', `r4')
define(`cnt', `r9')dnl
- neg. r6, r3
- and r6, r6, r3
- cntlzd cnt, r6
+ASM_START()
+PROLOGUE(mpn_gcd_11)
li r12, 63
- bne L(mid)
- b L(end)
+ b L(odd)
ALIGN(16)
-L(top): isel r30, r3, r30, 29 C y = min(x,y)
- isel r3, r10, r11, 29 C x = |y - x|
-L(mid): subf cnt, cnt, r12 C cnt = 63-cnt
- srd r3, r3, cnt
- subf r10, r3, r30 C r10 = y - x
- subf r11, r30, r3 C r11 = x - y
- cmpld cr7, r30, r3
- and r8, r11, r10 C isolate lsb
+L(top): and r8, r11, r10 C isolate lsb
cntlzd cnt, r8
+ isel v0, u0, v0, 29 C v = min(u,v)
+ isel u0, r10, r11, 29 C u = |u - v|
+ subf cnt, cnt, r12 C cnt = 63-cnt
+ srd u0, u0, cnt
+L(odd): cmpld cr7, v0, u0
+ subf r10, u0, v0 C r10 = v - u
+ subf r11, v0, u0 C r11 = u - v
bne cr7, L(top)
-L(end): sld r3, r30, r31
-
- addi r1, r1, 128
- ld r0, 16(r1)
- ld r30, -16(r1)
- ld r31, -8(r1)
- mtlr r0
- blr
+L(end): blr
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_22.asm
new file mode 100644
index 00000000000..ade30e49cc3
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gcd_22.asm
@@ -0,0 +1,146 @@
+dnl PowerPC-64 mpn_gcd_22 optimised for POWER7 and POWER8.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011-2013, 2019 Free Software Foundation,
+dnl 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/.
+
+include(`../config.m4')
+
+C cycles/bit (approx)
+C POWER3/PPC630 -
+C POWER4/PPC970 -
+C POWER5 -
+C POWER6 -
+C POWER7 12.3
+C POWER8 13.4
+C POWER9 10.6
+
+C We define SLOW if this target uses a slow struct return mechanism, with
+C r3 as an implicit parameter for the struct pointer.
+undefine(`SLOW')dnl
+ifdef(`AIX',`define(`SLOW',`due to AIX')',`
+ ifdef(`DARWIN',,`
+ ifdef(`ELFv2_ABI',,`define(`SLOW',`due to ELFv1')')dnl
+ ')
+')
+
+ifdef(`SLOW',`
+define(`IFSLOW', `$1')
+define(`u1', `r4')
+define(`u0', `r5')
+define(`v1', `r6')
+define(`v0', `r7')
+',`
+define(`IFSLOW', `')
+define(`u1', `r3')
+define(`u0', `r4')
+define(`v1', `r5')
+define(`v0', `r6')
+')
+
+define(`tmp', `r0')
+define(`t0', `r8')
+define(`t1', `r9')
+define(`s0', `r10')
+define(`s1', `r11')
+define(`cnt', `r12')
+
+ASM_START()
+PROLOGUE(mpn_gcd_22)
+L(top): subfc. t0, v0, u0 C 0 12
+ beq cr0, L(lowz)
+ subfe t1, v1, u1 C 2 14
+ subfe. tmp, tmp, tmp C 4 set cr0 from the carry bit
+ subfc s0, u0, v0 C 0
+ subfe s1, u1, v1 C 2
+
+L(bck): and tmp, s0, t0 C 2
+ cntlzd cnt, tmp C 4
+ addi tmp, cnt, 1 C 6
+ subfic cnt, cnt, 63 C 6
+
+ isel v0, v0, u0, 2 C 6 use condition set by subfe
+ isel v1, v1, u1, 2 C 6
+ isel u0, t0, s0, 2 C 6
+ isel u1, t1, s1, 2 C 6
+
+ srd u0, u0, cnt C 8
+ sld tmp, u1, tmp C 8
+ srd u1, u1, cnt C 8
+ or u0, u0, tmp C 10
+
+ or. r0, u1, v1 C 10
+ bne L(top)
+
+
+ li r0, 63
+ b L(odd)
+ ALIGN(16)
+L(top1):isel v0, u0, v0, 29 C v = min(u,v)
+ isel u0, r10, r11, 29 C u = |u - v|
+ subf cnt, cnt, r0 C cnt = 63-cnt
+ srd u0, u0, cnt
+L(odd): subf r10, u0, v0 C r10 = v - u
+ subf r11, v0, u0 C r11 = u - v
+ cmpld cr7, v0, u0
+ and r8, r11, r10 C isolate lsb
+ cntlzd cnt, r8
+ bne cr7, L(top1)
+
+ifdef(`SLOW',`
+ std v0, 0(r3)
+ std r10, 8(r3) C zero
+',`
+ mr r3, v0
+ li r4, 0
+')
+ blr
+
+
+L(lowz):C We come here when v0 - u0 = 0
+ C 1. If v1 - u1 = 0, then gcd is u = v.
+ C 2. Else compute gcd_21({v1,v0}, |u1-v1|)
+ subfc. t0, v1, u1 C 2 8
+ beq L(end)
+ li t1, 0
+ subfe. tmp, tmp, tmp C 4 set cr0 from the carry bit
+ subf s0, u1, v1 C 2
+ li s1, 0
+ b L(bck)
+
+L(end):
+ifdef(`SLOW',`
+ std v0, 0(r3)
+ std v1, 8(r3)
+ blr
+',`
+ mr r3, v0
+ mr r4, v1
+ blr
+')
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gmp-mparam.h
index 783f3c6bf75..5fa62cfb16d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p7/gmp-mparam.h
@@ -1,7 +1,6 @@
/* POWER7 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2003, 2009-2011, 2013-2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,214 +31,144 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 3425 MHz POWER8/SMT4 (gcc112.fsffrance.org) */
-/* FFT tuning limit = 100 M */
-/* Generated by tuneup.c, 2015-10-09, gcc 4.9 */
+/* 3720 MHz POWER7/SMT4 */
+/* FFT tuning limit = 0.5 M */
+/* Generated by tuneup.c, 2019-10-02, gcc 4.8 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 13
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 26
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 16
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 13
#define USE_PREINV_DIVREM_1 0
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 2
+#define DIV_QR_1N_PI1_METHOD 1 /* 3.47% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 1
#define DIV_QR_1_UNNORM_THRESHOLD 1
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 35
+#define BMOD_1_TO_MOD_1_THRESHOLD 27
+
+#define DIV_1_VS_MUL_1_PERCENT 341
#define MUL_TOOM22_THRESHOLD 22
-#define MUL_TOOM33_THRESHOLD 72
-#define MUL_TOOM44_THRESHOLD 202
-#define MUL_TOOM6H_THRESHOLD 278
+#define MUL_TOOM33_THRESHOLD 71
+#define MUL_TOOM44_THRESHOLD 196
+#define MUL_TOOM6H_THRESHOLD 298
#define MUL_TOOM8H_THRESHOLD 406
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 69
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 134
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 128
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 137
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 106
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 140
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 132
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 139
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 120
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 32
-#define SQR_TOOM3_THRESHOLD 96
-#define SQR_TOOM4_THRESHOLD 178
-#define SQR_TOOM6_THRESHOLD 270
-#define SQR_TOOM8_THRESHOLD 357
+#define SQR_TOOM3_THRESHOLD 105
+#define SQR_TOOM4_THRESHOLD 190
+#define SQR_TOOM6_THRESHOLD 318
+#define SQR_TOOM8_THRESHOLD 547
-#define MULMID_TOOM42_THRESHOLD 42
+#define MULMID_TOOM42_THRESHOLD 56
-#define MULMOD_BNM1_THRESHOLD 16
-#define SQRMOD_BNM1_THRESHOLD 19
+#define MULMOD_BNM1_THRESHOLD 18
+#define SQRMOD_BNM1_THRESHOLD 20
-#define MUL_FFT_MODF_THRESHOLD 404 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 436 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 404, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 21, 7}, { 12, 6}, { 25, 7}, { 21, 8}, \
+ { { 436, 5}, { 21, 6}, { 21, 7}, { 11, 6}, \
+ { 23, 7}, { 12, 6}, { 25, 7}, { 21, 8}, \
{ 11, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
- { 15, 7}, { 32, 8}, { 17, 7}, { 35, 8}, \
+ { 15, 7}, { 33, 8}, { 17, 7}, { 35, 8}, \
{ 19, 7}, { 39, 8}, { 21, 9}, { 11, 8}, \
- { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
- { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
+ { 29, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 49, 9}, { 27,10}, \
+ { 15, 9}, { 31, 8}, { 63, 9}, { 43,10}, \
+ { 23, 9}, { 55,11}, { 15,10}, { 31, 9}, \
+ { 67,10}, { 39, 9}, { 79,10}, { 47, 9}, \
+ { 95,10}, { 55,11}, { 31,10}, { 63, 9}, \
+ { 127,10}, { 79,11}, { 47,10}, { 103,12}, \
{ 31,11}, { 63,10}, { 135,11}, { 79,10}, \
- { 159,11}, { 95,10}, { 191, 9}, { 383,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271,11}, { 143,10}, { 287, 9}, { 575,11}, \
+ { 159,11}, { 95,10}, { 191, 9}, { 383,11}, \
+ { 111,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,11}, { 143,10}, { 287, 9}, { 575,11}, \
{ 159,10}, { 319,12}, { 95,11}, { 191,10}, \
- { 383,13}, { 63,12}, { 127,11}, { 255, 9}, \
- { 1023,10}, { 543, 9}, { 1087,11}, { 287,10}, \
- { 575, 9}, { 1151,11}, { 303,12}, { 159,11}, \
- { 319,10}, { 639,11}, { 335,10}, { 671,11}, \
- { 351,10}, { 703, 9}, { 1407,11}, { 383,10}, \
- { 767,11}, { 415,10}, { 831,12}, { 223,11}, \
- { 447,10}, { 895,13}, { 127,12}, { 255,11}, \
- { 511,10}, { 1023,11}, { 543,10}, { 1087,12}, \
- { 287,11}, { 575,10}, { 1151,11}, { 607,10}, \
- { 1215,12}, { 319,11}, { 639,10}, { 1279,11}, \
- { 671,12}, { 351,11}, { 703,10}, { 1407,13}, \
- { 191,12}, { 383,11}, { 767,12}, { 415,11}, \
- { 831,10}, { 1663,12}, { 447,11}, { 895,14}, \
- { 127,13}, { 255,12}, { 511,11}, { 1023,12}, \
- { 543,11}, { 1087,10}, { 2175,12}, { 575,11}, \
- { 1151,12}, { 607,11}, { 1215,13}, { 319,12}, \
- { 639,11}, { 1279,12}, { 671,11}, { 1343,12}, \
- { 703,13}, { 383,12}, { 767,11}, { 1535,12}, \
- { 831,11}, { 1663,13}, { 447,12}, { 959,11}, \
- { 1919,14}, { 255,13}, { 511,12}, { 1087,11}, \
- { 2175,13}, { 575,12}, { 1215,11}, { 2431,13}, \
- { 639,12}, { 1343,13}, { 703,12}, { 1407,14}, \
- { 383,13}, { 767,12}, { 1535,13}, { 831,12}, \
- { 1663,13}, { 959,12}, { 1919,15}, { 255,14}, \
- { 511,13}, { 1023,11}, { 4223,13}, { 1087,12}, \
- { 2175,13}, { 1215,12}, { 2431,14}, { 639,13}, \
- { 1343,12}, { 2687,13}, { 1407,12}, { 2815,14}, \
- { 767,13}, { 1535,12}, { 3071,13}, { 1599,12}, \
- { 3199,13}, { 1663,14}, { 895,13}, { 1919,15}, \
- { 511,14}, { 1023,13}, { 2047,12}, { 4095,13}, \
- { 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
- { 1279,13}, { 2687,14}, { 1407,13}, { 2815,15}, \
- { 767,14}, { 1535,13}, { 3199,14}, { 1663,13}, \
- { 3327,12}, { 6655,13}, { 3455,12}, { 6911,14}, \
- { 1919,13}, { 3839,16}, { 511,15}, { 1023,14}, \
- { 2047,13}, { 4095,14}, { 2175,13}, { 4351,12}, \
- { 8703,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
- { 2943,13}, { 5887,12}, { 11775,15}, { 1535,14}, \
- { 3327,13}, { 6655,14}, { 3455,13}, { 6911,15}, \
- { 1791,14}, { 3583,13}, { 7167,14}, { 3839,16}, \
- { 1023,15}, { 2047,14}, { 4351,13}, { 8703,14}, \
- { 4479,15}, { 2303,14}, { 4863,13}, { 9983,15}, \
- { 2559,14}, { 5247,15}, { 2815,14}, { 5631,13}, \
- { 11263,14}, { 5887,13}, { 11775,16}, { 65536,17}, \
+ { 383, 9}, { 767,11}, { 207,10}, { 415,13}, \
+ { 8192,14}, { 16384,15}, { 32768,16}, { 65536,17}, \
{ 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
{2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 247
-#define MUL_FFT_THRESHOLD 4544
+#define MUL_FFT_TABLE3_SIZE 83
+#define MUL_FFT_THRESHOLD 4736
-#define SQR_FFT_MODF_THRESHOLD 344 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 368 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 344, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 21, 7}, { 11, 6}, { 23, 7}, { 21, 8}, \
- { 11, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
- { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
- { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
- { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { { 368, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 21, 7}, { 11, 6}, { 23, 7}, { 12, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 25, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 32, 8}, \
+ { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { 21, 9}, { 11, 8}, { 29, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 31, 8}, \
+ { 63, 9}, { 39,10}, { 23, 9}, { 51,11}, \
{ 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 79,10}, { 55,11}, { 31,10}, { 79,11}, \
- { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255,11}, { 79, 9}, { 319,11}, \
- { 95,10}, { 191, 9}, { 383,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543,11}, { 143,10}, { 287, 9}, { 575,10}, \
- { 303, 9}, { 607,10}, { 319,12}, { 95,11}, \
- { 191,10}, { 383,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
- { 287,10}, { 575,11}, { 303,10}, { 607,11}, \
- { 319,10}, { 639,11}, { 351,10}, { 703,12}, \
- { 191,11}, { 383,10}, { 767,11}, { 415,12}, \
- { 223,11}, { 447,10}, { 895,13}, { 127,12}, \
- { 255,11}, { 511,10}, { 1023,11}, { 543,12}, \
- { 287,11}, { 575,10}, { 1151,11}, { 607,12}, \
- { 319,11}, { 639,10}, { 1279,12}, { 351,11}, \
- { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
- { 415,11}, { 831,12}, { 447,11}, { 895,14}, \
- { 127,13}, { 255,12}, { 511,11}, { 1023,12}, \
- { 575,11}, { 1151,12}, { 607,13}, { 319,12}, \
- { 639,11}, { 1279,12}, { 671,11}, { 1343,12}, \
- { 703,11}, { 1407,13}, { 383,12}, { 767,11}, \
- { 1535,12}, { 831,11}, { 1663,13}, { 447,12}, \
- { 959,11}, { 1919,14}, { 255,13}, { 511,12}, \
- { 1087,11}, { 2175,13}, { 575,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1343,13}, { 703,12}, \
- { 1407,14}, { 383,13}, { 767,12}, { 1535,13}, \
- { 831,12}, { 1663,13}, { 959,12}, { 1919,15}, \
- { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1215,12}, { 2431,14}, { 639,13}, { 1343,12}, \
- { 2687,13}, { 1407,12}, { 2815,14}, { 767,13}, \
- { 1663,14}, { 895,13}, { 1919,12}, { 3839,15}, \
- { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
- { 2431,12}, { 4863,14}, { 1407,13}, { 2815,15}, \
- { 767,14}, { 1535,13}, { 3071,14}, { 1663,13}, \
- { 3455,14}, { 1791,13}, { 3583,14}, { 1919,13}, \
- { 3839,16}, { 511,15}, { 1023,14}, { 2431,13}, \
- { 4863,15}, { 1279,14}, { 2815,13}, { 5631,14}, \
- { 2943,13}, { 5887,12}, { 11775,15}, { 1535,14}, \
- { 3199,15}, { 1791,14}, { 3583,13}, { 7679,12}, \
- { 15359,16}, { 1023,15}, { 2047,14}, { 4223,15}, \
- { 2303,14}, { 4863,13}, { 9983,15}, { 2815,14}, \
- { 5631,13}, { 11263,14}, { 5887,13}, { 11775,16}, \
+ { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
+ { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
+ { 31,11}, { 63,10}, { 135,11}, { 79,10}, \
+ { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
+ { 383,11}, { 111,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
+ { 575,10}, { 303,11}, { 159,10}, { 319, 9}, \
+ { 639,12}, { 95,11}, { 191,10}, { 383, 9}, \
+ { 767,13}, { 8192,14}, { 16384,15}, { 32768,16}, \
{ 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
{1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 212
-#define SQR_FFT_THRESHOLD 2880
+#define SQR_FFT_TABLE3_SIZE 84
+#define SQR_FFT_THRESHOLD 3264
#define MULLO_BASECASE_THRESHOLD 3
-#define MULLO_DC_THRESHOLD 23
-#define MULLO_MUL_N_THRESHOLD 8907
+#define MULLO_DC_THRESHOLD 35
+#define MULLO_MUL_N_THRESHOLD 9449
#define SQRLO_BASECASE_THRESHOLD 3
-#define SQRLO_DC_THRESHOLD 114
-#define SQRLO_SQR_THRESHOLD 5742
+#define SQRLO_DC_THRESHOLD 119
+#define SQRLO_SQR_THRESHOLD 6440
-#define DC_DIV_QR_THRESHOLD 32
-#define DC_DIVAPPR_Q_THRESHOLD 148
-#define DC_BDIV_QR_THRESHOLD 47
-#define DC_BDIV_Q_THRESHOLD 108
+#define DC_DIV_QR_THRESHOLD 33
+#define DC_DIVAPPR_Q_THRESHOLD 124
+#define DC_BDIV_QR_THRESHOLD 62
+#define DC_BDIV_Q_THRESHOLD 144
-#define INV_MULMOD_BNM1_THRESHOLD 58
-#define INV_NEWTON_THRESHOLD 147
-#define INV_APPR_THRESHOLD 132
+#define INV_MULMOD_BNM1_THRESHOLD 67
+#define INV_NEWTON_THRESHOLD 123
+#define INV_APPR_THRESHOLD 123
-#define BINV_NEWTON_THRESHOLD 278
-#define REDC_1_TO_REDC_2_THRESHOLD 59
-#define REDC_2_TO_REDC_N_THRESHOLD 0 /* always */
+#define BINV_NEWTON_THRESHOLD 284
+#define REDC_1_TO_REDC_2_THRESHOLD 18
+#define REDC_2_TO_REDC_N_THRESHOLD 109
-#define MU_DIV_QR_THRESHOLD 1142
-#define MU_DIVAPPR_Q_THRESHOLD 1142
+#define MU_DIV_QR_THRESHOLD 1387
+#define MU_DIVAPPR_Q_THRESHOLD 1334
#define MUPI_DIV_QR_THRESHOLD 50
-#define MU_BDIV_QR_THRESHOLD 1120
-#define MU_BDIV_Q_THRESHOLD 1470
-
-#define POWM_SEC_TABLE 3,25,194,712,2177
-
-#define GET_STR_DC_THRESHOLD 8
-#define GET_STR_PRECOMPUTE_THRESHOLD 17
-#define SET_STR_DC_THRESHOLD 795
-#define SET_STR_PRECOMPUTE_THRESHOLD 2655
-
-#define FAC_DSC_THRESHOLD 378
-#define FAC_ODD_THRESHOLD 24
-
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 90
-#define HGCD_APPR_THRESHOLD 136
-#define HGCD_REDUCE_THRESHOLD 2479
-#define GCD_DC_THRESHOLD 393
-#define GCDEXT_DC_THRESHOLD 408
-#define JACOBI_BASE_METHOD 4
+#define MU_BDIV_QR_THRESHOLD 1308
+#define MU_BDIV_Q_THRESHOLD 1499
+
+#define POWM_SEC_TABLE 1,23,121,579,642
+
+#define GET_STR_DC_THRESHOLD 11
+#define GET_STR_PRECOMPUTE_THRESHOLD 18
+#define SET_STR_DC_THRESHOLD 1562
+#define SET_STR_PRECOMPUTE_THRESHOLD 3100
+
+#define FAC_DSC_THRESHOLD 774
+#define FAC_ODD_THRESHOLD 25
+
+#define MATRIX22_STRASSEN_THRESHOLD 18
+#define HGCD2_DIV1_METHOD 5 /* 3.27% faster than 3 */
+#define HGCD_THRESHOLD 118
+#define HGCD_APPR_THRESHOLD 150
+#define HGCD_REDUCE_THRESHOLD 3014
+#define GCD_DC_THRESHOLD 386
+#define GCDEXT_DC_THRESHOLD 365
+#define JACOBI_BASE_METHOD 4 /* 27.64% faster than 1 */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p8/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p8/gmp-mparam.h
new file mode 100644
index 00000000000..ed4db28a924
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p8/gmp-mparam.h
@@ -0,0 +1,170 @@
+/* POWER8 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2017 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 4150 MHz POWER8/SMT4 */
+/* FFT tuning limit = 0.5 M */
+/* Generated by tuneup.c, 2019-09-24, gcc 7.2 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 11
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 22
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define USE_PREINV_DIVREM_1 0
+#define DIV_QR_1N_PI1_METHOD 2 /* 16.97% faster than 1 */
+#define DIV_QR_1_NORM_THRESHOLD 2
+#define DIV_QR_1_UNNORM_THRESHOLD 1
+#define DIV_QR_2_PI2_THRESHOLD 9
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 34
+
+#define DIV_1_VS_MUL_1_PERCENT 276
+
+#define MUL_TOOM22_THRESHOLD 18
+#define MUL_TOOM33_THRESHOLD 73
+#define MUL_TOOM44_THRESHOLD 195
+#define MUL_TOOM6H_THRESHOLD 278
+#define MUL_TOOM8H_THRESHOLD 406
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 131
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 121
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 138
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 106
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 32
+#define SQR_TOOM3_THRESHOLD 97
+#define SQR_TOOM4_THRESHOLD 178
+#define SQR_TOOM6_THRESHOLD 303
+#define SQR_TOOM8_THRESHOLD 454
+
+#define MULMID_TOOM42_THRESHOLD 42
+
+#define MULMOD_BNM1_THRESHOLD 15
+#define SQRMOD_BNM1_THRESHOLD 19
+
+#define MUL_FFT_MODF_THRESHOLD 404 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 404, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 21, 7}, { 11, 6}, { 23, 7}, { 12, 6}, \
+ { 25, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
+ { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
+ { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 63,10}, { 39, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 63, 9}, { 131,10}, \
+ { 79,11}, { 47,10}, { 95,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255,10}, { 135,11}, \
+ { 79,10}, { 159,11}, { 95, 8}, { 767, 7}, \
+ { 1599,11}, { 111,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
+ { 575,11}, { 159,12}, { 95,11}, { 191,10}, \
+ { 383,13}, { 8192,14}, { 16384,15}, { 32768,16}, \
+ { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+ {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 80
+#define MUL_FFT_THRESHOLD 4736
+
+#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 340, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 21, 7}, { 11, 6}, { 23, 7}, { 21, 8}, \
+ { 11, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
+ { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 47,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 47,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 127, 9}, { 255,11}, { 79, 9}, { 319,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271,11}, { 143,10}, \
+ { 287, 9}, { 575,10}, { 303, 9}, { 607,10}, \
+ { 319,12}, { 95,11}, { 191,10}, { 383,13}, \
+ { 8192,14}, { 16384,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 71
+#define SQR_FFT_THRESHOLD 3264
+
+#define MULLO_BASECASE_THRESHOLD 3
+#define MULLO_DC_THRESHOLD 33
+#define MULLO_MUL_N_THRESHOLD 9174
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 114
+#define SQRLO_SQR_THRESHOLD 6461
+
+#define DC_DIV_QR_THRESHOLD 38
+#define DC_DIVAPPR_Q_THRESHOLD 158
+#define DC_BDIV_QR_THRESHOLD 48
+#define DC_BDIV_Q_THRESHOLD 112
+
+#define INV_MULMOD_BNM1_THRESHOLD 74
+#define INV_NEWTON_THRESHOLD 132
+#define INV_APPR_THRESHOLD 131
+
+#define BINV_NEWTON_THRESHOLD 278
+#define REDC_1_TO_REDC_2_THRESHOLD 56
+#define REDC_2_TO_REDC_N_THRESHOLD 0 /* always */
+
+#define MU_DIV_QR_THRESHOLD 1142
+#define MU_DIVAPPR_Q_THRESHOLD 1142
+#define MUPI_DIV_QR_THRESHOLD 46
+#define MU_BDIV_QR_THRESHOLD 1142
+#define MU_BDIV_Q_THRESHOLD 1470
+
+#define POWM_SEC_TABLE 3,19,117,672,1867
+
+#define GET_STR_DC_THRESHOLD 11
+#define GET_STR_PRECOMPUTE_THRESHOLD 18
+#define SET_STR_DC_THRESHOLD 608
+#define SET_STR_PRECOMPUTE_THRESHOLD 2405
+
+#define FAC_DSC_THRESHOLD 164
+#define FAC_ODD_THRESHOLD 0 /* always */
+
+#define MATRIX22_STRASSEN_THRESHOLD 14
+#define HGCD2_DIV1_METHOD 1 /* 6.88% faster than 3 */
+#define HGCD_THRESHOLD 114
+#define HGCD_APPR_THRESHOLD 118
+#define HGCD_REDUCE_THRESHOLD 2205
+#define GCD_DC_THRESHOLD 440
+#define GCDEXT_DC_THRESHOLD 345
+#define JACOBI_BASE_METHOD 1 /* 0.74% faster than 4 */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p8/invert_limb.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p8/invert_limb.asm
index 9c2b79859de..53ea0e09a7d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p8/invert_limb.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p8/invert_limb.asm
@@ -1,6 +1,6 @@
dnl PowerPC-64 mpn_invert_limb -- Invert a normalized limb.
-dnl Copyright 2015 Free Software Foundation, Inc.
+dnl Copyright 2015, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -45,7 +45,7 @@ ASM_START()
PROLOGUE(mpn_invert_limb)
sldi. r4, r3, 1
neg r5, r3
- divdeu r3, r5, r3
+ divdeu( r3, r5, r3)
beq- L(1)
blr
L(1): li r3, -1
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/add_n_sub_n.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/add_n_sub_n.asm
new file mode 100644
index 00000000000..2426a00e48f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/add_n_sub_n.asm
@@ -0,0 +1,112 @@
+dnl PowerPC-64 mpn_add_n_sub_n optimised for POWER9.
+
+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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C POWER3/PPC630 -
+C POWER4/PPC970 -
+C POWER5 -
+C POWER6 -
+C POWER7 -
+C POWER8 -
+C POWER9 2.25
+
+
+C INPUT PARAMETERS
+define(`arp', `r3')
+define(`srp', `r4')
+define(`up', `r5')
+define(`vp', `r6')
+define(`n', `r7')
+
+ASM_START()
+PROLOGUE(mpn_add_n_sub_n)
+ cmpdi cr7, n, 2
+ subfo r0, r0, r0 C clear OV
+ rldicl. r9, n, 0, 63 C n & 1
+ beq cr0, L(bx0)
+
+L(bx1): ld r10, 0(up)
+ ld r11, 0(vp)
+ ble cr7, L(1)
+ srdi r7, r7, 1
+ mtctr r7
+ ld r8, 8(up)
+ ld r9, 8(vp)
+ addex( r0, r10, r11, 0)
+ subfc r12, r11, r10
+ addi up, up, -8
+ addi vp, vp, -8
+ b L(lo1)
+
+L(bx0): ld r8, 0(up)
+ ld r9, 0(vp)
+ ld r10, 8(up)
+ ld r11, 8(vp)
+ addex( r0, r8, r9, 0)
+ subfc r12, r9, r8
+ addi arp, arp, 8
+ addi srp, srp, 8
+ ble cr7, L(end)
+ addi r7, r7, -1
+ srdi r7, r7, 1
+ mtctr r7
+
+L(top): ld r8, 16(up)
+ ld r9, 16(vp)
+ std r0, -8(arp)
+ std r12, -8(srp)
+ addex( r0, r10, r11, 0)
+ subfe r12, r11, r10
+L(lo1): ld r10, 24(up)
+ ld r11, 24(vp)
+ std r0, 0(arp)
+ std r12, 0(srp)
+ addex( r0, r8, r9, 0)
+ subfe r12, r9, r8
+ addi up, up, 16
+ addi vp, vp, 16
+ addi arp, arp, 16
+ addi srp, srp, 16
+ bdnz L(top)
+
+L(end): std r0, -8(arp)
+ std r12, -8(srp)
+L(1): addex( r0, r10, r11, 0)
+ subfe r12, r11, r10
+ std r0, 0(arp)
+ std r12, 0(srp)
+ subfe r3, r3, r3
+ addex( r3, r3, r3, 0)
+ rldicl r3, r3, 1, 62
+ blr
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_1.asm
new file mode 100644
index 00000000000..8f496067467
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_1.asm
@@ -0,0 +1,130 @@
+dnl Power9 mpn_addmul_1.
+
+dnl Copyright 2017, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C POWER3/PPC630 -
+C POWER4/PPC970 -
+C POWER5 -
+C POWER6 -
+C POWER7 -
+C POWER8 -
+C POWER9 2.5
+
+C TODO
+C * Schedule for Power9 pipeline.
+C * Unroll 4x if that proves beneficial.
+C * This is marginally faster (but much smaller) than ../aorsmul_1.asm.
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`n', `r5')
+define(`v0', `r6')
+
+ASM_START()
+PROLOGUE(mpn_addmul_1)
+ cmpdi cr6, n, 2
+ addi r0, n, -1 C FIXME: postpone
+ srdi r0, r0, 1 C FIXME: postpone
+ mtctr r0 C FIXME: postpone
+ rldicl. r0, n, 0,63 C r0 = n & 3, set cr0
+ bne cr0, L(b1)
+
+L(b0): ld r10, 0(rp)
+ ld r12, 0(up)
+ ld r11, 8(rp)
+ ld r0, 8(up)
+ maddld( r9, r12, v0, r10)
+ maddhdu(r7, r12, v0, r10)
+ ble cr6, L(2)
+ ld r10, 16(rp)
+ ld r12, 16(up)
+ maddld( r8, r0, v0, r11)
+ maddhdu(r5, r0, v0, r11)
+ addic up, up, 16
+ addi rp, rp, -8
+ b L(mid)
+
+L(b1): ld r11, 0(rp)
+ ld r0, 0(up)
+ ble cr6, L(1)
+ ld r10, 8(rp)
+ ld r12, 8(up)
+ maddld( r8, r0, v0, r11)
+ maddhdu(r5, r0, v0, r11)
+ ld r11, 16(rp)
+ ld r0, 16(up)
+ maddld( r9, r12, v0, r10)
+ maddhdu(r7, r12, v0, r10)
+ addic up, up, 24
+ bdz L(end)
+
+ ALIGN(16)
+L(top): ld r10, 24(rp)
+ ld r12, 0(up)
+ std r8, 0(rp)
+ adde r9, r5, r9
+ maddld( r8, r0, v0, r11) C W:0,2,4
+ maddhdu(r5, r0, v0, r11) C W:1,3,5
+L(mid): ld r11, 32(rp)
+ ld r0, 8(up)
+ std r9, 8(rp)
+ adde r8, r7, r8
+ maddld( r9, r12, v0, r10) C W:1,3,5
+ maddhdu(r7, r12, v0, r10) C W:2,4,6
+ addi rp, rp, 16
+ addi up, up, 16
+ bdnz L(top)
+
+L(end): std r8, 0(rp)
+ maddld( r8, r0, v0, r11)
+ adde r9, r5, r9
+ maddhdu(r5, r0, v0, r11)
+ std r9, 8(rp)
+ adde r8, r7, r8
+ std r8, 16(rp)
+ addze r3, r5
+ blr
+
+L(2): maddld( r8, r0, v0, r11)
+ maddhdu(r5, r0, v0, r11)
+ std r9, 0(rp)
+ addc r8, r7, r8
+ std r8, 8(rp)
+ addze r3, r5
+ blr
+
+L(1): maddld( r8, r0, v0, r11)
+ std r8, 0(rp)
+ maddhdu(r3, r0, v0, r11)
+ blr
+EPILOGUE()
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
new file mode 100644
index 00000000000..1dd59ea5b63
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/addmul_2.asm
@@ -0,0 +1,182 @@
+dnl Power9 mpn_addmul_2.
+
+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 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C power9: 1.62
+
+C STATUS
+C * Not written with any power9 pipeline understanding.
+C * The 4x unrolling was not motivated by any timing tests.
+C * No local scheduling for performance tweaking has been done.
+C * Decrease load scheduling!
+
+define(`rp', `r3')
+define(`up', `r4')
+define(`n', `r5') C Note: Reused as scratch
+define(`vp', `r6') C Note: Reused for v1
+
+define(`v0', `r7')
+define(`v1', `r6')
+
+
+ASM_START()
+PROLOGUE(mpn_addmul_2)
+ std r26, -48(r1)
+ std r27, -40(r1)
+ std r28, -32(r1)
+ std r29, -24(r1)
+ std r30, -16(r1)
+ std r31, -8(r1)
+
+ subfic r0, r1, 0 C clear CA
+ subfo r0, r0, r0 C clear OV and r0
+
+ cmpdi cr7, n, 4
+
+ ld v0, 0(vp)
+ ld v1, 8(vp)
+
+ srdi r10, n, 2
+ mtctr r10
+
+ rldicl. r9, n, 0, 63
+ bne cr0, L(bx1)
+
+L(bx0): rldicl. r9, n, 63, 63
+
+ ld r28, 0(rp)
+ ld r8, 0(up)
+ ld r11, 8(rp)
+ ld r9, 8(up)
+ maddld( r26, r8, v0, r28)
+ maddhdu(r31, r8, v0, r28)
+ blt cr7, L(2)
+ ld r28, 16(rp)
+ mulld r5, r8, v1
+ mulhdu r10, r8, v1
+ bne cr0, L(b10)
+
+L(b00): addi up, up, -8
+ addi rp, rp, -24
+ b L(lo0)
+
+L(b10): addi up, up, 8
+ addi rp, rp, -8
+ b L(lo2)
+
+L(2): addi rp, rp, -8
+ mulld r5, r8, v1
+ mulhdu r10, r8, v1
+ b L(cj2)
+
+L(bx1): rldicl. r9, n, 63, 63
+
+ ld r29, 0(rp)
+ ld r9, 0(up)
+ ld r10, 8(rp)
+ ld r8, 8(up)
+ maddld( r27, r9, v0, r29)
+ maddhdu(r30, r9, v0, r29)
+ ld r29, 16(rp)
+ mulld r12, r9, v1
+ mulhdu r11, r9, v1
+ bne cr0, L(b11)
+
+L(b01): addi rp, rp, -16
+ b L(lo1)
+L(b11): addi up, up, 16
+ blt cr7, L(end)
+
+L(top): ld r9, 0(up)
+ maddld( r26, r8, v0, r10) C 0 4 -> adde
+ maddhdu(r31, r8, v0, r10) C 1 5
+ adde r0, r27, r0 C 7 11
+ ld r28, 24(rp)
+ std r0, 0(rp)
+ maddld( r5, r8, v1, r29) C 1 5 -> addex
+ maddhdu(r10, r8, v1, r29) C 2 6
+ addex( r0, r12, r30, 0) C 8 12
+L(lo2): ld r8, 8(up)
+ maddld( r27, r9, v0, r11) C 1 5 -> adde
+ maddhdu(r30, r9, v0, r11) C 2 6
+ adde r0, r26, r0 C 8 12
+ ld r29, 32(rp)
+ std r0, 8(rp)
+ maddld( r12, r9, v1, r28) C 2 6 -> addex
+ maddhdu(r11, r9, v1, r28) C 3 7
+ addex( r0, r5, r31, 0) C 5 9 13
+L(lo1): ld r9, 16(up)
+ maddld( r26, r8, v0, r10) C 2 6 -> adde
+ maddhdu(r31, r8, v0, r10) C 3 7
+ adde r0, r27, r0 C 5 9 13
+ ld r28, 40(rp)
+ std r0, 16(rp)
+ maddld( r5, r8, v1, r29) C 3 7 -> addex
+ maddhdu(r10, r8, v1, r29) C 4 8
+ addex( r0, r12, r30, 0) C 6 10
+L(lo0): ld r8, 24(up)
+ maddld( r27, r9, v0, r11) C 3 7 -> adde
+ maddhdu(r30, r9, v0, r11) C 4 8
+ adde r0, r26, r0 C 6 10
+ ld r29, 48(rp)
+ std r0, 24(rp)
+ maddld( r12, r9, v1, r28) C 4 8 -> addex
+ maddhdu(r11, r9, v1, r28) C 5 9
+ addex( r0, r5, r31, 0) C 7 11
+ addi up, up, 32
+ addi rp, rp, 32
+ bdnz L(top)
+
+L(end): ld r9, 0(up)
+ maddld( r26, r8, v0, r10) C 0 4
+ maddhdu(r31, r8, v0, r10) C 1 5
+ adde r0, r27, r0 C 7 11
+ std r0, 0(rp) C -4
+ maddld( r5, r8, v1, r29) C 1 5
+ maddhdu(r10, r8, v1, r29) C 2 6
+ addex( r0, r12, r30, 0) C 8 12
+L(cj2): maddld( r27, r9, v0, r11) C 1 5 -2
+ maddhdu(r30, r9, v0, r11) C 2 6 -1
+ adde r0, r26, r0 C 8 12 -3
+ std r0, 8(rp) C -3
+ mulld r12, r9, v1 C 2 6 -1
+ mulhdu r11, r9, v1 C 3 7 0 = return limb
+ addex( r0, r5, r31, 0) C 5 9 13
+ adde r0, r27, r0 C 5 9 13 -2
+ std r0, 16(rp) C -2
+ addex( r0, r12, r30, 0) C 6 10 -1
+ adde r0, r0, r10 C -1
+ std r0, 24(rp) C -1
+ li r4, 0
+ addze r3, r11
+ addex( r3, r3, r4, 0)
+
+L(ret): ld r26, -48(r1)
+ ld r27, -40(r1)
+ ld r28, -32(r1)
+ ld r29, -24(r1)
+ ld r30, -16(r1)
+ ld r31, -8(r1)
+ blr
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/aorsmul_1.asm
new file mode 100644
index 00000000000..e4ca3a808f0
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/aorsmul_1.asm
@@ -0,0 +1,179 @@
+dnl POWER9 mpn_addmul_1 and mpn_submul_1.
+
+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 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/.
+
+include(`../config.m4')
+
+C mpn_addmul_1 mpn_submul_1
+C cycles/limb cycles/limb
+C POWER3/PPC630 - -
+C POWER4/PPC970 - -
+C POWER5 - -
+C POWER6 - -
+C POWER7 - -
+C POWER8 - -
+C POWER9 2.63 2.63
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`n', `r5')
+define(`v0', `r6')
+
+
+ifdef(`OPERATION_addmul_1',`
+ define(`ADDSUBC', adde)
+ define(`ADDSUB', addc)
+ define(`func', mpn_addmul_1)
+ define(`AM', `$1')
+ define(`SM', `')
+')
+ifdef(`OPERATION_submul_1',`
+ define(`ADDSUBC', subfe)
+ define(`ADDSUB', subfc)
+ define(`func', mpn_submul_1)
+ define(`AM', `')
+ define(`SM', `$1')
+')
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+
+ASM_START()
+PROLOGUE(func)
+ cmpdi cr7, n, 3
+ srdi r10, n, 2
+ mtctr r10
+ rldicl. r9, n, 0, 63
+ ld r11, 0(up)
+ bne cr0, L(bx1)
+
+L(bx0): rldicl. r9, n, 63, 63
+AM(` subfzeo r12, n ') C ov = 0, ca = 0
+AM(` li r12, 0 ')
+SM(` subfco r12, r12, r12 ') C r12 = 0, ov = 0, ca = 1
+ ld r9, 8(up)
+ mulld r0, r11, v0
+ mulhdu r5, r11, v0
+ blt cr7, L(2)
+ ld r8, 16(up)
+ bne cr0, L(b10)
+
+L(b00): addi rp, rp, -24
+ b L(lo0)
+L(b10): addi rp, rp, -8
+ addi up, up, 16
+ b L(lo2)
+
+L(2): addi rp, rp, -8
+ b L(cj2)
+
+L(bx1): rldicl. r9, n, 63, 63
+AM(` subfzeo r5, n ') C ov = 0, ca = 0
+AM(` li r5, 0 ')
+SM(` subfco r5, r5, r5 ') C r5 = 0, ov = 0, ca = 1
+ blt cr7, L(1)
+ ld r8, 8(up)
+ mulld r7, r11, v0
+ mulhdu r12, r11, v0
+ ld r9, 16(up)
+ bne cr0, L(b11)
+
+L(b01): addi rp, rp, -16
+ addi up, up, 8
+ b L(lo1)
+
+L(1): mulld r7, r11, v0
+ mulhdu r12, r11, v0
+ ld r11, 0(rp)
+ ADDSUB r10, r7, r11
+ std r10, 0(rp)
+AM(` addze r3, r12 ')
+SM(` subfe r0, r0, r0 ')
+SM(` sub r3, r12, r0 ')
+ blr
+
+L(b11): addi up, up, 24
+ ble cr7, L(end)
+
+ ALIGN(16)
+L(top): ld r11, 0(rp)
+ mulld r0, r8, v0
+ addex( r7, r7, r5, 0)
+ mulhdu r5, r8, v0
+ ld r8, 0(up)
+ ADDSUBC r10, r7, r11
+ std r10, 0(rp)
+L(lo2): ld r11, 8(rp)
+ mulld r7, r9, v0
+ addex( r0, r0, r12, 0)
+ mulhdu r12, r9, v0
+ ld r9, 8(up)
+ ADDSUBC r10, r0, r11
+ std r10, 8(rp)
+L(lo1): ld r11, 16(rp)
+ mulld r0, r8, v0
+ addex( r7, r7, r5, 0)
+ mulhdu r5, r8, v0
+ ld r8, 16(up)
+ ADDSUBC r10, r7, r11
+ std r10, 16(rp)
+L(lo0): ld r11, 24(rp)
+ mulld r7, r9, v0
+ addex( r0, r0, r12, 0)
+ mulhdu r12, r9, v0
+ ld r9, 24(up)
+ ADDSUBC r10, r0, r11
+ std r10, 24(rp)
+ addi up, up, 32
+ addi rp, rp, 32
+ bdnz L(top)
+
+L(end): ld r11, 0(rp)
+ mulld r0, r8, v0
+ addex( r7, r7, r5, 0)
+ mulhdu r5, r8, v0
+ ADDSUBC r10, r7, r11
+ std r10, 0(rp)
+L(cj2): ld r11, 8(rp)
+ mulld r7, r9, v0
+ addex( r0, r0, r12, 0)
+ mulhdu r12, r9, v0
+ ADDSUBC r10, r0, r11
+ std r10, 8(rp)
+ ld r11, 16(rp)
+ addex( r7, r7, r5, 0)
+ ADDSUBC r10, r7, r11
+ std r10, 16(rp)
+ li r0, 0
+ addex( r3, r12, r0, 0)
+AM(` addze r3, r3 ')
+SM(` subfe r0, r0, r0 ')
+SM(` sub r3, r3, r0 ')
+ blr
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gcd_11.asm
new file mode 100644
index 00000000000..2dc982d2f8f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gcd_11.asm
@@ -0,0 +1,64 @@
+dnl PowerPC-64 mpn_gcd_11.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011-2013, 2019 Free Software Foundation,
+dnl 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/.
+
+include(`../config.m4')
+
+C cycles/bit (approx)
+C POWER3/PPC630 -
+C POWER4/PPC970 -
+C POWER5 -
+C POWER6 -
+C POWER7 -
+C POWER8 -
+C POWER9 5.75
+C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
+
+define(`u0', `r3')
+define(`v0', `r4')
+
+define(`cnt', `r9')dnl
+
+ASM_START()
+PROLOGUE(mpn_gcd_11)
+ b L(odd)
+
+ ALIGN(16)
+L(top): isel v0, u0, v0, 29 C v = min(u,v)
+ isel u0, r10, r11, 29 C u = |v - u|
+ srd u0, u0, cnt
+L(odd): subf r10, u0, v0 C r10 = v - u
+ subf r11, v0, u0 C r11 = u - v
+ cmpld cr7, v0, u0
+ cnttzd cnt, r10
+ bne cr7, L(top)
+
+L(end): blr
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gcd_22.asm
new file mode 100644
index 00000000000..12d11b0900c
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gcd_22.asm
@@ -0,0 +1,143 @@
+dnl PowerPC-64 mpn_gcd_22 optimised for POWER9.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011-2013, 2019 Free Software Foundation,
+dnl 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/.
+
+include(`../config.m4')
+
+C cycles/bit (approx)
+C POWER3/PPC630 -
+C POWER4/PPC970 -
+C POWER5 -
+C POWER6 -
+C POWER7 -
+C POWER8 -
+C POWER9 9.58
+
+C We define SLOW if this target uses a slow struct return mechanism, with
+C r3 as an implicit parameter for the struct pointer.
+undefine(`SLOW')dnl
+ifdef(`AIX',`define(`SLOW',`due to AIX')',`
+ ifdef(`DARWIN',,`
+ ifdef(`ELFv2_ABI',,`define(`SLOW',`due to ELFv1')')dnl
+ ')
+')
+
+ifdef(`SLOW',`
+define(`IFSLOW', `$1')
+define(`u1', `r4')
+define(`u0', `r5')
+define(`v1', `r6')
+define(`v0', `r7')
+',`
+define(`IFSLOW', `')
+define(`u1', `r3')
+define(`u0', `r4')
+define(`v1', `r5')
+define(`v0', `r6')
+')
+
+define(`tmp', `r0')
+define(`t0', `r8')
+define(`t1', `r9')
+define(`s0', `r10')
+define(`s1', `r11')
+define(`cnt', `r12')
+
+ASM_START()
+PROLOGUE(mpn_gcd_22)
+ cmpld cr7, v0, u0
+L(top): subfc t0, v0, u0 C 0 12
+ beq cr7, L(lowz)
+ subfe t1, v1, u1 C 2 14
+ subfe. tmp, tmp, tmp C 4 set cr0 from the carry bit
+ subfc s0, u0, v0 C 0
+ subfe s1, u1, v1 C 2
+
+L(bck): cnttzd cnt, t0 C 2
+ subfic tmp, cnt, 64 C 4
+
+ isel v0, v0, u0, 2 C 6 use condition set by subfe
+ isel u0, t0, s0, 2 C 6
+ isel v1, v1, u1, 2 C 6
+ isel u1, t1, s1, 2 C 6
+
+ srd u0, u0, cnt C 8
+ sld tmp, u1, tmp C 8
+ srd u1, u1, cnt C 8
+ or u0, u0, tmp C 10
+
+ or. r0, u1, v1 C 10
+ cmpld cr7, v0, u0
+ bne L(top)
+
+
+ b L(odd)
+ ALIGN(16)
+L(top1):isel v0, u0, v0, 29 C v = min(u,v)
+ isel u0, r10, r11, 29 C u = |u - v|
+ srd u0, u0, cnt
+L(odd): subf r10, u0, v0 C r10 = v - u
+ subf r11, v0, u0 C r11 = u - v
+ cmpld cr7, v0, u0
+ cnttzd cnt, r10
+ bne cr7, L(top1)
+
+ifdef(`SLOW',`
+ std v0, 0(r3)
+ std r10, 8(r3)
+',`
+ mr r3, v0
+ li r4, 0
+')
+ blr
+
+
+L(lowz):C We come here when v0 - u0 = 0
+ C 1. If v1 - u1 = 0, then gcd is u = v.
+ C 2. Else compute gcd_21({v1,v0}, |u1-v1|)
+ subfc. t0, v1, u1 C 2 8
+ beq L(end)
+ li t1, 0
+ subfe. tmp, tmp, tmp C 4 set cr0 from the carry bit
+ subf s0, u1, v1 C 2
+ li s1, 0
+ b L(bck)
+
+L(end):
+ifdef(`SLOW',`
+ std v0, 0(r3)
+ std v1, 8(r3)
+ blr
+',`
+ mr r3, v0
+ mr r4, v1
+ blr
+')
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gmp-mparam.h
new file mode 100644
index 00000000000..5650def855e
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/gmp-mparam.h
@@ -0,0 +1,253 @@
+/* POWER9 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 2200MHz POWER9 */
+/* FFT tuning limit = 221,245,838 */
+/* Generated by tuneup.c, 2019-10-29, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 7
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 44
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 11
+#define USE_PREINV_DIVREM_1 0
+#define DIV_QR_1N_PI1_METHOD 2 /* 19.28% faster than 1 */
+#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1_UNNORM_THRESHOLD 2
+#define DIV_QR_2_PI2_THRESHOLD 7
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 33
+
+#define DIV_1_VS_MUL_1_PERCENT 365
+
+#define MUL_TOOM22_THRESHOLD 34
+#define MUL_TOOM33_THRESHOLD 109
+#define MUL_TOOM44_THRESHOLD 458
+#define MUL_TOOM6H_THRESHOLD 517
+#define MUL_TOOM8H_THRESHOLD 608
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 113
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 292
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 204
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 211
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 178
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 46
+#define SQR_TOOM3_THRESHOLD 158
+#define SQR_TOOM4_THRESHOLD 674
+#define SQR_TOOM6_THRESHOLD 0 /* always */
+#define SQR_TOOM8_THRESHOLD 898
+
+#define MULMID_TOOM42_THRESHOLD 70
+
+#define MULMOD_BNM1_THRESHOLD 17
+#define SQRMOD_BNM1_THRESHOLD 25
+
+#define MUL_FFT_MODF_THRESHOLD 404 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 404, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
+ { 13, 5}, { 27, 6}, { 27, 7}, { 14, 6}, \
+ { 29, 7}, { 15, 6}, { 31, 7}, { 25, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 32, 8}, \
+ { 17, 7}, { 35, 8}, { 27, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 39, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 31, 8}, \
+ { 63, 9}, { 35, 8}, { 71, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 71,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 135,11}, { 79,10}, { 159,11}, { 95,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,11}, \
+ { 143,10}, { 287, 9}, { 575,10}, { 303,11}, \
+ { 159,12}, { 95,11}, { 191,13}, { 63,12}, \
+ { 127,11}, { 255,10}, { 511,11}, { 271,10}, \
+ { 543,11}, { 287,10}, { 575,11}, { 303,12}, \
+ { 159,11}, { 319,10}, { 639,11}, { 335,10}, \
+ { 671,11}, { 351,10}, { 703,11}, { 367,10}, \
+ { 735,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 415,10}, { 831,12}, { 223,11}, { 447,10}, \
+ { 895,11}, { 479,13}, { 127,12}, { 255,11}, \
+ { 511,10}, { 1023,11}, { 543,12}, { 287,11}, \
+ { 575,10}, { 1151,11}, { 607,12}, { 319,11}, \
+ { 639,10}, { 1279,11}, { 671,12}, { 351,11}, \
+ { 703,10}, { 1407,11}, { 735,13}, { 191,12}, \
+ { 383,11}, { 767,10}, { 1535,11}, { 799,12}, \
+ { 415,11}, { 831,10}, { 1663,11}, { 863,12}, \
+ { 447,11}, { 895,12}, { 479,14}, { 127,13}, \
+ { 255,12}, { 511,11}, { 1023,12}, { 543,11}, \
+ { 1087,12}, { 575,11}, { 1151,12}, { 607,13}, \
+ { 319,12}, { 639,11}, { 1279,12}, { 671,11}, \
+ { 1343,12}, { 703,11}, { 1407,12}, { 735,11}, \
+ { 1471,13}, { 383,12}, { 767,11}, { 1535,12}, \
+ { 799,11}, { 1599,12}, { 831,11}, { 1663,13}, \
+ { 447,12}, { 895,11}, { 1791,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1087,11}, { 2175,13}, \
+ { 575,12}, { 1215,13}, { 639,12}, { 1343,13}, \
+ { 703,12}, { 1471,14}, { 383,13}, { 767,12}, \
+ { 1599,13}, { 831,12}, { 1727,13}, { 895,11}, \
+ { 3583,12}, { 1919,15}, { 255,14}, { 511,13}, \
+ { 1087,12}, { 2175,13}, { 1215,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1471,14}, { 767,13}, \
+ { 1599,12}, { 3199,13}, { 1727,14}, { 895,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
+ { 2687,14}, { 1407,13}, { 2943,15}, { 767,14}, \
+ { 1535,13}, { 3199,14}, { 1663,13}, { 3455,12}, \
+ { 6911,14}, { 1919,16}, { 511,15}, { 1023,14}, \
+ { 2175,13}, { 4479,14}, { 2431,13}, { 4863,15}, \
+ { 1279,14}, { 2943,13}, { 5887,15}, { 1535,14}, \
+ { 3455,13}, { 6911,15}, { 1791,14}, { 3839,13}, \
+ { 7679,16}, { 1023,15}, { 2047,14}, { 4351,15}, \
+ { 2303,14}, { 4863,15}, { 2815,14}, { 5887,16}, \
+ { 1535,15}, { 3327,14}, { 6911,15}, { 3839,14}, \
+ { 7679,17}, { 1023,16}, { 2047,15}, { 4351,14}, \
+ { 8959,15}, { 4863,16}, { 2559,15}, { 5887,14}, \
+ { 11775,16}, { 3071,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 243
+#define MUL_FFT_THRESHOLD 3712
+
+#define SQR_FFT_MODF_THRESHOLD 404 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 404, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 29, 7}, { 15, 6}, { 31, 7}, { 25, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 32, 8}, \
+ { 17, 7}, { 35, 8}, { 29, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 71,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 127, 9}, { 255,10}, { 135,11}, { 79,10}, \
+ { 159,11}, { 95,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271,11}, { 143,10}, \
+ { 287, 9}, { 575,10}, { 303,11}, { 159,12}, \
+ { 95,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 303,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
+ { 703,11}, { 367,10}, { 735,12}, { 191,11}, \
+ { 383,10}, { 767,11}, { 415,12}, { 223,11}, \
+ { 447,10}, { 895,13}, { 127,12}, { 255,11}, \
+ { 511,10}, { 1023,11}, { 543,12}, { 287,11}, \
+ { 575,10}, { 1151,11}, { 607,12}, { 319,11}, \
+ { 671,12}, { 351,11}, { 703,10}, { 1407,11}, \
+ { 735,13}, { 191,12}, { 383,11}, { 767,10}, \
+ { 1535,12}, { 415,11}, { 831,12}, { 447,11}, \
+ { 895,12}, { 479,14}, { 127,13}, { 255,12}, \
+ { 511,11}, { 1023,12}, { 543,11}, { 1087,12}, \
+ { 575,11}, { 1151,12}, { 607,13}, { 319,12}, \
+ { 639,11}, { 1279,12}, { 671,11}, { 1343,12}, \
+ { 703,11}, { 1407,12}, { 735,13}, { 383,12}, \
+ { 767,11}, { 1535,12}, { 799,11}, { 1599,12}, \
+ { 831,13}, { 447,12}, { 895,11}, { 1791,12}, \
+ { 959,14}, { 255,13}, { 511,12}, { 1023,11}, \
+ { 2047,12}, { 1087,13}, { 575,12}, { 1215,13}, \
+ { 639,12}, { 1343,13}, { 703,12}, { 1407,14}, \
+ { 383,13}, { 767,12}, { 1599,13}, { 831,12}, \
+ { 1727,13}, { 895,12}, { 1791,13}, { 959,15}, \
+ { 255,14}, { 511,13}, { 1023,12}, { 2047,13}, \
+ { 1087,12}, { 2175,13}, { 1215,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1471,14}, { 767,13}, \
+ { 1599,12}, { 3199,13}, { 1727,14}, { 895,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
+ { 2687,14}, { 1407,13}, { 2815,15}, { 767,14}, \
+ { 1535,13}, { 3199,14}, { 1663,13}, { 3455,14}, \
+ { 1919,16}, { 511,15}, { 1023,14}, { 2175,13}, \
+ { 4479,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
+ { 2943,13}, { 5887,15}, { 1535,14}, { 3455,13}, \
+ { 6911,15}, { 1791,14}, { 3839,16}, { 1023,15}, \
+ { 2047,14}, { 4479,15}, { 2303,14}, { 4863,15}, \
+ { 2559,14}, { 5119,15}, { 2815,14}, { 5887,16}, \
+ { 1535,15}, { 3327,14}, { 6911,15}, { 3839,17}, \
+ { 1023,16}, { 2047,15}, { 4351,14}, { 8959,15}, \
+ { 4863,16}, { 2559,15}, { 5887,14}, { 11775,16}, \
+ { 3071,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
+ { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+ {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 230
+#define SQR_FFT_THRESHOLD 3264
+
+#define MULLO_BASECASE_THRESHOLD 3
+#define MULLO_DC_THRESHOLD 39
+#define MULLO_MUL_N_THRESHOLD 7246
+#define SQRLO_BASECASE_THRESHOLD 6
+#define SQRLO_DC_THRESHOLD 40
+#define SQRLO_SQR_THRESHOLD 6440
+
+#define DC_DIV_QR_THRESHOLD 30
+#define DC_DIVAPPR_Q_THRESHOLD 88
+#define DC_BDIV_QR_THRESHOLD 35
+#define DC_BDIV_Q_THRESHOLD 62
+
+#define INV_MULMOD_BNM1_THRESHOLD 79
+#define INV_NEWTON_THRESHOLD 11
+#define INV_APPR_THRESHOLD 11
+
+#define BINV_NEWTON_THRESHOLD 264
+#define REDC_1_TO_REDC_2_THRESHOLD 8
+#define REDC_2_TO_REDC_N_THRESHOLD 79
+
+#define MU_DIV_QR_THRESHOLD 1442
+#define MU_DIVAPPR_Q_THRESHOLD 1470
+#define MUPI_DIV_QR_THRESHOLD 0 /* always */
+#define MU_BDIV_QR_THRESHOLD 1470
+#define MU_BDIV_Q_THRESHOLD 1652
+
+#define POWM_SEC_TABLE 1,16,151,839
+
+#define GET_STR_DC_THRESHOLD 7
+#define GET_STR_PRECOMPUTE_THRESHOLD 15
+#define SET_STR_DC_THRESHOLD 406
+#define SET_STR_PRECOMPUTE_THRESHOLD 885
+
+#define FAC_DSC_THRESHOLD 179
+#define FAC_ODD_THRESHOLD 53
+
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD2_DIV1_METHOD 1 /* 9.10% faster than 3 */
+#define HGCD_THRESHOLD 45
+#define HGCD_APPR_THRESHOLD 50
+#define HGCD_REDUCE_THRESHOLD 2479
+#define GCD_DC_THRESHOLD 321
+#define GCDEXT_DC_THRESHOLD 258
+#define JACOBI_BASE_METHOD 4 /* 15.45% faster than 1 */
+
+/* Tuneup completed successfully, took 179422 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_1.asm
new file mode 100644
index 00000000000..363f0951a4e
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_1.asm
@@ -0,0 +1,126 @@
+dnl Power9 mpn_mul_1.
+
+dnl Copyright 2017, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C POWER3/PPC630 ?
+C POWER4/PPC970 ?
+C POWER5 ?
+C POWER6 ?
+C POWER7 ?
+C POWER8 ?
+C POWER9 2.47
+
+C TODO
+C * Schedule for Power9 pipeline.
+C * Unroll 4x if that proves beneficial.
+C * This is marginally faster (but much smaller) than ../mul_1.asm.
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`n', `r5')
+define(`v0', `r6')
+
+ASM_START()
+PROLOGUE(mpn_mul_1c)
+ b L(ent)
+EPILOGUE()
+PROLOGUE(mpn_mul_1)
+ li r7, 0
+L(ent): ld r11, 0(up)
+ cmpdi cr6, n, 2
+ addi r0, n, -1 C FIXME: postpone
+ srdi r0, r0, 1 C FIXME: postpone
+ mtctr r0 C FIXME: postpone
+ rldicl. r12, n, 0,63 C r0 = n & 3, set cr0
+ bne cr0, L(b1)
+
+L(b0): ld r0, 8(up)
+ maddld( r9, r11, v0, r7)
+ maddhdu(r7, r11, v0, r7)
+ ble cr6, L(2)
+ ld r12, 16(up)
+ mulld r8, r0, v0
+ mulhdu r5, r0, v0
+ addic up, up, 16
+ addi rp, rp, -8
+ b L(mid)
+
+L(b1): ld r0, 0(up)
+ ble cr6, L(1)
+ ld r12, 8(up)
+ maddld( r8, r11, v0, r7)
+ maddhdu(r5, r11, v0, r7)
+ ld r0, 16(up)
+ mulld r9, r12, v0
+ mulhdu r7, r12, v0
+ addic up, up, 24
+ bdz L(end)
+
+ ALIGN(16)
+L(top): ld r12, 0(up)
+ std r8, 0(rp)
+ adde r9, r5, r9
+ mulld r8, r0, v0
+ mulhdu r5, r0, v0
+L(mid): ld r0, 8(up)
+ std r9, 8(rp)
+ adde r8, r7, r8
+ mulld r9, r12, v0
+ mulhdu r7, r12, v0
+ addi rp, rp, 16
+ addi up, up, 16
+ bdnz L(top)
+
+L(end): std r8, 0(rp)
+ mulld r8, r0, v0
+ adde r9, r5, r9
+ mulhdu r5, r0, v0
+ std r9, 8(rp)
+ adde r8, r7, r8
+ std r8, 16(rp)
+ addze r3, r5
+ blr
+
+L(2): mulld r8, r0, v0
+ mulhdu r5, r0, v0
+ std r9, 0(rp)
+ addc r8, r7, r8
+ std r8, 8(rp)
+ addze r3, r5
+ blr
+
+L(1): maddld( r8, r0, v0, r7)
+ std r8, 0(rp)
+ maddhdu(r3, r0, v0, r7)
+ blr
+EPILOGUE()
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
new file mode 100644
index 00000000000..632b6cbc9a7
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_2.asm
@@ -0,0 +1,170 @@
+dnl Power9 mpn_mul_2.
+
+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 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C power9: 1.58
+
+C STATUS
+C * Not written with any power9 pipeline understanding.
+C * The 4x unrolling was not motivated by any timing tests.
+C * No local scheduling for performance tweaking has been done.
+C * Decrease load scheduling!
+
+define(`rp', `r3')
+define(`up', `r4')
+define(`n', `r5') C Note: Reused as scratch
+define(`vp', `r6') C Note: Reused for v1
+
+define(`v0', `r7')
+define(`v1', `r6')
+
+
+ASM_START()
+PROLOGUE(mpn_mul_2)
+ std r28, -32(r1)
+ std r29, -24(r1)
+ std r30, -16(r1)
+ std r31, -8(r1)
+
+ subfic r0, n, 0 C clear CA
+ subfo r0, r0, r0 C clear OV and r0
+
+ cmpdi cr7, n, 4
+
+ ld v0, 0(vp)
+ ld v1, 8(vp)
+
+ srdi r10, n, 2
+ mtctr r10
+
+ rldicl. r9, n, 0, 63
+ bne cr0, L(bx1)
+
+L(bx0): rldicl. r9, n, 63, 63
+
+ ld r8, 0(up)
+ ld r9, 8(up)
+ li r11, 0
+ mulld r28, r8, v0
+ mulhdu r31, r8, v0
+ blt cr7, L(2)
+ mulld r5, r8, v1
+ mulhdu r10, r8, v1
+ bne cr0, L(b10)
+
+L(b00): addi up, up, -8
+ addi rp, rp, -24
+ b L(lo0)
+
+L(b10): addi up, up, 8
+ addi rp, rp, -8
+ b L(lo2)
+
+L(2): addi rp, rp, -8
+ mulld r5, r8, v1
+ mulhdu r10, r8, v1
+ b L(cj2)
+
+L(bx1): rldicl. r9, n, 63, 63
+
+ ld r9, 0(up)
+ ld r8, 8(up)
+ li r10, 0
+ mulld r29, r9, v0
+ mulhdu r30, r9, v0
+ mulld r12, r9, v1
+ mulhdu r11, r9, v1
+ bne cr0, L(b11)
+
+L(b01): addi rp, rp, -16
+ b L(lo1)
+L(b11): addi up, up, 16
+ blt cr7, L(end)
+
+L(top): ld r9, 0(up)
+ maddld( r28, r8, v0, r10) C 0 4 -> adde
+ maddhdu(r31, r8, v0, r10) C 1 5
+ adde r0, r29, r0 C 7 11
+ std r0, 0(rp)
+ mulld r5, r8, v1 C 1 5 -> addex
+ mulhdu r10, r8, v1 C 2 6
+ addex( r0, r12, r30, 0) C 8 12
+L(lo2): ld r8, 8(up)
+ maddld( r29, r9, v0, r11) C 1 5 -> adde
+ maddhdu(r30, r9, v0, r11) C 2 6
+ adde r0, r28, r0 C 8 12
+ std r0, 8(rp)
+ mulld r12, r9, v1 C 2 6 -> addex
+ mulhdu r11, r9, v1 C 3 7
+ addex( r0, r5, r31, 0) C 5 9 13
+L(lo1): ld r9, 16(up)
+ maddld( r28, r8, v0, r10) C 2 6 -> adde
+ maddhdu(r31, r8, v0, r10) C 3 7
+ adde r0, r29, r0 C 5 9 13
+ std r0, 16(rp)
+ mulld r5, r8, v1 C 3 7 -> addex
+ mulhdu r10, r8, v1 C 4 8
+ addex( r0, r12, r30, 0) C 6 10
+L(lo0): ld r8, 24(up)
+ maddld( r29, r9, v0, r11) C 3 7 -> adde
+ maddhdu(r30, r9, v0, r11) C 4 8
+ adde r0, r28, r0 C 6 10
+ std r0, 24(rp)
+ mulld r12, r9, v1 C 4 8 -> addex
+ mulhdu r11, r9, v1 C 5 9
+ addex( r0, r5, r31, 0) C 7 11
+ addi up, up, 32
+ addi rp, rp, 32
+ bdnz L(top)
+
+L(end): ld r9, 0(up)
+ maddld( r28, r8, v0, r10) C 0 4
+ maddhdu(r31, r8, v0, r10) C 1 5
+ adde r0, r29, r0 C 7 11
+ std r0, 0(rp) C -4
+ mulld r5, r8, v1 C 1 5
+ mulhdu r10, r8, v1 C 2 6
+ addex( r0, r12, r30, 0) C 8 12
+L(cj2): maddld( r29, r9, v0, r11) C 1 5 -2
+ maddhdu(r30, r9, v0, r11) C 2 6 -1
+ adde r0, r28, r0 C 8 12 -3
+ std r0, 8(rp) C -3
+ mulld r12, r9, v1 C 2 6 -1
+ mulhdu r11, r9, v1 C 3 7 0 = return limb
+ addex( r0, r5, r31, 0) C 5 9 13
+ adde r0, r29, r0 C 5 9 13 -2
+ std r0, 16(rp) C -2
+ addex( r0, r12, r30, 0) C 6 10 -1
+ adde r0, r0, r10 C -1
+ std r0, 24(rp) C -1
+ li r4, 0
+ addze r3, r11
+ addex( r3, r3, r4, 0)
+
+L(ret): ld r28, -32(r1)
+ ld r29, -24(r1)
+ ld r30, -16(r1)
+ ld r31, -8(r1)
+ blr
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_basecase.asm
new file mode 100644
index 00000000000..8f3d322c168
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/mul_basecase.asm
@@ -0,0 +1,415 @@
+dnl Power9 mpn_mul_basecase.
+
+dnl Copyright 1999-2001, 2003-2006, 2008, 2017-2018 Free Software Foundation,
+dnl 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C POWER3/PPC630 -
+C POWER4/PPC970 -
+C POWER5 -
+C POWER6 -
+C POWER7 -
+C POWER8 -
+C POWER9 1.62
+
+C TODO
+C * Check if (inner) loop alignment affects performance.
+C * Could we schedule loads less in addmul_2/mul_2? That would save some regs
+C and make the tail code more manageable.
+C * Postpone some register saves to main loop.
+C * Perhaps write more small operands (3x1, 3x2, 3x3) code.
+C * Consider restoring rp,up after loop using arithmetic, eliminating rp2, up2.
+C On the other hand, the current rp,up restore register are useful for OSP.
+C * Do OSP. This should save a lot with the current deep addmul_2 pipeline.
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`un', `r5')
+define(`vp', `r6')
+define(`vn', `r7')
+
+define(`v0', `r0')
+define(`v1', `r7')
+define(`rp2', `r24')
+define(`up2', `r25')
+
+ASM_START()
+PROLOGUE(mpn_mul_basecase)
+ cmpdi cr0, un, 2
+ bgt cr0, L(un_gt2)
+ cmpdi cr6, vn, 1
+ ld r7, 0(vp)
+ ld r5, 0(up)
+ mulld r8, r5, r7 C weight 0
+ mulhdu r9, r5, r7 C weight 1
+ std r8, 0(rp)
+ beq cr0, L(2x)
+ std r9, 8(rp)
+ blr
+ ALIGN(16)
+L(2x): ld r0, 8(up)
+ mulld r8, r0, r7 C weight 1
+ mulhdu r10, r0, r7 C weight 2
+ addc r9, r9, r8
+ addze r10, r10
+ bne cr6, L(2x2)
+ std r9, 8(rp)
+ std r10, 16(rp)
+ blr
+ ALIGN(16)
+L(2x2): ld r6, 8(vp)
+ mulld r8, r5, r6 C weight 1
+ mulhdu r11, r5, r6 C weight 2
+ addc r9, r9, r8
+ std r9, 8(rp)
+ adde r11, r11, r10
+ mulld r12, r0, r6 C weight 2
+ mulhdu r0, r0, r6 C weight 3
+ addze r0, r0
+ addc r11, r11, r12
+ addze r0, r0
+ std r11, 16(rp)
+ std r0, 24(rp)
+ blr
+
+L(un_gt2):
+ std r22, -80(r1)
+ std r23, -72(r1)
+ std r24, -64(r1)
+ std r25, -56(r1)
+ std r26, -48(r1)
+ std r27, -40(r1)
+ std r28, -32(r1)
+ std r29, -24(r1)
+ std r30, -16(r1)
+ std r31, -8(r1)
+ mr rp2, r3 C rp
+ mr up2, r4 C up
+ srdi r22, r5, 2 C un
+ subfic r23, r7, 0 C -vn, clear CA
+ subfo r0, r0, r0 C clear OV (and r0)
+
+ cmpdi cr6, un, 3
+ rldicl r0, un, 0, 63 C r0 = un & 1
+ cmpdi cr7, r0, 0
+ rldicl r0, un, 63, 63 C FIXME: unused for vn = 1
+ cmpdi cr5, r0, 0 C FIXME: unused for vn = 1
+
+ ld v0, 0(vp)
+ rldicl. r9, vn, 0, 63
+ beq cr0, L(vn_evn)
+
+L(vn_odd):
+ addi r10, un, -2
+ ld r5, 0(up)
+ srdi r10, r10, 1
+ mtctr r10
+ bne cr7, L(m1_b1)
+
+L(m1_b0):
+ ld r10, 8(up)
+ mulld r9, r5, v0
+ mulhdu r11, r5, v0
+ ld r12, 16(up)
+ mulld r8, r10, v0
+ mulhdu r5, r10, v0
+ addi rp, rp, -8
+ b L(m1_mid)
+
+L(m1_b1):
+ ld r12, 8(up)
+ mulld r8, r5, v0
+ mulhdu r5, r5, v0
+ ld r10, 16(up)
+ mulld r9, r12, v0
+ mulhdu r11, r12, v0
+ addi up, up, 8
+ beq cr6, L(m1_end) C jump taken means un = 3, vn = {1,3}
+
+ ALIGN(16)
+L(m1_top):
+ ld r12, 16(up)
+ std r8, 0(rp)
+ adde r9, r5, r9
+ mulld r8, r10, v0
+ mulhdu r5, r10, v0
+L(m1_mid):
+ ld r10, 24(up)
+ std r9, 8(rp)
+ adde r8, r11, r8
+ mulld r9, r12, v0
+ mulhdu r11, r12, v0
+ addi rp, rp, 16
+ addi up, up, 16
+ bdnz L(m1_top)
+
+L(m1_end):
+ std r8, 0(rp)
+ mulld r8, r10, v0
+ adde r9, r5, r9
+ mulhdu r5, r10, v0
+ std r9, 8(rp)
+ adde r8, r11, r8
+ std r8, 16(rp)
+ addze r10, r5
+ std r10, 24(rp)
+
+ addi rp2, rp2, 8
+ addi vp, vp, 8
+ addic. r23, r23, 1
+ b L(do_outer)
+
+L(vn_evn):
+ ld v1, 8(vp)
+ addi r23, r23, 2
+ mtctr r22
+ bne cr7, L(m2_bx1)
+
+L(m2_bx0):
+ ld r8, 0(up)
+ ld r9, 8(up)
+ li r11, 0
+ mulld r28, r8, v0
+ mulhdu r31, r8, v0
+ mulld r5, r8, v1
+ mulhdu r10, r8, v1
+ li r12, 0
+ bne cr5, L(m2_b10)
+
+L(m2_b00):
+ addi up, up, -8
+ addi rp, rp, -24
+ b L(m2_lo0)
+
+L(m2_b10):
+ addi up, up, 8
+ addi rp, rp, -8
+ b L(m2_lo2)
+
+L(m2_bx1):
+ ld r9, 0(up)
+ ld r8, 8(up)
+ li r10, 0
+ mulld r29, r9, v0
+ mulhdu r30, r9, v0
+ mulld r12, r9, v1
+ mulhdu r11, r9, v1
+ li r5, 0
+ bne cr5, L(m2_b11)
+
+L(m2_b01):
+ addi rp, rp, -16
+ b L(m2_lo1)
+L(m2_b11):
+ addi up, up, 16
+ beq cr6, L(m2_end) C taken means un = 3, vn = 2. We're done.
+
+L(m2_top):
+ ld r9, 0(up)
+ maddld( r28, r8, v0, r10)
+ maddhdu(r31, r8, v0, r10)
+ adde r5, r29, r5
+ std r5, 0(rp)
+ mulld r5, r8, v1
+ mulhdu r10, r8, v1
+ addex( r12, r12, r30, 0)
+L(m2_lo2):
+ ld r8, 8(up)
+ maddld( r29, r9, v0, r11)
+ maddhdu(r30, r9, v0, r11)
+ adde r12, r28, r12
+ std r12, 8(rp)
+ mulld r12, r9, v1
+ mulhdu r11, r9, v1
+ addex( r5, r5, r31, 0)
+L(m2_lo1):
+ ld r9, 16(up)
+ maddld( r28, r8, v0, r10)
+ maddhdu(r31, r8, v0, r10)
+ adde r5, r29, r5
+ std r5, 16(rp)
+ mulld r5, r8, v1
+ mulhdu r10, r8, v1
+ addex( r12, r12, r30, 0)
+L(m2_lo0):
+ ld r8, 24(up)
+ maddld( r29, r9, v0, r11)
+ maddhdu(r30, r9, v0, r11)
+ adde r12, r28, r12
+ std r12, 24(rp)
+ mulld r12, r9, v1
+ mulhdu r11, r9, v1
+ addex( r5, r5, r31, 0)
+ addi up, up, 32
+ addi rp, rp, 32
+ bdnz L(m2_top)
+
+L(m2_end):
+ ld r9, 0(up)
+ maddld( r28, r8, v0, r10)
+ maddhdu(r31, r8, v0, r10)
+ adde r5, r29, r5
+ std r5, 0(rp)
+ mulld r5, r8, v1
+ mulhdu r10, r8, v1
+ b L(cj)
+
+L(outer):
+ ld v0, 0(vp)
+ ld v1, 8(vp)
+ addi r23, r23, 2
+ mtctr r22
+ bne cr7, L(bx1)
+
+L(bx0): ld r26, 0(rp2)
+ ld r8, 0(up2)
+ ld r11, 8(rp2)
+ ld r9, 8(up2)
+ maddld( r28, r8, v0, r26)
+ maddhdu(r31, r8, v0, r26)
+ ld r26, 16(rp2)
+ mulld r5, r8, v1
+ mulhdu r10, r8, v1
+ li r12, 0
+ bne cr5, L(b10)
+
+L(b00): addi up, up2, -8
+ addi rp, rp2, -24
+ b L(lo0)
+
+L(b10): addi up, up2, 8
+ addi rp, rp2, -8
+ b L(lo2)
+
+L(bx1): ld r27, 0(rp2)
+ ld r9, 0(up2)
+ ld r10, 8(rp2)
+ ld r8, 8(up2)
+ maddld( r29, r9, v0, r27)
+ maddhdu(r30, r9, v0, r27)
+ ld r27, 16(rp2)
+ mulld r12, r9, v1
+ mulhdu r11, r9, v1
+ li r5, 0
+ bne cr5, L(b11)
+
+L(b01): addi up, up2, 0
+ addi rp, rp2, -16
+ b L(lo1)
+L(b11): addi up, up2, 16
+ addi rp, rp2, 0
+ beq cr6, L(end) C taken means un = 3, vn = 3. We're done.
+
+L(top): ld r9, 0(up)
+ maddld( r28, r8, v0, r10)
+ maddhdu(r31, r8, v0, r10)
+ adde r5, r29, r5
+ ld r26, 24(rp)
+ std r5, 0(rp)
+ maddld( r5, r8, v1, r27)
+ maddhdu(r10, r8, v1, r27)
+ addex( r12, r12, r30, 0)
+L(lo2): ld r8, 8(up)
+ maddld( r29, r9, v0, r11)
+ maddhdu(r30, r9, v0, r11)
+ adde r12, r28, r12
+ ld r27, 32(rp)
+ std r12, 8(rp)
+ maddld( r12, r9, v1, r26)
+ maddhdu(r11, r9, v1, r26)
+ addex( r5, r5, r31, 0)
+L(lo1): ld r9, 16(up)
+ maddld( r28, r8, v0, r10)
+ maddhdu(r31, r8, v0, r10)
+ adde r5, r29, r5
+ ld r26, 40(rp)
+ std r5, 16(rp)
+ maddld( r5, r8, v1, r27)
+ maddhdu(r10, r8, v1, r27)
+ addex( r12, r12, r30, 0)
+L(lo0): ld r8, 24(up)
+ maddld( r29, r9, v0, r11)
+ maddhdu(r30, r9, v0, r11)
+ adde r12, r28, r12
+ ld r27, 48(rp)
+ std r12, 24(rp)
+ maddld( r12, r9, v1, r26)
+ maddhdu(r11, r9, v1, r26)
+ addex( r5, r5, r31, 0)
+ addi up, up, 32
+ addi rp, rp, 32
+ bdnz L(top)
+
+L(end): ld r9, 0(up)
+ maddld( r28, r8, v0, r10)
+ maddhdu(r31, r8, v0, r10)
+ adde r5, r29, r5
+ std r5, 0(rp)
+ maddld( r5, r8, v1, r27)
+ maddhdu(r10, r8, v1, r27)
+L(cj): addex( r12, r12, r30, 0)
+ maddld( r29, r9, v0, r11)
+ maddhdu(r30, r9, v0, r11)
+ adde r12, r28, r12
+ std r12, 8(rp)
+ mulld r12, r9, v1
+ mulhdu r11, r9, v1
+ addex( r5, r5, r31, 0)
+ adde r5, r29, r5
+ std r5, 16(rp)
+ addex( r12, r12, r30, 0)
+ adde r12, r12, r10
+ std r12, 24(rp)
+ li r4, 0
+ addze r5, r11
+ addex( r5, r5, r4, 0)
+ std r5, 32(rp)
+
+ cmpdi cr0, r23, 0
+ addi rp2, rp2, 16
+ addi vp, vp, 16
+L(do_outer):
+ bne cr0, L(outer)
+L(ret):
+ ld r22, -80(r1)
+ ld r23, -72(r1)
+ ld r24, -64(r1)
+ ld r25, -56(r1)
+ ld r26, -48(r1)
+ ld r27, -40(r1)
+ ld r28, -32(r1)
+ ld r29, -24(r1)
+ ld r30, -16(r1)
+ ld r31, -8(r1)
+ blr
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/sqr_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/sqr_basecase.asm
new file mode 100644
index 00000000000..2d4fa637aab
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/mode64/p9/sqr_basecase.asm
@@ -0,0 +1,555 @@
+dnl Power9 mpn_sqr_basecase.
+
+dnl Copyright 1999-2001, 2003-2006, 2008, 2017-2018 Free Software Foundation,
+dnl 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C POWER3/PPC630 -
+C POWER4/PPC970 -
+C POWER5 -
+C POWER6 -
+C POWER7 -
+C POWER8 -
+C POWER9 1.62
+
+C TODO
+C * Completely separate evn and odd code into two outer loops. Also consider
+C unrolling these two outer loops and thereby eliminate all branches.
+C * Avoid the reloading of u1 before every loop start.
+C * Reduce register usage.
+C * Consider getting rid of cy and instead load 3 u limbs, use addc+adde+adde.
+C * Consider skewing conditional adjustments to allow mask creation with subfe
+C like in the un=3 code. It might streamline the adjustments (or not).
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`un', `r5')
+
+define(`u0', `r0')
+define(`u1', `r7')
+define(`rp2', `r24')
+define(`up2', `r25')
+define(`cy', `r6')
+
+define(`LSHU1U0',`
+ addc u0, u0, u0
+ adde u1, u1, u1
+ li cy, 0
+ addze cy, cy
+')
+define(`LSHU1U',`
+ addc u0, u0, u0
+ add u0, u0, cy
+ adde u1, u1, u1
+ li cy, 0
+ addze cy, cy
+')
+define(`LSHU1UF',`
+ addc u0, u0, u0
+ add u0, u0, cy
+ adde u1, u1, u1
+')
+define(`LSHU1UHF',`
+ add u0, u0, u0
+ add u0, u0, cy
+')
+C These are cleverer replacements, but they tend to leave CA set, disturbing
+C the main accumulation code! Breaking that false dependency might have a
+C positive performance impact. Note that the subfe here results in a mask for
+C our adjustments.
+define(`xLSHU1U0',`
+ addc u0, u0, u0
+ adde u1, u1, u1
+ subfe cy, cy, cy
+')
+define(`xLSHU1U',`
+ subfic cy, cy, 0
+ adde u0, u0, u0
+ adde u1, u1, u1
+ subfe cy, cy, cy
+')
+define(`xLSHU1U',`
+ subfic cy, cy, 0
+ adde u0, u0, u0
+')
+
+ASM_START()
+PROLOGUE(mpn_sqr_basecase)
+ ld r0, 0(up) C n = 1
+ mulld r8, r0, r0 C weight 0
+ mulhdu r9, r0, r0 C weight 1
+ std r8, 0(rp)
+ cmpdi cr0, un, 2
+ bge cr0, L(ge2)
+ std r9, 8(rp)
+ blr
+
+L(ge2): bgt cr0, L(gt2)
+ ld r6, 8(up)
+ mulld r10, r6, r6 C u1 * u1
+ mulhdu r11, r6, r6 C u1 * u1
+ mulld r4, r6, r0 C u1 * u0
+ mulhdu r5, r6, r0 C u1 * u0
+ addc r4, r4, r4
+ adde r5, r5, r5
+ addze r11, r11
+ addc r9, r9, r4
+ adde r10, r10, r5
+ addze r11, r11
+ std r9, 8(rp)
+ std r10, 16(rp)
+ std r11, 24(rp)
+ blr
+
+L(gt2): cmpdi cr0, un, 3
+ bgt cr0, L(gt3)
+ std r30, -16(r1)
+ std r31, -8(r1)
+ subfo r12, r12, r12 C clear OV (and result register)
+ ld r8, 8(r4)
+ mulld r5, r8, r8 C W2
+ mulhdu r10, r8, r8 C W3
+ sradi r11, u0, 63 C CAUTION: clobbers CA
+ and r11, r11, r8 C W3
+ addc u0, u0, u0
+ adde u1, r8, r8
+ subfe r6, r6, r6 C mask
+ ld r4, 16(r4) C W2
+ mulld r12, r8, u0 C W1 u1 x u0
+ mulhdu r8, r8, u0 C W2 u1 x u0
+ maddld( r31, r4, u0, r11) C W2
+ maddhdu(r30, r4, u0, r11) C W3
+ andc r6, r4, r6 C W4
+ addc r9, r12, r9 C W1
+ std r9, 8(rp) C W1
+ mulld r9, r4, u1 C W3
+ mulhdu r11, r4, u1 C W4
+ addex( r5, r5, r8, 0) C W2
+ adde r5, r31, r5 C W2
+ std r5, 16(rp) C W2
+ maddld( r5, r4, r4, r6) C W4 u2^2
+ maddhdu(r6, r4, r4, r6) C W5 u2^2
+ addex( r9, r9, r30, 0) C W3
+ adde r9, r9, r10 C W3
+ std r9, 24(rp) C W3
+ adde r5, r5, r11 C W4
+ addze r6, r6 C W5
+ li r8, 0
+ addex( r5, r5, r8, 0) C W4
+ std r5, 32(rp) C W4
+ addex( r6, r6, r8, 0) C W5
+ std r6, 40(rp) C W5
+ ld r30, -16(r1)
+ ld r31, -8(r1)
+ blr
+
+L(gt3): std r22, -80(r1)
+ std r23, -72(r1)
+ std r24, -64(r1)
+ std r25, -56(r1)
+ std r26, -48(r1)
+ std r27, -40(r1)
+ std r28, -32(r1)
+ std r29, -24(r1)
+ std r30, -16(r1)
+ std r31, -8(r1)
+
+ mr rp2, rp
+ mr up2, up
+ addi r22, un, -1 C count for loop FIXME: Adjust
+ subfo r0, r0, r0 C clear OV (and r0)
+ rldicl r0, un, 0, 63 C r0 = un & 1
+ cmpdi cr7, r0, 0
+
+ ld u0, 0(up2)
+ ld u1, 8(up2)
+
+ cmpdi cr5, r22, 4
+ srdi r31, r22, 2
+ addi r22, r22, -2
+ mtctr r31
+
+ beq cr7, L(m2_evn)
+L(m2_odd):
+ rldicl. r31, r22, 63, 63 C r22 & 2
+ mulld r23, u0, u0
+ mulhdu r12, u0, u0
+ mulld r5, u1, u1
+ mulhdu r10, u1, u1
+
+ sradi r11, u0, 63
+ and r11, r11, u1
+
+ LSHU1U0
+
+ ld r8, 8(up2)
+ ld r9, 16(up2)
+ mulld r28, r8, u0 C W u1 x u0
+ mulhdu r31, r8, u0 C W u1 x u0
+ std r23, 0(rp2)
+
+ bne cr0, L(m2_11)
+L(m2_01):
+ addi up, up2, 16
+ addi rp, rp2, 0
+ b L(m2_lo2)
+L(m2_11):
+ addi up, up2, 0
+ addi rp, rp2, -16
+ b L(m2_lo0)
+
+L(m2_evn):
+ rldicl. r31, r22, 63, 63 C r22 & 2
+ mulld r23, u0, u0
+ mulhdu r5, u0, u0
+ mulld r12, u1, u1
+ mulhdu r11, u1, u1
+
+ sradi r10, u0, 63
+ and r10, r10, u1
+
+ LSHU1U0
+
+ ld r9, 8(up2)
+ ld r8, 16(up2)
+ mulld r29, r9, u0 C W u1 x u0
+ mulhdu r30, r9, u0 C W u1 x u0
+ std r23, 0(rp2)
+
+ beq cr0, L(m2_10)
+L(m2_00):
+ addi up, up2, 8
+ addi rp, rp2, -8
+ b L(m2_lo1)
+L(m2_10):
+ addi up, up2, 24
+ addi rp, rp2, 8
+ ble cr5, L(m2_end)
+
+L(m2_top):
+ ld r9, 0(up)
+ maddld( r28, r8, u0, r10)
+ maddhdu(r31, r8, u0, r10)
+ adde r5, r29, r5
+ std r5, 0(rp)
+ mulld r5, r8, u1
+ mulhdu r10, r8, u1
+ addex( r12, r12, r30, 0)
+L(m2_lo2):
+ ld r8, 8(up)
+ maddld( r29, r9, u0, r11)
+ maddhdu(r30, r9, u0, r11)
+ adde r12, r28, r12
+ std r12, 8(rp)
+ mulld r12, r9, u1
+ mulhdu r11, r9, u1
+ addex( r5, r5, r31, 0)
+L(m2_lo1):
+ ld r9, 16(up)
+ maddld( r28, r8, u0, r10)
+ maddhdu(r31, r8, u0, r10)
+ adde r5, r29, r5
+ std r5, 16(rp)
+ mulld r5, r8, u1
+ mulhdu r10, r8, u1
+ addex( r12, r12, r30, 0)
+L(m2_lo0):
+ ld r8, 24(up)
+ maddld( r29, r9, u0, r11)
+ maddhdu(r30, r9, u0, r11)
+ adde r12, r28, r12
+ std r12, 24(rp)
+ mulld r12, r9, u1
+ mulhdu r11, r9, u1
+ addex( r5, r5, r31, 0)
+ addi up, up, 32
+ addi rp, rp, 32
+ bdnz L(m2_top)
+
+L(m2_end):
+ ld r9, 0(up)
+ maddld( r28, r8, u0, r10)
+ maddhdu(r31, r8, u0, r10)
+ adde r5, r29, r5
+ std r5, 0(rp)
+ mulld r5, r8, u1
+ mulhdu r10, r8, u1
+ b L(cj) C jump to addmul_2 tail
+
+L(outer):
+ addi up2, up2, 16
+ addi rp2, rp2, 32
+
+ ld u0, 0(up2)
+ ld u1, 8(up2)
+
+ cmpdi cr5, r22, 4
+ srdi r31, r22, 2
+ addi r22, r22, -2
+ mtctr r31
+
+ ld r26, 0(rp2)
+ ld r27, 16(rp2)
+
+ rldicl. r31, r22, 63, 63 C r22 & 2
+ beq cr7, L(evn)
+
+L(odd): maddld( r23, u0, u0, r26) C W u2^2
+ maddhdu(r12, u0, u0, r26) C W u2^2
+ maddld( r5, u1, u1, r27) C W u3^2
+ maddhdu(r10, u1, u1, r27) C W u3^2
+ ld r26, 8(rp2)
+
+ ld r8, -8(up2)
+ sradi r8, r8, 63 C CAUTION: clobbers CA
+ and r8, r8, u0
+ sradi r11, u0, 63 C CAUTION: clobbers CA
+ and r11, r11, u1
+
+ LSHU1U
+
+ addc r23, r23, r8
+
+ ld r8, 8(up2)
+ ld r9, 16(up2)
+ maddld( r28, r8, u0, r26) C W u3 x u2
+ maddhdu(r31, r8, u0, r26) C W u3 x u2
+ ld r26, 24(rp2)
+ std r23, 0(rp2) C W0
+
+ bne cr0, L(11)
+L(01):
+ addi up, up2, 16
+ addi rp, rp2, 0
+ b L(lo2)
+L(11):
+ addi up, up2, 0
+ addi rp, rp2, -16
+ b L(lo0)
+
+L(evn): maddld( r23, u0, u0, r26) C W u2^2
+ maddhdu(r5, u0, u0, r26) C W u2^2
+ maddld( r12, u1, u1, r27) C W u3^2
+ maddhdu(r11, u1, u1, r27) C W u3^2
+ ld r27, 8(rp2)
+
+ ld r9, -8(up2)
+ sradi r9, r9, 63 C CAUTION: clobbers CA
+ and r9, r9, u0
+ sradi r10, u0, 63 C CAUTION: clobbers CA
+ and r10, r10, u1
+
+ LSHU1U
+
+ addc r23, r23, r9
+
+ ld r9, 8(up2)
+ ld r8, 16(up2)
+ maddld( r29, r9, u0, r27) C W u3 x u2
+ maddhdu(r30, r9, u0, r27) C W u3 x u2
+ ld r27, 24(rp2)
+ std r23, 0(rp2) C W0
+
+ beq cr0, L(10)
+L(00):
+ addi up, up2, 8
+ addi rp, rp2, -8
+ b L(lo1)
+L(10):
+ addi up, up2, 24
+ addi rp, rp2, 8
+ ble cr5, L(end)
+
+L(top): ld r9, 0(up)
+ maddld( r28, r8, u0, r10)
+ maddhdu(r31, r8, u0, r10)
+ adde r5, r29, r5
+ ld r26, 24(rp)
+ std r5, 0(rp)
+ maddld( r5, r8, u1, r27)
+ maddhdu(r10, r8, u1, r27)
+ addex( r12, r12, r30, 0)
+L(lo2): ld r8, 8(up)
+ maddld( r29, r9, u0, r11)
+ maddhdu(r30, r9, u0, r11)
+ adde r12, r28, r12
+ ld r27, 32(rp)
+ std r12, 8(rp)
+ maddld( r12, r9, u1, r26)
+ maddhdu(r11, r9, u1, r26)
+ addex( r5, r5, r31, 0)
+L(lo1): ld r9, 16(up)
+ maddld( r28, r8, u0, r10)
+ maddhdu(r31, r8, u0, r10)
+ adde r5, r29, r5
+ ld r26, 40(rp)
+ std r5, 16(rp)
+ maddld( r5, r8, u1, r27)
+ maddhdu(r10, r8, u1, r27)
+ addex( r12, r12, r30, 0)
+L(lo0): ld r8, 24(up)
+ maddld( r29, r9, u0, r11)
+ maddhdu(r30, r9, u0, r11)
+ adde r12, r28, r12
+ ld r27, 48(rp)
+ std r12, 24(rp)
+ maddld( r12, r9, u1, r26)
+ maddhdu(r11, r9, u1, r26)
+ addex( r5, r5, r31, 0)
+ addi up, up, 32
+ addi rp, rp, 32
+ bdnz L(top)
+
+L(end): ld r9, 0(up)
+ maddld( r28, r8, u0, r10)
+ maddhdu(r31, r8, u0, r10)
+ adde r5, r29, r5
+ std r5, 0(rp)
+ maddld( r5, r8, u1, r27)
+ maddhdu(r10, r8, u1, r27)
+L(cj): addex( r12, r12, r30, 0)
+ maddld( r29, r9, u0, r11)
+ maddhdu(r30, r9, u0, r11)
+ adde r12, r28, r12
+ std r12, 8(rp)
+ mulld r12, r9, u1
+ mulhdu r11, r9, u1
+ addex( r5, r5, r31, 0)
+ adde r5, r29, r5
+ std r5, 16(rp)
+ addex( r12, r12, r30, 0)
+ adde r12, r12, r10
+ std r12, 24(rp)
+ li r4, 0
+ addze r5, r11
+ addex( r5, r5, r4, 0)
+ std r5, 32(rp)
+ bgt cr5, L(outer)
+
+L(corner):
+ ld u0, 16(up2)
+ ld u1, 24(up2)
+ ld r26, 32(rp2)
+ bne cr7, L(corner_odd)
+
+L(corner_evn):
+ ld r27, 40(rp2)
+ maddld( r23, u0, u0, r26) C W u2^2
+ maddhdu(r5, u0, u0, r26) C W u2^2
+ mulld r12, u1, u1 C W u3^2
+ mulhdu r11, u1, u1 C W u3^2
+
+ ld r9, 8(up2)
+ sradi r9, r9, 63 C CAUTION: clobbers CA
+ and r9, r9, u0
+ sradi r10, u0, 63 C CAUTION: clobbers CA
+ and r10, r10, u1
+
+ LSHU1UHF
+
+ addc r23, r23, r9
+
+ ld r9, 24(up2)
+ maddld( r29, r9, u0, r27) C W u3 x u2
+ maddhdu(r30, r9, u0, r27) C W u3 x u2
+ std r23, 32(rp2)
+ adde r5, r29, r5
+ std r5, 40(rp2)
+ addex( r12, r12, r30, 0)
+ adde r12, r12, r10 C W FIXME can this co?
+ std r12, 48(rp2)
+ li r4, 0
+ addex( r5, r11, r4, 0)
+ addze r5, r5
+ std r5, 56(rp2)
+ b L(ret)
+
+L(corner_odd):
+ ld r27, 48(rp2)
+ maddld( r23, u0, u0, r26) C W u2^2
+ maddhdu(r12, u0, u0, r26) C W u2^2
+ maddld( r5, u1, u1, r27) C W u3^2
+ maddhdu(r10, u1, u1, r27) C W u3^2
+ ld r26, 40(rp2)
+
+ ld r8, 8(up2)
+ sradi r8, r8, 63 C CAUTION: clobbers CA
+ and r8, r8, u0
+ sradi r11, u0, 63 C CAUTION: clobbers CA
+ and r11, r11, u1
+
+ LSHU1UF
+
+ addc r23, r23, r8
+
+ ld r8, 24(up2)
+ ld r9, 32(up2)
+ maddld( r28, r8, u0, r26) C W u3 x u2
+ maddhdu(r31, r8, u0, r26) C W u3 x u2
+ std r23, 32(rp2)
+ maddld( r29, r9, u0, r11)
+ maddhdu(r30, r9, u0, r11)
+ adde r12, r28, r12
+ std r12, 40(rp2)
+ mulld r12, r9, u1
+ mulhdu r11, r9, u1
+ addex( r5, r5, r31, 0)
+ adde r5, r29, r5
+ std r5, 48(rp2)
+ addex( r12, r12, r30, 0)
+ adde r12, r12, r10
+ std r12, 56(rp2)
+ mulld r23, r9, r9 C W u2^2
+ mulhdu r12, r9, r9 C W u2^2
+ adde r23, r23, r11
+ addze r12, r12
+ sradi r4, r8, 63 C CAUTION: clobbers CA
+ and r4, r4, r9
+ addex( r23, r23, r4, 0)
+ std r23, 64(rp2)
+ li r4, 0
+ addex( r12, r12, r4, 0)
+ std r12, 72(rp2)
+
+L(ret): ld r22, -80(r1)
+ ld r23, -72(r1)
+ ld r24, -64(r1)
+ ld r25, -56(r1)
+ ld r26, -48(r1)
+ ld r27, -40(r1)
+ ld r28, -32(r1)
+ ld r29, -24(r1)
+ ld r30, -16(r1)
+ ld r31, -8(r1)
+ blr
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/hamdist.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/hamdist.asm
index 5af98946f75..960b3bc8495 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/hamdist.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/hamdist.asm
@@ -1,6 +1,6 @@
dnl PowerPC-64 mpn_hamdist.
-dnl Copyright 2012 Free Software Foundation, Inc.
+dnl Copyright 2012, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -64,7 +64,7 @@ L(odd): ld r6, 0(up)
ld r8, 0(vp)
addi vp, vp, 8
xor r10, r6, r8
- popcntd r0, r10
+ popcntd(r0, r10)
bdz L(e1)
L(evn): ld r6, 0(up)
@@ -85,21 +85,21 @@ L(top): add r0, r0, r30
ld r6, 0(up)
ld r8, 0(vp)
xor r11, r7, r9
- popcntd r30, r10
+ popcntd(r30, r10)
add r12, r12, r31
ld r7, 8(up)
ld r9, 8(vp)
xor r10, r6, r8
- popcntd r31, r11
+ popcntd(r31, r11)
addi up, up, 16
addi vp, vp, 16
bdnz L(top)
L(end): add r0, r0, r30
xor r11, r7, r9
- popcntd r30, r10
+ popcntd(r30, r10)
add r12, r12, r31
- popcntd r31, r11
+ popcntd(r31, r11)
add r0, r0, r30
add r12, r12, r31
diff --git a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/popcount.asm b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/popcount.asm
index eac72a64935..129ffef2453 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/popcount.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/powerpc64/p7/popcount.asm
@@ -1,6 +1,6 @@
dnl PowerPC-64 mpn_popcount.
-dnl Copyright 2012 Free Software Foundation, Inc.
+dnl Copyright 2012, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -56,13 +56,13 @@ ifdef(`HAVE_ABI_mode32',
L(odd): ld r4, 0(up)
addi up, up, 8
- popcntd r0, r4
+ popcntd(r0, r4)
bdz L(e1)
L(evn): ld r4, 0(up)
ld r5, 8(up)
- popcntd r8, r4
- popcntd r9, r5
+ popcntd(r8, r4)
+ popcntd(r9, r5)
bdz L(e2)
ld r4, 16(up)
@@ -71,18 +71,18 @@ L(evn): ld r4, 0(up)
addi up, up, 32
L(top): add r0, r0, r8
- popcntd r8, r4
+ popcntd(r8, r4)
ld r4, 0(up)
add r12, r12, r9
- popcntd r9, r5
+ popcntd(r9, r5)
ld r5, 8(up)
addi up, up, 16
bdnz L(top)
L(e4): add r0, r0, r8
- popcntd r8, r4
+ popcntd(r8, r4)
add r12, r12, r9
- popcntd r9, r5
+ popcntd(r9, r5)
L(e2): add r0, r0, r8
add r12, r12, r9
L(e1): add r3, r0, r12
diff --git a/Build/source/libs/gmp/gmp-src/mpn/riscv/64/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/riscv/64/aors_n.asm
new file mode 100644
index 00000000000..6e38083c836
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/riscv/64/aors_n.asm
@@ -0,0 +1,89 @@
+dnl RISC-V/64 mpn_add_n and mpn_sub_n.
+
+dnl Copyright 2016 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/.
+
+include(`../config.m4')
+
+C INPUT PARAMETERS
+define(`rp', `a0')
+define(`up', `a1')
+define(`vp', `a2')
+define(`n', `a3')
+
+ifdef(`OPERATION_add_n',`
+ define(`ADDSUB', `add')
+ define(`CMPCY', `sltu $1, $2, $3')
+ define(`func', `mpn_add_n')
+')
+ifdef(`OPERATION_sub_n',`
+ define(`ADDSUB', `sub')
+ define(`CMPCY', `sltu $1, $3, $2')
+ define(`func', `mpn_sub_n')
+')
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_sub_n)
+
+ASM_START()
+PROLOGUE(func)
+ li t6, 0
+
+ andi t0, n, 1
+ beq t0, x0, L(top)
+ addi up, up, 8
+ addi vp, vp, -8
+ addi rp, rp, -8
+ addi n, n, -1
+ j L(mid)
+
+L(top): ld a4, 0(up)
+ ld a6, 0(vp)
+ addi n, n, -2 C bookkeeping
+ addi up, up, 16 C bookkeeping
+ ADDSUB t0, a4, a6
+ CMPCY( t2, t0, a4)
+ ADDSUB t4, t0, t6 C cycle 3, 9, ...
+ CMPCY( t3, t4, t0) C cycle 4, 10, ...
+ sd t4, 0(rp)
+ add t6, t2, t3 C cycle 5, 11, ...
+L(mid): ld a5, -8(up)
+ ld a7, 8(vp)
+ addi vp, vp, 16 C bookkeeping
+ addi rp, rp, 16 C bookkeeping
+ ADDSUB t1, a5, a7
+ CMPCY( t2, t1, a5)
+ ADDSUB t4, t1, t6 C cycle 0, 6, ...
+ CMPCY( t3, t4, t1) C cycle 1, 7, ...
+ sd t4, -8(rp)
+ add t6, t2, t3 C cycle 2, 8, ...
+ bne n, x0, L(top) C bookkeeping
+
+L(end): mv a0, t6
+ ret
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/riscv/64/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/riscv/64/aorsmul_1.asm
new file mode 100644
index 00000000000..1125a9f586e
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/riscv/64/aorsmul_1.asm
@@ -0,0 +1,75 @@
+dnl RISC-V/64 mpn_addmul_1 and mpn_submul_1.
+
+dnl Copyright 2016 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/.
+
+include(`../config.m4')
+
+C INPUT PARAMETERS
+define(`rp', `a0')
+define(`up', `a1')
+define(`n', `a2')
+define(`v0', `a3')
+
+ifdef(`OPERATION_addmul_1',`
+ define(`ADDSUB', `add')
+ define(`CMPCY', `sltu $1, $2, $3')
+ define(`func', `mpn_addmul_1')
+')
+ifdef(`OPERATION_submul_1',`
+ define(`ADDSUB', `sub')
+ define(`CMPCY', `sltu $1, $3, $2')
+ define(`func', `mpn_submul_1')
+')
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+
+ASM_START()
+PROLOGUE(func)
+ li a6, 0
+
+L(top): ld a7, 0(up)
+ addi up, up, 8 C bookkeeping
+ ld a4, 0(rp)
+ addi rp, rp, 8 C bookkeeping
+ mul a5, a7, v0
+ addi n, n, -1 C bookkeeping
+ mulhu a7, a7, v0
+ ADDSUB a5, a4, a5
+ ADDSUB a6, a5, a6 C cycle 0, 3, ...
+ CMPCY( a4, a5, a4)
+ add a4, a4, a7
+ CMPCY( a5, a6, a5) C cycle 1, 4, ...
+ sd a6, -8(rp)
+ add a6, a4, a5 C cycle 2, 5, ...
+ bne n, x0, L(top) C bookkeeping
+
+L(end): mv a0, a6
+ ret
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/riscv/64/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/riscv/64/mul_1.asm
new file mode 100644
index 00000000000..e35eaa9dc9d
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/riscv/64/mul_1.asm
@@ -0,0 +1,58 @@
+dnl RISC-V/64 mpn_mul_1.
+
+dnl Copyright 2016 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/.
+
+include(`../config.m4')
+
+C INPUT PARAMETERS
+define(`rp', `a0')
+define(`up', `a1')
+define(`n', `a2')
+define(`v0', `a3')
+
+ASM_START()
+PROLOGUE(mpn_mul_1)
+ li a6, 0
+
+L(top): ld a7, 0(up)
+ addi up, up, 8 C bookkeeping
+ addi rp, rp, 8 C bookkeeping
+ mul a5, a7, v0
+ addi n, n, -1 C bookkeeping
+ mulhu a7, a7, v0
+ add a6, a5, a6 C cycle 0, 3, ...
+ sltu a5, a6, a5 C cycle 1, 4, ...
+ sd a6, -8(rp)
+ add a6, a7, a5 C cycle 2, 5, ...
+ bne n, x0, L(top) C bookkeeping
+
+L(end): mv a0, a6
+ ret
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/gmp-mparam.h
index a805fa1492d..c0e504689c3 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/gmp-mparam.h
@@ -31,177 +31,147 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 4400 MHz IBM z10 running in 32-bit mode */
-/* FFT tuning limit = 15000000 */
-/* Generated by tuneup.c, 2014-03-12, gcc 4.7 */
+/* 4400 MHz IBM z196 running in 32-bit mode */
+/* FFT tuning limit = 0.5M */
+/* Generated by tuneup.c, 2017-01-02, gcc 4.9 */
-#define DIVREM_1_NORM_THRESHOLD 3
+#define DIVREM_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVREM_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define MOD_1_1P_METHOD 1
-#define MOD_1_NORM_THRESHOLD 4
-#define MOD_1_UNNORM_THRESHOLD 8
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 16
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1_1P_METHOD 2
+#define MOD_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 45
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 18
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 38
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 30
-#define USE_PREINV_DIVREM_1 1
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD MP_SIZE_T_MAX
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 3
+#define USE_PREINV_DIVREM_1 0
#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 56
+#define DIVEXACT_1_THRESHOLD 6
+#define BMOD_1_TO_MOD_1_THRESHOLD 0 /* always */
-#define MUL_TOOM22_THRESHOLD 8
-#define MUL_TOOM33_THRESHOLD 59
-#define MUL_TOOM44_THRESHOLD 88
-#define MUL_TOOM6H_THRESHOLD 125
-#define MUL_TOOM8H_THRESHOLD 169
+#define DIV_1_VS_MUL_1_PERCENT 320
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 57
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 55
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 57
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 56
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 82
+#define MUL_TOOM22_THRESHOLD 12
+#define MUL_TOOM33_THRESHOLD 81
+#define MUL_TOOM44_THRESHOLD 130
+#define MUL_TOOM6H_THRESHOLD 173
+#define MUL_TOOM8H_THRESHOLD 260
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 91
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 83
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 86
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 112
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 14
-#define SQR_TOOM3_THRESHOLD 90
-#define SQR_TOOM4_THRESHOLD 144
-#define SQR_TOOM6_THRESHOLD 196
-#define SQR_TOOM8_THRESHOLD 309
+#define SQR_TOOM2_THRESHOLD 18
+#define SQR_TOOM3_THRESHOLD 69
+#define SQR_TOOM4_THRESHOLD 178
+#define SQR_TOOM6_THRESHOLD 254
+#define SQR_TOOM8_THRESHOLD 406
-#define MULMID_TOOM42_THRESHOLD 24
+#define MULMID_TOOM42_THRESHOLD 30
#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 10
+#define SQRMOD_BNM1_THRESHOLD 7
-#define MUL_FFT_MODF_THRESHOLD 252 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 276 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 252, 5}, { 9, 6}, { 5, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 13, 7}, { 7, 6}, \
- { 15, 7}, { 9, 6}, { 19, 7}, { 11, 6}, \
- { 23, 7}, { 13, 8}, { 7, 7}, { 15, 6}, \
- { 31, 7}, { 19, 8}, { 11, 7}, { 23, 9}, \
- { 7, 8}, { 15, 7}, { 31, 8}, { 19, 7}, \
- { 39, 8}, { 27, 9}, { 15, 8}, { 39, 9}, \
- { 23,10}, { 15, 9}, { 31, 8}, { 63, 9}, \
- { 39, 8}, { 79, 9}, { 47,10}, { 31, 9}, \
- { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
- { 127, 8}, { 255,10}, { 79, 8}, { 319, 9}, \
- { 175, 8}, { 351, 7}, { 703, 6}, { 1407,10}, \
- { 95, 9}, { 191, 8}, { 383, 9}, { 207, 8}, \
- { 415, 7}, { 831, 9}, { 223,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 143, 9}, { 287, 8}, \
- { 575, 9}, { 319,10}, { 175, 9}, { 351, 8}, \
- { 703, 7}, { 1407,11}, { 95,10}, { 191, 9}, \
- { 383,10}, { 207, 9}, { 415, 8}, { 831,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 575,11}, \
- { 159,10}, { 351, 9}, { 703, 8}, { 1407,11}, \
- { 191,10}, { 415, 9}, { 831,11}, { 223,10}, \
- { 447, 9}, { 895, 8}, { 1791,10}, { 479, 9}, \
- { 959,12}, { 127,11}, { 287,10}, { 575,11}, \
- { 351,10}, { 703, 9}, { 1407,12}, { 191,11}, \
- { 415,10}, { 831,11}, { 447,10}, { 895, 9}, \
- { 1791,11}, { 479,10}, { 959,13}, { 127,12}, \
- { 255,11}, { 575,12}, { 319,11}, { 703,10}, \
- { 1407,12}, { 383,11}, { 831,12}, { 447,11}, \
- { 895,10}, { 1791,11}, { 959,10}, { 1919, 9}, \
- { 3839,13}, { 255,12}, { 575,11}, { 1215,10}, \
- { 2431,12}, { 703,11}, { 1407,13}, { 383,12}, \
- { 895,11}, { 1791,12}, { 959,11}, { 1919,10}, \
- { 3839,14}, { 255,13}, { 511,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,13}, { 895,12}, \
- { 1919,11}, { 3839,10}, { 7679,14}, { 511,13}, \
- { 1023,12}, { 2047,13}, { 1151,12}, { 2431,13}, \
- { 1407,14}, { 767,13}, { 8192,14}, { 16384,15}, \
+ { { 276, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \
+ { 9, 5}, { 19, 6}, { 13, 7}, { 7, 6}, \
+ { 17, 7}, { 9, 6}, { 19, 7}, { 11, 6}, \
+ { 23, 7}, { 13, 8}, { 7, 7}, { 19, 8}, \
+ { 11, 7}, { 25, 8}, { 15, 7}, { 31, 8}, \
+ { 19, 7}, { 39, 8}, { 23, 9}, { 15, 8}, \
+ { 39, 9}, { 23,10}, { 15, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47,10}, \
+ { 31, 9}, { 71, 8}, { 143, 9}, { 79,10}, \
+ { 47,11}, { 31,10}, { 63, 9}, { 127, 8}, \
+ { 255, 7}, { 511, 9}, { 143,10}, { 79, 9}, \
+ { 159, 8}, { 319, 9}, { 175, 8}, { 351,10}, \
+ { 95, 9}, { 191, 8}, { 383,11}, { 63,10}, \
+ { 127, 9}, { 255, 8}, { 511,10}, { 143, 9}, \
+ { 287, 8}, { 575,10}, { 159, 9}, { 319,10}, \
+ { 175, 9}, { 351,11}, { 95,10}, { 191, 9}, \
+ { 383,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 271, 9}, { 543, 8}, { 1087,10}, \
+ { 287, 9}, { 575,11}, { 159,10}, { 351, 9}, \
+ { 703, 8}, { 1407,11}, { 191,10}, { 415, 9}, \
+ { 831,11}, { 223,10}, { 479, 9}, { 959, 8}, \
+ { 1919,12}, { 4096,13}, { 8192,14}, { 16384,15}, \
{ 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 149
-#define MUL_FFT_THRESHOLD 2240
+#define MUL_FFT_TABLE3_SIZE 89
+#define MUL_FFT_THRESHOLD 2688
-#define SQR_FFT_MODF_THRESHOLD 244 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 240 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 244, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \
- { 11, 5}, { 23, 6}, { 13, 7}, { 7, 6}, \
- { 16, 7}, { 9, 6}, { 19, 7}, { 11, 6}, \
- { 23, 7}, { 13, 8}, { 7, 7}, { 19, 8}, \
- { 11, 7}, { 23, 9}, { 7, 8}, { 15, 7}, \
- { 31, 8}, { 19, 7}, { 39, 8}, { 23, 9}, \
- { 15, 8}, { 39, 9}, { 23,10}, { 15, 9}, \
- { 31, 8}, { 63, 9}, { 39, 8}, { 79, 9}, \
- { 47,10}, { 31, 9}, { 63, 8}, { 127, 9}, \
- { 71, 8}, { 143, 7}, { 287,10}, { 47,11}, \
- { 31,10}, { 63, 9}, { 127, 8}, { 255, 9}, \
- { 143, 8}, { 287,10}, { 79, 9}, { 159, 8}, \
- { 319, 9}, { 175, 8}, { 351, 7}, { 703, 6}, \
- { 1407,10}, { 95, 9}, { 191, 8}, { 383,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
+ { { 240, 5}, { 17, 6}, { 17, 7}, { 9, 6}, \
+ { 19, 7}, { 11, 6}, { 23, 7}, { 13, 8}, \
+ { 7, 7}, { 19, 8}, { 11, 7}, { 25, 8}, \
+ { 15, 7}, { 33, 8}, { 19, 7}, { 39, 8}, \
+ { 23, 9}, { 15, 8}, { 39, 9}, { 23,10}, \
+ { 15, 9}, { 31, 8}, { 63, 9}, { 47,10}, \
+ { 31, 9}, { 63, 8}, { 127, 9}, { 71, 8}, \
+ { 143,10}, { 47,11}, { 31,10}, { 63, 9}, \
+ { 127, 8}, { 255, 7}, { 511, 9}, { 143,10}, \
+ { 79, 9}, { 159, 8}, { 319, 9}, { 175, 8}, \
+ { 351, 7}, { 703,10}, { 95, 9}, { 191, 8}, \
+ { 383, 9}, { 207, 8}, { 415,11}, { 63,10}, \
+ { 127, 9}, { 255, 8}, { 511,10}, { 143, 9}, \
{ 287, 8}, { 575,10}, { 159, 9}, { 319,10}, \
{ 175, 9}, { 351, 8}, { 703, 7}, { 1407,11}, \
- { 95,10}, { 191, 9}, { 383,10}, { 207,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 287, 9}, { 575,11}, { 159,10}, { 351, 9}, \
- { 703, 8}, { 1407,11}, { 191,10}, { 415,11}, \
- { 223,10}, { 447, 9}, { 895, 8}, { 1791,10}, \
- { 479, 9}, { 959,12}, { 127,11}, { 255,10}, \
- { 511,11}, { 287,10}, { 575,11}, { 319,10}, \
- { 639,11}, { 351,10}, { 703, 9}, { 1407,12}, \
- { 191,11}, { 415,10}, { 831,11}, { 447,10}, \
- { 895, 9}, { 1791,11}, { 479,13}, { 127,12}, \
- { 255,11}, { 575,12}, { 319,11}, { 703,10}, \
- { 1407,12}, { 383,11}, { 831,12}, { 447,11}, \
- { 895,10}, { 1791,11}, { 959,10}, { 1919,13}, \
- { 255,12}, { 511,11}, { 1023,12}, { 575,11}, \
- { 1215,10}, { 2431,12}, { 703,11}, { 1407,13}, \
- { 383,12}, { 895,11}, { 1791,12}, { 959,11}, \
- { 1919,14}, { 255,13}, { 511,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,11}, { 2943,10}, \
- { 5887,13}, { 895,12}, { 1919,11}, { 3839,10}, \
- { 7679,14}, { 511,13}, { 1023,12}, { 2047,13}, \
- { 1151,12}, { 2431,13}, { 1407,12}, { 2943,11}, \
- { 5887,14}, { 767,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 161
-#define SQR_FFT_THRESHOLD 1728
+ { 95,10}, { 191, 9}, { 383,10}, { 207, 9}, \
+ { 415,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 287, 9}, { 575,11}, { 159,10}, \
+ { 351, 9}, { 703, 8}, { 1407,11}, { 191,10}, \
+ { 415, 9}, { 831,11}, { 223,10}, { 479,12}, \
+ { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
+#define SQR_FFT_TABLE3_SIZE 84
+#define SQR_FFT_THRESHOLD 1856
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 33
-#define MULLO_MUL_N_THRESHOLD 4392
-
-#define DC_DIV_QR_THRESHOLD 43
-#define DC_DIVAPPR_Q_THRESHOLD 150
-#define DC_BDIV_QR_THRESHOLD 38
-#define DC_BDIV_Q_THRESHOLD 107
-
-#define INV_MULMOD_BNM1_THRESHOLD 14
-#define INV_NEWTON_THRESHOLD 165
-#define INV_APPR_THRESHOLD 149
-
-#define BINV_NEWTON_THRESHOLD 147
-#define REDC_1_TO_REDC_N_THRESHOLD 43
-
-#define MU_DIV_QR_THRESHOLD 777
-#define MU_DIVAPPR_Q_THRESHOLD 942
-#define MUPI_DIV_QR_THRESHOLD 69
-#define MU_BDIV_QR_THRESHOLD 654
-#define MU_BDIV_Q_THRESHOLD 777
-
-#define POWM_SEC_TABLE 3,32,126,692,1486
-
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 103
-#define HGCD_APPR_THRESHOLD 144
-#define HGCD_REDUCE_THRESHOLD 1437
-#define GCD_DC_THRESHOLD 275
-#define GCDEXT_DC_THRESHOLD 206
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 9
-#define GET_STR_PRECOMPUTE_THRESHOLD 20
-#define SET_STR_DC_THRESHOLD 532
-#define SET_STR_PRECOMPUTE_THRESHOLD 999
-
-#define FAC_DSC_THRESHOLD 156
+#define MULLO_DC_THRESHOLD 27
+#define MULLO_MUL_N_THRESHOLD 5240
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 65
+#define SQRLO_SQR_THRESHOLD 3470
+
+#define DC_DIV_QR_THRESHOLD 32
+#define DC_DIVAPPR_Q_THRESHOLD 135
+#define DC_BDIV_QR_THRESHOLD 32
+#define DC_BDIV_Q_THRESHOLD 80
+
+#define INV_MULMOD_BNM1_THRESHOLD 42
+#define INV_NEWTON_THRESHOLD 177
+#define INV_APPR_THRESHOLD 139
+
+#define BINV_NEWTON_THRESHOLD 179
+#define REDC_1_TO_REDC_N_THRESHOLD 39
+
+#define MU_DIV_QR_THRESHOLD 872
+#define MU_DIVAPPR_Q_THRESHOLD 998
+#define MUPI_DIV_QR_THRESHOLD 66
+#define MU_BDIV_QR_THRESHOLD 748
+#define MU_BDIV_Q_THRESHOLD 906
+
+#define POWM_SEC_TABLE 9,34,257,946,2913
+
+#define GET_STR_DC_THRESHOLD 10
+#define GET_STR_PRECOMPUTE_THRESHOLD 16
+#define SET_STR_DC_THRESHOLD 1045
+#define SET_STR_PRECOMPUTE_THRESHOLD 1800
+
+#define FAC_DSC_THRESHOLD 77
#define FAC_ODD_THRESHOLD 24
+
+#define MATRIX22_STRASSEN_THRESHOLD 15
+#define HGCD_THRESHOLD 121
+#define HGCD_APPR_THRESHOLD 142
+#define HGCD_REDUCE_THRESHOLD 1679
+#define GCD_DC_THRESHOLD 389
+#define GCDEXT_DC_THRESHOLD 285
+#define JACOBI_BASE_METHOD 4
diff --git a/Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/sqr_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/sqr_basecase.asm
index dcc13112bf3..f45f87a776d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/sqr_basecase.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/s390_32/esame/sqr_basecase.asm
@@ -169,7 +169,7 @@ L(outer_end):
st %r1, 12(rp)
st %r0, 16(rp)
-C sqr_dia_addlsh1 ============================================================
+C sqr_diag_addlsh1 ============================================================
define(`up', `up_saved')
define(`rp', `rp_saved')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/s390_64/README b/Build/source/libs/gmp/gmp-src/mpn/s390_64/README
index 52609e8f1df..53702dbd7ed 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/s390_64/README
+++ b/Build/source/libs/gmp/gmp-src/mpn/s390_64/README
@@ -28,7 +28,7 @@ see https://www.gnu.org/licenses/.
-There are 5 generations of 64-but s390 processors, z900, z990, z9,
+There are 5 generations of 64-bit s390 processors, z900, z990, z9,
z10, and z196. The current GMP code was optimised for the two oldest,
z900 and z990.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/s390_64/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/s390_64/gmp-mparam.h
index dacd9966a4b..062c3d2cc80 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/s390_64/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/s390_64/gmp-mparam.h
@@ -31,145 +31,151 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 1200 MHz z990 */
+/* 4400 MHz z196 */
+/* Generated by tuneup.c, 2017-01-02, gcc 4.9 */
-#define DIVREM_1_NORM_THRESHOLD 0 /* always */
-#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
+#define DIVREM_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVREM_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define MOD_1_1P_METHOD 2
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 62
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 17
-#define USE_PREINV_DIVREM_1 1
+#define MOD_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 14
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 15
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 31
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 2
+#define USE_PREINV_DIVREM_1 0
#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 98
-
-#define MUL_TOOM22_THRESHOLD 10
-#define MUL_TOOM33_THRESHOLD 41
-#define MUL_TOOM44_THRESHOLD 105
-#define MUL_TOOM6H_THRESHOLD 149
-#define MUL_TOOM8H_THRESHOLD 212
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 65
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 69
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 72
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 64
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 55
+#define DIV_QR_2_PI2_THRESHOLD 10
+#define DIVEXACT_1_THRESHOLD 4
+#define BMOD_1_TO_MOD_1_THRESHOLD 0 /* always */
+
+#define DIV_1_VS_MUL_1_PERCENT 317
+
+#define MUL_TOOM22_THRESHOLD 14
+#define MUL_TOOM33_THRESHOLD 45
+#define MUL_TOOM44_THRESHOLD 121
+#define MUL_TOOM6H_THRESHOLD 177
+#define MUL_TOOM8H_THRESHOLD 260
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 78
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 81
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 88
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 118
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 16
-#define SQR_TOOM3_THRESHOLD 57
-#define SQR_TOOM4_THRESHOLD 153
-#define SQR_TOOM6_THRESHOLD 204
-#define SQR_TOOM8_THRESHOLD 309
+#define SQR_TOOM2_THRESHOLD 13
+#define SQR_TOOM3_THRESHOLD 89
+#define SQR_TOOM4_THRESHOLD 242
+#define SQR_TOOM6_THRESHOLD 363
+#define SQR_TOOM8_THRESHOLD 482
-#define MULMID_TOOM42_THRESHOLD 20
+#define MULMID_TOOM42_THRESHOLD 38
-#define MULMOD_BNM1_THRESHOLD 10
-#define SQRMOD_BNM1_THRESHOLD 11
+#define MULMOD_BNM1_THRESHOLD 9
+#define SQRMOD_BNM1_THRESHOLD 9
-#define MUL_FFT_MODF_THRESHOLD 220 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 236 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 220, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 13, 7}, { 7, 6}, \
- { 15, 7}, { 8, 6}, { 17, 7}, { 9, 6}, \
- { 19, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 19, 8}, { 13, 9}, { 7, 8}, \
- { 19, 9}, { 11, 8}, { 23,10}, { 7, 9}, \
- { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
- { 23,10}, { 15, 9}, { 39,10}, { 23,11}, \
- { 15,10}, { 31, 9}, { 63,10}, { 39, 9}, \
- { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
- { 127, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
- { 287,10}, { 79,11}, { 47,12}, { 31,11}, \
- { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
- { 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
- { 319,10}, { 175, 9}, { 351, 8}, { 703, 7}, \
- { 1407,11}, { 95,10}, { 191, 9}, { 383,10}, \
- { 207,11}, { 111,10}, { 223,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,11}, { 143,10}, \
- { 287, 9}, { 575, 8}, { 1151,10}, { 319,11}, \
- { 175,10}, { 351, 9}, { 703,12}, { 95,11}, \
- { 191,10}, { 383, 9}, { 767,11}, { 207,10}, \
- { 415,11}, { 223,13}, { 8192,14}, { 16384,15}, \
- { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 97
-#define MUL_FFT_THRESHOLD 1728
-
-#define SQR_FFT_MODF_THRESHOLD 212 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 212, 5}, { 7, 4}, { 15, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 15, 7}, { 8, 6}, \
- { 17, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 19, 8}, { 11, 7}, { 23, 8}, \
+ { { 236, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
+ { 13, 7}, { 7, 6}, { 15, 7}, { 8, 6}, \
+ { 17, 7}, { 17, 8}, { 9, 7}, { 19, 8}, \
{ 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
- { 25,10}, { 7, 9}, { 15, 8}, { 31, 9}, \
+ { 25,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
{ 19, 8}, { 39, 9}, { 23,10}, { 15, 9}, \
- { 39,10}, { 23,11}, { 15,10}, { 31, 9}, \
- { 63,10}, { 47,11}, { 31,10}, { 63, 9}, \
- { 127, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
- { 287,10}, { 79,11}, { 47,12}, { 31,11}, \
+ { 39,10}, { 23, 9}, { 47,11}, { 15,10}, \
+ { 31, 9}, { 67,10}, { 39, 9}, { 79,10}, \
+ { 47,11}, { 31,10}, { 63, 9}, { 127, 8}, \
+ { 255,10}, { 71, 9}, { 143, 8}, { 287, 7}, \
+ { 575, 9}, { 159,11}, { 47,12}, { 31,11}, \
{ 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
{ 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
{ 319, 8}, { 639,10}, { 175, 9}, { 351, 8}, \
- { 703,10}, { 191, 9}, { 383, 8}, { 767,10}, \
- { 207, 9}, { 415,11}, { 111,10}, { 223,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,11}, \
- { 143,10}, { 287, 9}, { 575, 8}, { 1151,11}, \
- { 159,10}, { 319,11}, { 175,10}, { 351, 9}, \
- { 703,11}, { 191,10}, { 383,11}, { 207,10}, \
- { 415,11}, { 223,13}, { 8192,14}, { 16384,15}, \
- { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 93
-#define SQR_FFT_THRESHOLD 1600
-
-#define MULLO_BASECASE_THRESHOLD 2
-#define MULLO_DC_THRESHOLD 33
-#define MULLO_MUL_N_THRESHOLD 3176
-
-#define DC_DIV_QR_THRESHOLD 28
-#define DC_DIVAPPR_Q_THRESHOLD 107
-#define DC_BDIV_QR_THRESHOLD 31
-#define DC_BDIV_Q_THRESHOLD 78
-
-#define INV_MULMOD_BNM1_THRESHOLD 43
-#define INV_NEWTON_THRESHOLD 129
-#define INV_APPR_THRESHOLD 117
-
-#define BINV_NEWTON_THRESHOLD 149
-#define REDC_1_TO_REDC_N_THRESHOLD 38
-
-#define MU_DIV_QR_THRESHOLD 748
-#define MU_DIVAPPR_Q_THRESHOLD 748
-#define MUPI_DIV_QR_THRESHOLD 65
-#define MU_BDIV_QR_THRESHOLD 562
-#define MU_BDIV_Q_THRESHOLD 734
-
-#define POWM_SEC_TABLE 4,23,274,961,2783
-
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 79
-#define HGCD_APPR_THRESHOLD 70
-#define HGCD_REDUCE_THRESHOLD 1094
-#define GCD_DC_THRESHOLD 183
-#define GCDEXT_DC_THRESHOLD 148
+ { 703,11}, { 95,10}, { 191, 9}, { 383, 8}, \
+ { 767,10}, { 207, 9}, { 415, 8}, { 831,10}, \
+ { 223,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,11}, { 143,10}, { 287, 9}, { 575, 8}, \
+ { 1151,11}, { 159,10}, { 319, 9}, { 639,11}, \
+ { 175,10}, { 351, 9}, { 703, 8}, { 1407,12}, \
+ { 95,11}, { 191,10}, { 383, 9}, { 767,11}, \
+ { 207,10}, { 415, 9}, { 831,11}, { 223,13}, \
+ { 8192,14}, { 16384,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 99
+#define MUL_FFT_THRESHOLD 2240
+
+#define SQR_FFT_MODF_THRESHOLD 220 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 220, 5}, { 7, 4}, { 15, 5}, { 13, 6}, \
+ { 7, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \
+ { 13, 7}, { 7, 6}, { 15, 7}, { 8, 6}, \
+ { 17, 7}, { 9, 6}, { 19, 7}, { 13, 8}, \
+ { 7, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
+ { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
+ { 19, 9}, { 11, 8}, { 23, 9}, { 15, 8}, \
+ { 31, 9}, { 19, 8}, { 39, 9}, { 23,10}, \
+ { 15, 9}, { 39,10}, { 23,11}, { 15,10}, \
+ { 31, 9}, { 63,10}, { 47,11}, { 31,10}, \
+ { 63, 9}, { 127, 8}, { 255,10}, { 71, 9}, \
+ { 143, 8}, { 287,11}, { 47,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
+ { 143, 9}, { 287, 8}, { 575, 7}, { 1151,10}, \
+ { 159, 9}, { 319, 8}, { 639,10}, { 175, 9}, \
+ { 351, 8}, { 703,11}, { 95,10}, { 191, 9}, \
+ { 383,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,11}, { 143,10}, { 287, 9}, { 575, 8}, \
+ { 1151,11}, { 159,10}, { 319, 9}, { 639,11}, \
+ { 175,10}, { 351, 9}, { 703,12}, { 95,11}, \
+ { 191,10}, { 383,11}, { 207,13}, { 8192,14}, \
+ { 16384,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
+ { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+ {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 94
+#define SQR_FFT_THRESHOLD 1728
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 38
+#define MULLO_MUL_N_THRESHOLD 4392
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 54
+#define SQRLO_SQR_THRESHOLD 3176
+
+#define DC_DIV_QR_THRESHOLD 42
+#define DC_DIVAPPR_Q_THRESHOLD 148
+#define DC_BDIV_QR_THRESHOLD 46
+#define DC_BDIV_Q_THRESHOLD 107
+
+#define INV_MULMOD_BNM1_THRESHOLD 34
+#define INV_NEWTON_THRESHOLD 163
+#define INV_APPR_THRESHOLD 131
+
+#define BINV_NEWTON_THRESHOLD 183
+#define REDC_1_TO_REDC_N_THRESHOLD 43
+
+#define MU_DIV_QR_THRESHOLD 807
+#define MU_DIVAPPR_Q_THRESHOLD 942
+#define MUPI_DIV_QR_THRESHOLD 78
+#define MU_BDIV_QR_THRESHOLD 680
+#define MU_BDIV_Q_THRESHOLD 828
+
+#define POWM_SEC_TABLE 3,35,285,1603
+
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 21
+#define SET_STR_DC_THRESHOLD 1391
+#define SET_STR_PRECOMPUTE_THRESHOLD 2872
+
+#define FAC_DSC_THRESHOLD 151
+#define FAC_ODD_THRESHOLD 23
+
+#define MATRIX22_STRASSEN_THRESHOLD 15
+#define HGCD_THRESHOLD 135
+#define HGCD_APPR_THRESHOLD 169
+#define HGCD_REDUCE_THRESHOLD 1437
+#define GCD_DC_THRESHOLD 469
+#define GCDEXT_DC_THRESHOLD 342
#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 30
-#define GET_STR_PRECOMPUTE_THRESHOLD 41
-#define SET_STR_DC_THRESHOLD 402
-#define SET_STR_PRECOMPUTE_THRESHOLD 1104
-
-#define FAC_DSC_THRESHOLD 842
-#define FAC_ODD_THRESHOLD 0 /* always */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc32/sparc-defs.m4 b/Build/source/libs/gmp/gmp-src/mpn/sparc32/sparc-defs.m4
index 5a0d4252047..33a0c535bc5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc32/sparc-defs.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc32/sparc-defs.m4
@@ -3,7 +3,7 @@ divert(-1)
dnl m4 macros for SPARC assembler (32 and 64 bit).
-dnl Copyright 2002, 2011, 2013 Free Software Foundation, Inc.
+dnl Copyright 2002, 2011, 2013, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -62,6 +62,15 @@ dnl
dnl Use whatever 64-bit code sequence is appropriate to load "symbol" into
dnl register "reg", potentially using register "pic_reg" to perform the
dnl calculations.
+dnl
+dnl Caveat: We used to use the setx pseudo insn here, but some GNU/Linux
+dnl releases causes invalid code or relocs for that.
+dnl
+dnl Optimisation 1: Use thunk call instead of RDPC which causes pipeline
+dnl replay for some sparcs.
+dnl
+dnl Optimisation 2: Do the two symbol building sequences in parallel instead
+dnl of one after the other. That might need one more scratch register.
define(LEA64,
m4_assert_numargs(3)
@@ -71,9 +80,14 @@ m4_assert_defined(`HAVE_GOTDATA')
sethi %hi(_GLOBAL_OFFSET_TABLE_+4), %`$3'
add %`$3', %lo(_GLOBAL_OFFSET_TABLE_+8), %`$3'
add %`$2', %`$3', %`$3'
- sethi %hi(`$1'), %`$2'
- or %`$2', %lo(`$1'), %`$2'
- ldx [%`$3' + %`$2'], %`$2'',`
- setx `$1', %`$3', %`$2'')')
+ sethi %gdop_hix22(`$1'), %`$2'
+ xor %`$2', %gdop_lox10(`$1'), %`$2'
+ ldx [%`$3' + %`$2'], %`$2', %gdop(`$1')
+',`
+ sethi %h44(`$1'), %`$2'
+ or %`$2', %m44(`$1'), %`$2'
+ sllx %`$2', 12, %`$2'
+ or %`$2', %l44(`$1'), %$2
+')')
divert
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/dive_1.c b/Build/source/libs/gmp/gmp-src/mpn/sparc64/dive_1.c
index c3fbf01b14c..4264f292d7b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc64/dive_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/dive_1.c
@@ -4,7 +4,7 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2003, 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -88,16 +87,20 @@ mpn_divexact_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor)
{
count_trailing_zeros (rshift, divisor);
divisor >>= rshift;
+ lshift = 64 - rshift;
+
+ lshift_mask = MP_LIMB_T_MAX;
}
else
- rshift = 0;
-
- binvert_limb (inverse, divisor);
+ {
+ rshift = 0;
- lshift = 64 - rshift;
+ /* rshift==0 means no shift, so must mask out other part in this case */
+ lshift = 0;
+ lshift_mask = 0;
+ }
- /* lshift==64 means no shift, so must mask out other part in this case */
- lshift_mask = (rshift == 0 ? 0 : MP_LIMB_T_MAX);
+ binvert_limb (inverse, divisor);
c = 0;
divisor_h = HIGH32 (divisor);
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/divrem_1.c b/Build/source/libs/gmp/gmp-src/mpn/sparc64/divrem_1.c
index 531494a94f6..ac94565f6ee 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc64/divrem_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/divrem_1.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/sparc64/gcd_11.asm
index e4d8de6a28e..5564751f058 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc64/gcd_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/gcd_11.asm
@@ -1,4 +1,4 @@
-dnl SPARC64 mpn_gcd_1.
+dnl SPARC64 mpn_gcd_11.
dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for SPARC by Torbjörn
dnl Granlund.
@@ -56,78 +56,31 @@ forloop(i,1,MASK,
')
SIZE(ctz_table,.-ctz_table)
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 14)
-
-C INPUT PARAMETERS
-define(`up', `%i0')
-define(`n', `%i1')
-define(`v0', `%i2')
-
+define(`u0', `%o0')
+define(`v0', `%o1')
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
-PROLOGUE(mpn_gcd_1)
- save %sp, -192, %sp
- ldx [up+0], %g1 C U low limb
- mov -1, %i4
- or v0, %g1, %g2 C x | y
-
-L(twos):
- inc %i4
- andcc %g2, 1, %g0
- bz,a %xcc, L(twos)
- srlx %g2, 1, %g2
-
-L(divide_strip_y):
- andcc v0, 1, %g0
- bz,a %xcc, L(divide_strip_y)
- srlx v0, 1, v0
-
- cmp n, 1 C if n > 1 we need
- bnz %xcc, L(bmod) C to call bmod_1
- nop
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- srlx %g1, BMOD_THRES_LOG2, %g2
- cmp %g2, v0
- bleu %xcc, L(noreduce)
- mov %g1, %o0
-
-L(bmod):
- mov up, %o0
- mov n, %o1
- mov v0, %o2
- call mpn_modexact_1c_odd
- mov 0, %o3
-
-L(noreduce):
-
- LEA64(ctz_table, i5, g4)
-
- cmp %o0, 0
- bnz %xcc, L(mid)
- and %o0, MASK, %g3 C
-
- return %i7+8
- sllx %o2, %o4, %o0 C CAUTION: v0 alias for o2
+PROLOGUE(mpn_gcd_11)
+ LEA64(ctz_table, o5, g4)
+ b L(odd)
+ mov u0, %o4
ALIGN(16)
-L(top): movcc %xcc, %l4, v0 C v = min(u,v)
- movcc %xcc, %l2, %o0 C u = |v - u]
-L(mid): ldub [%i5+%g3], %g5 C
+L(top): movcc %xcc, %o4, v0 C v = min(u,v)
+ movcc %xcc, %o2, %o0 C u = |v - u]
+L(mid): ldub [%o5+%g3], %g5 C
brz,a,pn %g3, L(shift_alot) C
srlx %o0, MAXSHIFT, %o0
- srlx %o0, %g5, %l4 C new u, odd
- subcc v0, %l4, %l2 C v - u, set flags for branch and movcc
- sub %l4, v0, %o0 C u - v
+ srlx %o0, %g5, %o4 C new u, odd
+L(odd): subcc v0, %o4, %o2 C v - u, set flags for branch and movcc
+ sub %o4, v0, %o0 C u - v
bnz,pt %xcc, L(top) C
- and %l2, MASK, %g3 C extract low MAXSHIFT bits from (v-u)
+ and %o2, MASK, %g3 C extract low MAXSHIFT bits from (v-u)
- return %i7+8
- sllx %o2, %o4, %o0 C CAUTION: v0 alias for o2
+ retl
+ mov v0, %o0
L(shift_alot):
b L(mid)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1.c b/Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1.c
index f1c51970d97..ab53f9ddc25 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1_4.c b/Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1_4.c
index cc1b9484bcc..735a402675f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1_4.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/mod_1_4.c
@@ -37,7 +37,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/mode1o.c b/Build/source/libs/gmp/gmp-src/mpn/sparc64/mode1o.c
index 7c8fc1cf3d8..771c99915ca 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc64/mode1o.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/mode1o.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/sparc64.h b/Build/source/libs/gmp/gmp-src/mpn/sparc64/sparc64.h
index 09fc16d46a4..8698a82a72c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc64/sparc64.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/sparc64.h
@@ -215,5 +215,3 @@ Error, error, unknown limb endianness;
(r) = _r; \
(q) = _q; \
} while (0)
-
-
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/bdiv_q_1.asm b/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/bdiv_q_1.asm
new file mode 100644
index 00000000000..98470479fd5
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/bdiv_q_1.asm
@@ -0,0 +1,137 @@
+dnl SPARC T3/T4/T5 mpn_bdiv_q_1.
+
+dnl Contributed to the GNU project by Torbjörn Granlund.
+
+dnl Copyright 2013, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C UltraSPARC T3: 31
+C UltraSPARC T4/T5: 20-26 hits 20 early, then sharply drops
+
+C INPUT PARAMETERS
+define(`qp', `%i0')
+define(`ap', `%i1')
+define(`n', `%i2')
+define(`d', `%i3')
+define(`dinv',`%i4')
+define(`cnt', `%i5')
+
+define(`tnc', `%o2')
+
+ASM_START()
+ REGISTER(%g2,#scratch)
+ REGISTER(%g3,#scratch)
+PROLOGUE(mpn_bdiv_q_1)
+ save %sp, -176, %sp
+ ldx [ap], %o5
+ add d, -1, %g1
+ andn %g1, d, %g1
+ popc %g1, cnt
+
+ srlx d, cnt, d
+ srlx d, 1, %g1
+ and %g1, 127, %g1
+ LEA64(binvert_limb_table, g2, g4)
+ ldub [%g2+%g1], %g1
+ add %g1, %g1, %g2
+ mulx %g1, %g1, %g1
+ mulx %g1, d, %g1
+ sub %g2, %g1, %g2
+ add %g2, %g2, %g1
+ mulx %g2, %g2, %g2
+ mulx %g2, d, %g2
+ sub %g1, %g2, %g1
+ add %g1, %g1, %o7
+ mulx %g1, %g1, %g1
+ mulx %g1, d, %g1
+ add n, -2, n
+ brz,pt cnt, L(norm)
+ sub %o7, %g1, dinv
+
+ brlz,pt n, L(edu)
+ srlx %o5, cnt, %o5
+ b L(eee)
+ mov 0, %g4
+EPILOGUE()
+
+PROLOGUE(mpn_pi1_bdiv_q_1)
+ save %sp, -176, %sp
+ ldx [ap], %o5
+
+ brz,pt cnt, L(norm)
+ add n, -2, n
+
+L(unorm):
+ brlz,pt n, L(edu)
+ srlx %o5, cnt, %o5
+ mov 0, %g4
+L(eee): sub %g0, cnt, tnc
+
+L(tpu): ldx [ap+8], %g3
+ add ap, 8, ap
+ sllx %g3, tnc, %g5
+ or %g5, %o5, %g5
+ srlx %g3, cnt, %o5
+ subcc %g5, %g4, %g4
+ mulx %g4, dinv, %g1
+ stx %g1, [qp]
+ add qp, 8, qp
+ umulxhi(d, %g1, %g1)
+ addxc( %g1, %g0, %g4)
+ brgz,pt n, L(tpu)
+ add n, -1, n
+
+ sub %o5, %g4, %o5
+L(edu): mulx %o5, dinv, %g1
+ return %i7+8
+ stx %g1, [%o0]
+
+L(norm):
+ mulx dinv, %o5, %g1
+ brlz,pt n, L(edn)
+ stx %g1, [qp]
+ add qp, 8, qp
+ addcc %g0, 0, %g4
+
+L(tpn): umulxhi(d, %g1, %g1)
+ ldx [ap+8], %g5
+ add ap, 8, ap
+ addxc( %g1, %g0, %g1)
+ subcc %g5, %g1, %g1
+ mulx %g1, dinv, %g1
+ stx %g1, [qp]
+ add qp, 8, qp
+ brgz,pt n, L(tpn)
+ add n, -1, n
+
+L(edn): return %i7+8
+ nop
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/cnd_aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/cnd_aors_n.asm
index f10ee72c1ff..49ccaec08b6 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/cnd_aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/cnd_aors_n.asm
@@ -2,7 +2,7 @@ dnl SPARC v9 mpn_cnd_add_n and mpn_cnd_sub_n for T3/T4/T5.
dnl Contributed to the GNU project by David Miller and Torbjörn Granlund.
-dnl Copyright 2013 Free Software Foundation, Inc.
+dnl Copyright 2013, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -62,7 +62,8 @@ define(`w0', `%g1') define(`w1', `%g3')
ifdef(`OPERATION_cnd_add_n',`
define(`LOGOP', `and $1, $2, $3')
define(`MAKEMASK',`cmp %g0, $1
- subc %g0, %g0, $2')
+ addxc( %g0, %g0, $2)
+ neg $2, $2')
define(`INITCY', `addcc %g0, 0, %g0')
define(`RETVAL', `addxc( %g0, %g0, %i0)')
define(`func', `mpn_cnd_add_n')
@@ -70,7 +71,8 @@ ifdef(`OPERATION_cnd_add_n',`
ifdef(`OPERATION_cnd_sub_n',`
define(`LOGOP', `orn $2, $1, $3')
define(`MAKEMASK',`cmp $1, 1
- subc %g0, %g0, $2')
+ addxc( %g0, %g0, $2)
+ neg $2, $2')
define(`INITCY', `subcc %g0, 1, %g0')
define(`RETVAL', `addxc( %g0, %g0, %i0)
xor %i0, 1, %i0')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm b/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm
index 216ddc0ba1e..d46499f12d1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm
@@ -1,4 +1,4 @@
-dnl SPARC v9 mpn_sqr_dial_addlsh1 for T3/T4/T5.
+dnl SPARC v9 mpn_sqr_diag_addlsh1 for T3/T4/T5.
dnl Contributed to the GNU project by Torbjörn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct45/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct45/gmp-mparam.h
new file mode 100644
index 00000000000..2fecdba32c0
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/sparc64/ultrasparct45/gmp-mparam.h
@@ -0,0 +1,173 @@
+/* Sparc64 T4-T5 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 3600 MHz ultrasparct5 running GNU/Linux */
+/* FFT tuning limit = 0.5 M */
+/* Generated by tuneup.c, 2019-10-01, gcc 7.4 */
+
+#define DIVREM_1_NORM_THRESHOLD 3
+#define DIVREM_1_UNNORM_THRESHOLD 3
+#define MOD_1_1P_METHOD 2 /* 0.34% faster than 1 */
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 3
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 13
+#define USE_PREINV_DIVREM_1 1
+#define DIV_QR_1N_PI1_METHOD 2 /* 27.84% faster than 1 */
+#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1_UNNORM_THRESHOLD 2
+#define DIV_QR_2_PI2_THRESHOLD 5
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 19
+
+#define DIV_1_VS_MUL_1_PERCENT 654
+
+#define MUL_TOOM22_THRESHOLD 40
+#define MUL_TOOM33_THRESHOLD 129
+#define MUL_TOOM44_THRESHOLD 372
+#define MUL_TOOM6H_THRESHOLD 494
+#define MUL_TOOM8H_THRESHOLD 656
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 126
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 247
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 225
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 219
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 188
+
+#define SQR_BASECASE_THRESHOLD 20
+#define SQR_TOOM2_THRESHOLD 59
+#define SQR_TOOM3_THRESHOLD 107
+#define SQR_TOOM4_THRESHOLD 298
+#define SQR_TOOM6_THRESHOLD 399
+#define SQR_TOOM8_THRESHOLD 562
+
+#define MULMID_TOOM42_THRESHOLD 48
+
+#define MULMOD_BNM1_THRESHOLD 25
+#define SQRMOD_BNM1_THRESHOLD 23
+
+#define MUL_FFT_MODF_THRESHOLD 555 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 555, 5}, { 29, 6}, { 31, 7}, { 31, 8}, \
+ { 17, 7}, { 36, 8}, { 19, 7}, { 39, 8}, \
+ { 21, 7}, { 43, 8}, { 29, 9}, { 15, 8}, \
+ { 31, 7}, { 63, 8}, { 35, 9}, { 19, 8}, \
+ { 43, 9}, { 23, 8}, { 51, 9}, { 27, 8}, \
+ { 57,10}, { 15, 8}, { 61, 9}, { 31, 8}, \
+ { 67, 9}, { 35, 8}, { 71, 9}, { 39, 8}, \
+ { 81, 9}, { 43,10}, { 23, 9}, { 59,11}, \
+ { 15,10}, { 31, 9}, { 71,10}, { 39, 9}, \
+ { 87,10}, { 47, 9}, { 99,10}, { 55, 9}, \
+ { 115,11}, { 31,10}, { 63, 9}, { 131,10}, \
+ { 87,11}, { 47,10}, { 111, 9}, { 223,12}, \
+ { 31,11}, { 63,10}, { 135,11}, { 79,10}, \
+ { 159,11}, { 95,10}, { 191,11}, { 111,12}, \
+ { 63,11}, { 143,10}, { 287,11}, { 159,12}, \
+ { 95,11}, { 191,10}, { 383, 9}, { 767,13}, \
+ { 8192,14}, { 16384,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 75
+#define MUL_FFT_THRESHOLD 5760
+
+#define SQR_FFT_MODF_THRESHOLD 372 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 372, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 25, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 31, 8}, \
+ { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
+ { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
+ { 31,11}, { 63,10}, { 135,11}, { 79,10}, \
+ { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
+ { 383,11}, { 111,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271,11}, { 143,10}, \
+ { 287, 9}, { 575,10}, { 303, 9}, { 607,11}, \
+ { 159,10}, { 319, 9}, { 639,12}, { 95,11}, \
+ { 191,10}, { 383, 9}, { 767,11}, { 207,13}, \
+ { 8192,14}, { 16384,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 75
+#define SQR_FFT_THRESHOLD 3776
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 35
+#define MULLO_MUL_N_THRESHOLD 11278
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 168
+#define SQRLO_SQR_THRESHOLD 7511
+
+#define DC_DIV_QR_THRESHOLD 36
+#define DC_DIVAPPR_Q_THRESHOLD 103
+#define DC_BDIV_QR_THRESHOLD 28
+#define DC_BDIV_Q_THRESHOLD 88
+
+#define INV_MULMOD_BNM1_THRESHOLD 78
+#define INV_NEWTON_THRESHOLD 181
+#define INV_APPR_THRESHOLD 118
+
+#define BINV_NEWTON_THRESHOLD 296
+#define REDC_1_TO_REDC_2_THRESHOLD 4
+#define REDC_2_TO_REDC_N_THRESHOLD 79
+
+#define MU_DIV_QR_THRESHOLD 1970
+#define MU_DIVAPPR_Q_THRESHOLD 1970
+#define MUPI_DIV_QR_THRESHOLD 82
+#define MU_BDIV_QR_THRESHOLD 1528
+#define MU_BDIV_Q_THRESHOLD 1970
+
+#define POWM_SEC_TABLE 1,58,102,1509
+
+#define GET_STR_DC_THRESHOLD 15
+#define GET_STR_PRECOMPUTE_THRESHOLD 29
+#define SET_STR_DC_THRESHOLD 686
+#define SET_STR_PRECOMPUTE_THRESHOLD 2717
+
+#define FAC_DSC_THRESHOLD 336
+#define FAC_ODD_THRESHOLD 24
+
+#define MATRIX22_STRASSEN_THRESHOLD 32
+#define HGCD2_DIV1_METHOD 1 /* 0.66% faster than 3 */
+#define HGCD_THRESHOLD 57
+#define HGCD_APPR_THRESHOLD 50
+#define HGCD_REDUCE_THRESHOLD 3389
+#define GCD_DC_THRESHOLD 386
+#define GCDEXT_DC_THRESHOLD 288
+#define JACOBI_BASE_METHOD 4 /* 2.50% faster than 3 */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/atom/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/atom/gmp-mparam.h
index 7e6c4196816..e025bb79579 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/atom/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/atom/gmp-mparam.h
@@ -1,6 +1,6 @@
/* Intel Atom/32 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2011, 2014-2015 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,176 +32,183 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BYTES 4
/* 1600 MHz Diamondville (Atom 330) */
-/* FFT tuning limit = 50 M */
-/* Generated by tuneup.c, 2015-10-09, gcc 4.7 */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 3
#define MOD_1_UNNORM_THRESHOLD 5
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 10
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 11
#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 17
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 4
+#define DIV_QR_1N_PI1_METHOD 1 /* 72.60% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 31
+#define BMOD_1_TO_MOD_1_THRESHOLD 35
-#define MUL_TOOM22_THRESHOLD 20
+#define DIV_1_VS_MUL_1_PERCENT 236
+
+#define MUL_TOOM22_THRESHOLD 22
#define MUL_TOOM33_THRESHOLD 81
#define MUL_TOOM44_THRESHOLD 178
#define MUL_TOOM6H_THRESHOLD 270
-#define MUL_TOOM8H_THRESHOLD 381
+#define MUL_TOOM8H_THRESHOLD 399
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 120
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 126
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 115
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 127
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 106
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 129
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 115
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 32
-#define SQR_TOOM3_THRESHOLD 121
-#define SQR_TOOM4_THRESHOLD 184
-#define SQR_TOOM6_THRESHOLD 303
+#define SQR_TOOM3_THRESHOLD 117
+#define SQR_TOOM4_THRESHOLD 178
+#define SQR_TOOM6_THRESHOLD 366
#define SQR_TOOM8_THRESHOLD 527
-#define MULMID_TOOM42_THRESHOLD 54
+#define MULMID_TOOM42_THRESHOLD 50
-#define MULMOD_BNM1_THRESHOLD 16
+#define MULMOD_BNM1_THRESHOLD 13
#define SQRMOD_BNM1_THRESHOLD 17
-#define MUL_FFT_MODF_THRESHOLD 380 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 404 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 380, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 12, 5}, { 25, 6}, { 21, 7}, { 11, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 21, 8}, { 11, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
- { 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
- { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
- { 47, 8}, { 99, 9}, { 55,10}, { 31, 9}, \
- { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
- { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
- { 95, 9}, { 191,10}, { 111,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511, 9}, { 271,10}, \
+ { { 404, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 12, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 21, 7}, { 11, 6}, { 25, 7}, { 13, 6}, \
+ { 27, 7}, { 15, 6}, { 31, 7}, { 21, 8}, \
+ { 11, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 39, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 39, 9}, { 23, 8}, \
+ { 51,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
+ { 39, 8}, { 79, 9}, { 47, 8}, { 95,10}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
+ { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
+ { 159,10}, { 95, 9}, { 191,10}, { 111,11}, \
+ { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
{ 143, 9}, { 287, 8}, { 575, 9}, { 303,10}, \
- { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
- { 383,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 271, 9}, { 543,10}, { 287, 9}, \
- { 575,10}, { 303,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 351,11}, { 191,10}, { 383, 9}, \
+ { 159,11}, { 95,10}, { 191, 9}, { 383,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543,10}, { 287, 9}, { 575,10}, \
+ { 303,11}, { 159,10}, { 351, 9}, { 703,10}, \
+ { 367, 9}, { 735,11}, { 191,10}, { 383, 9}, \
{ 767,10}, { 415,11}, { 223,10}, { 447,12}, \
{ 127,11}, { 255,10}, { 543,11}, { 287,10}, \
- { 607,11}, { 319,10}, { 639,11}, { 351,10}, \
- { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 607,11}, { 319,10}, { 671,11}, { 351,10}, \
+ { 735,12}, { 191,11}, { 383,10}, { 767,11}, \
{ 415,10}, { 831,11}, { 447,13}, { 127,12}, \
{ 255,11}, { 543,10}, { 1087,11}, { 607,12}, \
{ 319,11}, { 735,12}, { 383,11}, { 831,12}, \
{ 447,11}, { 959,13}, { 255,12}, { 511,11}, \
{ 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
{ 1279,12}, { 703,11}, { 1407,13}, { 383,12}, \
- { 959,14}, { 255,13}, { 511,12}, { 1215,13}, \
- { 639,12}, { 1471,13}, { 767,12}, { 1599,13}, \
- { 895,12}, { 1791,14}, { 511,13}, { 1023,12}, \
- { 2111,13}, { 1151,12}, { 2431,13}, { 1407,14}, \
- { 767,13}, { 1663,12}, { 3455,13}, { 1791,15}, \
- { 511,14}, { 1023,13}, { 2431,14}, { 1279,13}, \
- { 2943,12}, { 5887,14}, { 1535,13}, { 3455,14}, \
- { 1791,13}, { 3839,15}, { 1023,14}, { 2047,13}, \
- { 4223,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
- { 2815,13}, { 5887,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 155
+ { 831,11}, { 1663,12}, { 959,14}, { 255,13}, \
+ { 511,12}, { 1215,13}, { 639,12}, { 1471,13}, \
+ { 767,12}, { 1599,13}, { 895,12}, { 1791,14}, \
+ { 511,13}, { 1023,12}, { 2111,13}, { 1151,12}, \
+ { 2431,13}, { 1407,14}, { 767,13}, { 1663,12}, \
+ { 3455,13}, { 1791,15}, { 511,14}, { 1023,13}, \
+ { 2431,14}, { 1279,13}, { 2943,12}, { 5887,14}, \
+ { 1535,13}, { 3455,14}, { 1791,13}, { 3839,15}, \
+ { 1023,14}, { 2047,13}, { 4223,14}, { 2303,13}, \
+ { 4991,12}, { 9983,14}, { 2815,13}, { 5887,15}, \
+ { 1535,14}, { 3839,16} }
+#define MUL_FFT_TABLE3_SIZE 158
#define MUL_FFT_THRESHOLD 4544
-#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 368 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 340, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 12, 5}, { 25, 6}, { 21, 7}, { 11, 6}, \
- { 25, 7}, { 13, 6}, { 28, 7}, { 15, 6}, \
- { 31, 7}, { 21, 8}, { 11, 7}, { 27, 8}, \
+ { { 368, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
+ { 13, 5}, { 27, 6}, { 25, 7}, { 13, 6}, \
+ { 28, 7}, { 15, 6}, { 31, 7}, { 17, 6}, \
+ { 35, 7}, { 21, 8}, { 11, 7}, { 27, 8}, \
{ 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
{ 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
{ 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
+ { 31, 8}, { 63, 9}, { 39, 8}, { 79, 9}, \
{ 47,10}, { 31, 9}, { 79,10}, { 47, 9}, \
{ 95,11}, { 31,10}, { 63, 9}, { 127, 8}, \
- { 255, 7}, { 511, 9}, { 135, 8}, { 271, 9}, \
- { 143,10}, { 79, 8}, { 319, 7}, { 639,10}, \
- { 95, 9}, { 191, 8}, { 383,10}, { 111,11}, \
- { 63,10}, { 127, 9}, { 255, 8}, { 511, 9}, \
- { 271, 8}, { 543,10}, { 143, 9}, { 287, 8}, \
- { 607, 9}, { 319,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271, 9}, { 543,10}, { 287, 9}, { 575,10}, \
- { 303, 9}, { 607,10}, { 319, 9}, { 639,10}, \
- { 335, 9}, { 671,10}, { 351, 9}, { 703,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 415,11}, \
- { 223,10}, { 447,12}, { 127,11}, { 255,10}, \
- { 543,11}, { 287,10}, { 607,11}, { 319,10}, \
- { 671,11}, { 351,10}, { 703,12}, { 191,11}, \
- { 383,10}, { 767,11}, { 415,10}, { 831,11}, \
- { 479,13}, { 127,12}, { 255,11}, { 543,10}, \
- { 1087,11}, { 607,12}, { 319,11}, { 671,10}, \
- { 1343,11}, { 735,12}, { 383,11}, { 831,12}, \
- { 447,11}, { 959,13}, { 255,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
- { 1343,12}, { 703,13}, { 383,12}, { 959,14}, \
- { 255,13}, { 511,12}, { 1215,13}, { 639,12}, \
- { 1471,13}, { 767,12}, { 1599,13}, { 895,14}, \
- { 511,13}, { 1023,12}, { 2111,13}, { 1151,12}, \
- { 2431,13}, { 1407,14}, { 767,13}, { 1663,12}, \
- { 3455,15}, { 511,14}, { 1023,13}, { 2431,14}, \
+ { 255, 9}, { 135,10}, { 79, 9}, { 159, 8}, \
+ { 319,10}, { 95, 9}, { 191,11}, { 63,10}, \
+ { 127, 9}, { 255, 8}, { 511, 9}, { 271,10}, \
+ { 143, 9}, { 287, 8}, { 575, 9}, { 303,10}, \
+ { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
+ { 383,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 271, 9}, { 543,10}, { 287, 9}, \
+ { 575,10}, { 303, 9}, { 607,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
+ { 351, 9}, { 703,11}, { 191,10}, { 383, 9}, \
+ { 767,10}, { 415,11}, { 223,10}, { 447,12}, \
+ { 127,11}, { 255,10}, { 543,11}, { 287,10}, \
+ { 607,11}, { 319,10}, { 671,11}, { 351,10}, \
+ { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 415,10}, { 831,11}, { 447,13}, { 127,12}, \
+ { 255,11}, { 543,10}, { 1087,11}, { 607,12}, \
+ { 319,11}, { 671,10}, { 1343,11}, { 735,12}, \
+ { 383,11}, { 831,12}, { 447,11}, { 959,13}, \
+ { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
+ { 1215,12}, { 639,11}, { 1343,12}, { 703,13}, \
+ { 383,12}, { 959,14}, { 255,13}, { 511,12}, \
+ { 1215,13}, { 639,12}, { 1471,13}, { 767,12}, \
+ { 1599,13}, { 895,14}, { 511,13}, { 1023,12}, \
+ { 2111,13}, { 1151,12}, { 2431,13}, { 1407,14}, \
+ { 767,13}, { 1663,12}, { 3455,15}, { 511,14}, \
+ { 1023,13}, { 2175,12}, { 4351,13}, { 2431,14}, \
{ 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
{ 3455,14}, { 1791,13}, { 3839,15}, { 1023,14}, \
{ 2047,13}, { 4351,14}, { 2303,13}, { 4991,12}, \
- { 9983,14}, { 2815,13}, { 5887,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 160
+ { 9983,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 161
#define SQR_FFT_THRESHOLD 3712
#define MULLO_BASECASE_THRESHOLD 0 /* always */
#define MULLO_DC_THRESHOLD 56
#define MULLO_MUL_N_THRESHOLD 8907
-#define SQRLO_BASECASE_THRESHOLD 0 /* always */
-#define SQRLO_DC_THRESHOLD 114
+#define SQRLO_BASECASE_THRESHOLD 6
+#define SQRLO_DC_THRESHOLD 111
#define SQRLO_SQR_THRESHOLD 6654
-#define DC_DIV_QR_THRESHOLD 71
-#define DC_DIVAPPR_Q_THRESHOLD 250
-#define DC_BDIV_QR_THRESHOLD 68
+#define DC_DIV_QR_THRESHOLD 67
+#define DC_DIVAPPR_Q_THRESHOLD 252
+#define DC_BDIV_QR_THRESHOLD 63
#define DC_BDIV_Q_THRESHOLD 172
-#define INV_MULMOD_BNM1_THRESHOLD 38
+#define INV_MULMOD_BNM1_THRESHOLD 42
#define INV_NEWTON_THRESHOLD 250
#define INV_APPR_THRESHOLD 250
-#define BINV_NEWTON_THRESHOLD 264
-#define REDC_1_TO_REDC_N_THRESHOLD 71
+#define BINV_NEWTON_THRESHOLD 276
+#define REDC_1_TO_REDC_N_THRESHOLD 68
-#define MU_DIV_QR_THRESHOLD 1442
+#define MU_DIV_QR_THRESHOLD 1334
#define MU_DIVAPPR_Q_THRESHOLD 1442
-#define MUPI_DIV_QR_THRESHOLD 114
-#define MU_BDIV_QR_THRESHOLD 1017
-#define MU_BDIV_Q_THRESHOLD 1210
+#define MUPI_DIV_QR_THRESHOLD 116
+#define MU_BDIV_QR_THRESHOLD 1142
+#define MU_BDIV_Q_THRESHOLD 1341
-#define POWM_SEC_TABLE 3,16,96,416,1985
+#define POWM_SEC_TABLE 1,16,98,376,1259
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 25
-#define SET_STR_DC_THRESHOLD 396
-#define SET_STR_PRECOMPUTE_THRESHOLD 1105
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 23
+#define SET_STR_DC_THRESHOLD 298
+#define SET_STR_PRECOMPUTE_THRESHOLD 1037
-#define FAC_DSC_THRESHOLD 224
-#define FAC_ODD_THRESHOLD 29
+#define FAC_DSC_THRESHOLD 171
+#define FAC_ODD_THRESHOLD 34
#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 126
-#define HGCD_APPR_THRESHOLD 165
+#define HGCD2_DIV1_METHOD 3 /* 3.71% faster than 1 */
+#define HGCD_THRESHOLD 128
+#define HGCD_APPR_THRESHOLD 186
#define HGCD_REDUCE_THRESHOLD 2479
-#define GCD_DC_THRESHOLD 511
-#define GCDEXT_DC_THRESHOLD 333
-#define JACOBI_BASE_METHOD 2
+#define GCD_DC_THRESHOLD 465
+#define GCDEXT_DC_THRESHOLD 339
+#define JACOBI_BASE_METHOD 3 /* 2.58% faster than 2 */
+
+/* Tuneup completed successfully, took 214190 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/bd1/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/bd1/gmp-mparam.h
index 7d80a1cb4c0..254cfea53c0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/bd1/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/bd1/gmp-mparam.h
@@ -1,7 +1,6 @@
-/* AMD bd2 gmp-mparam.h -- Compiler/machine parameter header file.
+/* AMD bd1 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2005, 2008-2010, 2014 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,177 +31,181 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 3600 MHz Bulldozer Zambezi */
-/* FFT tuning limit = 25000000 */
-/* Generated by tuneup.c, 2014-03-13, gcc 4.5 */
+/* 3600-3800 MHz Bulldozer Zambezi */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-27, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 16
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 15
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 11
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 13
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1N_PI1_METHOD 1 /* 59.59% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 5
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD 27
+#define DIV_1_VS_MUL_1_PERCENT 245
+
#define MUL_TOOM22_THRESHOLD 32
-#define MUL_TOOM33_THRESHOLD 65
+#define MUL_TOOM33_THRESHOLD 89
#define MUL_TOOM44_THRESHOLD 154
#define MUL_TOOM6H_THRESHOLD 230
-#define MUL_TOOM8H_THRESHOLD 354
+#define MUL_TOOM8H_THRESHOLD 351
#define MUL_TOOM32_TO_TOOM43_THRESHOLD 89
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 110
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 93
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 102
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 101
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 111
#define MUL_TOOM43_TO_TOOM54_THRESHOLD 130
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 48
+#define SQR_TOOM2_THRESHOLD 46
#define SQR_TOOM3_THRESHOLD 87
-#define SQR_TOOM4_THRESHOLD 204
-#define SQR_TOOM6_THRESHOLD 315
-#define SQR_TOOM8_THRESHOLD 430
+#define SQR_TOOM4_THRESHOLD 216
+#define SQR_TOOM6_THRESHOLD 294
+#define SQR_TOOM8_THRESHOLD 442
-#define MULMID_TOOM42_THRESHOLD 48
+#define MULMID_TOOM42_THRESHOLD 50
-#define MULMOD_BNM1_THRESHOLD 21
-#define SQRMOD_BNM1_THRESHOLD 23
+#define MULMOD_BNM1_THRESHOLD 22
+#define SQRMOD_BNM1_THRESHOLD 26
-#define MUL_FFT_MODF_THRESHOLD 840 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 636 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 840, 5}, { 28, 6}, { 15, 5}, { 33, 6}, \
- { 28, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
+ { { 636, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
+ { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
{ 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 29, 8}, { 15, 7}, { 31, 6}, \
- { 63, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 51, 8}, { 27, 7}, { 55, 8}, \
- { 31, 7}, { 63, 8}, { 39, 7}, { 79, 9}, \
- { 23, 8}, { 55, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
- { 55,10}, { 31, 9}, { 63, 8}, { 127, 9}, \
- { 79,10}, { 47, 9}, { 103,11}, { 31,10}, \
- { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
- { 95, 9}, { 191,10}, { 111,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 159,11}, { 95,10}, \
- { 191,12}, { 63,11}, { 127,10}, { 271,11}, \
- { 159,10}, { 319, 9}, { 639,11}, { 191,10}, \
- { 383, 9}, { 767,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 287,10}, { 607,11}, \
- { 319,10}, { 639,12}, { 191,11}, { 383,10}, \
- { 799,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
+ { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
+ { 191,11}, { 63, 7}, { 1023, 8}, { 543,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335,11}, { 191,10}, \
+ { 399,11}, { 223,12}, { 127,11}, { 255,10}, \
+ { 543,11}, { 287,10}, { 607,11}, { 319,10}, \
+ { 639,12}, { 191,11}, { 383,10}, { 799,11}, \
+ { 415,13}, { 127,12}, { 255,11}, { 543,10}, \
{ 1087,11}, { 607,12}, { 319,11}, { 671,10}, \
- { 1343,11}, { 735,10}, { 1471, 9}, { 2943,12}, \
- { 383,11}, { 799,10}, { 1599,11}, { 863,10}, \
- { 1727,12}, { 447,13}, { 255,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,10}, { 2431,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,10}, \
- { 2943,13}, { 383,12}, { 767,11}, { 1599,12}, \
- { 831,11}, { 1727,10}, { 3455,14}, { 255,13}, \
- { 511,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
+ { 1343,11}, { 735,12}, { 383,11}, { 799,10}, \
+ { 1599,11}, { 863,12}, { 447,11}, { 895,13}, \
+ { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
+ { 1215,12}, { 639,11}, { 1343,12}, { 703,11}, \
+ { 1471,13}, { 383,12}, { 767,11}, { 1599,12}, \
+ { 831,11}, { 1727,12}, { 895,14}, { 255,13}, \
+ { 511,12}, { 1087,11}, { 2239,10}, { 4479,12}, \
+ { 1215,13}, { 639,12}, { 1471,11}, { 2943,13}, \
{ 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
- { 1919,11}, { 3839,12}, { 1983,11}, { 3967,10}, \
- { 7935,14}, { 511,13}, { 1023,12}, { 2239,13}, \
- { 1151,12}, { 2495,11}, { 4991,13}, { 1279,12}, \
- { 2623,13}, { 1407,12}, { 2943,14}, { 767,13}, \
- { 1535,12}, { 3071,13}, { 1663,12}, { 3455,13}, \
- { 1791,12}, { 3583,13}, { 1919,12}, { 3967,11}, \
- { 7935,15}, { 511,14}, { 1023,13}, { 2175,12}, \
- { 4479,13}, { 2431,12}, { 4991,14}, { 1279,13}, \
- { 2943,12}, { 6015,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 160
-#define MUL_FFT_THRESHOLD 7808
-
-#define SQR_FFT_MODF_THRESHOLD 690 /* k = 5 */
+ { 1919,14}, { 511,13}, { 1023,12}, { 2239,11}, \
+ { 4479,13}, { 1151,12}, { 2495,11}, { 4991,13}, \
+ { 1279,12}, { 2623,13}, { 1407,12}, { 2943,14}, \
+ { 767,13}, { 1663,12}, { 3455,13}, { 1919,15}, \
+ { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
+ { 2431,12}, { 4991,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,12}, { 7935,15}, { 1023,14}, { 2047,13}, \
+ { 4479,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
+ { 2815,13}, { 5887,15}, { 1535,14}, { 3327,13}, \
+ { 6911,14}, { 3839,13}, { 7935,16} }
+#define MUL_FFT_TABLE3_SIZE 159
+#define MUL_FFT_THRESHOLD 6784
+
+#define SQR_FFT_MODF_THRESHOLD 565 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 690, 5}, { 28, 6}, { 15, 5}, { 32, 6}, \
- { 29, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 40, 7}, { 21, 6}, \
- { 43, 7}, { 23, 6}, { 47, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 49, 8}, \
- { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
- { 39, 7}, { 79, 8}, { 43, 9}, { 23, 8}, \
+ { { 565, 5}, { 29, 6}, { 15, 5}, { 32, 6}, \
+ { 17, 5}, { 35, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 23, 6}, { 47, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
+ { 27, 7}, { 55, 8}, { 43, 9}, { 23, 8}, \
{ 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
{ 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 63, 8}, { 127, 9}, { 79,10}, \
- { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
- { 127,10}, { 79, 9}, { 167,10}, { 95, 9}, \
- { 191,10}, { 111,11}, { 63,10}, { 159,11}, \
- { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
- { 271,11}, { 159,10}, { 319, 9}, { 639,11}, \
- { 191,10}, { 383,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 511, 9}, { 1023,10}, { 543,11}, \
- { 287,10}, { 607, 9}, { 1215,11}, { 319,10}, \
- { 639,12}, { 191,11}, { 383,10}, { 799,11}, \
- { 415,13}, { 127,12}, { 255,11}, { 511,10}, \
- { 1023,11}, { 543,10}, { 1087,11}, { 607,10}, \
- { 1215,12}, { 319,11}, { 671,10}, { 1343,11}, \
- { 735,10}, { 1471,12}, { 383,11}, { 799,10}, \
- { 1599,11}, { 863,12}, { 447,11}, { 927,13}, \
- { 255,12}, { 511,11}, { 1055,10}, { 2111,11}, \
- { 1087,12}, { 575,11}, { 1215,10}, { 2431,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,13}, \
- { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
- { 1727,10}, { 3455,12}, { 895,14}, { 255,13}, \
- { 511,12}, { 1023,11}, { 2111,12}, { 1087,11}, \
- { 2239,10}, { 4479,12}, { 1215,11}, { 2431,13}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
+ { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
+ { 159,10}, { 95,11}, { 63,10}, { 159,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 335, 9}, { 671,11}, { 191,10}, { 415,11}, \
+ { 223,12}, { 127,11}, { 255,10}, { 543,11}, \
+ { 287,10}, { 607,11}, { 319,10}, { 671,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 831,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 1087,11}, { 607,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,12}, { 383,11}, { 863,12}, \
+ { 447,11}, { 959,13}, { 255,12}, { 511,11}, \
+ { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
+ { 1343,12}, { 703,13}, { 383,12}, { 767,11}, \
+ { 1535,12}, { 831,11}, { 1727,12}, { 895,11}, \
+ { 1791,12}, { 959,14}, { 255,13}, { 511,12}, \
+ { 1087,11}, { 2239,10}, { 4479,12}, { 1215,13}, \
{ 639,12}, { 1471,11}, { 2943,13}, { 767,12}, \
- { 1727,11}, { 3455,13}, { 895,12}, { 1983,11}, \
- { 3967,14}, { 511,13}, { 1023,12}, { 2239,11}, \
- { 4479,13}, { 1151,12}, { 2495,11}, { 4991,10}, \
- { 9983,13}, { 1279,12}, { 2623,13}, { 1407,12}, \
- { 2943,14}, { 767,13}, { 1663,12}, { 3455,13}, \
- { 1791,12}, { 3583,13}, { 1919,12}, { 3967,15}, \
- { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
- { 2431,12}, { 4991,11}, { 9983,14}, { 1279,13}, \
- { 2687,12}, { 5375,13}, { 2943,12}, { 5887,14}, \
- { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 166
-#define SQR_FFT_THRESHOLD 6784
-
-#define MULLO_BASECASE_THRESHOLD 5
+ { 1727,13}, { 895,12}, { 1919,14}, { 511,13}, \
+ { 1023,12}, { 2239,11}, { 4479,13}, { 1151,12}, \
+ { 2495,11}, { 4991,13}, { 1279,12}, { 2623,13}, \
+ { 1407,12}, { 2943,14}, { 767,13}, { 1663,12}, \
+ { 3455,13}, { 1919,15}, { 511,14}, { 1023,13}, \
+ { 2175,12}, { 4479,13}, { 2431,12}, { 4991,14}, \
+ { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
+ { 3455,14}, { 1791,13}, { 3967,15}, { 1023,14}, \
+ { 2047,13}, { 4479,14}, { 2303,13}, { 4991,12}, \
+ { 9983,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3327,13}, { 6783,14}, { 3839,13}, { 7679,16} }
+#define SQR_FFT_TABLE3_SIZE 152
+#define SQR_FFT_THRESHOLD 5760
+
+#define MULLO_BASECASE_THRESHOLD 3
#define MULLO_DC_THRESHOLD 31
-#define MULLO_MUL_N_THRESHOLD 14709
-
-#define DC_DIV_QR_THRESHOLD 53
-#define DC_DIVAPPR_Q_THRESHOLD 230
-#define DC_BDIV_QR_THRESHOLD 50
-#define DC_BDIV_Q_THRESHOLD 136
-
-#define INV_MULMOD_BNM1_THRESHOLD 78
-#define INV_NEWTON_THRESHOLD 202
+#define MULLO_MUL_N_THRESHOLD 13463
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 33
+#define SQRLO_SQR_THRESHOLD 11278
+
+#define DC_DIV_QR_THRESHOLD 52
+#define DC_DIVAPPR_Q_THRESHOLD 198
+#define DC_BDIV_QR_THRESHOLD 48
+#define DC_BDIV_Q_THRESHOLD 126
+
+#define INV_MULMOD_BNM1_THRESHOLD 82
+#define INV_NEWTON_THRESHOLD 212
#define INV_APPR_THRESHOLD 202
-#define BINV_NEWTON_THRESHOLD 236
+#define BINV_NEWTON_THRESHOLD 238
#define REDC_1_TO_REDC_N_THRESHOLD 55
-#define MU_DIV_QR_THRESHOLD 1442
-#define MU_DIVAPPR_Q_THRESHOLD 1652
-#define MUPI_DIV_QR_THRESHOLD 81
-#define MU_BDIV_QR_THRESHOLD 1787
-#define MU_BDIV_Q_THRESHOLD 1685
+#define MU_DIV_QR_THRESHOLD 1652
+#define MU_DIVAPPR_Q_THRESHOLD 1528
+#define MUPI_DIV_QR_THRESHOLD 110
+#define MU_BDIV_QR_THRESHOLD 1442
+#define MU_BDIV_Q_THRESHOLD 1528
-#define POWM_SEC_TABLE 1,22,194,376,692,2657
+#define POWM_SEC_TABLE 1,20,96,386,1221,2698
-#define MATRIX22_STRASSEN_THRESHOLD 21
-#define HGCD_THRESHOLD 85
-#define HGCD_APPR_THRESHOLD 50
-#define HGCD_REDUCE_THRESHOLD 4455
-#define GCD_DC_THRESHOLD 456
-#define GCDEXT_DC_THRESHOLD 345
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 17
-#define GET_STR_PRECOMPUTE_THRESHOLD 27
+#define GET_STR_DC_THRESHOLD 11
+#define GET_STR_PRECOMPUTE_THRESHOLD 21
#define SET_STR_DC_THRESHOLD 100
-#define SET_STR_PRECOMPUTE_THRESHOLD 960
+#define SET_STR_PRECOMPUTE_THRESHOLD 762
+
+#define FAC_DSC_THRESHOLD 118
+#define FAC_ODD_THRESHOLD 34
+
+#define MATRIX22_STRASSEN_THRESHOLD 16
+#define HGCD2_DIV1_METHOD 4 /* 1.22% faster than 3 */
+#define HGCD_THRESHOLD 67
+#define HGCD_APPR_THRESHOLD 150
+#define HGCD_REDUCE_THRESHOLD 3389
+#define GCD_DC_THRESHOLD 483
+#define GCDEXT_DC_THRESHOLD 345
+#define JACOBI_BASE_METHOD 4 /* 5.07% faster than 1 */
-#define FAC_DSC_THRESHOLD 208
-#define FAC_ODD_THRESHOLD 26
+/* Tuneup completed successfully, took 65358 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/bd2/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/bd2/gmp-mparam.h
index 57223ea360f..6893da72574 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/bd2/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/bd2/gmp-mparam.h
@@ -1,7 +1,6 @@
/* AMD bd2 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2005, 2008-2010, 2014, 2015 Free
-Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,180 +31,184 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 4000 MHz Piledriver Vishera */
-/* FFT tuning limit = 40000000 */
+/* 4000-4200 MHz Piledriver Vishera */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-23, gcc 8.3 */
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 3
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 19
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 4
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 18
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 12
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1N_PI1_METHOD 1 /* 40.87% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 5
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD 24
-#define MUL_TOOM22_THRESHOLD 30
-#define MUL_TOOM33_THRESHOLD 81
-#define MUL_TOOM44_THRESHOLD 153
+#define DIV_1_VS_MUL_1_PERCENT 254
+
+#define MUL_TOOM22_THRESHOLD 32
+#define MUL_TOOM33_THRESHOLD 73
+#define MUL_TOOM44_THRESHOLD 151
#define MUL_TOOM6H_THRESHOLD 222
-#define MUL_TOOM8H_THRESHOLD 357
+#define MUL_TOOM8H_THRESHOLD 351
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 89
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 114
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 99
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 96
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 85
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 110
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 100
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 110
#define MUL_TOOM43_TO_TOOM54_THRESHOLD 130
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 38
-#define SQR_TOOM3_THRESHOLD 89
-#define SQR_TOOM4_THRESHOLD 196
-#define SQR_TOOM6_THRESHOLD 290
-#define SQR_TOOM8_THRESHOLD 454
+#define SQR_TOOM2_THRESHOLD 44
+#define SQR_TOOM3_THRESHOLD 93
+#define SQR_TOOM4_THRESHOLD 212
+#define SQR_TOOM6_THRESHOLD 318
+#define SQR_TOOM8_THRESHOLD 466
-#define MULMID_TOOM42_THRESHOLD 68
+#define MULMID_TOOM42_THRESHOLD 66
-#define MULMOD_BNM1_THRESHOLD 19
-#define SQRMOD_BNM1_THRESHOLD 22
+#define MULMOD_BNM1_THRESHOLD 20
+#define SQRMOD_BNM1_THRESHOLD 23
-#define MUL_FFT_MODF_THRESHOLD 636 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 595 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 636, 5}, { 27, 6}, { 27, 7}, { 15, 6}, \
+ { { 595, 5}, { 27, 6}, { 29, 7}, { 15, 6}, \
{ 33, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
{ 39, 7}, { 23, 6}, { 47, 7}, { 29, 8}, \
{ 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 49, 8}, { 27, 7}, { 55, 9}, \
- { 15, 8}, { 31, 7}, { 63, 8}, { 43, 9}, \
- { 23, 8}, { 55, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
- { 55,10}, { 31, 9}, { 63, 8}, { 127, 9}, \
- { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
- { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
- { 95, 9}, { 191,11}, { 63,10}, { 127, 6}, \
- { 2111, 5}, { 4351, 6}, { 2239, 7}, { 1215, 9}, \
- { 311, 8}, { 639,10}, { 175, 8}, { 703,10}, \
- { 191,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 271, 9}, { 543,10}, { 287,11}, \
- { 159, 9}, { 671,11}, { 191,10}, { 383, 9}, \
- { 799,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607,11}, \
- { 319,10}, { 671,12}, { 191,11}, { 383,10}, \
- { 799,11}, { 415,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
+ { 23, 7}, { 49, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 83, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
+ { 191,11}, { 63,10}, { 143, 7}, { 1215, 9}, \
+ { 319, 8}, { 639, 9}, { 335, 8}, { 671, 9}, \
+ { 351,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 271,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 335,11}, { 191,10}, { 399,11}, { 223,12}, \
+ { 127,11}, { 255,10}, { 543,11}, { 287,10}, \
+ { 607,11}, { 319,10}, { 671,12}, { 191,11}, \
+ { 383,10}, { 799,11}, { 415,13}, { 127,12}, \
+ { 255,11}, { 543,10}, { 1087,11}, { 607,12}, \
{ 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
{ 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
{ 863,12}, { 447,11}, { 895,13}, { 255,12}, \
- { 511,11}, { 1087,12}, { 575,11}, { 1215,10}, \
- { 2431,12}, { 639,11}, { 1343,12}, { 703,11}, \
- { 1471,13}, { 383,12}, { 767,11}, { 1599,12}, \
- { 831,11}, { 1727,10}, { 3455,12}, { 895,14}, \
- { 255,13}, { 511,12}, { 1023,11}, { 2047,12}, \
- { 1087,11}, { 2239,10}, { 4479,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
- { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
- { 1919,14}, { 511,13}, { 1023,12}, { 2239,11}, \
- { 4479,13}, { 1151,12}, { 2495,11}, { 4991,13}, \
- { 1279,12}, { 2623,13}, { 1407,12}, { 2943,14}, \
- { 767,13}, { 1535,12}, { 3071,13}, { 1663,12}, \
- { 3455,13}, { 1919,15}, { 511,14}, { 1023,13}, \
- { 2175,12}, { 4479,13}, { 2431,12}, { 4991,14}, \
- { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
- { 3455,14}, { 1791,13}, { 3967,12}, { 7935,11}, \
- { 15871,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
- { 2303,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 172
+ { 511,11}, { 1087,12}, { 575,11}, { 1215,12}, \
+ { 639,11}, { 1343,12}, { 703,11}, { 1471,13}, \
+ { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
+ { 1727,12}, { 895,14}, { 255,13}, { 511,12}, \
+ { 1087,11}, { 2239,12}, { 1215,13}, { 639,12}, \
+ { 1471,11}, { 2943,13}, { 767,12}, { 1727,13}, \
+ { 895,12}, { 1919,14}, { 511,13}, { 1023,12}, \
+ { 2239,13}, { 1151,12}, { 2431,13}, { 1279,12}, \
+ { 2623,13}, { 1407,12}, { 2943,14}, { 767,13}, \
+ { 1535,12}, { 3135,13}, { 1663,12}, { 3455,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,12}, { 7935,11}, { 15871,15}, { 1023,14}, \
+ { 2047,13}, { 4479,14}, { 2303,13}, { 4991,12}, \
+ { 9983,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3839,13}, { 7935,12}, { 15871,16} }
+#define MUL_FFT_TABLE3_SIZE 155
#define MUL_FFT_THRESHOLD 6784
-#define SQR_FFT_MODF_THRESHOLD 606 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 555 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 606, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 29, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
- { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
- { 51, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95,10}, { 31, 9}, \
- { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
- { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
- { 95, 9}, { 191,11}, { 63,10}, { 159,11}, \
- { 95,10}, { 191, 6}, { 3135, 5}, { 6399, 6}, \
- { 3455, 8}, { 895, 9}, { 479, 8}, { 991,10}, \
- { 255, 9}, { 575,11}, { 159, 9}, { 639,10}, \
- { 335, 8}, { 1343,10}, { 351,11}, { 191, 9}, \
- { 799,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543,11}, { 287,10}, { 607, 9}, { 1215,10}, \
- { 671,12}, { 191,11}, { 383,10}, { 767, 9}, \
- { 1535,10}, { 799,11}, { 415,10}, { 863,13}, \
- { 127,12}, { 255,11}, { 511,10}, { 1023,11}, \
- { 543,10}, { 1087,11}, { 607,12}, { 319,11}, \
- { 671,10}, { 1343,11}, { 735,12}, { 383,11}, \
- { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
- { 927,13}, { 255,12}, { 511,11}, { 1087,12}, \
- { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
- { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
- { 1599,12}, { 831,11}, { 1727,12}, { 895,11}, \
- { 1791,12}, { 959,14}, { 255,13}, { 511,12}, \
- { 1087,11}, { 2239,10}, { 4479,12}, { 1215,13}, \
- { 639,12}, { 1471,11}, { 2943,13}, { 767,12}, \
- { 1727,13}, { 895,12}, { 1919,14}, { 511,13}, \
- { 1023,12}, { 2239,11}, { 4479,13}, { 1151,12}, \
- { 2495,11}, { 4991,13}, { 1279,12}, { 2623,13}, \
+ { { 555, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
+ { 16, 5}, { 33, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
+ { 39, 7}, { 23, 6}, { 47, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 49, 8}, { 31, 7}, { 63, 8}, \
+ { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95,11}, \
+ { 63,10}, { 143, 9}, { 287,10}, { 159,11}, \
+ { 95,10}, { 191, 6}, { 3071, 5}, { 6399, 6}, \
+ { 3455, 7}, { 1791, 8}, { 959,10}, { 255, 9}, \
+ { 511,10}, { 271,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 335, 9}, { 671,10}, { 351,11}, \
+ { 191,10}, { 399, 9}, { 799,10}, { 415,11}, \
+ { 223,12}, { 127,11}, { 255,10}, { 543,11}, \
+ { 287,10}, { 607,11}, { 319,10}, { 671,11}, \
+ { 351,12}, { 191,11}, { 383,10}, { 799,11}, \
+ { 415,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 1087,11}, { 607,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,12}, { 383,11}, { 799,10}, \
+ { 1599,11}, { 863,12}, { 447,11}, { 927,13}, \
+ { 255,12}, { 511,11}, { 1055,10}, { 2111,11}, \
+ { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
+ { 1343,12}, { 703,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,10}, { 3455,12}, \
+ { 959,14}, { 255,13}, { 511,12}, { 1023,11}, \
+ { 2111,12}, { 1087,11}, { 2239,10}, { 4479,12}, \
+ { 1215,13}, { 639,12}, { 1471,11}, { 2943,13}, \
+ { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
+ { 1855,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2495,13}, { 1279,12}, { 2623,13}, \
{ 1407,12}, { 2943,14}, { 767,13}, { 1663,12}, \
- { 3455,13}, { 1791,12}, { 3583,13}, { 1919,15}, \
- { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
- { 2431,12}, { 4991,14}, { 1279,13}, { 2943,12}, \
- { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
- { 3967,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
- { 2303,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 160
+ { 3455,13}, { 1791,15}, { 511,14}, { 1023,13}, \
+ { 2175,12}, { 4479,13}, { 2431,14}, { 1279,13}, \
+ { 2943,12}, { 5887,14}, { 1535,13}, { 3455,14}, \
+ { 1791,13}, { 3967,12}, { 7935,15}, { 1023,14}, \
+ { 2047,13}, { 4479,14}, { 2303,13}, { 4991,12}, \
+ { 9983,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3839,13}, { 7935,16} }
+#define SQR_FFT_TABLE3_SIZE 166
#define SQR_FFT_THRESHOLD 5760
#define MULLO_BASECASE_THRESHOLD 3
#define MULLO_DC_THRESHOLD 34
#define MULLO_MUL_N_THRESHOLD 13463
-#define SQRLO_BASECASE_THRESHOLD 7
+#define SQRLO_BASECASE_THRESHOLD 8
#define SQRLO_DC_THRESHOLD 43
#define SQRLO_SQR_THRESHOLD 11278
-#define DC_DIV_QR_THRESHOLD 67
-#define DC_DIVAPPR_Q_THRESHOLD 196
-#define DC_BDIV_QR_THRESHOLD 67
-#define DC_BDIV_Q_THRESHOLD 112
+#define DC_DIV_QR_THRESHOLD 75
+#define DC_DIVAPPR_Q_THRESHOLD 200
+#define DC_BDIV_QR_THRESHOLD 71
+#define DC_BDIV_Q_THRESHOLD 119
-#define INV_MULMOD_BNM1_THRESHOLD 70
-#define INV_NEWTON_THRESHOLD 262
-#define INV_APPR_THRESHOLD 222
+#define INV_MULMOD_BNM1_THRESHOLD 74
+#define INV_NEWTON_THRESHOLD 266
+#define INV_APPR_THRESHOLD 214
-#define BINV_NEWTON_THRESHOLD 288
-#define REDC_1_TO_REDC_N_THRESHOLD 67
+#define BINV_NEWTON_THRESHOLD 278
+#define REDC_1_TO_REDC_N_THRESHOLD 71
-#define MU_DIV_QR_THRESHOLD 1718
-#define MU_DIVAPPR_Q_THRESHOLD 1652
+#define MU_DIV_QR_THRESHOLD 1652
+#define MU_DIVAPPR_Q_THRESHOLD 1589
#define MUPI_DIV_QR_THRESHOLD 122
-#define MU_BDIV_QR_THRESHOLD 1387
-#define MU_BDIV_Q_THRESHOLD 1528
+#define MU_BDIV_QR_THRESHOLD 1442
+#define MU_BDIV_Q_THRESHOLD 1597
+
+#define POWM_SEC_TABLE 1,22,96,289,1259
-#define POWM_SEC_TABLE 1,16,69,508,1378,2657,2825
+#define GET_STR_DC_THRESHOLD 11
+#define GET_STR_PRECOMPUTE_THRESHOLD 20
+#define SET_STR_DC_THRESHOLD 173
+#define SET_STR_PRECOMPUTE_THRESHOLD 454
+
+#define FAC_DSC_THRESHOLD 90
+#define FAC_ODD_THRESHOLD 34
#define MATRIX22_STRASSEN_THRESHOLD 19
-#define HGCD_THRESHOLD 61
+#define HGCD2_DIV1_METHOD 1 /* 5.80% faster than 3 */
+#define HGCD_THRESHOLD 74
#define HGCD_APPR_THRESHOLD 50
#define HGCD_REDUCE_THRESHOLD 3389
-#define GCD_DC_THRESHOLD 492
+#define GCD_DC_THRESHOLD 456
#define GCDEXT_DC_THRESHOLD 345
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 9
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 189
-#define SET_STR_PRECOMPUTE_THRESHOLD 541
+#define JACOBI_BASE_METHOD 4 /* 17.07% faster than 1 */
-#define FAC_DSC_THRESHOLD 141
-#define FAC_ODD_THRESHOLD 29
+/* Tuneup completed successfully, took 53914 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/bd4/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/bd4/gmp-mparam.h
new file mode 100644
index 00000000000..6c20d0fb262
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/bd4/gmp-mparam.h
@@ -0,0 +1,225 @@
+/* AMD bd4 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* 3800-4200 MHz Excavator/Bristol Ridge */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-23, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 27
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 50
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 13
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 28.45% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 4
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 13
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 28
+
+#define DIV_1_VS_MUL_1_PERCENT 314
+
+#define MUL_TOOM22_THRESHOLD 32
+#define MUL_TOOM33_THRESHOLD 73
+#define MUL_TOOM44_THRESHOLD 166
+#define MUL_TOOM6H_THRESHOLD 270
+#define MUL_TOOM8H_THRESHOLD 357
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 69
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 114
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 103
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 121
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 154
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 42
+#define SQR_TOOM3_THRESHOLD 89
+#define SQR_TOOM4_THRESHOLD 208
+#define SQR_TOOM6_THRESHOLD 306
+#define SQR_TOOM8_THRESHOLD 454
+
+#define MULMID_TOOM42_THRESHOLD 68
+
+#define MULMOD_BNM1_THRESHOLD 19
+#define SQRMOD_BNM1_THRESHOLD 18
+
+#define MUL_FFT_MODF_THRESHOLD 570 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 570, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
+ { 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
+ { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
+ { 47, 8}, { 95,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
+ { 191,11}, { 63,10}, { 143, 6}, { 2303, 5}, \
+ { 4735, 4}, { 9471, 5}, { 4863, 7}, { 1279, 9}, \
+ { 335, 8}, { 671, 9}, { 351, 8}, { 703,10}, \
+ { 191,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 271, 9}, { 543,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335, 9}, { 671, 8}, \
+ { 1343,10}, { 351, 9}, { 703,10}, { 367, 9}, \
+ { 735,11}, { 191,10}, { 383, 9}, { 767,10}, \
+ { 399, 9}, { 799, 8}, { 1599,10}, { 415,11}, \
+ { 223,12}, { 127,11}, { 255,10}, { 543, 9}, \
+ { 1087,11}, { 287,10}, { 607, 9}, { 1215,11}, \
+ { 319,10}, { 671, 9}, { 1343,11}, { 351,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 863,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 1087,11}, { 607,10}, { 1215, 9}, { 2431,12}, \
+ { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
+ { 1471, 9}, { 2943,12}, { 383,11}, { 799,10}, \
+ { 1599,11}, { 863,10}, { 1727,12}, { 447,11}, \
+ { 959,10}, { 1919,13}, { 255,12}, { 511,11}, \
+ { 1087,12}, { 575,11}, { 1215,10}, { 2431,12}, \
+ { 639,11}, { 1343,12}, { 703,11}, { 1471,10}, \
+ { 2943,13}, { 383,12}, { 767,11}, { 1599,12}, \
+ { 831,11}, { 1727,10}, { 3455,12}, { 959,11}, \
+ { 1919,10}, { 3839,13}, { 511,12}, { 1087,11}, \
+ { 2239,12}, { 1215,11}, { 2431,13}, { 639,12}, \
+ { 1471,11}, { 2943,10}, { 5887,13}, { 767,12}, \
+ { 1727,11}, { 3455,13}, { 895,12}, { 1919,11}, \
+ { 3839,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2431,13}, { 1279,12}, { 2559,13}, \
+ { 1407,12}, { 2943,11}, { 5887,14}, { 767,13}, \
+ { 1663,12}, { 3455,13}, { 1919,12}, { 3839,15}, \
+ { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
+ { 2431,14}, { 1279,13}, { 2943,12}, { 5887,14}, \
+ { 1535,13}, { 3455,14}, { 1791,13}, { 3967,12}, \
+ { 7935,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
+ { 2303,13}, { 4991,12}, { 9983,14}, { 2815,13}, \
+ { 5887,15}, { 1535,14}, { 3839,13}, { 7935,16} }
+#define MUL_FFT_TABLE3_SIZE 192
+#define MUL_FFT_THRESHOLD 5760
+
+#define SQR_FFT_MODF_THRESHOLD 476 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 476, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
+ { 16, 5}, { 33, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
+ { 39, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 39, 9}, { 23, 8}, \
+ { 51, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
+ { 79, 9}, { 47, 8}, { 95,10}, { 31, 9}, \
+ { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
+ { 63, 9}, { 135,10}, { 95, 9}, { 191,10}, \
+ { 111,11}, { 63,10}, { 127, 9}, { 255,10}, \
+ { 143, 9}, { 287, 8}, { 575,10}, { 159,11}, \
+ { 95,10}, { 191,12}, { 63,10}, { 255, 9}, \
+ { 511,10}, { 271, 9}, { 543,10}, { 287, 9}, \
+ { 575,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 335, 9}, { 671,10}, { 351, 9}, { 735,11}, \
+ { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
+ { 799,10}, { 415, 9}, { 863,12}, { 127,11}, \
+ { 255,10}, { 511, 9}, { 1023,10}, { 543,11}, \
+ { 287,10}, { 607, 9}, { 1215,11}, { 319,10}, \
+ { 671, 9}, { 1343,11}, { 351,10}, { 735,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 863,13}, { 127,12}, { 255,11}, { 511,10}, \
+ { 1055,11}, { 543,10}, { 1087,11}, { 607,10}, \
+ { 1215,12}, { 319,11}, { 671,10}, { 1343,11}, \
+ { 735,10}, { 1471,12}, { 383,11}, { 799,10}, \
+ { 1599,11}, { 863,10}, { 1727,12}, { 447,11}, \
+ { 959,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,12}, { 959,11}, \
+ { 1919,14}, { 255,13}, { 511,12}, { 1023,11}, \
+ { 2047,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
+ { 767,12}, { 1727,13}, { 895,12}, { 1983,14}, \
+ { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
+ { 2431,13}, { 1279,12}, { 2559,13}, { 1407,12}, \
+ { 2943,14}, { 767,13}, { 1663,12}, { 3455,13}, \
+ { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
+ { 2175,12}, { 4479,13}, { 2431,14}, { 1279,13}, \
+ { 2943,12}, { 5887,14}, { 1535,13}, { 3455,14}, \
+ { 1791,13}, { 3967,15}, { 1023,14}, { 2047,13}, \
+ { 4479,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
+ { 2815,13}, { 5887,15}, { 1535,14}, { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 176
+#define SQR_FFT_THRESHOLD 4736
+
+#define MULLO_BASECASE_THRESHOLD 3
+#define MULLO_DC_THRESHOLD 54
+#define MULLO_MUL_N_THRESHOLD 10950
+#define SQRLO_BASECASE_THRESHOLD 10
+#define SQRLO_DC_THRESHOLD 77
+#define SQRLO_SQR_THRESHOLD 9449
+
+#define DC_DIV_QR_THRESHOLD 84
+#define DC_DIVAPPR_Q_THRESHOLD 252
+#define DC_BDIV_QR_THRESHOLD 79
+#define DC_BDIV_Q_THRESHOLD 80
+
+#define INV_MULMOD_BNM1_THRESHOLD 71
+#define INV_NEWTON_THRESHOLD 254
+#define INV_APPR_THRESHOLD 266
+
+#define BINV_NEWTON_THRESHOLD 294
+#define REDC_1_TO_REDC_N_THRESHOLD 79
+
+#define MU_DIV_QR_THRESHOLD 1652
+#define MU_DIVAPPR_Q_THRESHOLD 1528
+#define MUPI_DIV_QR_THRESHOLD 122
+#define MU_BDIV_QR_THRESHOLD 1387
+#define MU_BDIV_Q_THRESHOLD 1528
+
+#define POWM_SEC_TABLE 1,16,96,480,960
+
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 19
+#define SET_STR_DC_THRESHOLD 264
+#define SET_STR_PRECOMPUTE_THRESHOLD 542
+
+#define FAC_DSC_THRESHOLD 91
+#define FAC_ODD_THRESHOLD 29
+
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD2_DIV1_METHOD 1 /* 9.73% faster than 3 */
+#define HGCD_THRESHOLD 55
+#define HGCD_APPR_THRESHOLD 50
+#define HGCD_REDUCE_THRESHOLD 3389
+#define GCD_DC_THRESHOLD 562
+#define GCDEXT_DC_THRESHOLD 416
+#define JACOBI_BASE_METHOD 4 /* 16.50% faster than 1 */
+
+/* Tuneup completed successfully, took 49179 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/bobcat/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/bobcat/gmp-mparam.h
deleted file mode 100644
index 198081f9fd8..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/bobcat/gmp-mparam.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* x86/bobcat gmp-mparam.h -- Compiler/machine parameter header file.
-
-Copyright 1991, 1993, 1994, 2000-2011, 2014 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-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/. */
-
-#define GMP_LIMB_BITS 32
-#define GMP_LIMB_BYTES 4
-
-/* 1600 MHz AMD Bobcat Zacate E-350 */
-/* FFT tuning limit = 25000000 */
-/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
-
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 12
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 16
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 16
-#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 2
-#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 40
-
-#define MUL_TOOM22_THRESHOLD 28
-#define MUL_TOOM33_THRESHOLD 90
-#define MUL_TOOM44_THRESHOLD 154
-#define MUL_TOOM6H_THRESHOLD 270
-#define MUL_TOOM8H_THRESHOLD 490
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 89
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 107
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 95
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 110
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 130
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 38
-#define SQR_TOOM3_THRESHOLD 121
-#define SQR_TOOM4_THRESHOLD 212
-#define SQR_TOOM6_THRESHOLD 303
-#define SQR_TOOM8_THRESHOLD 454
-
-#define MULMID_TOOM42_THRESHOLD 74
-
-#define MULMOD_BNM1_THRESHOLD 18
-#define SQRMOD_BNM1_THRESHOLD 23
-
-#define MUL_FFT_MODF_THRESHOLD 660 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 660, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 27, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 63, 8}, { 127, 9}, { 79,10}, \
- { 47, 9}, { 103,11}, { 31,10}, { 63, 9}, \
- { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
- { 191,10}, { 111,11}, { 63,10}, { 159,11}, \
- { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,10}, { 271, 9}, { 543,11}, \
- { 159, 9}, { 639,10}, { 335, 9}, { 671,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
- { 799,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
- { 1215,10}, { 671,12}, { 191,11}, { 383,10}, \
- { 799, 9}, { 1599,11}, { 415,13}, { 127,12}, \
- { 255,11}, { 543,10}, { 1087,11}, { 607,10}, \
- { 1215,11}, { 671,10}, { 1343,11}, { 735,10}, \
- { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,12}, { 447,11}, { 991,13}, { 255,12}, \
- { 511,11}, { 1087,12}, { 575,11}, { 1215,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,13}, \
- { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
- { 1727,12}, { 959,14}, { 255,13}, { 511,12}, \
- { 1215,13}, { 639,12}, { 1471,13}, { 767,12}, \
- { 1727,13}, { 895,12}, { 1919,14}, { 511,13}, \
- { 1023,12}, { 2111,13}, { 1151,12}, { 2431,13}, \
- { 1407,14}, { 767,13}, { 1663,12}, { 3455,13}, \
- { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
- { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
- { 5887,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 139
-#define MUL_FFT_THRESHOLD 7552
-
-#define SQR_FFT_MODF_THRESHOLD 606 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 606, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
- { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 103,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 159,10}, { 95, 9}, { 191,11}, { 63,10}, \
- { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543, 8}, { 1087,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335, 9}, { 671, 8}, { 1343,10}, \
- { 351,11}, { 191,10}, { 383, 9}, { 767,10}, \
- { 399, 9}, { 799,10}, { 415, 9}, { 831,12}, \
- { 127,11}, { 255,10}, { 511, 9}, { 1023,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
- { 1215,11}, { 319,10}, { 671, 9}, { 1343,12}, \
- { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
- { 831,13}, { 127,12}, { 255,11}, { 511,10}, \
- { 1023,11}, { 543,10}, { 1087,11}, { 607,10}, \
- { 1215,12}, { 319,11}, { 671,10}, { 1343,11}, \
- { 735,10}, { 1471,12}, { 383,11}, { 799,10}, \
- { 1599,11}, { 863,12}, { 447,11}, { 991,13}, \
- { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
- { 1215,12}, { 639,11}, { 1343,12}, { 703,11}, \
- { 1471,13}, { 383,12}, { 767,11}, { 1599,12}, \
- { 831,11}, { 1727,12}, { 959,14}, { 255,13}, \
- { 511,12}, { 1215,13}, { 639,12}, { 1471,13}, \
- { 767,12}, { 1727,13}, { 895,12}, { 1983,14}, \
- { 511,13}, { 1023,12}, { 2111,13}, { 1151,12}, \
- { 2431,13}, { 1407,14}, { 767,13}, { 1663,12}, \
- { 3455,13}, { 1919,15}, { 511,14}, { 1023,13}, \
- { 2175,12}, { 4479,13}, { 2431,14}, { 1279,13}, \
- { 2943,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 147
-#define SQR_FFT_THRESHOLD 5760
-
-#define MULLO_BASECASE_THRESHOLD 5
-#define MULLO_DC_THRESHOLD 45
-#define MULLO_MUL_N_THRESHOLD 14281
-
-#define DC_DIV_QR_THRESHOLD 71
-#define DC_DIVAPPR_Q_THRESHOLD 238
-#define DC_BDIV_QR_THRESHOLD 67
-#define DC_BDIV_Q_THRESHOLD 151
-
-#define INV_MULMOD_BNM1_THRESHOLD 66
-#define INV_NEWTON_THRESHOLD 228
-#define INV_APPR_THRESHOLD 222
-
-#define BINV_NEWTON_THRESHOLD 270
-#define REDC_1_TO_REDC_N_THRESHOLD 71
-
-#define MU_DIV_QR_THRESHOLD 1718
-#define MU_DIVAPPR_Q_THRESHOLD 1718
-#define MUPI_DIV_QR_THRESHOLD 91
-#define MU_BDIV_QR_THRESHOLD 1589
-#define MU_BDIV_Q_THRESHOLD 1718
-
-#define POWM_SEC_TABLE 1,16,96,416,1185
-
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 88
-#define HGCD_APPR_THRESHOLD 137
-#define HGCD_REDUCE_THRESHOLD 3664
-#define GCD_DC_THRESHOLD 465
-#define GCDEXT_DC_THRESHOLD 345
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 18
-#define GET_STR_PRECOMPUTE_THRESHOLD 34
-#define SET_STR_DC_THRESHOLD 270
-#define SET_STR_PRECOMPUTE_THRESHOLD 828
-
-#define FAC_DSC_THRESHOLD 256
-#define FAC_ODD_THRESHOLD 34
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/bt1/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/bt1/gmp-mparam.h
new file mode 100644
index 00000000000..302dbc6c18a
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/bt1/gmp-mparam.h
@@ -0,0 +1,218 @@
+/* x86/bobcat gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* NOTE: In a fat binary build SQR_TOOM2_THRESHOLD here cannot be greater than
+ the value in mpn/x86/k7/gmp-mparam.h. The latter is used as a hard limit in
+ k7/sqr_basecase.asm. */
+
+/* 1600 MHz AMD Bobcat Zacate E-350 */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-17, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 10
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 16
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 21
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 57.16% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 36
+
+#define DIV_1_VS_MUL_1_PERCENT 199
+
+#define MUL_TOOM22_THRESHOLD 28
+#define MUL_TOOM33_THRESHOLD 93
+#define MUL_TOOM44_THRESHOLD 166
+#define MUL_TOOM6H_THRESHOLD 270
+#define MUL_TOOM8H_THRESHOLD 478
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 102
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 177
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 169
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 143
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 50
+#define SQR_TOOM3_THRESHOLD 89
+#define SQR_TOOM4_THRESHOLD 248
+#define SQR_TOOM6_THRESHOLD 342
+#define SQR_TOOM8_THRESHOLD 470
+
+#define MULMID_TOOM42_THRESHOLD 72
+
+#define MULMOD_BNM1_THRESHOLD 20
+#define SQRMOD_BNM1_THRESHOLD 21
+
+#define MUL_FFT_MODF_THRESHOLD 630 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 630, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 15, 5}, { 31, 6}, { 27, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 23, 6}, { 47, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 7}, { 55, 9}, \
+ { 15, 8}, { 31, 7}, { 63, 8}, { 43, 9}, \
+ { 23, 8}, { 55, 9}, { 31, 8}, { 67, 9}, \
+ { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
+ { 55,10}, { 31, 9}, { 79,10}, { 47, 6}, \
+ { 767, 7}, { 399, 6}, { 799, 7}, { 415, 8}, \
+ { 235, 7}, { 479, 9}, { 135,10}, { 79, 9}, \
+ { 159,10}, { 95, 9}, { 191,11}, { 63,10}, \
+ { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 335, 9}, { 671,11}, { 191,10}, { 383, 9}, \
+ { 767,10}, { 399, 9}, { 799,11}, { 223,12}, \
+ { 127,11}, { 255,10}, { 543, 9}, { 1087,11}, \
+ { 287,10}, { 607, 9}, { 1215,11}, { 319,10}, \
+ { 671,11}, { 351,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,13}, { 127,12}, { 255,11}, \
+ { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
+ { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
+ { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
+ { 863,12}, { 447,11}, { 991,13}, { 255,12}, \
+ { 511,11}, { 1087,12}, { 575,11}, { 1215,12}, \
+ { 639,11}, { 1343,12}, { 703,11}, { 1471,13}, \
+ { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
+ { 1727,12}, { 959,14}, { 255,13}, { 511,12}, \
+ { 1215,13}, { 639,12}, { 1471,13}, { 767,12}, \
+ { 1727,13}, { 895,12}, { 1919,14}, { 511,13}, \
+ { 1023,12}, { 2111,13}, { 1151,12}, { 2431,13}, \
+ { 1407,14}, { 767,13}, { 1663,12}, { 3455,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
+ { 2303,13}, { 4991,12}, { 9983,14}, { 2815,13}, \
+ { 5887,15}, { 1535,14}, { 3839,16} }
+#define MUL_FFT_TABLE3_SIZE 159
+#define MUL_FFT_THRESHOLD 7424
+
+#define SQR_FFT_MODF_THRESHOLD 500 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 500, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 28, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
+ { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
+ { 47, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 51, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 127, 6}, { 1087, 7}, { 575, 8}, { 303, 9}, \
+ { 159,10}, { 95,11}, { 63,10}, { 127, 9}, \
+ { 255,10}, { 143, 9}, { 287,10}, { 159,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
+ { 287, 9}, { 575,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 335, 9}, { 671,10}, { 351,11}, \
+ { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
+ { 799,10}, { 415, 9}, { 831,12}, { 127,11}, \
+ { 255,10}, { 543,11}, { 287,10}, { 607,11}, \
+ { 319,10}, { 671,11}, { 351,10}, { 703,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 831,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 1087,11}, { 607,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,10}, { 1471,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 959,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1215,13}, { 639,12}, \
+ { 1471,13}, { 767,12}, { 1727,13}, { 895,12}, \
+ { 1919,14}, { 511,13}, { 1023,12}, { 2111,13}, \
+ { 1151,12}, { 2431,13}, { 1407,14}, { 767,13}, \
+ { 1663,12}, { 3455,13}, { 1919,15}, { 511,14}, \
+ { 1023,13}, { 2175,12}, { 4479,13}, { 2431,14}, \
+ { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
+ { 3455,14}, { 1791,13}, { 3839,15}, { 1023,14}, \
+ { 2047,13}, { 4479,14}, { 2303,13}, { 4991,12}, \
+ { 9983,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 161
+#define SQR_FFT_THRESHOLD 5760
+
+#define MULLO_BASECASE_THRESHOLD 9
+#define MULLO_DC_THRESHOLD 48
+#define MULLO_MUL_N_THRESHOLD 14281
+#define SQRLO_BASECASE_THRESHOLD 7
+#define SQRLO_DC_THRESHOLD 146
+#define SQRLO_SQR_THRESHOLD 11278
+
+#define DC_DIV_QR_THRESHOLD 77
+#define DC_DIVAPPR_Q_THRESHOLD 240
+#define DC_BDIV_QR_THRESHOLD 83
+#define DC_BDIV_Q_THRESHOLD 182
+
+#define INV_MULMOD_BNM1_THRESHOLD 74
+#define INV_NEWTON_THRESHOLD 252
+#define INV_APPR_THRESHOLD 252
+
+#define BINV_NEWTON_THRESHOLD 252
+#define REDC_1_TO_REDC_N_THRESHOLD 79
+
+#define MU_DIV_QR_THRESHOLD 1787
+#define MU_DIVAPPR_Q_THRESHOLD 1718
+#define MUPI_DIV_QR_THRESHOLD 122
+#define MU_BDIV_QR_THRESHOLD 1470
+#define MU_BDIV_Q_THRESHOLD 1713
+
+#define POWM_SEC_TABLE 1,16,96,563,1317,1867
+
+#define GET_STR_DC_THRESHOLD 19
+#define GET_STR_PRECOMPUTE_THRESHOLD 32
+#define SET_STR_DC_THRESHOLD 254
+#define SET_STR_PRECOMPUTE_THRESHOLD 907
+
+#define FAC_DSC_THRESHOLD 224
+#define FAC_ODD_THRESHOLD 55
+
+#define MATRIX22_STRASSEN_THRESHOLD 23
+#define HGCD2_DIV1_METHOD 3 /* 3.59% faster than 5 */
+#define HGCD_THRESHOLD 85
+#define HGCD_APPR_THRESHOLD 152
+#define HGCD_REDUCE_THRESHOLD 3389
+#define GCD_DC_THRESHOLD 531
+#define GCDEXT_DC_THRESHOLD 386
+#define JACOBI_BASE_METHOD 3 /* 0.92% faster than 1 */
+
+/* Tuneup completed successfully, took 159946 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/bt2/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/bt2/gmp-mparam.h
new file mode 100644
index 00000000000..f936cb76afc
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/bt2/gmp-mparam.h
@@ -0,0 +1,214 @@
+/* x86/bobcat gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* NOTE: In a fat binary build SQR_TOOM2_THRESHOLD here cannot be greater than
+ the value in mpn/x86/k7/gmp-mparam.h. The latter is used as a hard limit in
+ k7/sqr_basecase.asm. */
+
+/* 2050 MHz AMD Jaguar/Kabini */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-24, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 4
+#define MOD_1_UNNORM_THRESHOLD 6
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 18
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 47.53% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 27
+
+#define DIV_1_VS_MUL_1_PERCENT 243
+
+#define MUL_TOOM22_THRESHOLD 32
+#define MUL_TOOM33_THRESHOLD 90
+#define MUL_TOOM44_THRESHOLD 154
+#define MUL_TOOM6H_THRESHOLD 286
+#define MUL_TOOM8H_THRESHOLD 478
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 152
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 103
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 154
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 38
+#define SQR_TOOM3_THRESHOLD 126
+#define SQR_TOOM4_THRESHOLD 220
+#define SQR_TOOM6_THRESHOLD 318
+#define SQR_TOOM8_THRESHOLD 502
+
+#define MULMID_TOOM42_THRESHOLD 68
+
+#define MULMOD_BNM1_THRESHOLD 19
+#define SQRMOD_BNM1_THRESHOLD 25
+
+#define MUL_FFT_MODF_THRESHOLD 570 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 570, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 15, 5}, { 31, 6}, { 28, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 23, 6}, { 47, 7}, { 27, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
+ { 23, 7}, { 49, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95,11}, \
+ { 63,10}, { 159,11}, { 95,10}, { 191,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543,10}, { 287,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335, 9}, { 671,11}, \
+ { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
+ { 799,10}, { 415,11}, { 223,12}, { 127,11}, \
+ { 255,10}, { 543,11}, { 287,10}, { 607, 9}, \
+ { 1215,11}, { 319,10}, { 671,11}, { 351,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,13}, \
+ { 127,12}, { 255,11}, { 543,10}, { 1087,11}, \
+ { 607,10}, { 1215,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,10}, { 1471,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 991,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1215,13}, { 639,12}, \
+ { 1471,13}, { 767,12}, { 1727,13}, { 895,12}, \
+ { 1919,14}, { 511,13}, { 1023,12}, { 2111,13}, \
+ { 1151,12}, { 2431,13}, { 1407,14}, { 767,13}, \
+ { 1663,12}, { 3455,13}, { 1919,15}, { 511,14}, \
+ { 1023,13}, { 2175,12}, { 4479,13}, { 2431,14}, \
+ { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
+ { 3455,14}, { 1791,13}, { 3967,15}, { 1023,14}, \
+ { 2047,13}, { 4479,14}, { 2303,13}, { 4991,12}, \
+ { 9983,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3839,16} }
+#define MUL_FFT_TABLE3_SIZE 153
+#define MUL_FFT_THRESHOLD 5760
+
+#define SQR_FFT_MODF_THRESHOLD 530 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 530, 5}, { 27, 6}, { 15, 5}, { 31, 6}, \
+ { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
+ { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
+ { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
+ { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
+ { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
+ { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
+ { 31,10}, { 63, 9}, { 135,10}, { 95,11}, \
+ { 63,10}, { 143, 9}, { 287,10}, { 159,11}, \
+ { 95,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 271, 9}, { 543,10}, { 287,11}, \
+ { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
+ { 671,10}, { 351,11}, { 191,10}, { 383, 9}, \
+ { 767,10}, { 399, 9}, { 799,12}, { 127,11}, \
+ { 255,10}, { 543,11}, { 287,10}, { 607, 9}, \
+ { 1215,11}, { 319,10}, { 671,11}, { 351,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 831,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 1087,11}, { 607,10}, { 1215,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,10}, { 1471,12}, \
+ { 383,11}, { 799,10}, { 1599,11}, { 863,12}, \
+ { 447,11}, { 991,13}, { 255,12}, { 511,11}, \
+ { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 831,11}, { 1727,12}, \
+ { 959,11}, { 1919,14}, { 255,13}, { 511,12}, \
+ { 1215,13}, { 639,12}, { 1471,13}, { 767,12}, \
+ { 1727,13}, { 895,12}, { 1919,14}, { 511,13}, \
+ { 1023,12}, { 2111,13}, { 1151,12}, { 2495,13}, \
+ { 1407,14}, { 767,13}, { 1663,12}, { 3455,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
+ { 2303,13}, { 4991,12}, { 9983,14}, { 2815,13}, \
+ { 5887,15}, { 1535,14}, { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 151
+#define SQR_FFT_THRESHOLD 4736
+
+#define MULLO_BASECASE_THRESHOLD 8
+#define MULLO_DC_THRESHOLD 44
+#define MULLO_MUL_N_THRESHOLD 11278
+#define SQRLO_BASECASE_THRESHOLD 13
+#define SQRLO_DC_THRESHOLD 62
+#define SQRLO_SQR_THRESHOLD 8907
+
+#define DC_DIV_QR_THRESHOLD 79
+#define DC_DIVAPPR_Q_THRESHOLD 228
+#define DC_BDIV_QR_THRESHOLD 75
+#define DC_BDIV_Q_THRESHOLD 136
+
+#define INV_MULMOD_BNM1_THRESHOLD 90
+#define INV_NEWTON_THRESHOLD 260
+#define INV_APPR_THRESHOLD 236
+
+#define BINV_NEWTON_THRESHOLD 294
+#define REDC_1_TO_REDC_N_THRESHOLD 80
+
+#define MU_DIV_QR_THRESHOLD 1787
+#define MU_DIVAPPR_Q_THRESHOLD 1718
+#define MUPI_DIV_QR_THRESHOLD 118
+#define MU_BDIV_QR_THRESHOLD 1442
+#define MU_BDIV_Q_THRESHOLD 1652
+
+#define POWM_SEC_TABLE 1,16,96,615,865,1442
+
+#define GET_STR_DC_THRESHOLD 16
+#define GET_STR_PRECOMPUTE_THRESHOLD 27
+#define SET_STR_DC_THRESHOLD 252
+#define SET_STR_PRECOMPUTE_THRESHOLD 638
+
+#define FAC_DSC_THRESHOLD 141
+#define FAC_ODD_THRESHOLD 39
+
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD2_DIV1_METHOD 1 /* 13.65% faster than 3 */
+#define HGCD_THRESHOLD 81
+#define HGCD_APPR_THRESHOLD 66
+#define HGCD_REDUCE_THRESHOLD 3389
+#define GCD_DC_THRESHOLD 531
+#define GCDEXT_DC_THRESHOLD 345
+#define JACOBI_BASE_METHOD 1 /* 0.84% faster than 4 */
+
+/* Tuneup completed successfully, took 103818 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/core2/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/core2/gmp-mparam.h
index b370eb58771..8a44ad1fad2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/core2/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/core2/gmp-mparam.h
@@ -1,6 +1,6 @@
/* x86/core2 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2011, 2014 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,170 +31,180 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 2133 MHz Core 2 (65nm) */
-/* FFT tuning limit = 25000000 */
-/* Generated by tuneup.c, 2014-03-14, gcc 4.5 */
+/* 3000 MHz Penryn */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-20, gcc 8.3 */
-#define MOD_1_NORM_THRESHOLD 4
-#define MOD_1_UNNORM_THRESHOLD 4
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
+#define MOD_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 9
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 3
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1N_PI1_METHOD 2 /* 22.20% faster than 1 */
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 9
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 19
+#define BMOD_1_TO_MOD_1_THRESHOLD 18
-#define MUL_TOOM22_THRESHOLD 26
-#define MUL_TOOM33_THRESHOLD 90
-#define MUL_TOOM44_THRESHOLD 144
-#define MUL_TOOM6H_THRESHOLD 286
-#define MUL_TOOM8H_THRESHOLD 430
+#define DIV_1_VS_MUL_1_PERCENT 277
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 93
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 140
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 89
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 102
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 136
+#define MUL_TOOM22_THRESHOLD 24
+#define MUL_TOOM33_THRESHOLD 93
+#define MUL_TOOM44_THRESHOLD 136
+#define MUL_TOOM6H_THRESHOLD 300
+#define MUL_TOOM8H_THRESHOLD 478
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 91
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 153
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 93
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 94
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 130
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 34
-#define SQR_TOOM3_THRESHOLD 114
-#define SQR_TOOM4_THRESHOLD 178
+#define SQR_TOOM3_THRESHOLD 117
+#define SQR_TOOM4_THRESHOLD 184
#define SQR_TOOM6_THRESHOLD 262
-#define SQR_TOOM8_THRESHOLD 357
+#define SQR_TOOM8_THRESHOLD 597
-#define MULMID_TOOM42_THRESHOLD 66
+#define MULMID_TOOM42_THRESHOLD 70
-#define MULMOD_BNM1_THRESHOLD 15
-#define SQRMOD_BNM1_THRESHOLD 21
+#define MULMOD_BNM1_THRESHOLD 17
+#define SQRMOD_BNM1_THRESHOLD 25
-#define MUL_FFT_MODF_THRESHOLD 600 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 505 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 600, 5}, { 25, 6}, { 13, 5}, { 28, 6}, \
- { 25, 7}, { 13, 6}, { 29, 7}, { 15, 6}, \
- { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
- { 39, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 47, 8}, \
- { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
- { 43, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
- { 47, 8}, { 95, 9}, { 55,10}, { 31, 9}, \
- { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
- { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
- { 95, 9}, { 191,11}, { 63,10}, { 159,11}, \
- { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
- { 271, 9}, { 543, 8}, { 1087,11}, { 159,10}, \
- { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
- { 351,11}, { 191,10}, { 383, 9}, { 767,10}, \
- { 399, 9}, { 799,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 543, 9}, { 1087,11}, { 287,10}, \
- { 607, 9}, { 1215,11}, { 319,10}, { 671,11}, \
- { 351,12}, { 191,11}, { 383,10}, { 799, 9}, \
- { 1599,13}, { 127,12}, { 255,11}, { 543,10}, \
- { 1087,11}, { 607,10}, { 1215,12}, { 319,11}, \
- { 671,10}, { 1343,11}, { 735,12}, { 383,11}, \
- { 799,10}, { 1599,11}, { 863,10}, { 1727,12}, \
+ { { 505, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
+ { 29, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
+ { 35, 7}, { 19, 6}, { 39, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
+ { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
+ { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
+ { 79, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95,11}, \
+ { 63, 9}, { 255,10}, { 159,11}, { 95,10}, \
+ { 191,12}, { 63,11}, { 127,10}, { 271, 9}, \
+ { 543,10}, { 287,11}, { 159,10}, { 335, 9}, \
+ { 671,10}, { 351,11}, { 191,10}, { 399, 9}, \
+ { 799,11}, { 223,12}, { 127,11}, { 255,10}, \
+ { 543,11}, { 287,10}, { 607,11}, { 319,10}, \
+ { 671,11}, { 351,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,13}, { 127,12}, { 255,11}, \
+ { 543,10}, { 1087,11}, { 607,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,10}, { 1471,12}, \
+ { 383,11}, { 799,10}, { 1599,11}, { 863,12}, \
{ 447,11}, { 959,13}, { 255,12}, { 511,11}, \
{ 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
- { 1343,12}, { 703,13}, { 383,12}, { 767,11}, \
- { 1599,12}, { 831,11}, { 1727,12}, { 959,14}, \
- { 255,13}, { 511,12}, { 1087,11}, { 2239,10}, \
- { 4479,12}, { 1215,13}, { 639,12}, { 1471,11}, \
+ { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 831,11}, { 1727,12}, \
+ { 959,14}, { 255,13}, { 511,12}, { 1087,11}, \
+ { 2239,12}, { 1215,13}, { 639,12}, { 1471,11}, \
{ 2943,13}, { 767,12}, { 1727,13}, { 895,12}, \
- { 1983,14}, { 511,13}, { 1023,12}, { 2239,11}, \
- { 4479,13}, { 1151,12}, { 2495,13}, { 1279,12}, \
- { 2623,13}, { 1407,12}, { 2815,14}, { 767,13}, \
- { 1663,12}, { 3455,13}, { 1919,15}, { 511,14}, \
- { 1023,13}, { 2175,12}, { 4479,13}, { 2431,14}, \
- { 1279,13}, { 2943,12}, { 5887,14}, { 16384,15}, \
- { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 149
+ { 1919,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2431,13}, { 1407,12}, { 2943,14}, \
+ { 767,13}, { 1663,12}, { 3455,13}, { 1919,15}, \
+ { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
+ { 2431,14}, { 1279,13}, { 2943,12}, { 5887,14}, \
+ { 1535,13}, { 3455,14}, { 1791,13}, { 3967,12}, \
+ { 7935,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
+ { 2303,13}, { 4991,12}, { 9983,14}, { 2815,13}, \
+ { 5887,15}, { 1535,14}, { 3839,16} }
+#define MUL_FFT_TABLE3_SIZE 147
#define MUL_FFT_THRESHOLD 6784
-#define SQR_FFT_MODF_THRESHOLD 500 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 464 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 500, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 28, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
+ { { 464, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
+ { 29, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
{ 35, 7}, { 19, 6}, { 39, 7}, { 29, 8}, \
{ 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
{ 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 51,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 79, 9}, { 55,10}, { 31, 9}, \
+ { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
+ { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
+ { 47, 8}, { 95, 9}, { 55,10}, { 31, 9}, \
{ 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
{ 63, 9}, { 127,10}, { 79, 9}, { 159,10}, \
- { 95,11}, { 63,10}, { 143, 9}, { 287,10}, \
- { 159,11}, { 95,12}, { 63,11}, { 127,10}, \
- { 271, 9}, { 543,10}, { 287,11}, { 159,10}, \
- { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
- { 351, 9}, { 703,11}, { 191,10}, { 383, 9}, \
+ { 95,11}, { 63,10}, { 127, 9}, { 255,10}, \
+ { 143, 9}, { 287, 5}, { 4863, 6}, { 2495, 7}, \
+ { 1343, 8}, { 703, 9}, { 367,12}, { 63,11}, \
+ { 127,10}, { 303,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 335, 9}, { 671,10}, { 351, 9}, \
+ { 703,10}, { 367,11}, { 191,10}, { 383, 9}, \
{ 767,10}, { 399, 9}, { 799,10}, { 415, 9}, \
- { 831,10}, { 431,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 543, 9}, { 1087,11}, { 287,10}, \
- { 607,11}, { 319,10}, { 671,11}, { 351,10}, \
- { 703,12}, { 191,11}, { 383,10}, { 799,11}, \
- { 415,10}, { 863,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
+ { 831,12}, { 127,11}, { 255,10}, { 543,11}, \
+ { 287,10}, { 607,11}, { 319,10}, { 671,11}, \
+ { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,10}, { 863,13}, { 127,12}, \
+ { 255,11}, { 543,10}, { 1087,11}, { 607,12}, \
{ 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
{ 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
{ 863,12}, { 447,11}, { 959,13}, { 255,12}, \
{ 511,11}, { 1087,12}, { 575,11}, { 1215,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,13}, \
- { 383,12}, { 831,11}, { 1727,12}, { 959,14}, \
- { 255,13}, { 511,12}, { 1087,11}, { 2239,12}, \
+ { 639,11}, { 1343,12}, { 703,11}, { 1407,13}, \
+ { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
+ { 1727,12}, { 959,14}, { 255,13}, { 511,12}, \
{ 1215,13}, { 639,12}, { 1471,11}, { 2943,13}, \
- { 767,12}, { 1727,13}, { 895,12}, { 1983,14}, \
- { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
- { 2495,13}, { 1407,12}, { 2943,14}, { 767,13}, \
+ { 767,12}, { 1727,13}, { 895,12}, { 1919,14}, \
+ { 511,13}, { 1023,12}, { 2111,13}, { 1151,12}, \
+ { 2431,13}, { 1407,12}, { 2943,14}, { 767,13}, \
{ 1663,12}, { 3455,13}, { 1919,15}, { 511,14}, \
{ 1023,13}, { 2175,12}, { 4479,13}, { 2431,14}, \
- { 1279,13}, { 2943,12}, { 5887,14}, { 16384,15}, \
- { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 145
+ { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
+ { 3455,14}, { 1791,13}, { 3967,15}, { 1023,14}, \
+ { 2047,13}, { 4479,14}, { 2303,13}, { 4991,12}, \
+ { 9983,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 157
#define SQR_FFT_THRESHOLD 5312
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 29
+#define MULLO_DC_THRESHOLD 36
#define MULLO_MUL_N_THRESHOLD 13463
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 140
+#define SQRLO_SQR_THRESHOLD 10393
-#define DC_DIV_QR_THRESHOLD 21
-#define DC_DIVAPPR_Q_THRESHOLD 50
-#define DC_BDIV_QR_THRESHOLD 79
-#define DC_BDIV_Q_THRESHOLD 174
+#define DC_DIV_QR_THRESHOLD 32
+#define DC_DIVAPPR_Q_THRESHOLD 116
+#define DC_BDIV_QR_THRESHOLD 76
+#define DC_BDIV_Q_THRESHOLD 180
-#define INV_MULMOD_BNM1_THRESHOLD 50
-#define INV_NEWTON_THRESHOLD 39
-#define INV_APPR_THRESHOLD 37
+#define INV_MULMOD_BNM1_THRESHOLD 46
+#define INV_NEWTON_THRESHOLD 138
+#define INV_APPR_THRESHOLD 123
-#define BINV_NEWTON_THRESHOLD 318
-#define REDC_1_TO_REDC_N_THRESHOLD 87
+#define BINV_NEWTON_THRESHOLD 306
+#define REDC_1_TO_REDC_N_THRESHOLD 82
-#define MU_DIV_QR_THRESHOLD 1099
-#define MU_DIVAPPR_Q_THRESHOLD 792
-#define MUPI_DIV_QR_THRESHOLD 0 /* always */
+#define MU_DIV_QR_THRESHOLD 1499
+#define MU_DIVAPPR_Q_THRESHOLD 1442
+#define MUPI_DIV_QR_THRESHOLD 63
#define MU_BDIV_QR_THRESHOLD 1442
#define MU_BDIV_Q_THRESHOLD 1589
-#define POWM_SEC_TABLE 3,32,95,480,597,2657
+#define POWM_SEC_TABLE 1,22,66,428,1035
+
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 18
+#define SET_STR_DC_THRESHOLD 732
+#define SET_STR_PRECOMPUTE_THRESHOLD 1118
-#define MATRIX22_STRASSEN_THRESHOLD 21
-#define HGCD_THRESHOLD 83
-#define HGCD_APPR_THRESHOLD 159
-#define HGCD_REDUCE_THRESHOLD 3389
-#define GCD_DC_THRESHOLD 379
-#define GCDEXT_DC_THRESHOLD 309
-#define JACOBI_BASE_METHOD 4
+#define FAC_DSC_THRESHOLD 115
+#define FAC_ODD_THRESHOLD 50
-#define GET_STR_DC_THRESHOLD 10
-#define GET_STR_PRECOMPUTE_THRESHOLD 25
-#define SET_STR_DC_THRESHOLD 442
-#define SET_STR_PRECOMPUTE_THRESHOLD 1104
+#define MATRIX22_STRASSEN_THRESHOLD 25
+#define HGCD2_DIV1_METHOD 1 /* 5.78% faster than 3 */
+#define HGCD_THRESHOLD 121
+#define HGCD_APPR_THRESHOLD 151
+#define HGCD_REDUCE_THRESHOLD 3259
+#define GCD_DC_THRESHOLD 368
+#define GCDEXT_DC_THRESHOLD 306
+#define JACOBI_BASE_METHOD 4 /* 14.19% faster than 1 */
-#define FAC_DSC_THRESHOLD 155
-#define FAC_ODD_THRESHOLD 34
+/* Tuneup completed successfully, took 67142 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/coreibwl/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/coreibwl/gmp-mparam.h
new file mode 100644
index 00000000000..7b58cad27ad
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/coreibwl/gmp-mparam.h
@@ -0,0 +1,216 @@
+/* x86/coreibwl gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* 3400-3800 MHz Intel Xeon E3-1285Lv4 Broadwell */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-20, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 15
+#define MOD_1_UNNORM_THRESHOLD 16
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 10
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 10
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 11
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 21.34% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 14
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 29
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 19
+
+#define DIV_1_VS_MUL_1_PERCENT 295
+
+#define MUL_TOOM22_THRESHOLD 26
+#define MUL_TOOM33_THRESHOLD 97
+#define MUL_TOOM44_THRESHOLD 220
+#define MUL_TOOM6H_THRESHOLD 306
+#define MUL_TOOM8H_THRESHOLD 454
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 93
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 153
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 154
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 169
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 136
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 44
+#define SQR_TOOM3_THRESHOLD 134
+#define SQR_TOOM4_THRESHOLD 242
+#define SQR_TOOM6_THRESHOLD 342
+#define SQR_TOOM8_THRESHOLD 502
+
+#define MULMID_TOOM42_THRESHOLD 98
+
+#define MULMOD_BNM1_THRESHOLD 20
+#define SQRMOD_BNM1_THRESHOLD 23
+
+#define MUL_FFT_MODF_THRESHOLD 540 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 540, 5}, { 29, 6}, { 15, 5}, { 31, 6}, \
+ { 16, 5}, { 33, 6}, { 17, 5}, { 36, 6}, \
+ { 25, 7}, { 13, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
+ { 39, 7}, { 21, 6}, { 43, 7}, { 23, 6}, \
+ { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 43, 8}, { 23, 7}, { 49, 8}, \
+ { 27, 7}, { 55, 9}, { 15, 8}, { 31, 7}, \
+ { 63, 8}, { 43, 9}, { 23, 8}, { 55,10}, \
+ { 15, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
+ { 83, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
+ { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
+ { 159,10}, { 95, 9}, { 191,10}, { 111,11}, \
+ { 63,10}, { 143, 9}, { 287,10}, { 159,11}, \
+ { 95, 7}, { 1599, 8}, { 831, 9}, { 431, 8}, \
+ { 863, 9}, { 447,10}, { 239, 9}, { 479,10}, \
+ { 255, 9}, { 511,10}, { 287,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335, 9}, { 671,11}, \
+ { 191,10}, { 383, 9}, { 767,10}, { 399,11}, \
+ { 223,12}, { 127,11}, { 255,10}, { 511, 9}, \
+ { 1023,11}, { 287,10}, { 607,11}, { 319,10}, \
+ { 671,11}, { 351,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,13}, { 127,12}, { 255,11}, \
+ { 543,10}, { 1119,11}, { 607,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 959,13}, { 255,12}, { 511,11}, { 1119,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1407,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1215,13}, { 639,12}, \
+ { 1471,13}, { 767,12}, { 1727,13}, { 895,12}, \
+ { 1919,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2431,13}, { 1279,12}, { 2623,13}, \
+ { 1407,12}, { 2815,14}, { 767,13}, { 1535,12}, \
+ { 3135,13}, { 1663,12}, { 3455,13}, { 1919,15}, \
+ { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
+ { 2431,14}, { 1279,13}, { 2943,12}, { 5887,14}, \
+ { 1535,13}, { 3455,14}, { 1791,13}, { 3839,15}, \
+ { 1023,14}, { 2047,13}, { 4479,14}, { 2303,13}, \
+ { 4991,12}, { 9983,14}, { 2559,13}, { 5247,14}, \
+ { 2815,13}, { 5887,15}, { 1535,14}, { 3839,16} }
+#define MUL_FFT_TABLE3_SIZE 172
+#define MUL_FFT_THRESHOLD 7424
+
+#define SQR_FFT_MODF_THRESHOLD 472 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 472, 5}, { 29, 6}, { 15, 5}, { 33, 6}, \
+ { 37, 7}, { 19, 6}, { 40, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
+ { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
+ { 55,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
+ { 39, 8}, { 83, 9}, { 47, 8}, { 95, 9}, \
+ { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 63, 9}, { 135,10}, \
+ { 79, 9}, { 159,10}, { 95,11}, { 63,10}, \
+ { 127, 9}, { 255,10}, { 143, 9}, { 287,10}, \
+ { 159,11}, { 95,12}, { 63,11}, { 127,10}, \
+ { 271, 9}, { 543, 6}, { 4479, 7}, { 2431, 8}, \
+ { 1247, 7}, { 2495, 8}, { 1279,10}, { 351,11}, \
+ { 191,10}, { 399, 9}, { 799,10}, { 415,12}, \
+ { 127,11}, { 255,10}, { 543,11}, { 287,10}, \
+ { 607,11}, { 319,10}, { 639,11}, { 351,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 831,13}, { 127,12}, { 255,11}, { 511,10}, \
+ { 1023,11}, { 543,10}, { 1087,11}, { 607,12}, \
+ { 319,11}, { 671,10}, { 1343,11}, { 735,12}, \
+ { 383,11}, { 799,10}, { 1599,11}, { 863,12}, \
+ { 447,11}, { 927,13}, { 255,12}, { 511,11}, \
+ { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 831,11}, { 1663,12}, \
+ { 895,11}, { 1855,14}, { 255,13}, { 511,12}, \
+ { 1023,11}, { 2047,12}, { 1087,11}, { 2239,12}, \
+ { 1215,13}, { 639,12}, { 1471,13}, { 767,12}, \
+ { 1663,13}, { 895,12}, { 1983,14}, { 511,13}, \
+ { 1023,12}, { 2239,13}, { 1151,12}, { 2495,13}, \
+ { 1279,12}, { 2623,13}, { 1407,14}, { 767,13}, \
+ { 1535,12}, { 3135,13}, { 1663,12}, { 3455,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3839,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
+ { 2303,13}, { 4991,12}, { 9983,14}, { 2815,13}, \
+ { 5887,15}, { 1535,14}, { 3327,13}, { 6783,14}, \
+ { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 157
+#define SQR_FFT_THRESHOLD 5568
+
+#define MULLO_BASECASE_THRESHOLD 16
+#define MULLO_DC_THRESHOLD 37
+#define MULLO_MUL_N_THRESHOLD 14281
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 137
+#define SQRLO_SQR_THRESHOLD 10821
+
+#define DC_DIV_QR_THRESHOLD 54
+#define DC_DIVAPPR_Q_THRESHOLD 146
+#define DC_BDIV_QR_THRESHOLD 98
+#define DC_BDIV_Q_THRESHOLD 218
+
+#define INV_MULMOD_BNM1_THRESHOLD 50
+#define INV_NEWTON_THRESHOLD 173
+#define INV_APPR_THRESHOLD 165
+
+#define BINV_NEWTON_THRESHOLD 278
+#define REDC_1_TO_REDC_N_THRESHOLD 79
+
+#define MU_DIV_QR_THRESHOLD 1787
+#define MU_DIVAPPR_Q_THRESHOLD 1787
+#define MUPI_DIV_QR_THRESHOLD 78
+#define MU_BDIV_QR_THRESHOLD 1589
+#define MU_BDIV_Q_THRESHOLD 1830
+
+#define POWM_SEC_TABLE 1,16,126,416,932
+
+#define GET_STR_DC_THRESHOLD 11
+#define GET_STR_PRECOMPUTE_THRESHOLD 17
+#define SET_STR_DC_THRESHOLD 306
+#define SET_STR_PRECOMPUTE_THRESHOLD 894
+
+#define FAC_DSC_THRESHOLD 141
+#define FAC_ODD_THRESHOLD 34
+
+#define MATRIX22_STRASSEN_THRESHOLD 20
+#define HGCD2_DIV1_METHOD 3 /* 5.97% faster than 1 */
+#define HGCD_THRESHOLD 73
+#define HGCD_APPR_THRESHOLD 123
+#define HGCD_REDUCE_THRESHOLD 3664
+#define GCD_DC_THRESHOLD 562
+#define GCDEXT_DC_THRESHOLD 465
+#define JACOBI_BASE_METHOD 1 /* 31.16% faster than 3 */
+
+/* Tuneup completed successfully, took 35114 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/coreihwl/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/coreihwl/gmp-mparam.h
index e2b289cc3cb..ea4ac11c5bc 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/coreihwl/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/coreihwl/gmp-mparam.h
@@ -1,6 +1,6 @@
/* x86/coreihwl gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2011, 2014 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,180 +31,185 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 2900 MHz Core i5 Haswell */
-/* FFT tuning limit = 40000000 */
-/* Generated by tuneup.c, 2014-03-13, gcc 4.5 */
+/* 3600-4000 MHz Intel Xeon E3-1271v3 Haswell */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-21, gcc 8.3 */
-#define MOD_1_NORM_THRESHOLD 16
-#define MOD_1_UNNORM_THRESHOLD 13
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 11
+#define MOD_1_NORM_THRESHOLD 17
+#define MOD_1_UNNORM_THRESHOLD 17
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 10
#define MOD_1U_TO_MOD_1_1_THRESHOLD 9
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 10
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 5
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 15
+#define DIV_QR_1N_PI1_METHOD 1 /* 11.44% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 13
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 19
+#define BMOD_1_TO_MOD_1_THRESHOLD 21
-#define MUL_TOOM22_THRESHOLD 27
-#define MUL_TOOM33_THRESHOLD 90
-#define MUL_TOOM44_THRESHOLD 218
-#define MUL_TOOM6H_THRESHOLD 318
-#define MUL_TOOM8H_THRESHOLD 490
+#define DIV_1_VS_MUL_1_PERCENT 296
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 89
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 153
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 101
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 130
+#define MUL_TOOM22_THRESHOLD 28
+#define MUL_TOOM33_THRESHOLD 108
+#define MUL_TOOM44_THRESHOLD 232
+#define MUL_TOOM6H_THRESHOLD 306
+#define MUL_TOOM8H_THRESHOLD 478
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 109
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 183
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 113
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 136
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 44
-#define SQR_TOOM3_THRESHOLD 137
-#define SQR_TOOM4_THRESHOLD 242
-#define SQR_TOOM6_THRESHOLD 351
-#define SQR_TOOM8_THRESHOLD 597
+#define SQR_TOOM3_THRESHOLD 141
+#define SQR_TOOM4_THRESHOLD 384
+#define SQR_TOOM6_THRESHOLD 517
+#define SQR_TOOM8_THRESHOLD 698
#define MULMID_TOOM42_THRESHOLD 98
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 21
+#define MULMOD_BNM1_THRESHOLD 20
+#define SQRMOD_BNM1_THRESHOLD 23
-#define MUL_FFT_MODF_THRESHOLD 630 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 565 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 630, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 15, 5}, { 31, 6}, { 28, 7}, { 15, 6}, \
- { 33, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 23, 6}, { 47, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 55,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
- { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
- { 103,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 159,10}, { 95, 9}, { 191,10}, \
- { 111,11}, { 63,10}, { 159,11}, { 95,10}, \
- { 191,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 271, 9}, { 543,11}, { 159,10}, \
+ { { 565, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
+ { 16, 5}, { 33, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
+ { 39, 7}, { 21, 6}, { 43, 7}, { 23, 6}, \
+ { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 43, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 7}, { 55, 9}, { 15, 8}, { 31, 7}, \
+ { 63, 8}, { 43, 9}, { 23, 8}, { 55, 9}, \
+ { 31, 8}, { 71, 9}, { 39, 8}, { 83, 9}, \
+ { 47, 8}, { 95, 9}, { 55,10}, { 31, 9}, \
+ { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
+ { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
+ { 95, 9}, { 191,10}, { 111,11}, { 63,10}, \
+ { 143, 9}, { 287,10}, { 159,11}, { 95,10}, \
+ { 191, 6}, { 3199, 7}, { 1727, 9}, { 447,10}, \
+ { 239, 9}, { 479,10}, { 287,11}, { 159,10}, \
{ 319, 9}, { 639,10}, { 335, 9}, { 671,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
- { 799,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543,11}, { 287,10}, { 607, 9}, { 1215,11}, \
+ { 191,10}, { 399, 9}, { 799,10}, { 415,11}, \
+ { 223,12}, { 127,11}, { 255,10}, { 511, 9}, \
+ { 1023,10}, { 527,11}, { 287,10}, { 607,11}, \
{ 319,10}, { 671,12}, { 191,11}, { 383,10}, \
{ 799,11}, { 415,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
- { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,10}, { 1727,12}, { 447,11}, { 959,13}, \
- { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
- { 1215,10}, { 2431,12}, { 639,11}, { 1343,12}, \
- { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
- { 1599,12}, { 831,11}, { 1727,10}, { 3455,12}, \
- { 959,14}, { 255,13}, { 511,12}, { 1087,11}, \
- { 2239,12}, { 1215,11}, { 2431,13}, { 639,12}, \
- { 1471,11}, { 2943,10}, { 5887,13}, { 767,12}, \
- { 1727,11}, { 3455,13}, { 895,12}, { 1983,14}, \
- { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
- { 2495,13}, { 1279,12}, { 2559,13}, { 1407,12}, \
- { 2943,11}, { 5887,14}, { 767,13}, { 1535,12}, \
- { 3071,13}, { 1663,12}, { 3455,13}, { 1919,15}, \
- { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
- { 2431,14}, { 1279,13}, { 2943,12}, { 5887,14}, \
- { 1535,13}, { 3455,14}, { 1791,13}, { 3967,12}, \
- { 7935,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
- { 2303,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 168
-#define MUL_FFT_THRESHOLD 7424
-
-#define SQR_FFT_MODF_THRESHOLD 530 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 530, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 36, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
- { 27, 7}, { 55, 9}, { 15, 8}, { 31, 7}, \
- { 63, 8}, { 39, 9}, { 23, 8}, { 55,10}, \
- { 15, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 159,10}, { 95, 9}, { 191,10}, { 111,11}, \
- { 63,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271, 9}, { 543,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335, 9}, { 671,10}, { 351,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
- { 799,12}, { 127,11}, { 255,10}, { 511, 9}, \
- { 1023,10}, { 543,11}, { 287,10}, { 607,11}, \
- { 319,10}, { 671,11}, { 351,12}, { 191,11}, \
- { 383,10}, { 799,11}, { 415,10}, { 831,13}, \
- { 127,12}, { 255,11}, { 511,10}, { 1023,11}, \
- { 543,10}, { 1087,11}, { 607,12}, { 319,11}, \
- { 671,10}, { 1343,11}, { 735,10}, { 1471,12}, \
- { 383,11}, { 799,10}, { 1599,11}, { 863,10}, \
- { 1727,12}, { 447,11}, { 991,13}, { 255,12}, \
+ { 511,10}, { 1023,11}, { 543,10}, { 1087,11}, \
+ { 607,12}, { 319,11}, { 671,10}, { 1343,11}, \
+ { 735,12}, { 383,11}, { 799,10}, { 1599,11}, \
+ { 863,12}, { 447,11}, { 991,13}, { 255,12}, \
{ 511,11}, { 1087,12}, { 575,11}, { 1215,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,13}, \
+ { 639,11}, { 1343,12}, { 703,11}, { 1407,13}, \
{ 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
- { 1727,12}, { 959,11}, { 1983,14}, { 255,13}, \
- { 511,12}, { 1023,11}, { 2047,12}, { 1087,11}, \
- { 2239,12}, { 1215,11}, { 2431,13}, { 639,12}, \
- { 1471,11}, { 2943,13}, { 767,12}, { 1727,13}, \
- { 895,12}, { 1983,14}, { 511,13}, { 1023,12}, \
- { 2239,13}, { 1151,12}, { 2495,13}, { 1279,12}, \
- { 2623,13}, { 1407,12}, { 2943,14}, { 767,13}, \
- { 1535,12}, { 3071,13}, { 1663,12}, { 3455,13}, \
- { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
- { 2175,12}, { 4479,13}, { 2431,12}, { 4863,14}, \
- { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
- { 3455,14}, { 1791,13}, { 3967,15}, { 1023,14}, \
- { 2047,13}, { 4479,14}, { 2303,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 170
-#define SQR_FFT_THRESHOLD 5760
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 57
+ { 1727,12}, { 959,11}, { 1919,14}, { 255,13}, \
+ { 511,12}, { 1087,11}, { 2239,12}, { 1215,13}, \
+ { 639,12}, { 1471,13}, { 767,12}, { 1727,13}, \
+ { 895,12}, { 1919,14}, { 511,13}, { 1023,12}, \
+ { 2239,13}, { 1151,12}, { 2431,13}, { 1279,12}, \
+ { 2623,13}, { 1407,14}, { 767,13}, { 1663,12}, \
+ { 3455,13}, { 1919,15}, { 511,14}, { 1023,13}, \
+ { 2175,12}, { 4479,13}, { 2431,14}, { 1279,13}, \
+ { 2943,12}, { 5887,14}, { 1535,13}, { 3455,14}, \
+ { 1791,13}, { 3967,15}, { 1023,14}, { 2047,13}, \
+ { 4479,14}, { 2303,13}, { 4991,14}, { 2559,13}, \
+ { 5375,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3839,16} }
+#define MUL_FFT_TABLE3_SIZE 165
+#define MUL_FFT_THRESHOLD 7808
+
+#define SQR_FFT_MODF_THRESHOLD 560 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 560, 5}, { 29, 6}, { 15, 5}, { 31, 6}, \
+ { 16, 5}, { 33, 6}, { 17, 5}, { 36, 6}, \
+ { 29, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
+ { 36, 7}, { 19, 6}, { 40, 7}, { 21, 6}, \
+ { 43, 7}, { 23, 6}, { 47, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 7}, { 55, 9}, \
+ { 15, 8}, { 31, 7}, { 63, 8}, { 43, 9}, \
+ { 23, 8}, { 55,10}, { 15, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95,11}, \
+ { 63,10}, { 143, 9}, { 287,10}, { 159,11}, \
+ { 95,12}, { 63,11}, { 127, 9}, { 511, 5}, \
+ { 8959, 7}, { 2431, 8}, { 1247, 7}, { 2495, 8}, \
+ { 1279, 9}, { 671,10}, { 367,11}, { 191,10}, \
+ { 399, 9}, { 799,10}, { 415,12}, { 127,11}, \
+ { 255,10}, { 527,11}, { 287,10}, { 607,11}, \
+ { 319,10}, { 671,11}, { 351,10}, { 703,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 831,13}, { 127,11}, { 543,10}, { 1119,11}, \
+ { 607,12}, { 319,11}, { 671,10}, { 1343,11}, \
+ { 735,12}, { 383,11}, { 863,12}, { 447,11}, \
+ { 991,12}, { 511,11}, { 1119,12}, { 575,11}, \
+ { 1215,12}, { 639,11}, { 1343,12}, { 703,13}, \
+ { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
+ { 1727,12}, { 959,11}, { 1983,13}, { 511,12}, \
+ { 1087,11}, { 2239,12}, { 1215,13}, { 639,12}, \
+ { 1471,13}, { 767,12}, { 1727,13}, { 895,12}, \
+ { 1983,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2495,13}, { 1279,12}, { 2623,13}, \
+ { 1407,14}, { 767,13}, { 1663,12}, { 3455,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
+ { 2303,13}, { 4991,12}, { 9983,14}, { 2559,13}, \
+ { 5119,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3327,13}, { 6911,14}, { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 159
+#define SQR_FFT_THRESHOLD 5568
+
+#define MULLO_BASECASE_THRESHOLD 17
+#define MULLO_DC_THRESHOLD 40
#define MULLO_MUL_N_THRESHOLD 14281
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 141
+#define SQRLO_SQR_THRESHOLD 10821
-#define DC_DIV_QR_THRESHOLD 23
-#define DC_DIVAPPR_Q_THRESHOLD 63
-#define DC_BDIV_QR_THRESHOLD 87
-#define DC_BDIV_Q_THRESHOLD 204
+#define DC_DIV_QR_THRESHOLD 30
+#define DC_DIVAPPR_Q_THRESHOLD 190
+#define DC_BDIV_QR_THRESHOLD 67
+#define DC_BDIV_Q_THRESHOLD 254
#define INV_MULMOD_BNM1_THRESHOLD 54
-#define INV_NEWTON_THRESHOLD 75
-#define INV_APPR_THRESHOLD 67
+#define INV_NEWTON_THRESHOLD 157
+#define INV_APPR_THRESHOLD 163
-#define BINV_NEWTON_THRESHOLD 296
+#define BINV_NEWTON_THRESHOLD 236
#define REDC_1_TO_REDC_N_THRESHOLD 79
-#define MU_DIV_QR_THRESHOLD 872
-#define MU_DIVAPPR_Q_THRESHOLD 654
-#define MUPI_DIV_QR_THRESHOLD 0 /* always */
-#define MU_BDIV_QR_THRESHOLD 1858
-#define MU_BDIV_Q_THRESHOLD 2089
-
-#define POWM_SEC_TABLE 1,17,127,508,1603
+#define MU_DIV_QR_THRESHOLD 1895
+#define MU_DIVAPPR_Q_THRESHOLD 1718
+#define MUPI_DIV_QR_THRESHOLD 54
+#define MU_BDIV_QR_THRESHOLD 1589
+#define MU_BDIV_Q_THRESHOLD 1898
-#define MATRIX22_STRASSEN_THRESHOLD 19
-#define HGCD_THRESHOLD 61
-#define HGCD_APPR_THRESHOLD 60
-#define HGCD_REDUCE_THRESHOLD 3810
-#define GCD_DC_THRESHOLD 263
-#define GCDEXT_DC_THRESHOLD 278
-#define JACOBI_BASE_METHOD 4
+#define POWM_SEC_TABLE 1,16,95,480,1442
-#define GET_STR_DC_THRESHOLD 11
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 527
-#define SET_STR_PRECOMPUTE_THRESHOLD 1178
+#define GET_STR_DC_THRESHOLD 10
+#define GET_STR_PRECOMPUTE_THRESHOLD 16
+#define SET_STR_DC_THRESHOLD 372
+#define SET_STR_PRECOMPUTE_THRESHOLD 1037
-#define FAC_DSC_THRESHOLD 187
+#define FAC_DSC_THRESHOLD 141
#define FAC_ODD_THRESHOLD 34
+
+#define MATRIX22_STRASSEN_THRESHOLD 21
+#define HGCD2_DIV1_METHOD 3 /* 6.26% faster than 1 */
+#define HGCD_THRESHOLD 70
+#define HGCD_APPR_THRESHOLD 129
+#define HGCD_REDUCE_THRESHOLD 3664
+#define GCD_DC_THRESHOLD 573
+#define GCDEXT_DC_THRESHOLD 483
+#define JACOBI_BASE_METHOD 1 /* 27.01% faster than 3 */
+
+/* Tuneup completed successfully, took 35232 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/coreinhm/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/coreinhm/gmp-mparam.h
index 13289c0c239..4428b4bf873 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/coreinhm/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/coreinhm/gmp-mparam.h
@@ -1,6 +1,6 @@
/* x86/coreinhm gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2011, 2014 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,194 +31,193 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 2667 MHz Core i7 Nehalem */
-/* FFT tuning limit = 100000000 */
-/* Generated by tuneup.c, 2014-03-19, gcc 4.5 */
+/* 2933-3200 MHz Intel Xeon X3470 Nehalem */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-23, gcc 8.3 */
-#define MOD_1_NORM_THRESHOLD 25
-#define MOD_1_UNNORM_THRESHOLD 15
+#define MOD_1_NORM_THRESHOLD 36
+#define MOD_1_UNNORM_THRESHOLD 40
#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 11
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 12
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 3
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 18
+#define DIV_QR_1N_PI1_METHOD 1 /* 42.59% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 9
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 15
+#define BMOD_1_TO_MOD_1_THRESHOLD 17
-#define MUL_TOOM22_THRESHOLD 26
-#define MUL_TOOM33_THRESHOLD 89
+#define DIV_1_VS_MUL_1_PERCENT 288
+
+#define MUL_TOOM22_THRESHOLD 24
+#define MUL_TOOM33_THRESHOLD 93
#define MUL_TOOM44_THRESHOLD 214
-#define MUL_TOOM6H_THRESHOLD 327
-#define MUL_TOOM8H_THRESHOLD 466
+#define MUL_TOOM6H_THRESHOLD 306
+#define MUL_TOOM8H_THRESHOLD 430
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 159
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 95
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 101
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 142
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 93
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 134
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 145
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 94
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 118
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 44
-#define SQR_TOOM3_THRESHOLD 145
-#define SQR_TOOM4_THRESHOLD 232
-#define SQR_TOOM6_THRESHOLD 342
-#define SQR_TOOM8_THRESHOLD 502
+#define SQR_TOOM2_THRESHOLD 38
+#define SQR_TOOM3_THRESHOLD 133
+#define SQR_TOOM4_THRESHOLD 212
+#define SQR_TOOM6_THRESHOLD 318
+#define SQR_TOOM8_THRESHOLD 620
-#define MULMID_TOOM42_THRESHOLD 78
+#define MULMID_TOOM42_THRESHOLD 68
#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 21
+#define SQRMOD_BNM1_THRESHOLD 23
-#define MUL_FFT_MODF_THRESHOLD 606 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 595 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 606, 5}, { 25, 6}, { 13, 5}, { 28, 6}, \
- { 15, 5}, { 33, 6}, { 29, 7}, { 15, 6}, \
+ { { 595, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
+ { 17, 5}, { 35, 6}, { 28, 7}, { 15, 6}, \
{ 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
- { 39, 7}, { 23, 6}, { 47, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 49, 8}, \
+ { 39, 7}, { 23, 6}, { 47, 7}, { 27, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
{ 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
{ 51, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 159,10}, { 95, 9}, { 191,10}, { 111,11}, \
- { 63,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271, 9}, { 543,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335,11}, { 191,10}, { 383, 9}, \
+ { 79, 9}, { 47, 8}, { 99, 9}, { 55,10}, \
+ { 31, 9}, { 63, 8}, { 127, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
+ { 191,11}, { 63, 9}, { 255,10}, { 159,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,11}, \
+ { 159,10}, { 335,11}, { 191,10}, { 383, 9}, \
{ 767,10}, { 399,12}, { 127,11}, { 255,10}, \
- { 511, 9}, { 1023,10}, { 543,11}, { 287,10}, \
- { 607,11}, { 319,10}, { 639,12}, { 191,11}, \
- { 383,10}, { 767,13}, { 127,12}, { 255,11}, \
- { 511,10}, { 1023,11}, { 543,10}, { 1087,11}, \
- { 607,12}, { 319,11}, { 671,10}, { 1343,11}, \
- { 735,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,10}, { 1727,12}, { 447,11}, { 927,10}, \
- { 1855,11}, { 991,13}, { 255,12}, { 511,11}, \
+ { 511, 9}, { 1023,10}, { 543, 9}, { 1087,11}, \
+ { 287,10}, { 607,11}, { 319,10}, { 671,12}, \
+ { 191,11}, { 383,10}, { 767,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
+ { 1119,11}, { 607,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,10}, { 1471,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,10}, { 1727,12}, \
+ { 447,11}, { 959,13}, { 255,12}, { 511,11}, \
{ 1119,12}, { 575,11}, { 1215,10}, { 2431,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,13}, \
- { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
- { 1727,12}, { 895,11}, { 1855,12}, { 959,14}, \
- { 255,13}, { 511,12}, { 1023,11}, { 2111,12}, \
- { 1087,11}, { 2239,10}, { 4479,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,13}, { 767,12}, \
- { 1727,11}, { 3455,13}, { 895,12}, { 1983,11}, \
- { 3967,14}, { 511,13}, { 1023,12}, { 2239,11}, \
- { 4479,13}, { 1151,12}, { 2495,11}, { 4991,13}, \
- { 1279,12}, { 2623,13}, { 1407,12}, { 2943,14}, \
- { 767,13}, { 1535,12}, { 3071,13}, { 1663,12}, \
- { 3455,13}, { 1919,12}, { 3967,15}, { 511,14}, \
- { 1023,13}, { 2175,12}, { 4479,13}, { 2431,12}, \
- { 4991,14}, { 1279,13}, { 2687,12}, { 5503,13}, \
- { 2943,12}, { 6015,14}, { 1535,13}, { 3455,14}, \
- { 1791,13}, { 3967,12}, { 7935,15}, { 1023,14}, \
+ { 639,11}, { 1343,12}, { 703,11}, { 1471,10}, \
+ { 2943,13}, { 383,12}, { 767,11}, { 1599,12}, \
+ { 831,11}, { 1727,10}, { 3455,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1087,11}, { 2239,10}, \
+ { 4479,12}, { 1215,11}, { 2431,13}, { 639,12}, \
+ { 1471,11}, { 2943,13}, { 767,12}, { 1727,11}, \
+ { 3455,13}, { 895,12}, { 1983,14}, { 511,13}, \
+ { 1023,12}, { 2239,11}, { 4479,13}, { 1151,12}, \
+ { 2431,13}, { 1279,12}, { 2559,13}, { 1407,12}, \
+ { 2943,11}, { 5887,14}, { 767,13}, { 1663,12}, \
+ { 3455,13}, { 1919,12}, { 3839,15}, { 511,14}, \
+ { 1023,13}, { 2175,12}, { 4479,13}, { 2431,14}, \
+ { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
+ { 3455,14}, { 1791,13}, { 3967,15}, { 1023,14}, \
{ 2047,13}, { 4479,14}, { 2303,13}, { 4991,12}, \
- { 9983,14}, { 2559,13}, { 5503,14}, { 2815,13}, \
- { 6015,15}, { 1535,14}, { 3839,13}, { 7935,16}, \
- { 1023,15}, { 2047,14}, { 4095,13}, { 8191,12}, \
- { 16383,11}, { 32767,10}, { 65535, 9}, { 131071, 8}, \
- { 256, 9}, { 512,10}, { 1024,11}, { 2048,12}, \
- { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 192
+ { 9983,14}, { 2815,13}, { 6015,15}, { 1535,14}, \
+ { 3839,13}, { 7679,16} }
+#define MUL_FFT_TABLE3_SIZE 170
#define MUL_FFT_THRESHOLD 6784
-#define SQR_FFT_MODF_THRESHOLD 555 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 525 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 555, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 16, 5}, { 33, 6}, { 29, 7}, { 15, 6}, \
- { 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
- { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
- { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
- { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
- { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
- { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
- { 135,10}, { 79, 9}, { 159,10}, { 95,11}, \
- { 63,10}, { 143, 9}, { 287,10}, { 159,11}, \
- { 95,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511, 8}, { 1023,10}, { 271, 9}, { 543,10}, \
- { 287,11}, { 159,10}, { 319, 9}, { 639,10}, \
- { 335, 9}, { 671,10}, { 351,11}, { 191,10}, \
- { 383, 9}, { 767,10}, { 399, 9}, { 799,10}, \
- { 415,12}, { 127,11}, { 255,10}, { 511, 9}, \
- { 1023,10}, { 543,11}, { 287,10}, { 607,11}, \
- { 319,10}, { 671,11}, { 351,12}, { 191,11}, \
- { 383,10}, { 799,11}, { 415,13}, { 127,12}, \
- { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
- { 1087,11}, { 607,12}, { 319,11}, { 671,10}, \
- { 1343,11}, { 735,10}, { 1471,12}, { 383,11}, \
- { 799,10}, { 1599,11}, { 863,10}, { 1727,12}, \
- { 447,11}, { 991,10}, { 1983,13}, { 255,12}, \
- { 511,11}, { 1023,10}, { 2047,11}, { 1087,12}, \
+ { { 525, 5}, { 29, 6}, { 15, 5}, { 33, 6}, \
+ { 17, 5}, { 35, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 23, 6}, { 47, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 7}, { 55, 9}, \
+ { 15, 8}, { 31, 7}, { 63, 8}, { 39, 9}, \
+ { 23, 8}, { 55, 9}, { 31, 8}, { 67, 9}, \
+ { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
+ { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 63, 9}, { 135,10}, \
+ { 79, 9}, { 159,10}, { 95,11}, { 63,10}, \
+ { 143, 9}, { 287,10}, { 159, 6}, { 2687, 7}, \
+ { 1407, 9}, { 367, 8}, { 735, 9}, { 383,10}, \
+ { 207, 9}, { 415,11}, { 127,10}, { 271, 9}, \
+ { 543,10}, { 287,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 335, 9}, { 671,10}, { 351,11}, \
+ { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
+ { 799,10}, { 415,12}, { 127,11}, { 255,10}, \
+ { 511, 9}, { 1023,10}, { 543,11}, { 287,10}, \
+ { 607,11}, { 319,10}, { 671,11}, { 351,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,13}, \
+ { 127,12}, { 255,11}, { 511,10}, { 1023,11}, \
+ { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
+ { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
+ { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
+ { 863,10}, { 1727,12}, { 447,11}, { 991,10}, \
+ { 1983,13}, { 255,12}, { 511,11}, { 1119,12}, \
{ 575,11}, { 1215,10}, { 2431,12}, { 639,11}, \
{ 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
{ 767,11}, { 1599,12}, { 831,11}, { 1727,10}, \
{ 3455,12}, { 895,11}, { 1791,12}, { 959,11}, \
{ 1983,14}, { 255,13}, { 511,12}, { 1023,11}, \
- { 2111,12}, { 1087,11}, { 2239,10}, { 4479,12}, \
- { 1215,11}, { 2431,13}, { 639,12}, { 1471,11}, \
- { 2943,13}, { 767,12}, { 1727,11}, { 3455,13}, \
- { 895,12}, { 1983,11}, { 3967,14}, { 511,13}, \
- { 1023,12}, { 2239,11}, { 4479,13}, { 1151,12}, \
- { 2495,13}, { 1279,12}, { 2623,13}, { 1407,12}, \
- { 2943,14}, { 767,13}, { 1663,12}, { 3455,13}, \
- { 1919,12}, { 3967,15}, { 511,14}, { 1023,13}, \
- { 2175,12}, { 4479,13}, { 2431,12}, { 4863,14}, \
- { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
- { 3455,14}, { 1791,13}, { 3967,12}, { 7935,15}, \
- { 1023,14}, { 2047,13}, { 4479,14}, { 2303,13}, \
- { 4991,12}, { 9983,14}, { 2815,13}, { 5887,15}, \
- { 1535,14}, { 3327,13}, { 6655,14}, { 3839,13}, \
- { 7935,16}, { 1023,15}, { 2047,14}, { 4095,13}, \
- { 8191,12}, { 16383,11}, { 32767,10}, { 65535, 9}, \
- { 131071, 8}, { 256, 9}, { 512,10}, { 1024,11}, \
- { 2048,12}, { 4096,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 201
+ { 2047,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
+ { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
+ { 1983,11}, { 3967,14}, { 511,13}, { 1023,12}, \
+ { 2239,13}, { 1151,12}, { 2495,13}, { 1279,12}, \
+ { 2623,13}, { 1407,12}, { 2943,14}, { 767,13}, \
+ { 1663,12}, { 3455,13}, { 1919,12}, { 3967,15}, \
+ { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
+ { 2431,12}, { 4863,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,12}, { 7935,15}, { 1023,14}, { 2047,13}, \
+ { 4479,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
+ { 2815,13}, { 5887,15}, { 1535,14}, { 3327,13}, \
+ { 6655,14}, { 3839,13}, { 7935,16} }
+#define SQR_FFT_TABLE3_SIZE 187
#define SQR_FFT_THRESHOLD 5312
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 38
+#define MULLO_DC_THRESHOLD 43
#define MULLO_MUL_N_THRESHOLD 13463
+#define SQRLO_BASECASE_THRESHOLD 9
+#define SQRLO_DC_THRESHOLD 42
+#define SQRLO_SQR_THRESHOLD 10323
-#define DC_DIV_QR_THRESHOLD 22
-#define DC_DIVAPPR_Q_THRESHOLD 43
-#define DC_BDIV_QR_THRESHOLD 78
-#define DC_BDIV_Q_THRESHOLD 157
+#define DC_DIV_QR_THRESHOLD 43
+#define DC_DIVAPPR_Q_THRESHOLD 132
+#define DC_BDIV_QR_THRESHOLD 83
+#define DC_BDIV_Q_THRESHOLD 130
-#define INV_MULMOD_BNM1_THRESHOLD 50
-#define INV_NEWTON_THRESHOLD 15
-#define INV_APPR_THRESHOLD 18
+#define INV_MULMOD_BNM1_THRESHOLD 46
+#define INV_NEWTON_THRESHOLD 189
+#define INV_APPR_THRESHOLD 167
-#define BINV_NEWTON_THRESHOLD 351
-#define REDC_1_TO_REDC_N_THRESHOLD 84
+#define BINV_NEWTON_THRESHOLD 372
+#define REDC_1_TO_REDC_N_THRESHOLD 83
-#define MU_DIV_QR_THRESHOLD 889
-#define MU_DIVAPPR_Q_THRESHOLD 483
-#define MUPI_DIV_QR_THRESHOLD 0 /* always */
+#define MU_DIV_QR_THRESHOLD 1589
+#define MU_DIVAPPR_Q_THRESHOLD 1589
+#define MUPI_DIV_QR_THRESHOLD 97
#define MU_BDIV_QR_THRESHOLD 1589
-#define MU_BDIV_Q_THRESHOLD 1787
+#define MU_BDIV_Q_THRESHOLD 1718
-#define POWM_SEC_TABLE 2,25,95,473,1357
+#define POWM_SEC_TABLE 1,28,96,473,803
+
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 16
+#define SET_STR_DC_THRESHOLD 145
+#define SET_STR_PRECOMPUTE_THRESHOLD 419
+
+#define FAC_DSC_THRESHOLD 114
+#define FAC_ODD_THRESHOLD 57
#define MATRIX22_STRASSEN_THRESHOLD 20
-#define HGCD_THRESHOLD 52
-#define HGCD_APPR_THRESHOLD 51
+#define HGCD2_DIV1_METHOD 1 /* 1.03% faster than 3 */
+#define HGCD_THRESHOLD 117
+#define HGCD_APPR_THRESHOLD 137
#define HGCD_REDUCE_THRESHOLD 3524
-#define GCD_DC_THRESHOLD 213
-#define GCDEXT_DC_THRESHOLD 249
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 24
-#define SET_STR_DC_THRESHOLD 145
-#define SET_STR_PRECOMPUTE_THRESHOLD 545
+#define GCD_DC_THRESHOLD 389
+#define GCDEXT_DC_THRESHOLD 318
+#define JACOBI_BASE_METHOD 4 /* 6.10% faster than 1 */
-#define FAC_DSC_THRESHOLD 91
-#define FAC_ODD_THRESHOLD 29
+/* Tuneup completed successfully, took 67994 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/coreisbr/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/coreisbr/gmp-mparam.h
index 9b227a71ba2..23d708a6615 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/coreisbr/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/coreisbr/gmp-mparam.h
@@ -1,6 +1,6 @@
/* x86/coreisbr gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2011, 2014 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,173 +31,185 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 3300 MHz Core i5 Sandy Bridge */
-/* FFT tuning limit = 40000000 */
-/* Generated by tuneup.c, 2014-03-13, gcc 4.5 */
+/* 3400-3800 MHz Intel Xeon E3-1270 Sandy Bridge */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-24, gcc 8.3 */
-#define MOD_1_NORM_THRESHOLD 18
-#define MOD_1_UNNORM_THRESHOLD 11
+#define MOD_1_NORM_THRESHOLD 28
+#define MOD_1_UNNORM_THRESHOLD 26
#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 11
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 4
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 16
+#define DIV_QR_1N_PI1_METHOD 2 /* 88.29% faster than 1 */
+#define DIV_QR_1_NORM_THRESHOLD 21
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 14
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 19
+#define BMOD_1_TO_MOD_1_THRESHOLD 20
-#define MUL_TOOM22_THRESHOLD 28
-#define MUL_TOOM33_THRESHOLD 99
-#define MUL_TOOM44_THRESHOLD 160
-#define MUL_TOOM6H_THRESHOLD 268
-#define MUL_TOOM8H_THRESHOLD 490
+#define DIV_1_VS_MUL_1_PERCENT 297
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 106
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 140
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 109
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 108
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 137
+#define MUL_TOOM22_THRESHOLD 32
+#define MUL_TOOM33_THRESHOLD 105
+#define MUL_TOOM44_THRESHOLD 190
+#define MUL_TOOM6H_THRESHOLD 294
+#define MUL_TOOM8H_THRESHOLD 478
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 109
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 144
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 116
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 129
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 160
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 48
-#define SQR_TOOM3_THRESHOLD 105
-#define SQR_TOOM4_THRESHOLD 256
-#define SQR_TOOM6_THRESHOLD 366
-#define SQR_TOOM8_THRESHOLD 562
+#define SQR_TOOM3_THRESHOLD 163
+#define SQR_TOOM4_THRESHOLD 250
+#define SQR_TOOM6_THRESHOLD 354
+#define SQR_TOOM8_THRESHOLD 502
#define MULMID_TOOM42_THRESHOLD 98
#define MULMOD_BNM1_THRESHOLD 19
#define SQRMOD_BNM1_THRESHOLD 23
-#define MUL_FFT_MODF_THRESHOLD 636 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 666 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 636, 5}, { 27, 6}, { 28, 7}, { 15, 6}, \
- { 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 23, 6}, { 47, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 55,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
- { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
- { 103,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 159,10}, { 95, 9}, { 191,11}, \
- { 63,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271, 9}, { 543,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335, 9}, { 671,11}, { 191,10}, \
- { 383, 9}, { 767,10}, { 399, 9}, { 799,11}, \
- { 223,12}, { 127,11}, { 255,10}, { 543, 9}, \
- { 1087,11}, { 287,10}, { 607, 9}, { 1215,11}, \
- { 319,10}, { 671,12}, { 191,11}, { 383,10}, \
- { 799,11}, { 415,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
- { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,12}, { 447,11}, { 959,13}, { 255,12}, \
- { 511,11}, { 1087,12}, { 575,11}, { 1215,10}, \
- { 2431,12}, { 639,11}, { 1343,12}, { 703,11}, \
- { 1471,13}, { 383,12}, { 767,11}, { 1599,12}, \
- { 831,11}, { 1727,12}, { 959,14}, { 255,13}, \
- { 511,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
- { 767,12}, { 1727,13}, { 895,12}, { 1983,14}, \
- { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
- { 2431,13}, { 1279,12}, { 2559,13}, { 1407,12}, \
- { 2943,14}, { 767,13}, { 1535,12}, { 3071,13}, \
- { 1663,12}, { 3455,13}, { 1919,15}, { 511,14}, \
- { 1023,13}, { 2175,12}, { 4479,13}, { 2431,14}, \
- { 1279,13}, { 2943,12}, { 5887,14}, { 16384,15}, \
- { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 149
-#define MUL_FFT_THRESHOLD 7424
-
-#define SQR_FFT_MODF_THRESHOLD 555 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 555, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 29, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
+ { { 666, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
+ { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
{ 36, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
{ 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 47, 8}, \
- { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
- { 43, 9}, { 23, 8}, { 51, 9}, { 31, 8}, \
- { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
- { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
+ { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
+ { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 71, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 99, 9}, { 55,10}, { 31, 9}, { 79,10}, \
{ 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
{ 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
- { 191,10}, { 111,11}, { 63,10}, { 159,11}, \
- { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 543,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335, 9}, { 671,10}, { 351,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
- { 799,10}, { 415,12}, { 127,11}, { 255,10}, \
+ { 191,11}, { 63,10}, { 159, 7}, { 1343, 8}, \
+ { 703, 9}, { 367, 8}, { 735, 9}, { 383,10}, \
+ { 207,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543,10}, { 287,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335,11}, { 191,10}, \
+ { 383, 9}, { 767,11}, { 223,12}, { 127,11}, \
+ { 255,10}, { 543,11}, { 287,10}, { 607, 9}, \
+ { 1215,11}, { 319,10}, { 671,12}, { 191,11}, \
+ { 383,10}, { 799,13}, { 127,12}, { 255,11}, \
+ { 511,10}, { 1023,11}, { 543,10}, { 1087,11}, \
+ { 607,10}, { 1215,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,10}, { 1471,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 959,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1087,11}, { 2239,12}, \
+ { 1215,13}, { 639,12}, { 1471,11}, { 2943,13}, \
+ { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
+ { 1983,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2495,13}, { 1279,12}, { 2623,13}, \
+ { 1407,12}, { 2943,14}, { 767,13}, { 1535,12}, \
+ { 3071,13}, { 1663,12}, { 3455,13}, { 1919,15}, \
+ { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
+ { 2431,14}, { 1279,13}, { 2943,12}, { 5887,14}, \
+ { 1535,13}, { 3455,14}, { 1791,13}, { 3967,15}, \
+ { 1023,14}, { 2047,13}, { 4479,14}, { 2303,13}, \
+ { 4991,12}, { 9983,14}, { 2815,13}, { 5887,15}, \
+ { 1535,14}, { 3839,13}, { 7679,16} }
+#define MUL_FFT_TABLE3_SIZE 163
+#define MUL_FFT_THRESHOLD 7552
+
+#define SQR_FFT_MODF_THRESHOLD 570 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 570, 5}, { 28, 6}, { 15, 5}, { 32, 6}, \
+ { 17, 5}, { 35, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
+ { 40, 7}, { 23, 6}, { 47, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 7}, { 55, 8}, \
+ { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
+ { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
+ { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
+ { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
+ { 159,10}, { 95,11}, { 63,10}, { 159,11}, \
+ { 95,10}, { 191,12}, { 63, 8}, { 1023, 9}, \
+ { 543,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 335,11}, { 191,10}, { 383, 9}, { 767,10}, \
+ { 399, 9}, { 799,12}, { 127,11}, { 255,10}, \
{ 511, 9}, { 1023,10}, { 543,11}, { 287,10}, \
{ 607,11}, { 319,10}, { 671,11}, { 351,12}, \
- { 191,11}, { 383,10}, { 799,11}, { 415,13}, \
- { 127,12}, { 255,11}, { 511,10}, { 1023,11}, \
- { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
- { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,10}, { 1727,12}, { 447,11}, { 959,10}, \
- { 1919,11}, { 991,13}, { 255,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,10}, { 2431,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,13}, \
- { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
- { 1727,12}, { 959,11}, { 1919,14}, { 255,13}, \
- { 511,12}, { 1023,11}, { 2047,12}, { 1087,11}, \
- { 2239,12}, { 1215,11}, { 2431,13}, { 639,12}, \
- { 1471,11}, { 2943,13}, { 767,12}, { 1727,13}, \
- { 895,12}, { 1983,14}, { 511,13}, { 1023,12}, \
- { 2239,13}, { 1151,12}, { 2495,13}, { 1279,12}, \
- { 2623,13}, { 1407,12}, { 2943,14}, { 767,13}, \
- { 1663,12}, { 3455,13}, { 1919,12}, { 3839,15}, \
- { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
- { 2431,12}, { 4863,14}, { 1279,13}, { 2943,12}, \
- { 5887,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 159
+ { 191,11}, { 383,10}, { 799,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
+ { 1087,11}, { 607,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,10}, { 1471,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 991,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,12}, { 959,11}, \
+ { 1919,14}, { 255,13}, { 511,12}, { 1023,11}, \
+ { 2047,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1471,13}, { 767,12}, \
+ { 1727,13}, { 895,12}, { 1983,14}, { 511,13}, \
+ { 1023,12}, { 2239,13}, { 1151,12}, { 2495,13}, \
+ { 1279,12}, { 2623,13}, { 1407,12}, { 2943,14}, \
+ { 767,13}, { 1663,12}, { 3455,13}, { 1919,12}, \
+ { 3967,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
+ { 2943,12}, { 5887,14}, { 1535,13}, { 3455,14}, \
+ { 1791,13}, { 3967,15}, { 1023,14}, { 2047,13}, \
+ { 4479,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
+ { 2559,13}, { 5119,14}, { 2815,13}, { 5887,15}, \
+ { 1535,14}, { 3839,13}, { 7679,16} }
+#define SQR_FFT_TABLE3_SIZE 163
#define SQR_FFT_THRESHOLD 5760
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 62
+#define MULLO_BASECASE_THRESHOLD 16
+#define MULLO_DC_THRESHOLD 46
#define MULLO_MUL_N_THRESHOLD 14281
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 159
+#define SQRLO_SQR_THRESHOLD 11317
-#define DC_DIV_QR_THRESHOLD 25
-#define DC_DIVAPPR_Q_THRESHOLD 43
-#define DC_BDIV_QR_THRESHOLD 99
-#define DC_BDIV_Q_THRESHOLD 240
+#define DC_DIV_QR_THRESHOLD 47
+#define DC_DIVAPPR_Q_THRESHOLD 191
+#define DC_BDIV_QR_THRESHOLD 107
+#define DC_BDIV_Q_THRESHOLD 232
-#define INV_MULMOD_BNM1_THRESHOLD 54
-#define INV_NEWTON_THRESHOLD 14
-#define INV_APPR_THRESHOLD 13
+#define INV_MULMOD_BNM1_THRESHOLD 62
+#define INV_NEWTON_THRESHOLD 181
+#define INV_APPR_THRESHOLD 182
-#define BINV_NEWTON_THRESHOLD 363
-#define REDC_1_TO_REDC_N_THRESHOLD 90
+#define BINV_NEWTON_THRESHOLD 378
+#define REDC_1_TO_REDC_N_THRESHOLD 91
-#define MU_DIV_QR_THRESHOLD 998
-#define MU_DIVAPPR_Q_THRESHOLD 667
-#define MUPI_DIV_QR_THRESHOLD 0 /* always */
-#define MU_BDIV_QR_THRESHOLD 1787
-#define MU_BDIV_Q_THRESHOLD 2130
+#define MU_DIV_QR_THRESHOLD 1858
+#define MU_DIVAPPR_Q_THRESHOLD 1858
+#define MUPI_DIV_QR_THRESHOLD 77
+#define MU_BDIV_QR_THRESHOLD 1830
+#define MU_BDIV_Q_THRESHOLD 2166
-#define POWM_SEC_TABLE 1,16,126,480,1317
+#define POWM_SEC_TABLE 1,16,126,428,1442
-#define MATRIX22_STRASSEN_THRESHOLD 21
-#define HGCD_THRESHOLD 61
-#define HGCD_APPR_THRESHOLD 56
-#define HGCD_REDUCE_THRESHOLD 3810
-#define GCD_DC_THRESHOLD 283
-#define GCDEXT_DC_THRESHOLD 309
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 399
-#define SET_STR_PRECOMPUTE_THRESHOLD 1183
-
-#define FAC_DSC_THRESHOLD 194
+#define GET_STR_DC_THRESHOLD 10
+#define GET_STR_PRECOMPUTE_THRESHOLD 16
+#define SET_STR_DC_THRESHOLD 418
+#define SET_STR_PRECOMPUTE_THRESHOLD 1104
+
+#define FAC_DSC_THRESHOLD 149
#define FAC_ODD_THRESHOLD 34
+
+#define MATRIX22_STRASSEN_THRESHOLD 21
+#define HGCD2_DIV1_METHOD 1 /* 5.54% faster than 4 */
+#define HGCD_THRESHOLD 66
+#define HGCD_APPR_THRESHOLD 135
+#define HGCD_REDUCE_THRESHOLD 4284
+#define GCD_DC_THRESHOLD 642
+#define GCDEXT_DC_THRESHOLD 465
+#define JACOBI_BASE_METHOD 3 /* 14.76% faster than 4 */
+
+/* Tuneup completed successfully, took 44241 seconds */
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 bd84219a9ef..18be05a395c 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
@@ -4,7 +4,8 @@
THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
COMPLETELY IN FUTURE GNU MP RELEASES.
-Copyright 2003, 2004, 2011-2013, 2015 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2011-2013, 2015, 2017, 2018 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -36,7 +37,6 @@ see https://www.gnu.org/licenses/. */
#include <stdlib.h> /* for getenv */
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
/* Change this to "#define TRACE(x) x" for some traces. */
@@ -174,7 +174,7 @@ struct cpuvec_t __gmpn_cpuvec = {
__MPN(copyi_init),
__MPN(divexact_1_init),
__MPN(divrem_1_init),
- __MPN(gcd_1_init),
+ __MPN(gcd_11_init),
__MPN(lshift_init),
__MPN(lshiftc_init),
__MPN(mod_1_init),
@@ -261,7 +261,7 @@ __gmpn_cpuvec_init (void)
case 5:
TRACE (printf (" pentium\n"));
CPUVEC_SETUP_pentium;
- if (model >= 4)
+ if (model == 4 || model == 8)
{
TRACE (printf (" pentiummmx\n"));
CPUVEC_SETUP_pentium_mmx;
@@ -362,7 +362,19 @@ __gmpn_cpuvec_init (void)
case 0x2a: /* SBR */
case 0x2d: /* SBR-EP */
case 0x3a: /* IBR */
- case 0x3c: /* Haswell */
+ case 0x3c: /* Haswell client */
+ case 0x3f: /* Haswell server */
+ case 0x45: /* Haswell ULT */
+ case 0x46: /* Crystal Well */
+ case 0x3d: /* Broadwell */
+ case 0x47: /* Broadwell */
+ case 0x4f: /* Broadwell server */
+ case 0x56: /* Broadwell microserver */
+ case 0x4e: /* Skylake client */
+ case 0x55: /* Skylake server */
+ case 0x5e: /* Skylake */
+ case 0x8e: /* Kabylake */
+ case 0x9e: /* Kabylake */
TRACE (printf (" sandybridge\n"));
CPUVEC_SETUP_p6_mmx;
CPUVEC_SETUP_p6_p3mmx;
@@ -435,7 +447,7 @@ __gmpn_cpuvec_init (void)
TRACE (printf (" bobcat\n"));
CPUVEC_SETUP_k7;
CPUVEC_SETUP_k7_mmx;
- CPUVEC_SETUP_bobcat;
+ CPUVEC_SETUP_bt1;
break;
case 0x15: /* bulldozer */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/gcd_11.asm
new file mode 100644
index 00000000000..af691353d29
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/gcd_11.asm
@@ -0,0 +1,126 @@
+dnl x86 mpn_gcd_11 optimised for processors with slow BSF.
+
+dnl Based on C version.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+dnl Rudimentary code for x86-32, i.e. for CPUs without cmov. Also, the bsf
+dnl instruction is assumed to be so slow it is useless. Instead a teble is
+dnl used.
+dnl
+dnl The loop benefits from OoO, in-order CPUs might want a different loop.
+dnl The ebx and ecx registers could be combined if the assigment of ecx were
+dnl postponed until ebx died, but that would at least hurt in-order CPUs.
+
+C cycles/bit (approx)
+C AMD K7 ?
+C AMD K8,K9 ?
+C AMD K10 ?
+C AMD bd1 ?
+C AMD bd2 ?
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD bt1 ?
+C AMD bt2 ?
+C AMD zn1 ?
+C AMD zn2 ?
+C Intel P4-2 ?
+C Intel P4-3/4 ?
+C Intel P6/13 ?
+C Intel CNR ?
+C Intel NHM ?
+C Intel SBR ?
+C Intel IBR ?
+C Intel HWL ?
+C Intel BWL ?
+C Intel SKL ?
+C Intel atom ?
+C Intel SLM ?
+C Intel GLM ?
+C Intel GLM+ ?
+C VIA nano ?
+C Numbers measured with: speed -CD -s8-32 -t24 mpn_gcd_1
+
+deflit(MAXSHIFT, 6)
+deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
+
+DEF_OBJECT(ctz_table,64)
+ .byte MAXSHIFT
+forloop(i,1,MASK,
+` .byte m4_count_trailing_zeros(i)
+')
+END_OBJECT(ctz_table)
+
+define(`u0', `%eax')
+define(`v0', `%edx')
+
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(mpn_gcd_11)
+ push %edi
+ push %esi
+ push %ebx
+
+ mov 16(%esp), u0
+ mov 20(%esp), v0
+ LEAL( ctz_table, %esi)
+ sub v0, u0 C u = u - v 0
+ jz L(end)
+
+ ALIGN(16)
+L(top): sbb %ebx, %ebx C mask 1
+ mov u0, %edi C 1
+ mov u0, %ecx C 1
+ and %ebx, %edi C 2
+ xor %ebx, u0 C 2
+ add %edi, v0 C v = min(u.v) 3
+ sub %ebx, u0 C u = |u - v| 3
+L(mid): and $MASK, %ecx C 2
+ movzbl (%esi,%ecx), %ecx C 3
+ jz L(shift_alot)
+ shr %cl, u0 C 4
+ sub v0, u0 C u = u - v 0,5
+ jnz L(top)
+
+L(end): mov v0, %eax
+ pop %ebx
+ pop %esi
+ pop %edi
+ ret
+
+L(shift_alot):
+ shr $MAXSHIFT, u0
+ mov u0, %ecx
+ jmp L(mid)
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/goldmont/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/goldmont/gmp-mparam.h
new file mode 100644
index 00000000000..3d37fa3b07b
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/goldmont/gmp-mparam.h
@@ -0,0 +1,219 @@
+/* Intel Goldmont/32 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* 2200 MHz Intel Atom C3758 Goldmont/Denverton */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-22, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 7
+#define MOD_1_UNNORM_THRESHOLD 12
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 12
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 32.79% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 32
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 23
+
+#define DIV_1_VS_MUL_1_PERCENT 228
+
+#define MUL_TOOM22_THRESHOLD 18
+#define MUL_TOOM33_THRESHOLD 81
+#define MUL_TOOM44_THRESHOLD 193
+#define MUL_TOOM6H_THRESHOLD 286
+#define MUL_TOOM8H_THRESHOLD 399
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 138
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 125
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 137
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 185
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 32
+#define SQR_TOOM3_THRESHOLD 113
+#define SQR_TOOM4_THRESHOLD 280
+#define SQR_TOOM6_THRESHOLD 399
+#define SQR_TOOM8_THRESHOLD 547
+
+#define MULMID_TOOM42_THRESHOLD 60
+
+#define MULMOD_BNM1_THRESHOLD 13
+#define SQRMOD_BNM1_THRESHOLD 15
+
+#define MUL_FFT_MODF_THRESHOLD 368 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 368, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 21, 7}, { 11, 6}, { 25, 7}, { 13, 6}, \
+ { 27, 7}, { 15, 6}, { 31, 7}, { 21, 8}, \
+ { 11, 7}, { 27, 8}, { 15, 7}, { 33, 8}, \
+ { 19, 7}, { 39, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 39, 9}, { 23, 8}, \
+ { 47,10}, { 15, 9}, { 31, 8}, { 63, 9}, \
+ { 39, 8}, { 79, 9}, { 47,10}, { 31, 9}, \
+ { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
+ { 63, 9}, { 127, 8}, { 255, 9}, { 135,10}, \
+ { 79, 9}, { 159,10}, { 95, 9}, { 191,11}, \
+ { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
+ { 143, 9}, { 287, 8}, { 575, 9}, { 303,10}, \
+ { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,10}, { 287, 9}, { 575,10}, { 303, 9}, \
+ { 607,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 351, 9}, { 703,11}, { 191,10}, { 383, 9}, \
+ { 767,10}, { 415, 9}, { 831,11}, { 223,10}, \
+ { 447,12}, { 127,11}, { 255,10}, { 543, 9}, \
+ { 1087,11}, { 287,10}, { 607, 9}, { 1215,11}, \
+ { 319,10}, { 671,11}, { 351,10}, { 703,12}, \
+ { 191,11}, { 383,10}, { 767,11}, { 415,10}, \
+ { 831,11}, { 447,13}, { 127,12}, { 255,11}, \
+ { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
+ { 319,11}, { 671,10}, { 1343,11}, { 703,10}, \
+ { 1407,11}, { 735,12}, { 383,11}, { 831,12}, \
+ { 447,11}, { 959,13}, { 255,12}, { 511,11}, \
+ { 1087,12}, { 575,11}, { 1215,10}, { 2431,12}, \
+ { 639,11}, { 1343,12}, { 703,11}, { 1407,13}, \
+ { 383,12}, { 831,11}, { 1663,12}, { 959,11}, \
+ { 1919,14}, { 255,13}, { 511,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
+ { 767,12}, { 1727,13}, { 895,12}, { 1919,11}, \
+ { 3839,14}, { 511,13}, { 1023,12}, { 2111,13}, \
+ { 1151,12}, { 2431,13}, { 1407,12}, { 2943,14}, \
+ { 767,13}, { 1663,12}, { 3455,13}, { 1919,12}, \
+ { 3839,15}, { 511,14}, { 1023,13}, { 2431,14}, \
+ { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
+ { 3455,14}, { 1791,13}, { 3839,12}, { 7679,15}, \
+ { 1023,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
+ { 2559,13}, { 5119,14}, { 2815,13}, { 5887,15}, \
+ { 1535,14}, { 3839,13}, { 7679,16} }
+#define MUL_FFT_TABLE3_SIZE 171
+#define MUL_FFT_THRESHOLD 3712
+
+#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 340, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 12, 5}, { 25, 6}, { 21, 7}, { 11, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
+ { 31, 7}, { 21, 8}, { 11, 7}, { 27, 8}, \
+ { 15, 7}, { 33, 8}, { 19, 7}, { 39, 8}, \
+ { 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
+ { 39, 9}, { 23, 8}, { 47,10}, { 15, 9}, \
+ { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
+ { 47,10}, { 31, 9}, { 79,10}, { 47,11}, \
+ { 31,10}, { 63, 9}, { 127, 8}, { 255,10}, \
+ { 79, 9}, { 159, 8}, { 319,10}, { 95, 9}, \
+ { 191,11}, { 63,10}, { 127, 9}, { 255, 8}, \
+ { 511, 9}, { 271,10}, { 143, 9}, { 287, 8}, \
+ { 575, 9}, { 303, 8}, { 607, 9}, { 319,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
+ { 287, 9}, { 575,10}, { 303, 9}, { 607,11}, \
+ { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
+ { 671,10}, { 351, 9}, { 703,11}, { 191,10}, \
+ { 383, 9}, { 767,10}, { 415, 9}, { 831,11}, \
+ { 223,10}, { 479,12}, { 127,11}, { 255,10}, \
+ { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
+ { 1215,11}, { 319,10}, { 671,11}, { 351,10}, \
+ { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 415,10}, { 831,11}, { 479,13}, { 127,12}, \
+ { 255,11}, { 543,10}, { 1087,11}, { 607,10}, \
+ { 1215,12}, { 319,11}, { 671,10}, { 1343,11}, \
+ { 735,12}, { 383,11}, { 831,12}, { 447,11}, \
+ { 959,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,13}, { 383,12}, { 831,11}, \
+ { 1663,12}, { 959,11}, { 1919,14}, { 255,13}, \
+ { 511,12}, { 1215,13}, { 639,12}, { 1471,11}, \
+ { 2943,13}, { 767,12}, { 1727,13}, { 895,12}, \
+ { 1919,14}, { 511,13}, { 1023,12}, { 2111,13}, \
+ { 1151,12}, { 2431,13}, { 1407,12}, { 2943,14}, \
+ { 767,13}, { 1663,12}, { 3455,13}, { 1919,15}, \
+ { 511,14}, { 1023,13}, { 2431,14}, { 1279,13}, \
+ { 2943,12}, { 5887,14}, { 1535,13}, { 3455,14}, \
+ { 1791,13}, { 3839,12}, { 7679,15}, { 1023,14}, \
+ { 2047,13}, { 4095,14}, { 2303,13}, { 4991,12}, \
+ { 9983,14}, { 2815,13}, { 5887,15}, { 1535,14}, \
+ { 3839,13}, { 7679,16} }
+#define SQR_FFT_TABLE3_SIZE 170
+#define SQR_FFT_THRESHOLD 3520
+
+#define MULLO_BASECASE_THRESHOLD 5
+#define MULLO_DC_THRESHOLD 50
+#define MULLO_MUL_N_THRESHOLD 6633
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 95
+#define SQRLO_SQR_THRESHOLD 6633
+
+#define DC_DIV_QR_THRESHOLD 68
+#define DC_DIVAPPR_Q_THRESHOLD 204
+#define DC_BDIV_QR_THRESHOLD 64
+#define DC_BDIV_Q_THRESHOLD 108
+
+#define INV_MULMOD_BNM1_THRESHOLD 34
+#define INV_NEWTON_THRESHOLD 276
+#define INV_APPR_THRESHOLD 226
+
+#define BINV_NEWTON_THRESHOLD 298
+#define REDC_1_TO_REDC_N_THRESHOLD 65
+
+#define MU_DIV_QR_THRESHOLD 1528
+#define MU_DIVAPPR_Q_THRESHOLD 1589
+#define MUPI_DIV_QR_THRESHOLD 140
+#define MU_BDIV_QR_THRESHOLD 1334
+#define MU_BDIV_Q_THRESHOLD 1499
+
+#define POWM_SEC_TABLE 3,16,96,428,1317
+
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 18
+#define SET_STR_DC_THRESHOLD 704
+#define SET_STR_PRECOMPUTE_THRESHOLD 1358
+
+#define FAC_DSC_THRESHOLD 95
+#define FAC_ODD_THRESHOLD 29
+
+#define MATRIX22_STRASSEN_THRESHOLD 15
+#define HGCD2_DIV1_METHOD 1 /* 5.53% faster than 3 */
+#define HGCD_THRESHOLD 172
+#define HGCD_APPR_THRESHOLD 204
+#define HGCD_REDUCE_THRESHOLD 2479
+#define GCD_DC_THRESHOLD 610
+#define GCDEXT_DC_THRESHOLD 443
+#define JACOBI_BASE_METHOD 4 /* 6.53% faster than 3 */
+
+/* Tuneup completed successfully, took 101563 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/k10/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/k10/gmp-mparam.h
index 90cb96f911e..eceaaae85cb 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/k10/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/k10/gmp-mparam.h
@@ -31,184 +31,187 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 32
#define GMP_LIMB_BYTES 4
-/* 2400 MHz K10 Barcelona */
-/* FFT tuning limit = 25000000 */
-/* Generated by tuneup.c, 2014-03-13, gcc 4.5 */
+/* 3200-3600 MHz K10 Thuban */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-19, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 12
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 14
#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 9
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 12
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 15
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 18
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 22
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1N_PI1_METHOD 1 /* 29.33% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 2
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 32
+#define BMOD_1_TO_MOD_1_THRESHOLD 35
-#define MUL_TOOM22_THRESHOLD 24
-#define MUL_TOOM33_THRESHOLD 81
-#define MUL_TOOM44_THRESHOLD 130
-#define MUL_TOOM6H_THRESHOLD 189
+#define DIV_1_VS_MUL_1_PERCENT 258
+
+#define MUL_TOOM22_THRESHOLD 22
+#define MUL_TOOM33_THRESHOLD 73
+#define MUL_TOOM44_THRESHOLD 124
+#define MUL_TOOM6H_THRESHOLD 274
#define MUL_TOOM8H_THRESHOLD 430
#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 91
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 82
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 90
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 112
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 99
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 85
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 88
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 113
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 38
-#define SQR_TOOM3_THRESHOLD 77
-#define SQR_TOOM4_THRESHOLD 184
-#define SQR_TOOM6_THRESHOLD 262
-#define SQR_TOOM8_THRESHOLD 369
+#define SQR_TOOM2_THRESHOLD 26
+#define SQR_TOOM3_THRESHOLD 105
+#define SQR_TOOM4_THRESHOLD 154
+#define SQR_TOOM6_THRESHOLD 238
+#define SQR_TOOM8_THRESHOLD 309
-#define MULMID_TOOM42_THRESHOLD 56
+#define MULMID_TOOM42_THRESHOLD 50
-#define MULMOD_BNM1_THRESHOLD 17
+#define MULMOD_BNM1_THRESHOLD 15
#define SQRMOD_BNM1_THRESHOLD 18
-#define MUL_FFT_MODF_THRESHOLD 765 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 570 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 765, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { { 570, 5}, { 21, 6}, { 11, 5}, { 25, 6}, \
+ { 13, 5}, { 27, 6}, { 15, 5}, { 31, 6}, \
{ 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 23, 6}, { 47, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 51, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95,10}, { 31, 9}, \
- { 63, 8}, { 127, 9}, { 79,10}, { 47, 9}, \
- { 103,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 159,10}, { 95, 9}, { 199,10}, \
- { 111,11}, { 63,10}, { 127, 9}, { 263,10}, \
- { 175,11}, { 95,10}, { 207,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 543, 8}, { 1087, 9}, \
- { 575,11}, { 159,10}, { 319, 9}, { 671, 8}, \
- { 1343, 9}, { 735,11}, { 191, 9}, { 799, 8}, \
- { 1599,10}, { 415, 9}, { 863,11}, { 223,12}, \
- { 127,11}, { 255,10}, { 543, 9}, { 1087,10}, \
- { 607, 9}, { 1215, 8}, { 2431,11}, { 319,10}, \
- { 671, 9}, { 1343,10}, { 735,12}, { 191,11}, \
- { 383,10}, { 799, 9}, { 1599,11}, { 415,10}, \
- { 863, 9}, { 1727,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1087,11}, { 607,10}, { 1215, 9}, \
- { 2431,12}, { 319,11}, { 671,10}, { 1343,11}, \
- { 735,10}, { 1471, 9}, { 2943, 8}, { 5887,12}, \
- { 383,11}, { 799,10}, { 1599,11}, { 863,10}, \
- { 1727,12}, { 447,11}, { 959,10}, { 1919,11}, \
- { 991,10}, { 1983,13}, { 255,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,10}, { 2431,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,10}, \
- { 2943, 9}, { 5887,13}, { 383,12}, { 767,11}, \
- { 1599,12}, { 831,11}, { 1727,10}, { 3455,12}, \
- { 959,11}, { 1983,14}, { 255,13}, { 511,12}, \
- { 1087,11}, { 2239,12}, { 1215,11}, { 2431,13}, \
- { 639,12}, { 1471,11}, { 2943,10}, { 5887,13}, \
- { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
- { 1983,14}, { 511,13}, { 1023,12}, { 2239,13}, \
- { 1151,12}, { 2495,13}, { 1407,12}, { 2943,11}, \
- { 5887,14}, { 767,13}, { 1663,12}, { 3455,13}, \
- { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
- { 2175,12}, { 4351,13}, { 2431,14}, { 1279,13}, \
- { 2943,12}, { 5887,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 172
-#define MUL_FFT_THRESHOLD 6784
-
-#define SQR_FFT_MODF_THRESHOLD 555 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 555, 5}, { 21, 6}, { 11, 5}, { 25, 6}, \
- { 13, 5}, { 27, 6}, { 27, 7}, { 15, 6}, \
{ 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
{ 39, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 39, 8}, { 23, 7}, { 47, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
{ 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
- { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
- { 47,10}, { 31, 9}, { 79,10}, { 47, 9}, \
- { 95,11}, { 31,10}, { 63, 9}, { 127,10}, \
- { 79, 9}, { 167,10}, { 95, 9}, { 191,10}, \
- { 111,11}, { 63,10}, { 143, 9}, { 287, 8}, \
- { 575,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 543, 8}, \
- { 1087,10}, { 287, 9}, { 607,11}, { 159,10}, \
- { 319, 9}, { 671, 8}, { 1343,10}, { 351, 9}, \
- { 735, 8}, { 1471,11}, { 191,10}, { 383, 9}, \
- { 767,10}, { 399, 9}, { 799, 8}, { 1599,10}, \
- { 415, 9}, { 863,11}, { 223,10}, { 479,12}, \
- { 127,11}, { 255,10}, { 543, 9}, { 1087,11}, \
- { 287,10}, { 607, 9}, { 1215, 8}, { 2431,11}, \
- { 319,10}, { 671, 9}, { 1343,11}, { 351,10}, \
- { 735, 9}, { 1471,12}, { 191,11}, { 383,10}, \
- { 799, 9}, { 1599,11}, { 415,10}, { 863, 9}, \
- { 1727,11}, { 479,13}, { 127,12}, { 255,11}, \
- { 511,10}, { 1023,11}, { 543,10}, { 1087,11}, \
- { 607,10}, { 1215, 9}, { 2431,12}, { 319,11}, \
+ { 39, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
+ { 191,11}, { 63,10}, { 143, 9}, { 287,10}, \
+ { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,10}, { 287,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 335, 9}, { 671,11}, { 191,10}, \
+ { 383, 9}, { 767,10}, { 399, 9}, { 799,11}, \
+ { 223,12}, { 127,11}, { 255,10}, { 543,11}, \
+ { 287,10}, { 607, 9}, { 1215,11}, { 319,10}, \
+ { 671,12}, { 191,11}, { 383,10}, { 799,11}, \
+ { 415,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 1087,11}, { 607,10}, { 1215,12}, { 319,11}, \
{ 671,10}, { 1343,11}, { 735,10}, { 1471, 9}, \
{ 2943,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,10}, { 1727,12}, { 447,11}, { 959,10}, \
- { 1919,11}, { 991,10}, { 1983,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,10}, { 2431,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,10}, \
- { 2943,13}, { 383,12}, { 767,11}, { 1599,12}, \
- { 831,11}, { 1727,10}, { 3455,12}, { 959,11}, \
- { 1983,13}, { 511,12}, { 1215,11}, { 2431,13}, \
+ { 863,12}, { 447,11}, { 959,13}, { 255,12}, \
+ { 511,11}, { 1087,12}, { 575,11}, { 1215,10}, \
+ { 2431,12}, { 639,11}, { 1343,12}, { 703,11}, \
+ { 1471,10}, { 2943,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,10}, { 3455,12}, \
+ { 959,11}, { 1919,14}, { 255,13}, { 511,12}, \
+ { 1087,11}, { 2239,12}, { 1215,11}, { 2431,13}, \
{ 639,12}, { 1471,11}, { 2943,13}, { 767,12}, \
{ 1727,11}, { 3455,13}, { 895,12}, { 1983,14}, \
- { 511,13}, { 1023,12}, { 2111,13}, { 1151,12}, \
+ { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
{ 2431,13}, { 1407,12}, { 2943,14}, { 767,13}, \
- { 1663,12}, { 3455,13}, { 1919,12}, { 3839,15}, \
- { 511,14}, { 1023,13}, { 2431,14}, { 1279,13}, \
- { 2943,12}, { 5887,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 172
-#define SQR_FFT_THRESHOLD 5504
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
+ { 1663,12}, { 3455,13}, { 1919,15}, { 511,14}, \
+ { 1023,13}, { 2175,12}, { 4479,13}, { 2431,14}, \
+ { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
+ { 3455,14}, { 1791,13}, { 3967,15}, { 1023,14}, \
+ { 2047,13}, { 4479,14}, { 2303,13}, { 4991,14}, \
+ { 2815,13}, { 5887,15}, { 1535,14}, { 3839,16} }
+#define MUL_FFT_TABLE3_SIZE 168
+#define MUL_FFT_THRESHOLD 7424
+
+#define SQR_FFT_MODF_THRESHOLD 525 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 525, 5}, { 25, 6}, { 13, 5}, { 28, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
+ { 31, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 51, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 55,10}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
+ { 31,10}, { 63, 9}, { 127,10}, { 79, 9}, \
+ { 159,10}, { 95,11}, { 63,10}, { 143, 9}, \
+ { 287,10}, { 159,11}, { 95,10}, { 191,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543,10}, { 287,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
+ { 351,11}, { 191,10}, { 383, 9}, { 767,10}, \
+ { 399, 9}, { 799,10}, { 415,12}, { 127,11}, \
+ { 255,10}, { 543,11}, { 287,10}, { 607,11}, \
+ { 319,10}, { 671, 9}, { 1343,11}, { 351,10}, \
+ { 703,12}, { 191,11}, { 383,10}, { 799, 9}, \
+ { 1599,11}, { 415,10}, { 831,13}, { 127,12}, \
+ { 255,11}, { 543,10}, { 1087,11}, { 607,12}, \
+ { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
+ { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
+ { 863,10}, { 1727,12}, { 447,11}, { 959,10}, \
+ { 1919,11}, { 991,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,10}, { 2431,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 831,11}, { 1727,10}, \
+ { 3455,12}, { 959,11}, { 1919,13}, { 511,12}, \
+ { 1087,11}, { 2239,12}, { 1215,11}, { 2431,13}, \
+ { 639,12}, { 1471,11}, { 2943,13}, { 767,12}, \
+ { 1727,11}, { 3455,13}, { 895,12}, { 1919,14}, \
+ { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
+ { 2495,13}, { 1279,12}, { 2623,13}, { 1407,12}, \
+ { 2943,14}, { 767,13}, { 1663,12}, { 3455,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4351,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,15}, { 1023,14}, { 2047,13}, { 4351,14}, \
+ { 2303,13}, { 4991,14}, { 2815,13}, { 5887,15}, \
+ { 1535,14}, { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 166
+#define SQR_FFT_THRESHOLD 5312
+
+#define MULLO_BASECASE_THRESHOLD 6
#define MULLO_DC_THRESHOLD 40
-#define MULLO_MUL_N_THRESHOLD 13463
-#define SQRLO_BASECASE_THRESHOLD 7
-#define SQRLO_DC_THRESHOLD 143
-#define SQRLO_SQR_THRESHOLD 11000
+#define MULLO_MUL_N_THRESHOLD 14281
+#define SQRLO_BASECASE_THRESHOLD 8
+#define SQRLO_DC_THRESHOLD 113
+#define SQRLO_SQR_THRESHOLD 10323
-#define DC_DIV_QR_THRESHOLD 59
-#define DC_DIVAPPR_Q_THRESHOLD 270
+#define DC_DIV_QR_THRESHOLD 56
+#define DC_DIVAPPR_Q_THRESHOLD 248
#define DC_BDIV_QR_THRESHOLD 55
-#define DC_BDIV_Q_THRESHOLD 206
+#define DC_BDIV_Q_THRESHOLD 158
-#define INV_MULMOD_BNM1_THRESHOLD 62
+#define INV_MULMOD_BNM1_THRESHOLD 42
#define INV_NEWTON_THRESHOLD 254
#define INV_APPR_THRESHOLD 252
-#define BINV_NEWTON_THRESHOLD 274
-#define REDC_1_TO_REDC_N_THRESHOLD 74
+#define BINV_NEWTON_THRESHOLD 292
+#define REDC_1_TO_REDC_N_THRESHOLD 67
#define MU_DIV_QR_THRESHOLD 1589
-#define MU_DIVAPPR_Q_THRESHOLD 1589
-#define MUPI_DIV_QR_THRESHOLD 106
-#define MU_BDIV_QR_THRESHOLD 1470
-#define MU_BDIV_Q_THRESHOLD 1558
+#define MU_DIVAPPR_Q_THRESHOLD 1558
+#define MUPI_DIV_QR_THRESHOLD 114
+#define MU_BDIV_QR_THRESHOLD 1442
+#define MU_BDIV_Q_THRESHOLD 1524
-#define POWM_SEC_TABLE 1,16,114,428,1240
+#define POWM_SEC_TABLE 1,16,102,416,1378
-#define MATRIX22_STRASSEN_THRESHOLD 19
-#define HGCD_THRESHOLD 136
-#define HGCD_APPR_THRESHOLD 175
-#define HGCD_REDUCE_THRESHOLD 3389
-#define GCD_DC_THRESHOLD 595
-#define GCDEXT_DC_THRESHOLD 424
-#define JACOBI_BASE_METHOD 4
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 21
+#define SET_STR_DC_THRESHOLD 270
+#define SET_STR_PRECOMPUTE_THRESHOLD 1105
-#define GET_STR_DC_THRESHOLD 15
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 100
-#define SET_STR_PRECOMPUTE_THRESHOLD 1360
+#define FAC_DSC_THRESHOLD 159
+#define FAC_ODD_THRESHOLD 34
+
+#define MATRIX22_STRASSEN_THRESHOLD 17
+#define HGCD2_DIV1_METHOD 3 /* 0.70% faster than 4 */
+#define HGCD_THRESHOLD 130
+#define HGCD_APPR_THRESHOLD 163
+#define HGCD_REDUCE_THRESHOLD 3389
+#define GCD_DC_THRESHOLD 573
+#define GCDEXT_DC_THRESHOLD 393
+#define JACOBI_BASE_METHOD 4 /* 9.13% faster than 1 */
-#define FAC_DSC_THRESHOLD 224
-#define FAC_ODD_THRESHOLD 29
+/* Tuneup completed successfully, took 52901 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/k6/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/k6/gcd_1.asm
deleted file mode 100644
index a45774d3721..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/k6/gcd_1.asm
+++ /dev/null
@@ -1,359 +0,0 @@
-dnl AMD K6 mpn_gcd_1 -- mpn by 1 gcd.
-
-dnl Copyright 2000-2002, 2004, 2014 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/.
-
-include(`../config.m4')
-
-
-C K6: 9.5 cycles/bit (approx) 1x1 gcd
-C 11.0 cycles/limb Nx1 reduction (modexact_1_odd)
-
-
-C mp_limb_t mpn_gcd_1 (mp_srcptr src, mp_size_t size, mp_limb_t y);
-C
-C This code is nothing very special, but offers a speedup over what gcc 2.95
-C can do with mpn/generic/gcd_1.c.
-C
-C Future:
-C
-C Using a lookup table to count trailing zeros seems a touch quicker, but
-C after a slightly longer startup. Might be worthwhile if an mpn_gcd_2 used
-C it too.
-
-
-dnl If size==1 and x (the larger operand) is more than DIV_THRESHOLD bits
-dnl bigger than y, then a division x%y is done to reduce it.
-dnl
-dnl A divl is 20 cycles and the loop runs at about 9.5 cycles/bitpair so
-dnl there should be an advantage in the divl at about 4 or 5 bits, which is
-dnl what's found.
-
-deflit(DIV_THRESHOLD, 5)
-
-
-defframe(PARAM_LIMB, 12)
-defframe(PARAM_SIZE, 8)
-defframe(PARAM_SRC, 4)
-
- TEXT
- ALIGN(16)
-
-PROLOGUE(mpn_gcd_1)
-deflit(`FRAME',0)
-
- ASSERT(ne, `cmpl $0, PARAM_LIMB')
- ASSERT(ae, `cmpl $1, PARAM_SIZE')
-
-
- movl PARAM_SRC, %eax
- pushl %ebx FRAME_pushl()
-
- movl PARAM_LIMB, %edx
- movl $-1, %ecx
-
- movl (%eax), %ebx C src low limb
-
- movl %ebx, %eax C src low limb
- orl %edx, %ebx
-
-L(common_twos):
- shrl %ebx
- incl %ecx
-
- jnc L(common_twos) C 1/4 chance on random data
- shrl %cl, %edx C y
-
- cmpl $1, PARAM_SIZE
- ja L(size_two_or_more)
-
-
- ASSERT(nz, `orl %eax, %eax') C should have src limb != 0
-
- shrl %cl, %eax C x
-
-
- C Swap if necessary to make x>=y. Measures a touch quicker as a
- C jump than a branch free calculation.
- C
- C eax x
- C ebx
- C ecx common twos
- C edx y
-
- movl %eax, %ebx
- cmpl %eax, %edx
-
- jb L(noswap)
- movl %edx, %eax
-
- movl %ebx, %edx
- movl %eax, %ebx
-L(noswap):
-
-
- C See if it's worth reducing x with a divl.
- C
- C eax x
- C ebx x
- C ecx common twos
- C edx y
-
- shrl $DIV_THRESHOLD, %ebx
-
- cmpl %ebx, %edx
- ja L(nodiv)
-
-
- C Reduce x to x%y.
- C
- C eax x
- C ebx
- C ecx common twos
- C edx y
-
- movl %edx, %ebx
- xorl %edx, %edx
-
- divl %ebx
-
- orl %edx, %edx C y
- nop C code alignment
-
- movl %ebx, %eax C x
- jz L(done_shll)
-L(nodiv):
-
-
- C eax x
- C ebx
- C ecx common twos
- C edx y
- C esi
- C edi
- C ebp
-
-L(strip_y):
- shrl %edx
- jnc L(strip_y)
-
- leal 1(%edx,%edx), %edx
- movl %ecx, %ebx C common twos
-
- leal 1(%eax), %ecx
- jmp L(strip_x_and)
-
-
-C Calculating a %cl shift based on the low bit 0 or 1 avoids doing a branch
-C on a 50/50 chance of 0 or 1. The chance of the next bit also being 0 is
-C only 1/4.
-C
-C A second computed %cl shift was tried, but that measured a touch slower
-C than branching back.
-C
-C A branch-free abs(x-y) and min(x,y) calculation was tried, but that
-C measured about 1 cycle/bit slower.
-
- C eax x
- C ebx common twos
- C ecx scratch
- C edx y
-
- ALIGN(4)
-L(swap):
- addl %eax, %edx C x-y+y = x
- negl %eax C -(x-y) = y-x
-
-L(strip_x):
- shrl %eax C odd-odd = even, so always one to strip
- ASSERT(nz)
-
-L(strip_x_leal):
- leal 1(%eax), %ecx
-
-L(strip_x_and):
- andl $1, %ecx C (x^1)&1
-
- shrl %cl, %eax C shift if x even
-
- testb $1, %al
- jz L(strip_x)
-
- ASSERT(nz,`testl $1, %eax') C x, y odd
- ASSERT(nz,`testl $1, %edx')
-
- subl %edx, %eax
- jb L(swap)
- ja L(strip_x)
-
-
- movl %edx, %eax
- movl %ebx, %ecx
-
-L(done_shll):
- shll %cl, %eax
- popl %ebx
-
- ret
-
-
-C -----------------------------------------------------------------------------
-C Two or more limbs.
-C
-C x={src,size} is reduced modulo y using either a plain mod_1 style
-C remainder, or a modexact_1 style exact division.
-
-deflit(MODEXACT_THRESHOLD, ifdef(`PIC', 4, 4))
-
- ALIGN(8)
-L(size_two_or_more):
- C eax
- C ebx
- C ecx common twos
- C edx y, without common twos
- C esi
- C edi
- C ebp
-
-deflit(FRAME_TWO_OR_MORE, FRAME)
-
- pushl %edi defframe_pushl(SAVE_EDI)
- movl PARAM_SRC, %ebx
-
-L(y_twos):
- shrl %edx
- jnc L(y_twos)
-
- movl %ecx, %edi C common twos
- movl PARAM_SIZE, %ecx
-
- pushl %esi defframe_pushl(SAVE_ESI)
- leal 1(%edx,%edx), %esi C y (odd)
-
- movl -4(%ebx,%ecx,4), %eax C src high limb
-
- cmpl %edx, %eax C carry if high<divisor
-
- sbbl %edx, %edx C -1 if high<divisor
-
- addl %edx, %ecx C skip one limb if high<divisor
- andl %eax, %edx
-
- cmpl $MODEXACT_THRESHOLD, %ecx
- jae L(modexact)
-
-
-L(divide_top):
- C eax scratch (quotient)
- C ebx src
- C ecx counter, size-1 to 1
- C edx carry (remainder)
- C esi divisor (odd)
- C edi
- C ebp
-
- movl -4(%ebx,%ecx,4), %eax
- divl %esi
- loop L(divide_top)
-
-
- movl %edx, %eax C x
- movl %esi, %edx C y (odd)
-
- movl %edi, %ebx C common twos
- popl %esi
-
- popl %edi
- leal 1(%eax), %ecx
-
- orl %eax, %eax
- jnz L(strip_x_and)
-
-
- movl %ebx, %ecx
- movl %edx, %eax
-
- shll %cl, %eax
- popl %ebx
-
- ret
-
-
- ALIGN(8)
-L(modexact):
- C eax
- C ebx src ptr
- C ecx size or size-1
- C edx
- C esi y odd
- C edi common twos
- C ebp
-
- movl PARAM_SIZE, %eax
- pushl %esi FRAME_pushl()
-
- pushl %eax FRAME_pushl()
-
- pushl %ebx FRAME_pushl()
-
-ifdef(`PIC_WITH_EBX',`
- nop C code alignment
- call L(movl_eip_ebx)
- add $_GLOBAL_OFFSET_TABLE_, %ebx
-')
- CALL( mpn_modexact_1_odd)
-
- movl %esi, %edx C y odd
- movl SAVE_ESI, %esi
-
- movl %edi, %ebx C common twos
- movl SAVE_EDI, %edi
-
- addl $eval(FRAME - FRAME_TWO_OR_MORE), %esp
- orl %eax, %eax
-
- leal 1(%eax), %ecx
- jnz L(strip_x_and)
-
-
- movl %ebx, %ecx
- movl %edx, %eax
-
- shll %cl, %eax
- popl %ebx
-
- ret
-
-
-ifdef(`PIC_WITH_EBX',`
-L(movl_eip_ebx):
- movl (%esp), %ebx
- ret_internal
-')
-
-EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/k7/addlsh1_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/k7/addlsh1_n.asm
index a957b6f78e6..2cba1eb1248 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/k7/addlsh1_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/k7/addlsh1_n.asm
@@ -65,7 +65,7 @@ C latency.
C
C Breaking carry recurrency might be a good idea. We would then need separate
C registers for the shift carry and add/subtract carry, which in turn would
-C force is to 2*2-way unrolling.
+C force us to 2*2-way unrolling.
defframe(PARAM_SIZE, 16)
defframe(PARAM_DBLD, 12)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gcd_1.asm
deleted file mode 100644
index 833d05d934c..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gcd_1.asm
+++ /dev/null
@@ -1,193 +0,0 @@
-dnl x86 mpn_gcd_1 optimised for AMD K7.
-
-dnl Contributed to the GNU project by by Kevin Ryde. Rehacked by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011, 2012, 2014, 2015 Free Software
-dnl 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/.
-
-include(`../config.m4')
-
-
-C cycles/bit (approx)
-C AMD K7 5.31
-C AMD K8,K9 5.33
-C AMD K10 5.30
-C AMD bd1 ?
-C AMD bobcat 7.02
-C Intel P4-2 10.1
-C Intel P4-3/4 10.0
-C Intel P6/13 5.88
-C Intel core2 6.26
-C Intel NHM 6.83
-C Intel SBR 8.50
-C Intel atom 8.90
-C VIA nano ?
-C Numbers measured with: speed -CD -s16-32 -t16 mpn_gcd_1
-
-C TODO
-C * Tune overhead, this takes 2-3 cycles more than old code when v0 is tiny.
-C * Stream things better through registers, avoiding some copying.
-C * For ELF, avoid putting GOT base in both ebx and esi. Needs special
-C LEA/LEAL or else discrete code here.
-
-C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
-
-deflit(MAXSHIFT, 6)
-deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
-
-DEF_OBJECT(ctz_table,64)
- .byte MAXSHIFT
-forloop(i,1,MASK,
-` .byte m4_count_trailing_zeros(i)
-')
-END_OBJECT(ctz_table)
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`DIV_THRES_LOG2', 7)
-
-
-define(`up', `%edi')
-define(`n', `%esi')
-define(`v0', `%edx')
-
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- push %edi
- push %esi
-
- mov 12(%esp), up
- mov 16(%esp), n
- mov 20(%esp), v0
-
- mov (up), %eax C U low limb
- or v0, %eax C x | y
- mov $-1, %ecx
-
-L(twos):
- inc %ecx
- shr %eax
- jnc L(twos)
-
- shr %cl, v0
- mov %ecx, %eax C common twos
-
-L(divide_strip_y):
- shr v0
- jnc L(divide_strip_y)
- adc v0, v0
-
- push %eax
- push v0
-
- cmp $1, n
- jnz L(reduce_nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- mov (up), %ecx
- mov %ecx, %eax
- shr $DIV_THRES_LOG2, %ecx
- cmp %ecx, v0
- ja L(reduced)
-
- mov v0, %esi
- xor %edx, %edx
- div %esi
- mov %edx, %eax
- jmp L(reduced)
-
-L(reduce_nby1):
-ifdef(`PIC_WITH_EBX',`dnl
- push %ebx
- add $-4, %esp
- call L(movl_eip_ebx)
- add $_GLOBAL_OFFSET_TABLE_, %ebx
-')
- push v0 C param 3
- push n C param 2
- push up C param 1
- cmp $BMOD_1_TO_MOD_1_THRESHOLD, n
- jl L(bmod)
- CALL( mpn_mod_1)
- jmp L(called)
-L(bmod):
- CALL( mpn_modexact_1_odd)
-
-L(called):
-ifdef(`PIC_WITH_EBX',`dnl
- add $16, %esp C deallocate params
- pop %ebx
-',`
- add $12, %esp C deallocate params
-')
-L(reduced):
- pop %edx
-
- LEAL( ctz_table, %esi)
- test %eax, %eax
- mov %eax, %ecx
- jnz L(mid)
- jmp L(end)
-
- ALIGN(16) C K8 BC P4 NHM SBR
-L(top): cmovc( %ecx, %eax) C if x-y < 0 0
- cmovc( %edi, %edx) C use x,y-x 0
-L(mid): and $MASK, %ecx C 0
- movzbl (%esi,%ecx), %ecx C 1
- jz L(shift_alot) C 1
- shr %cl, %eax C 3
- mov %eax, %edi C 4
- mov %edx, %ecx C 3
- sub %eax, %ecx C 4
- sub %edx, %eax C 4
- jnz L(top) C 5
-
-L(end): pop %ecx
- mov %edx, %eax
- shl %cl, %eax
- pop %esi
- pop %edi
- ret
-
-L(shift_alot):
- shr $MAXSHIFT, %eax
- mov %eax, %ecx
- jmp L(mid)
-
-ifdef(`PIC_WITH_EBX',`dnl
-L(movl_eip_ebx):
- mov (%esp), %ebx
- ret
-')
-EPILOGUE()
-ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gcd_11.asm
new file mode 100644
index 00000000000..2648dfdebc2
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gcd_11.asm
@@ -0,0 +1,107 @@
+dnl x86 mpn_gcd_11 optimised for AMD K7.
+
+dnl Contributed to the GNU project by by Kevin Ryde. Rehacked by Torbjorn
+dnl Granlund.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011, 2012, 2014, 2015 Free Software
+dnl 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit (approx)
+C AMD K7 5.31
+C AMD K8,K9 5.33
+C AMD K10 5.30
+C AMD bd1 ?
+C AMD bobcat 7.02
+C Intel P4-2 10.1
+C Intel P4-3/4 10.0
+C Intel P6/13 5.88
+C Intel core2 6.26
+C Intel NHM 6.83
+C Intel SBR 8.50
+C Intel atom 8.90
+C VIA nano ?
+C Numbers measured with: speed -CD -s16-32 -t16 mpn_gcd_1
+
+
+C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
+
+deflit(MAXSHIFT, 6)
+deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
+
+DEF_OBJECT(ctz_table,64)
+ .byte MAXSHIFT
+forloop(i,1,MASK,
+` .byte m4_count_trailing_zeros(i)
+')
+END_OBJECT(ctz_table)
+
+
+define(`u0', `%eax')
+define(`v0', `%edx')
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(mpn_gcd_11)
+ push %edi
+ push %esi
+
+ mov 12(%esp), %eax
+ mov 16(%esp), %edx
+
+ LEAL( ctz_table, %esi)
+ jmp L(odd)
+
+ ALIGN(16) C
+L(top): cmovc( %ecx, %eax) C u = |v - u|
+ cmovc( %edi, %edx) C v = min(u,v)
+L(mid): and $MASK, %ecx C
+ movzbl (%esi,%ecx), %ecx C
+ jz L(shift_alot) C
+ shr %cl, %eax C
+L(odd): mov %eax, %edi C
+ mov %edx, %ecx C
+ sub %eax, %ecx C
+ sub %edx, %eax C
+ jnz L(top) C
+
+L(end): mov %edx, %eax
+ pop %esi
+ pop %edi
+ ret
+
+L(shift_alot):
+ shr $MAXSHIFT, %eax
+ mov %eax, %ecx
+ jmp L(mid)
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gmp-mparam.h
index 7a507472424..25b22e2175c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/k7/gmp-mparam.h
@@ -1,7 +1,6 @@
/* AMD K7 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2005, 2008-2010, 2014, 2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -33,221 +32,231 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BYTES 4
/* 2083 MHz K7 Barton */
-/* FFT tuning limit = 30 M */
-/* Generated by tuneup.c, 2015-10-11, gcc 4.5 */
+/* FFT tuning limit = 49,770,069 */
+/* Generated by tuneup.c, 2019-11-09, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 3
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 24
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 12
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 13
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1N_PI1_METHOD 1 /* 27.00% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 4
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 24
+#define BMOD_1_TO_MOD_1_THRESHOLD 26
+
+#define DIV_1_VS_MUL_1_PERCENT 182
#define MUL_TOOM22_THRESHOLD 28
#define MUL_TOOM33_THRESHOLD 85
-#define MUL_TOOM44_THRESHOLD 145
-#define MUL_TOOM6H_THRESHOLD 206
-#define MUL_TOOM8H_THRESHOLD 454
+#define MUL_TOOM44_THRESHOLD 154
+#define MUL_TOOM6H_THRESHOLD 208
+#define MUL_TOOM8H_THRESHOLD 309
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 85
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 99
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 97
#define MUL_TOOM42_TO_TOOM63_THRESHOLD 102
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 124
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 121
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 48
-#define SQR_TOOM3_THRESHOLD 83
-#define SQR_TOOM4_THRESHOLD 208
-#define SQR_TOOM6_THRESHOLD 294
-#define SQR_TOOM8_THRESHOLD 430
+#define SQR_TOOM2_THRESHOLD 50
+#define SQR_TOOM3_THRESHOLD 86
+#define SQR_TOOM4_THRESHOLD 220
+#define SQR_TOOM6_THRESHOLD 270
+#define SQR_TOOM8_THRESHOLD 446
-#define MULMID_TOOM42_THRESHOLD 56
+#define MULMID_TOOM42_THRESHOLD 50
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 18
+#define MULMOD_BNM1_THRESHOLD 18
+#define SQRMOD_BNM1_THRESHOLD 19
-#define MUL_FFT_MODF_THRESHOLD 666 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 606 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 666, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
+ { { 606, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 15, 5}, { 31, 6}, { 28, 7}, { 15, 6}, \
{ 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 23, 6}, { 47, 7}, { 27, 8}, \
+ { 39, 7}, { 23, 6}, { 47, 7}, { 29, 8}, \
{ 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 47, 8}, { 31, 7}, { 63, 8}, \
- { 39, 9}, { 23, 8}, { 51, 9}, { 31, 8}, \
- { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
- { 95, 9}, { 55,10}, { 31, 9}, { 63, 8}, \
- { 127, 9}, { 71, 8}, { 143, 9}, { 79,10}, \
- { 47, 9}, { 103,11}, { 31,10}, { 63, 9}, \
- { 143,10}, { 79, 9}, { 167,10}, { 95, 9}, \
- { 199,10}, { 111,11}, { 63,10}, { 143, 9}, \
- { 287, 8}, { 575,10}, { 159,11}, { 95,10}, \
- { 191, 9}, { 383, 8}, { 767,10}, { 207,12}, \
- { 63,11}, { 127,10}, { 271, 9}, { 543, 8}, \
- { 1087,10}, { 287, 9}, { 575,11}, { 159, 9}, \
- { 639, 8}, { 1279,10}, { 335, 9}, { 671, 8}, \
- { 1343, 9}, { 703,11}, { 191,10}, { 383, 9}, \
- { 767,10}, { 399, 9}, { 799, 8}, { 1599,10}, \
- { 415, 9}, { 831,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 543, 9}, { 1087,11}, { 287,10}, \
- { 575, 9}, { 1151,10}, { 607, 9}, { 1215, 8}, \
- { 2431,11}, { 319,10}, { 671, 9}, { 1343,11}, \
- { 351,10}, { 703, 9}, { 1407,12}, { 191,11}, \
- { 383,10}, { 799, 9}, { 1599,11}, { 415,10}, \
- { 831, 9}, { 1663,10}, { 863, 9}, { 1727,11}, \
- { 447,13}, { 127,12}, { 255,11}, { 543,10}, \
- { 1087, 9}, { 2175,10}, { 1119,11}, { 575,10}, \
- { 1151,11}, { 607,10}, { 1215, 9}, { 2431,12}, \
- { 319,11}, { 671,10}, { 1343, 9}, { 2687,11}, \
- { 735,10}, { 1471, 9}, { 2943,12}, { 383,11}, \
- { 799,10}, { 1599,11}, { 863,10}, { 1727,12}, \
- { 447,11}, { 895,10}, { 1791, 9}, { 3583,11}, \
- { 959,10}, { 1919,11}, { 991,13}, { 255,12}, \
- { 511,11}, { 1023,10}, { 2111,11}, { 1119,12}, \
- { 575,11}, { 1151,10}, { 2303,11}, { 1215,10}, \
- { 2431,12}, { 639,11}, { 1343,10}, { 2687,12}, \
- { 703,11}, { 1407,10}, { 2815,11}, { 1471,10}, \
- { 2943,13}, { 383,12}, { 767,11}, { 1599,12}, \
- { 831,11}, { 1663,10}, { 3327,11}, { 1727,10}, \
- { 3455,12}, { 895,11}, { 1791,10}, { 3583,12}, \
+ { 23, 7}, { 49, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
+ { 63, 7}, { 127, 8}, { 71, 9}, { 39, 6}, \
+ { 319, 9}, { 47, 8}, { 99, 6}, { 399, 9}, \
+ { 55,10}, { 31, 9}, { 63, 8}, { 127, 9}, \
+ { 79,10}, { 47, 9}, { 95, 8}, { 191, 4}, \
+ { 3135, 5}, { 1599, 4}, { 3455, 6}, { 959, 8}, \
+ { 247,10}, { 79, 9}, { 167,10}, { 95, 9}, \
+ { 199,10}, { 111,11}, { 63,10}, { 127, 9}, \
+ { 255,10}, { 143, 9}, { 287, 8}, { 575,10}, \
+ { 159, 9}, { 319, 8}, { 639, 7}, { 1279,11}, \
+ { 95,10}, { 191, 9}, { 383, 8}, { 799,10}, \
+ { 207,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511, 8}, { 1023,10}, { 271, 9}, { 543, 8}, \
+ { 1087, 9}, { 575,11}, { 159, 9}, { 639,10}, \
+ { 335, 9}, { 671, 8}, { 1343,10}, { 351, 9}, \
+ { 703,11}, { 191,10}, { 383, 9}, { 799, 8}, \
+ { 1599,11}, { 223,10}, { 447,12}, { 127,11}, \
+ { 255,10}, { 511, 9}, { 1023,10}, { 543, 9}, \
+ { 1087,10}, { 575, 9}, { 1151,10}, { 607, 9}, \
+ { 1215,11}, { 319,10}, { 639, 9}, { 1343,10}, \
+ { 703, 9}, { 1407,12}, { 191,11}, { 383,10}, \
+ { 767, 9}, { 1535,10}, { 799, 9}, { 1599,10}, \
+ { 831, 9}, { 1727, 8}, { 3455,11}, { 447,13}, \
+ { 127,12}, { 255,11}, { 511,10}, { 1023, 9}, \
+ { 2047,11}, { 543,10}, { 1087,11}, { 575,10}, \
+ { 1151, 9}, { 2303,11}, { 607,10}, { 1215,12}, \
+ { 319,11}, { 639,10}, { 1279,11}, { 671,10}, \
+ { 1343,11}, { 703,10}, { 1407,11}, { 735,10}, \
+ { 1471, 9}, { 2943,12}, { 383,11}, { 767,10}, \
+ { 1535,11}, { 799,10}, { 1599,11}, { 831,10}, \
+ { 1663,11}, { 863,10}, { 1727,12}, { 447,11}, \
+ { 895,10}, { 1791,11}, { 959,10}, { 1919,13}, \
+ { 255,12}, { 511,11}, { 1023,10}, { 2111,11}, \
+ { 1087,10}, { 2175,12}, { 575,11}, { 1151,10}, \
+ { 2303,11}, { 1215,10}, { 2431,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1407,10}, { 2815,11}, \
+ { 1471,10}, { 2943,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1663,10}, { 3327,11}, \
+ { 1727,10}, { 3455,12}, { 895,11}, { 1855,12}, \
{ 959,11}, { 1919,10}, { 3839,14}, { 255,13}, \
- { 511,12}, { 1023,11}, { 2047,12}, { 1087,11}, \
- { 2175,10}, { 4351,11}, { 2239,12}, { 1151,11}, \
- { 2303,12}, { 1215,11}, { 2431,13}, { 639,12}, \
- { 1343,11}, { 2687,12}, { 1407,11}, { 2815,12}, \
- { 1471,11}, { 2943,13}, { 767,12}, { 1663,11}, \
- { 3327,12}, { 1727,13}, { 895,12}, { 1791,11}, \
- { 3583,12}, { 1919,11}, { 3839,12}, { 1983,11}, \
- { 3967,14}, { 511,13}, { 1023,12}, { 2239,13}, \
- { 1151,12}, { 2495,13}, { 1279,12}, { 2623,13}, \
+ { 511,12}, { 1023,11}, { 2111,12}, { 1087,11}, \
+ { 2239,12}, { 1151,11}, { 2303,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1343,11}, { 2687,12}, \
+ { 1407,11}, { 2815,12}, { 1471,11}, { 2943,13}, \
+ { 767,12}, { 1663,11}, { 3327,12}, { 1727,11}, \
+ { 3455,13}, { 895,12}, { 1919,11}, { 3839,12}, \
+ { 1983,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2495,13}, { 1279,12}, { 2687,13}, \
{ 1407,12}, { 2943,14}, { 767,13}, { 1535,12}, \
- { 3071,13}, { 1663,12}, { 3455,13}, { 1791,12}, \
+ { 3135,13}, { 1663,12}, { 3455,13}, { 1791,12}, \
{ 3583,13}, { 1919,12}, { 3967,15}, { 511,14}, \
{ 1023,13}, { 2047,12}, { 4095,13}, { 2175,12}, \
- { 4351,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
+ { 4479,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
{ 2559,12}, { 5119,13}, { 2943,12}, { 5887,14}, \
- { 1535,13}, { 3071,12}, { 6143,13}, { 3199,12}, \
- { 6399,13}, { 3327,12}, { 6655,11}, { 13311,12}, \
- { 6911,14}, { 1791,13}, { 3583,12}, { 7167,13}, \
- { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 247
+ { 1535,13}, { 3455,14}, { 1791,13}, { 3967,15}, \
+ { 1023,14}, { 2047,13}, { 4479,14}, { 2303,13}, \
+ { 4991,14}, { 2559,13}, { 5119,14}, { 2815,13}, \
+ { 5887,15}, { 32768,16} }
+#define MUL_FFT_TABLE3_SIZE 254
#define MUL_FFT_THRESHOLD 7552
-#define SQR_FFT_MODF_THRESHOLD 565 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 492 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 565, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
- { 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 23, 6}, { 47, 7}, { 27, 8}, \
+ { { 492, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 28, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
+ { 35, 7}, { 19, 6}, { 39, 7}, { 27, 8}, \
{ 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
{ 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
{ 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
{ 51, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95,10}, { 31, 9}, \
- { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
- { 63, 9}, { 143,10}, { 79, 9}, { 167,10}, \
- { 95, 9}, { 191,10}, { 111,11}, { 63,10}, \
- { 143, 9}, { 287, 8}, { 575,10}, { 159, 9}, \
- { 319,11}, { 95,10}, { 191, 9}, { 383, 8}, \
- { 767,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 543, 8}, { 1087,10}, { 287, 9}, { 575, 8}, \
- { 1151,11}, { 159,10}, { 319, 9}, { 639, 8}, \
- { 1279,10}, { 335, 9}, { 671, 8}, { 1343,10}, \
- { 351, 9}, { 703, 8}, { 1407,11}, { 191,10}, \
- { 383, 9}, { 767,10}, { 399, 9}, { 799, 8}, \
- { 1599,10}, { 415, 9}, { 831, 8}, { 1663, 9}, \
- { 863,11}, { 223,10}, { 447, 9}, { 895,12}, \
- { 127,11}, { 255,10}, { 543, 9}, { 1087,11}, \
- { 287,10}, { 575, 9}, { 1151,10}, { 607, 9}, \
- { 1215, 8}, { 2431,11}, { 319,10}, { 671, 9}, \
- { 1343,11}, { 351,10}, { 703, 9}, { 1407,10}, \
- { 735,12}, { 191,11}, { 383,10}, { 799, 9}, \
- { 1599,11}, { 415,10}, { 831, 9}, { 1663,10}, \
- { 863, 9}, { 1727,11}, { 447,13}, { 127,12}, \
- { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
- { 1087, 9}, { 2175,10}, { 1119,11}, { 575,10}, \
- { 1151,11}, { 607,10}, { 1215, 9}, { 2431,12}, \
+ { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 103,11}, \
+ { 31,10}, { 63, 9}, { 135, 8}, { 271, 9}, \
+ { 143,10}, { 79, 9}, { 167,10}, { 95, 9}, \
+ { 191, 8}, { 383,10}, { 111,11}, { 63,10}, \
+ { 127, 9}, { 255, 8}, { 511,10}, { 143, 9}, \
+ { 303,10}, { 159, 9}, { 319, 8}, { 639,11}, \
+ { 95,10}, { 191, 9}, { 383, 8}, { 767, 9}, \
+ { 399,10}, { 207,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543, 8}, \
+ { 1087,10}, { 287, 9}, { 575,10}, { 303,11}, \
+ { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
+ { 671, 8}, { 1343, 9}, { 703,11}, { 191,10}, \
+ { 383, 9}, { 767, 8}, { 1535,10}, { 399, 9}, \
+ { 799, 8}, { 1599, 9}, { 863,11}, { 223,10}, \
+ { 447,12}, { 127,11}, { 255,10}, { 511, 9}, \
+ { 1087,10}, { 575, 9}, { 1215,10}, { 639, 9}, \
+ { 1279,10}, { 671, 9}, { 1343,11}, { 351,10}, \
+ { 703, 9}, { 1407,10}, { 735, 9}, { 1471,12}, \
+ { 191,11}, { 383,10}, { 767, 9}, { 1535,10}, \
+ { 799, 9}, { 1599,11}, { 415,10}, { 831, 9}, \
+ { 1663,10}, { 863, 9}, { 1727, 8}, { 3455,11}, \
+ { 447,10}, { 895,13}, { 127,12}, { 255,11}, \
+ { 511,10}, { 1023, 9}, { 2047,11}, { 543,10}, \
+ { 1087, 9}, { 2175,11}, { 575,10}, { 1151, 9}, \
+ { 2303,11}, { 607,10}, { 1215, 9}, { 2431,12}, \
{ 319,11}, { 639,10}, { 1279,11}, { 671,10}, \
- { 1343, 9}, { 2687,11}, { 703,10}, { 1407,11}, \
+ { 1343,11}, { 703,10}, { 1407, 9}, { 2815,11}, \
{ 735,10}, { 1471, 9}, { 2943,12}, { 383,11}, \
- { 767,10}, { 1535,11}, { 799,10}, { 1599,11}, \
- { 831,10}, { 1663,11}, { 863,10}, { 1727,12}, \
- { 447,11}, { 895,10}, { 1791,11}, { 959,10}, \
- { 1919,11}, { 991,10}, { 1983,13}, { 255,12}, \
- { 511,11}, { 1023,10}, { 2111,11}, { 1087,12}, \
- { 575,11}, { 1151,10}, { 2303,11}, { 1215,10}, \
- { 2431,12}, { 639,11}, { 1343,10}, { 2687,12}, \
+ { 767,10}, { 1599,11}, { 831,10}, { 1663, 9}, \
+ { 3327,10}, { 1727,12}, { 447,11}, { 895,10}, \
+ { 1791,11}, { 959,10}, { 1919,13}, { 255,12}, \
+ { 511,11}, { 1023,10}, { 2111,11}, { 1087,10}, \
+ { 2175,12}, { 575,11}, { 1151,10}, { 2303,11}, \
+ { 1215,10}, { 2431,12}, { 639,11}, { 1343,12}, \
{ 703,11}, { 1407,10}, { 2815,11}, { 1471,10}, \
{ 2943,13}, { 383,12}, { 767,11}, { 1599,12}, \
{ 831,11}, { 1663,10}, { 3327,11}, { 1727,10}, \
- { 3455,12}, { 895,11}, { 1791,10}, { 3583,12}, \
- { 959,11}, { 1919,10}, { 3839,13}, { 511,12}, \
- { 1023,11}, { 2047,12}, { 1087,11}, { 2175,10}, \
- { 4351,11}, { 2239,12}, { 1151,11}, { 2303,12}, \
- { 1215,11}, { 2431,13}, { 639,12}, { 1343,11}, \
- { 2687,12}, { 1407,11}, { 2815,12}, { 1471,11}, \
- { 2943,13}, { 767,12}, { 1599,11}, { 3199,12}, \
- { 1663,11}, { 3327,12}, { 1727,11}, { 3455,13}, \
- { 895,12}, { 1791,11}, { 3583,12}, { 1919,11}, \
- { 3839,12}, { 1983,14}, { 511,13}, { 1023,12}, \
- { 2239,13}, { 1151,12}, { 2431,13}, { 1279,12}, \
- { 2687,13}, { 1407,12}, { 2943,14}, { 767,13}, \
- { 1535,12}, { 3071,13}, { 1663,12}, { 3455,13}, \
- { 1791,10}, { 14335,12}, { 3967,11}, { 7935,15}, \
- { 511,14}, { 1023,13}, { 2047,12}, { 4095,13}, \
- { 2175,12}, { 4351,13}, { 2431,14}, { 1279,13}, \
- { 2943,12}, { 5887,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 248
-#define SQR_FFT_THRESHOLD 5760
+ { 3455,12}, { 895,11}, { 1791,12}, { 959,11}, \
+ { 1919,10}, { 3839,14}, { 255,13}, { 511,12}, \
+ { 1023,11}, { 2111,12}, { 1087,11}, { 2239,12}, \
+ { 1151,11}, { 2303,12}, { 1215,11}, { 2431,13}, \
+ { 639,12}, { 1343,11}, { 2687,12}, { 1407,11}, \
+ { 2815,12}, { 1471,11}, { 2943,13}, { 767,12}, \
+ { 1599,11}, { 3199,12}, { 1663,11}, { 3327,12}, \
+ { 1727,11}, { 3455,13}, { 895,12}, { 1791,11}, \
+ { 3583,12}, { 1919,11}, { 3839,12}, { 1983,14}, \
+ { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
+ { 2431,13}, { 1279,12}, { 2687,13}, { 1407,12}, \
+ { 2943,14}, { 767,13}, { 1535,12}, { 3199,13}, \
+ { 1663,12}, { 3455,13}, { 1791,12}, { 3583,13}, \
+ { 1919,12}, { 3967,15}, { 511,14}, { 1023,13}, \
+ { 2047,12}, { 4095,13}, { 2175,12}, { 4351,13}, \
+ { 2431,14}, { 1279,13}, { 2943,12}, { 5887,14}, \
+ { 1535,13}, { 3455,14}, { 1791,13}, { 3967,15}, \
+ { 1023,14}, { 2047,13}, { 4351,14}, { 2303,13}, \
+ { 4991,14}, { 2559,13}, { 5119,14}, { 2815,13}, \
+ { 5887,15}, { 32768,16} }
+#define SQR_FFT_TABLE3_SIZE 258
+#define SQR_FFT_THRESHOLD 5504
#define MULLO_BASECASE_THRESHOLD 3
#define MULLO_DC_THRESHOLD 34
-#define MULLO_MUL_N_THRESHOLD 13463
+#define MULLO_MUL_N_THRESHOLD 14281
#define SQRLO_BASECASE_THRESHOLD 6
-#define SQRLO_DC_THRESHOLD 134
-#define SQRLO_SQR_THRESHOLD 11278
+#define SQRLO_DC_THRESHOLD 137
+#define SQRLO_SQR_THRESHOLD 10821
-#define DC_DIV_QR_THRESHOLD 47
+#define DC_DIV_QR_THRESHOLD 45
#define DC_DIVAPPR_Q_THRESHOLD 206
-#define DC_BDIV_QR_THRESHOLD 41
-#define DC_BDIV_Q_THRESHOLD 140
+#define DC_BDIV_QR_THRESHOLD 39
+#define DC_BDIV_Q_THRESHOLD 144
-#define INV_MULMOD_BNM1_THRESHOLD 66
-#define INV_NEWTON_THRESHOLD 189
-#define INV_APPR_THRESHOLD 195
+#define INV_MULMOD_BNM1_THRESHOLD 54
+#define INV_NEWTON_THRESHOLD 202
+#define INV_APPR_THRESHOLD 206
-#define BINV_NEWTON_THRESHOLD 220
-#define REDC_1_TO_REDC_N_THRESHOLD 59
+#define BINV_NEWTON_THRESHOLD 224
+#define REDC_1_TO_REDC_N_THRESHOLD 63
-#define MU_DIV_QR_THRESHOLD 1528
-#define MU_DIVAPPR_Q_THRESHOLD 1442
-#define MUPI_DIV_QR_THRESHOLD 79
-#define MU_BDIV_QR_THRESHOLD 1258
-#define MU_BDIV_Q_THRESHOLD 1442
+#define MU_DIV_QR_THRESHOLD 1442
+#define MU_DIVAPPR_Q_THRESHOLD 1387
+#define MUPI_DIV_QR_THRESHOLD 82
+#define MU_BDIV_QR_THRESHOLD 1308
+#define MU_BDIV_Q_THRESHOLD 1387
-#define POWM_SEC_TABLE 1,16,114,452,1221,2577
+#define POWM_SEC_TABLE 1,16,102,428,1221
-#define GET_STR_DC_THRESHOLD 15
-#define GET_STR_PRECOMPUTE_THRESHOLD 31
-#define SET_STR_DC_THRESHOLD 274
-#define SET_STR_PRECOMPUTE_THRESHOLD 1100
+#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_PRECOMPUTE_THRESHOLD 28
+#define SET_STR_DC_THRESHOLD 254
+#define SET_STR_PRECOMPUTE_THRESHOLD 890
-#define FAC_DSC_THRESHOLD 360
-#define FAC_ODD_THRESHOLD 24
+#define FAC_DSC_THRESHOLD 206
+#define FAC_ODD_THRESHOLD 29
-#define MATRIX22_STRASSEN_THRESHOLD 16
-#define HGCD_THRESHOLD 119
-#define HGCD_APPR_THRESHOLD 136
+#define MATRIX22_STRASSEN_THRESHOLD 17
+#define HGCD2_DIV1_METHOD 3 /* 3.84% faster than 4 */
+#define HGCD_THRESHOLD 123
+#define HGCD_APPR_THRESHOLD 151
#define HGCD_REDUCE_THRESHOLD 3389
-#define GCD_DC_THRESHOLD 443
+#define GCD_DC_THRESHOLD 435
#define GCDEXT_DC_THRESHOLD 318
-#define JACOBI_BASE_METHOD 1
+#define JACOBI_BASE_METHOD 4 /* 8.04% faster than 3 */
+
+/* Tuneup completed successfully, took 175382 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/k7/sublsh1_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/k7/sublsh1_n.asm
index 523b01218db..88516830096 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/k7/sublsh1_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/k7/sublsh1_n.asm
@@ -57,7 +57,7 @@ C processors. It uses 2*4-way unrolling, for good reasons.
C
C Breaking carry recurrency might be a good idea. We would then need separate
C registers for the shift carry and add/subtract carry, which in turn would
-C force is to 2*2-way unrolling.
+C force us to 2*2-way unrolling.
defframe(PARAM_SIZE, 12)
defframe(PARAM_SRC, 8)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/k8/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/k8/gmp-mparam.h
index 8d95fef80b7..fa71292489e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/k8/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/k8/gmp-mparam.h
@@ -32,167 +32,184 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BYTES 4
/* 2500 MHz K8 Brisbane */
-/* FFT tuning limit = 10000000 */
-/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-20, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1N_TO_MOD_1_1_THRESHOLD 11
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 12
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 16
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 21
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 2
+#define DIV_QR_1N_PI1_METHOD 1 /* 36.85% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 3
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 40
+#define BMOD_1_TO_MOD_1_THRESHOLD 44
-#define MUL_TOOM22_THRESHOLD 24
-#define MUL_TOOM33_THRESHOLD 81
-#define MUL_TOOM44_THRESHOLD 130
-#define MUL_TOOM6H_THRESHOLD 303
+#define DIV_1_VS_MUL_1_PERCENT 251
+
+#define MUL_TOOM22_THRESHOLD 26
+#define MUL_TOOM33_THRESHOLD 78
+#define MUL_TOOM44_THRESHOLD 136
+#define MUL_TOOM6H_THRESHOLD 270
#define MUL_TOOM8H_THRESHOLD 430
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 85
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 91
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 93
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 92
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 122
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 89
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 96
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 121
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 46
-#define SQR_TOOM3_THRESHOLD 78
+#define SQR_TOOM3_THRESHOLD 81
#define SQR_TOOM4_THRESHOLD 202
-#define SQR_TOOM6_THRESHOLD 286
-#define SQR_TOOM8_THRESHOLD 422
+#define SQR_TOOM6_THRESHOLD 300
+#define SQR_TOOM8_THRESHOLD 430
-#define MULMID_TOOM42_THRESHOLD 56
+#define MULMID_TOOM42_THRESHOLD 50
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 18
+#define MULMOD_BNM1_THRESHOLD 18
+#define SQRMOD_BNM1_THRESHOLD 22
-#define MUL_FFT_MODF_THRESHOLD 848 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 606 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 848, 5}, { 27, 6}, { 25, 7}, { 13, 6}, \
- { 27, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { { 606, 5}, { 27, 6}, { 15, 5}, { 31, 6}, \
+ { 25, 7}, { 13, 6}, { 29, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 23, 6}, { 47, 7}, { 35, 8}, \
{ 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
{ 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
{ 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
{ 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
{ 31, 9}, { 79,10}, { 47, 9}, { 103,11}, \
{ 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 167,10}, { 95, 9}, { 199,10}, { 111,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
- { 287,10}, { 159,11}, { 95,10}, { 207,12}, \
- { 63,11}, { 127,10}, { 271, 9}, { 543,10}, \
- { 287,11}, { 159,10}, { 319, 9}, { 639,10}, \
- { 335, 9}, { 671,11}, { 191,10}, { 383, 9}, \
- { 799,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543,11}, { 287,10}, { 607, 9}, { 1215,11}, \
- { 319,10}, { 671, 9}, { 1343,12}, { 191,11}, \
- { 383,10}, { 799, 9}, { 1599,11}, { 415,10}, \
- { 863, 9}, { 1727,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1119,11}, { 607,10}, { 1215,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
- { 1471, 9}, { 2943,12}, { 383,11}, { 799,10}, \
- { 1599,11}, { 863,10}, { 1727,12}, { 447,11}, \
- { 991,13}, { 255,12}, { 511,11}, { 1023,10}, \
- { 2111,11}, { 1119,12}, { 575,11}, { 1215,10}, \
- { 2431,12}, { 639,11}, { 1343,12}, { 703,11}, \
- { 1471,10}, { 2943,13}, { 383,12}, { 767,11}, \
- { 1599,12}, { 831,11}, { 1727,12}, { 959,11}, \
- { 1919,14}, { 255,13}, { 511,12}, { 1023,11}, \
- { 2047,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
- { 767,12}, { 1727,13}, { 895,12}, { 1983,14}, \
- { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
- { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 144
-#define MUL_FFT_THRESHOLD 7552
-
-#define SQR_FFT_MODF_THRESHOLD 618 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 618, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 51, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
{ 167,10}, { 95, 9}, { 191,10}, { 111,11}, \
{ 63,10}, { 159,11}, { 95,10}, { 191,12}, \
{ 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271, 9}, { 543, 8}, { 1087,10}, { 287,11}, \
- { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
- { 671, 8}, { 1343,10}, { 351,11}, { 191,10}, \
+ { 271, 9}, { 543,10}, { 287,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335, 9}, { 671,11}, \
+ { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
+ { 799,11}, { 223,12}, { 127,11}, { 255,10}, \
+ { 511, 9}, { 1023,10}, { 543,11}, { 287,10}, \
+ { 607,11}, { 319,10}, { 671,11}, { 351,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,13}, \
+ { 127,12}, { 255,11}, { 511,10}, { 1023,11}, \
+ { 543,10}, { 1087,11}, { 607,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,10}, { 1471,12}, \
+ { 383,11}, { 799,10}, { 1599,11}, { 863,12}, \
+ { 447,11}, { 927,13}, { 255,12}, { 511,11}, \
+ { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 831,11}, { 1727,12}, \
+ { 895,11}, { 1791,12}, { 959,14}, { 255,13}, \
+ { 511,12}, { 1087,11}, { 2239,12}, { 1215,13}, \
+ { 639,12}, { 1471,13}, { 767,12}, { 1727,13}, \
+ { 895,12}, { 1919,14}, { 511,13}, { 1023,12}, \
+ { 2239,13}, { 1151,12}, { 2431,13}, { 1279,12}, \
+ { 2623,13}, { 1407,12}, { 2943,14}, { 767,13}, \
+ { 1663,12}, { 3455,13}, { 1919,15}, { 511,14}, \
+ { 1023,13}, { 2175,12}, { 4351,13}, { 2431,14}, \
+ { 1279,13}, { 2943,14}, { 1535,13}, { 3455,14}, \
+ { 1791,13}, { 3967,15}, { 1023,14}, { 2047,13}, \
+ { 4351,14}, { 2303,13}, { 4991,14}, { 2815,15}, \
+ { 1535,14}, { 3839,16} }
+#define MUL_FFT_TABLE3_SIZE 158
+#define MUL_FFT_THRESHOLD 7296
+
+#define SQR_FFT_MODF_THRESHOLD 500 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 500, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 25, 7}, { 13, 6}, { 29, 7}, { 15, 6}, \
+ { 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 51, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95,10}, { 31, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 63, 9}, { 135,10}, \
+ { 79, 9}, { 159,10}, { 95, 9}, { 191,10}, \
+ { 111,11}, { 63,10}, { 127, 9}, { 255,10}, \
+ { 143, 9}, { 287, 8}, { 575,10}, { 159,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
+ { 287,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 335, 9}, { 671,10}, { 351,11}, { 191,10}, \
{ 383, 9}, { 767,10}, { 399, 9}, { 799,10}, \
{ 415,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
- { 1215,11}, { 319,10}, { 671, 9}, { 1343,11}, \
- { 351,12}, { 191,11}, { 383,10}, { 799, 9}, \
- { 1599,11}, { 415,10}, { 863, 9}, { 1727,13}, \
- { 127,12}, { 255,11}, { 543,10}, { 1087,11}, \
- { 607,10}, { 1215,12}, { 319,11}, { 671,10}, \
+ { 511, 9}, { 1023,10}, { 543,11}, { 287,10}, \
+ { 607, 9}, { 1215,11}, { 319,10}, { 671,11}, \
+ { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,10}, { 831,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
+ { 1087,11}, { 607,12}, { 319,11}, { 671,10}, \
{ 1343,11}, { 735,10}, { 1471,12}, { 383,11}, \
- { 799,10}, { 1599,11}, { 863,10}, { 1727,12}, \
- { 447,11}, { 959,10}, { 1919,11}, { 991,13}, \
- { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
- { 1215,10}, { 2431,12}, { 639,11}, { 1343,12}, \
- { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
- { 1599,12}, { 831,11}, { 1727,12}, { 959,11}, \
- { 1919,14}, { 255,13}, { 511,12}, { 1087,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 959,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,10}, { 2431,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 831,11}, { 1727,12}, \
+ { 959,14}, { 255,13}, { 511,12}, { 1087,11}, \
{ 2239,12}, { 1215,11}, { 2431,13}, { 639,12}, \
- { 1471,11}, { 2943,13}, { 767,12}, { 1727,11}, \
- { 3455,13}, { 895,12}, { 1983,14}, { 511,13}, \
- { 1023,12}, { 2239,13}, { 1151,12}, { 4096,13}, \
- { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 147
-#define SQR_FFT_THRESHOLD 5760
-
-#define MULLO_BASECASE_THRESHOLD 8
-#define MULLO_DC_THRESHOLD 31
+ { 1471,13}, { 767,12}, { 1727,13}, { 895,12}, \
+ { 1919,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2431,13}, { 1279,12}, { 2623,13}, \
+ { 1407,12}, { 2943,14}, { 767,13}, { 1663,12}, \
+ { 3455,13}, { 1919,15}, { 511,14}, { 1023,13}, \
+ { 2431,14}, { 1279,13}, { 2943,14}, { 1535,13}, \
+ { 3455,14}, { 1791,13}, { 3839,15}, { 1023,14}, \
+ { 2047,13}, { 4223,14}, { 2303,13}, { 4863,14}, \
+ { 2815,15}, { 1535,14}, { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 167
+#define SQR_FFT_THRESHOLD 5504
+
+#define MULLO_BASECASE_THRESHOLD 4
+#define MULLO_DC_THRESHOLD 29
#define MULLO_MUL_N_THRESHOLD 14281
+#define SQRLO_BASECASE_THRESHOLD 6
+#define SQRLO_DC_THRESHOLD 193
+#define SQRLO_SQR_THRESHOLD 10704
-#define DC_DIV_QR_THRESHOLD 91
-#define DC_DIVAPPR_Q_THRESHOLD 280
+#define DC_DIV_QR_THRESHOLD 84
+#define DC_DIVAPPR_Q_THRESHOLD 278
#define DC_BDIV_QR_THRESHOLD 87
-#define DC_BDIV_Q_THRESHOLD 222
+#define DC_BDIV_Q_THRESHOLD 216
-#define INV_MULMOD_BNM1_THRESHOLD 62
+#define INV_MULMOD_BNM1_THRESHOLD 50
#define INV_NEWTON_THRESHOLD 268
-#define INV_APPR_THRESHOLD 270
+#define INV_APPR_THRESHOLD 268
-#define BINV_NEWTON_THRESHOLD 260
-#define REDC_1_TO_REDC_N_THRESHOLD 79
+#define BINV_NEWTON_THRESHOLD 276
+#define REDC_1_TO_REDC_N_THRESHOLD 78
-#define MU_DIV_QR_THRESHOLD 1718
+#define MU_DIV_QR_THRESHOLD 1652
#define MU_DIVAPPR_Q_THRESHOLD 1528
-#define MUPI_DIV_QR_THRESHOLD 97
-#define MU_BDIV_QR_THRESHOLD 1470
-#define MU_BDIV_Q_THRESHOLD 1470
+#define MUPI_DIV_QR_THRESHOLD 114
+#define MU_BDIV_QR_THRESHOLD 1442
+#define MU_BDIV_Q_THRESHOLD 1466
+
+#define POWM_SEC_TABLE 1,22,102,452,1357
-#define POWM_SEC_TABLE 1,22,114,416,1464
+#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_PRECOMPUTE_THRESHOLD 24
+#define SET_STR_DC_THRESHOLD 270
+#define SET_STR_PRECOMPUTE_THRESHOLD 1149
+
+#define FAC_DSC_THRESHOLD 208
+#define FAC_ODD_THRESHOLD 48
#define MATRIX22_STRASSEN_THRESHOLD 16
-#define HGCD_THRESHOLD 149
-#define HGCD_APPR_THRESHOLD 204
-#define HGCD_REDUCE_THRESHOLD 4455
+#define HGCD2_DIV1_METHOD 3 /* 4.69% faster than 1 */
+#define HGCD_THRESHOLD 139
+#define HGCD_APPR_THRESHOLD 174
+#define HGCD_REDUCE_THRESHOLD 3389
#define GCD_DC_THRESHOLD 599
-#define GCDEXT_DC_THRESHOLD 403
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 270
-#define SET_STR_PRECOMPUTE_THRESHOLD 1367
+#define GCDEXT_DC_THRESHOLD 419
+#define JACOBI_BASE_METHOD 1 /* 1.57% faster than 4 */
-#define FAC_DSC_THRESHOLD 348
-#define FAC_ODD_THRESHOLD 24
+/* Tuneup completed successfully, took 83851 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/p6/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/p6/gcd_11.asm
index eafbf4a79db..80e055e2e81 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/p6/gcd_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/p6/gcd_11.asm
@@ -1,4 +1,4 @@
-dnl x86 mpn_gcd_1 optimised for processors with fast BSF.
+dnl x86 mpn_gcd_11 optimised for processors with fast BSF.
dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked by Torbjorn Granlund.
@@ -50,112 +50,34 @@ C Intel atom 17.1
C VIA nano ?
C Numbers measured with: speed -CD -s16-32 -t16 mpn_gcd_1
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 6)
-
-define(`up', `%edi')
-define(`n', `%esi')
+define(`u0', `%eax')
define(`v0', `%edx')
-
ASM_START()
TEXT
ALIGN(16)
-PROLOGUE(mpn_gcd_1)
+PROLOGUE(mpn_gcd_11)
push %edi
push %esi
- mov 12(%esp), up
- mov 16(%esp), n
- mov 20(%esp), v0
-
- mov (up), %eax C U low limb
- or v0, %eax
- bsf %eax, %eax C min(ctz(u0),ctz(v0))
-
- bsf v0, %ecx
- shr %cl, v0
-
- push %eax C preserve common twos over call
- push v0 C preserve v0 argument over call
-
- cmp $1, n
- jnz L(reduce_nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- mov (up), %ecx
- mov %ecx, %eax
- shr $BMOD_THRES_LOG2, %ecx
- cmp %ecx, v0
- ja L(reduced)
- jmp L(bmod)
-
-L(reduce_nby1):
- cmp $BMOD_1_TO_MOD_1_THRESHOLD, n
- jl L(bmod)
-ifdef(`PIC_WITH_EBX',`dnl
- push %ebx
- add $-4, %esp
- call L(movl_eip_to_ebx)
- add $_GLOBAL_OFFSET_TABLE_, %ebx
-')
- push v0 C param 3
- push n C param 2
- push up C param 1
- CALL( mpn_mod_1)
- jmp L(called)
-
-L(bmod):
-ifdef(`PIC_WITH_EBX',`dnl
- push %ebx
- add $-4, %esp
- call L(movl_eip_to_ebx)
- add $_GLOBAL_OFFSET_TABLE_, %ebx
-')
- push v0 C param 3
- push n C param 2
- push up C param 1
- CALL( mpn_modexact_1_odd)
-
-L(called):
-ifdef(`PIC_WITH_EBX',`dnl
- add $16, %esp C deallocate params
- pop %ebx
-',`
- add $12, %esp C deallocate params
-')
-L(reduced):
- pop %edx
-
- bsf %eax, %ecx
-C test %eax, %eax C FIXME: does this lower latency?
- jnz L(mid)
- jmp L(end)
+ mov 12(%esp), %eax
+ mov 16(%esp), %edx
+ jmp L(odd)
ALIGN(16) C K10 BD C2 NHM SBR
-L(top): cmovc( %esi, %eax) C if x-y < 0 0,3 0,3 0,6 0,5 0,5
- cmovc( %edi, %edx) C use x,y-x 0,3 0,3 2,8 1,7 1,7
-L(mid): shr %cl, %eax C 1,7 1,6 2,8 2,8 2,8
- mov %edx, %esi C 1 1 4 3 3
+L(top): cmovc( %esi, %eax) C u = |v - u| 0,3 0,3 0,6 0,5 0,5
+ cmovc( %edi, %edx) C v = min(u,v) 0,3 0,3 2,8 1,7 1,7
+ shr %cl, %eax C 1,7 1,6 2,8 2,8 2,8
+L(odd): mov %edx, %esi C 1 1 4 3 3
sub %eax, %esi C 2 2 5 4 4
bsf %esi, %ecx C 3 3 6 5 5
mov %eax, %edi C 2 2 3 3 4
sub %edx, %eax C 2 2 4 3 4
jnz L(top) C
-L(end): pop %ecx
- mov %edx, %eax
- shl %cl, %eax
-
+L(end): mov %edx, %eax
pop %esi
pop %edi
ret
-
-ifdef(`PIC_WITH_EBX',`dnl
-L(movl_eip_to_ebx):
- mov (%esp), %ebx
- ret
-')
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/p6/mmx/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/p6/mmx/gmp-mparam.h
index 35c3aadfc1f..ef290612c4a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/p6/mmx/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/p6/mmx/gmp-mparam.h
@@ -1,7 +1,6 @@
/* Intel P6/mmx gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2005, 2009, 2010 Free Software Foundation,
-Inc.
+Copyright 1991-2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -40,38 +39,49 @@ see https://www.gnu.org/licenses/. */
/* 800 MHz P6 model 8 */
+/* Generated by tuneup.c, 2017-02-03, gcc 4.8 */
-#define MOD_1_NORM_THRESHOLD 4
+#define MOD_1_1P_METHOD 2
+#define MOD_1_NORM_THRESHOLD 3
#define MOD_1_UNNORM_THRESHOLD 4
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 10
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 17
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 30
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 14
#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1
+#define DIV_QR_1_NORM_THRESHOLD 4
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 49
+#define BMOD_1_TO_MOD_1_THRESHOLD 62
+
+#define DIV_1_VS_MUL_1_PERCENT 168
#define MUL_TOOM22_THRESHOLD 22
#define MUL_TOOM33_THRESHOLD 73
-#define MUL_TOOM44_THRESHOLD 193
+#define MUL_TOOM44_THRESHOLD 195
#define MUL_TOOM6H_THRESHOLD 254
#define MUL_TOOM8H_THRESHOLD 381
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 122
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 73
#define MUL_TOOM42_TO_TOOM63_THRESHOLD 80
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 100
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 81
-#define SQR_TOOM4_THRESHOLD 142
-#define SQR_TOOM6_THRESHOLD 258
-#define SQR_TOOM8_THRESHOLD 399
+#define SQR_TOOM2_THRESHOLD 30 /* WRONG value, see comment above */
+#define SQR_TOOM3_THRESHOLD 83
+#define SQR_TOOM4_THRESHOLD 196
+#define SQR_TOOM6_THRESHOLD 214
+#define SQR_TOOM8_THRESHOLD 381
+
+#define MULMID_TOOM42_THRESHOLD 56
-#define MULMOD_BNM1_THRESHOLD 15
-#define SQRMOD_BNM1_THRESHOLD 18
+#define MULMOD_BNM1_THRESHOLD 16
+#define SQRMOD_BNM1_THRESHOLD 17
#define MUL_FFT_MODF_THRESHOLD 476 /* k = 5 */
#define MUL_FFT_TABLE3 \
@@ -164,35 +174,45 @@ see https://www.gnu.org/licenses/. */
#define SQR_FFT_TABLE3_SIZE 161
#define SQR_FFT_THRESHOLD 3712
-#define MULLO_BASECASE_THRESHOLD 8
-#define MULLO_DC_THRESHOLD 60
-#define MULLO_MUL_N_THRESHOLD 13765
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 62
+#define MULLO_MUL_N_THRESHOLD 13463
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 177
+#define SQRLO_SQR_THRESHOLD 8937
-#define DC_DIV_QR_THRESHOLD 83
-#define DC_DIVAPPR_Q_THRESHOLD 246
+#define DC_DIV_QR_THRESHOLD 80
+#define DC_DIVAPPR_Q_THRESHOLD 240
#define DC_BDIV_QR_THRESHOLD 76
-#define DC_BDIV_Q_THRESHOLD 175
+#define DC_BDIV_Q_THRESHOLD 166
#define INV_MULMOD_BNM1_THRESHOLD 42
-#define INV_NEWTON_THRESHOLD 268
+#define INV_NEWTON_THRESHOLD 262
#define INV_APPR_THRESHOLD 250
-#define BINV_NEWTON_THRESHOLD 276
-#define REDC_1_TO_REDC_N_THRESHOLD 74
+#define BINV_NEWTON_THRESHOLD 272
+#define REDC_1_TO_REDC_N_THRESHOLD 72
-#define MU_DIV_QR_THRESHOLD 1442
-#define MU_DIVAPPR_Q_THRESHOLD 1442
-#define MUPI_DIV_QR_THRESHOLD 132
+#define MU_DIV_QR_THRESHOLD 1499
+#define MU_DIVAPPR_Q_THRESHOLD 1470
+#define MUPI_DIV_QR_THRESHOLD 124
#define MU_BDIV_QR_THRESHOLD 1142
-#define MU_BDIV_Q_THRESHOLD 1334
-
-#define MATRIX22_STRASSEN_THRESHOLD 18
-#define HGCD_THRESHOLD 121
-#define GCD_DC_THRESHOLD 478
-#define GCDEXT_DC_THRESHOLD 361
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 26
-#define SET_STR_DC_THRESHOLD 272
-#define SET_STR_PRECOMPUTE_THRESHOLD 1074
+#define MU_BDIV_Q_THRESHOLD 1341
+
+#define POWM_SEC_TABLE 1,16,96,416,1259
+
+#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_PRECOMPUTE_THRESHOLD 27
+#define SET_STR_DC_THRESHOLD 270
+#define SET_STR_PRECOMPUTE_THRESHOLD 1084
+
+#define FAC_DSC_THRESHOLD 194
+#define FAC_ODD_THRESHOLD 25
+
+#define MATRIX22_STRASSEN_THRESHOLD 16
+#define HGCD_THRESHOLD 124
+#define HGCD_APPR_THRESHOLD 152
+#define HGCD_REDUCE_THRESHOLD 3014
+#define GCD_DC_THRESHOLD 474
+#define GCDEXT_DC_THRESHOLD 321
+#define JACOBI_BASE_METHOD 1
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/p6/sse2/submul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/p6/sse2/submul_1.asm
index 98a603ce93e..69d940da53c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/p6/sse2/submul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/p6/sse2/submul_1.asm
@@ -32,4 +32,4 @@ include(`../config.m4')
MULFUNC_PROLOGUE(mpn_submul_1)
-include_mpn(`x86/k6/aorsmul_1.asm')
+include_mpn(`x86/pentium4/sse2/submul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/pentium/mul_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/pentium/mul_basecase.asm
index 50e15d35672..e1d0f052623 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/pentium/mul_basecase.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/pentium/mul_basecase.asm
@@ -140,4 +140,3 @@ L(done):
ret
EPILOGUE()
-
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/gmp-mparam.h
index a94ae868b37..a047a51d3b7 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/gmp-mparam.h
@@ -1,7 +1,6 @@
/* Intel Pentium-4 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2005, 2007-2010, 2014 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -33,174 +32,182 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BYTES 4
/* 2600 MHz P4 Northwood */
-/* FFT tuning limit = 12500000 */
-/* Generated by tuneup.c, 2014-03-12, gcc 4.2 */
+/* FFT tuning limit = 23,700,309 */
+/* Generated by tuneup.c, 2019-11-09, gcc 8.2 */
-#define MOD_1_NORM_THRESHOLD 24
-#define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1_NORM_THRESHOLD 5
+#define MOD_1_UNNORM_THRESHOLD 14
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 13
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 2
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 7
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 2
-#define DIV_QR_1_NORM_THRESHOLD 19
+#define DIV_QR_1N_PI1_METHOD 2 /* 4.36% faster than 1 */
+#define DIV_QR_1_NORM_THRESHOLD 16
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 20
+#define BMOD_1_TO_MOD_1_THRESHOLD 21
-#define MUL_TOOM22_THRESHOLD 29
-#define MUL_TOOM33_THRESHOLD 113
-#define MUL_TOOM44_THRESHOLD 288
-#define MUL_TOOM6H_THRESHOLD 454
+#define DIV_1_VS_MUL_1_PERCENT 358
+
+#define MUL_TOOM22_THRESHOLD 26
+#define MUL_TOOM33_THRESHOLD 101
+#define MUL_TOOM44_THRESHOLD 284
+#define MUL_TOOM6H_THRESHOLD 406
#define MUL_TOOM8H_THRESHOLD 592
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 118
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 214
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 193
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 186
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 287
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 101
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 191
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 189
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 195
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 151
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 44
-#define SQR_TOOM3_THRESHOLD 173
-#define SQR_TOOM4_THRESHOLD 390
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 915
+#define SQR_TOOM2_THRESHOLD 51
+#define SQR_TOOM3_THRESHOLD 163
+#define SQR_TOOM4_THRESHOLD 254
+#define SQR_TOOM6_THRESHOLD 614
+#define SQR_TOOM8_THRESHOLD 842
-#define MULMID_TOOM42_THRESHOLD 66
+#define MULMID_TOOM42_THRESHOLD 58
#define MULMOD_BNM1_THRESHOLD 19
#define SQRMOD_BNM1_THRESHOLD 23
-#define MUL_FFT_MODF_THRESHOLD 1147 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 824 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 1147, 5}, { 36, 6}, { 19, 5}, { 39, 6}, \
- { 27, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 40, 7}, { 21, 6}, \
- { 43, 7}, { 23, 6}, { 49, 7}, { 27, 6}, \
- { 55, 7}, { 31, 6}, { 63, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 51, 8}, \
- { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
- { 39, 7}, { 79, 8}, { 43, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 71, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 63, 8}, { 127, 9}, { 79,10}, \
- { 47, 9}, { 111,11}, { 31,10}, { 63, 9}, \
- { 143,10}, { 79, 9}, { 159,10}, { 111,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 159, 9}, \
- { 319,11}, { 95,10}, { 207,12}, { 63,11}, \
- { 127,10}, { 287,11}, { 159,10}, { 335,11}, \
- { 191,10}, { 383,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 319,10}, { 671,11}, \
- { 351,12}, { 191,11}, { 383,10}, { 799,13}, \
- { 127,12}, { 255,11}, { 511,10}, { 1055, 9}, \
- { 2111,10}, { 1119, 9}, { 2239,11}, { 607,12}, \
- { 319,11}, { 671,10}, { 1407,11}, { 735,10}, \
- { 1471, 9}, { 2943,12}, { 383,11}, { 799,10}, \
- { 1599,11}, { 863,10}, { 1727, 9}, { 3455,12}, \
- { 447,11}, { 895,13}, { 255,12}, { 511,11}, \
- { 1055,10}, { 2111,11}, { 1119,10}, { 2239, 9}, \
- { 4479,12}, { 575,11}, { 1247,10}, { 2495, 9}, \
- { 4991,12}, { 639,11}, { 1471,10}, { 2943,13}, \
+ { { 824, 5}, { 29, 6}, { 15, 5}, { 33, 6}, \
+ { 17, 5}, { 36, 6}, { 19, 5}, { 39, 6}, \
+ { 29, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
+ { 36, 7}, { 19, 6}, { 39, 7}, { 21, 6}, \
+ { 43, 7}, { 23, 6}, { 48, 7}, { 29, 8}, \
+ { 15, 7}, { 37, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 7}, { 55, 8}, \
+ { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
+ { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
+ { 79, 9}, { 47, 8}, { 99, 9}, { 55,10}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 103,11}, \
+ { 31,10}, { 63, 9}, { 143,10}, { 79, 9}, \
+ { 167,10}, { 95, 9}, { 191,10}, { 111,11}, \
+ { 63,10}, { 127, 9}, { 255,10}, { 159,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 271,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 335,11}, { 191,10}, { 383, 9}, { 799,10}, \
+ { 415,11}, { 223,12}, { 127,11}, { 255,10}, \
+ { 527,11}, { 287,10}, { 607, 9}, { 1215,11}, \
+ { 319,10}, { 671,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,10}, { 863,13}, { 127,12}, \
+ { 255,11}, { 543,10}, { 1119, 9}, { 2239,11}, \
+ { 607,10}, { 1215,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,10}, { 1471, 9}, { 2943,12}, \
+ { 383,11}, { 799,10}, { 1599,11}, { 863,12}, \
+ { 447,11}, { 927,10}, { 1855,11}, { 959,13}, \
+ { 255,12}, { 511,11}, { 1119,12}, { 575,11}, \
+ { 1215,10}, { 2431,11}, { 1247,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1471,10}, { 2943,13}, \
{ 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
{ 1727,10}, { 3455,12}, { 895,14}, { 255,13}, \
- { 511,12}, { 1023,11}, { 2047,12}, { 1087,11}, \
- { 2239,10}, { 4479,12}, { 1215,11}, { 2495,10}, \
- { 4991,13}, { 639,12}, { 1471,11}, { 2943,10}, \
- { 5887,11}, { 3007,13}, { 767,12}, { 1727,11}, \
- { 3455,13}, { 895,12}, { 1791,11}, { 3711,12}, \
- { 1983,11}, { 3967,10}, { 7935,14}, { 511,13}, \
- { 1023,12}, { 2239,11}, { 4479,13}, { 1151,12}, \
- { 2495,11}, { 4991,13}, { 1279,12}, { 2623,13}, \
- { 1407,12}, { 2943,11}, { 5887,12}, { 3007,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 158
+ { 511,12}, { 1087,11}, { 2239,10}, { 4479,12}, \
+ { 1215,11}, { 2431,13}, { 639,12}, { 1343,11}, \
+ { 2687,12}, { 1471,11}, { 2943,13}, { 767,12}, \
+ { 1727,11}, { 3455,13}, { 895,12}, { 1983,14}, \
+ { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
+ { 2495,11}, { 4991,13}, { 1407,12}, { 2943,14}, \
+ { 767,13}, { 1535,12}, { 3135,13}, { 1663,12}, \
+ { 3455,13}, { 1919,12}, { 3967,15}, { 511,14}, \
+ { 1023,13}, { 2175,12}, { 4479,13}, { 2431,12}, \
+ { 4991,14}, { 1279,13}, { 2687,12}, { 5503,13}, \
+ { 8192,14}, { 16384,15}, { 32768,16} }
+#define MUL_FFT_TABLE3_SIZE 167
#define MUL_FFT_THRESHOLD 7808
-#define SQR_FFT_MODF_THRESHOLD 896 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 560 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 896, 5}, { 28, 6}, { 15, 5}, { 33, 6}, \
- { 17, 5}, { 35, 6}, { 19, 5}, { 39, 6}, \
- { 27, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 36, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 27, 6}, { 55, 7}, { 31, 6}, \
- { 63, 7}, { 37, 8}, { 19, 7}, { 43, 8}, \
- { 23, 7}, { 51, 8}, { 27, 7}, { 55, 8}, \
- { 31, 7}, { 63, 8}, { 39, 7}, { 79, 8}, \
- { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
- { 71, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
- { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
- { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
- { 127,10}, { 79, 9}, { 159,10}, { 95, 9}, \
- { 191,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543,11}, { 159,10}, { 319, 9}, { 639,11}, \
- { 191,10}, { 383, 9}, { 767,11}, { 223,12}, \
- { 127,11}, { 255,10}, { 511, 9}, { 1055,10}, \
- { 543,11}, { 287,10}, { 607,11}, { 319,12}, \
- { 191,11}, { 383,10}, { 767,13}, { 127,12}, \
- { 255,11}, { 511,10}, { 1055,11}, { 543,10}, \
- { 1119, 9}, { 2239,11}, { 607,12}, { 319,11}, \
- { 671,10}, { 1407,11}, { 735,10}, { 1471, 9}, \
- { 2943,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,10}, { 1727,12}, { 447,11}, { 991,13}, \
- { 255,12}, { 511,11}, { 1055,10}, { 2111,11}, \
- { 1119,10}, { 2239,12}, { 575,11}, { 1247,10}, \
- { 2495,12}, { 639,11}, { 1471,10}, { 2943,13}, \
- { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
- { 1727,10}, { 3455,12}, { 959,14}, { 255,13}, \
- { 511,12}, { 1023,11}, { 2111,12}, { 1087,11}, \
- { 2239,10}, { 4479,12}, { 1215,11}, { 2495,13}, \
- { 639,12}, { 1471,11}, { 2943,10}, { 5887,13}, \
- { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
- { 1791,11}, { 3711,12}, { 1983,11}, { 3967,10}, \
- { 7935,14}, { 511,13}, { 1023,12}, { 2239,11}, \
- { 4479,13}, { 1151,12}, { 2495,11}, { 4991,13}, \
- { 1279,12}, { 2623,13}, { 1407,12}, { 2943,11}, \
- { 5887,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 159
-#define SQR_FFT_THRESHOLD 7296
+ { { 560, 5}, { 33, 6}, { 17, 5}, { 35, 6}, \
+ { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
+ { 39, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 47, 8}, { 27, 7}, { 55, 8}, \
+ { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
+ { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
+ { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
+ { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
+ { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
+ { 159,10}, { 111,11}, { 63,10}, { 143, 9}, \
+ { 287,10}, { 159,11}, { 95,10}, { 191,12}, \
+ { 63,11}, { 127, 9}, { 511, 8}, { 1023, 9}, \
+ { 527,11}, { 159,10}, { 319, 9}, { 639,10}, \
+ { 351,11}, { 191,10}, { 431,11}, { 223,12}, \
+ { 127,11}, { 255,10}, { 543,11}, { 287,10}, \
+ { 607, 9}, { 1215,11}, { 319,10}, { 639,11}, \
+ { 351,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 415,10}, { 831,13}, { 127,12}, { 255,11}, \
+ { 543,10}, { 1119,11}, { 607,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 927,10}, { 1855,11}, { 991,13}, { 255,12}, \
+ { 511,11}, { 1055,10}, { 2111,11}, { 1087,12}, \
+ { 575,11}, { 1215,10}, { 2431,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1407,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 831,11}, { 1727,10}, \
+ { 3455,12}, { 895,11}, { 1855,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1087,11}, { 2239,12}, \
+ { 1215,11}, { 2431,13}, { 639,12}, { 1471,11}, \
+ { 2943,13}, { 767,12}, { 1727,11}, { 3455,13}, \
+ { 895,12}, { 1983,14}, { 511,13}, { 1023,12}, \
+ { 2239,13}, { 1151,12}, { 2495,11}, { 4991,13}, \
+ { 1279,12}, { 2623,13}, { 1407,12}, { 2943,14}, \
+ { 767,13}, { 1663,12}, { 3455,13}, { 1919,12}, \
+ { 3839,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,12}, { 4991,14}, { 1279,13}, \
+ { 2687,12}, { 5503,13}, { 8192,14}, { 16384,15}, \
+ { 32768,16} }
+#define SQR_FFT_TABLE3_SIZE 149
+#define SQR_FFT_THRESHOLD 4800
#define MULLO_BASECASE_THRESHOLD 12
-#define MULLO_DC_THRESHOLD 55
-#define MULLO_MUL_N_THRESHOLD 14709
+#define MULLO_DC_THRESHOLD 44
+#define MULLO_MUL_N_THRESHOLD 14281
+#define SQRLO_BASECASE_THRESHOLD 13
+#define SQRLO_DC_THRESHOLD 42
+#define SQRLO_SQR_THRESHOLD 9449
#define DC_DIV_QR_THRESHOLD 38
-#define DC_DIVAPPR_Q_THRESHOLD 77
-#define DC_BDIV_QR_THRESHOLD 51
-#define DC_BDIV_Q_THRESHOLD 85
-
-#define INV_MULMOD_BNM1_THRESHOLD 56
-#define INV_NEWTON_THRESHOLD 121
-#define INV_APPR_THRESHOLD 93
-
-#define BINV_NEWTON_THRESHOLD 366
-#define REDC_1_TO_REDC_N_THRESHOLD 64
-
-#define MU_DIV_QR_THRESHOLD 2350
-#define MU_DIVAPPR_Q_THRESHOLD 2172
-#define MUPI_DIV_QR_THRESHOLD 62
-#define MU_BDIV_QR_THRESHOLD 2172
-#define MU_BDIV_Q_THRESHOLD 2304
-
-#define POWM_SEC_TABLE 1,19,102,615,2111
-
-#define MATRIX22_STRASSEN_THRESHOLD 23
-#define HGCD_THRESHOLD 88
-#define HGCD_APPR_THRESHOLD 93
-#define HGCD_REDUCE_THRESHOLD 5010
-#define GCD_DC_THRESHOLD 379
-#define GCDEXT_DC_THRESHOLD 258
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 26
-#define SET_STR_DC_THRESHOLD 147
-#define SET_STR_PRECOMPUTE_THRESHOLD 894
-
-#define FAC_DSC_THRESHOLD 906
-#define FAC_ODD_THRESHOLD 28
+#define DC_DIVAPPR_Q_THRESHOLD 105
+#define DC_BDIV_QR_THRESHOLD 52
+#define DC_BDIV_Q_THRESHOLD 83
+
+#define INV_MULMOD_BNM1_THRESHOLD 50
+#define INV_NEWTON_THRESHOLD 158
+#define INV_APPR_THRESHOLD 118
+
+#define BINV_NEWTON_THRESHOLD 342
+#define REDC_1_TO_REDC_N_THRESHOLD 67
+
+#define MU_DIV_QR_THRESHOLD 2130
+#define MU_DIVAPPR_Q_THRESHOLD 1895
+#define MUPI_DIV_QR_THRESHOLD 60
+#define MU_BDIV_QR_THRESHOLD 1652
+#define MU_BDIV_Q_THRESHOLD 2089
+
+#define POWM_SEC_TABLE 1,22,96,446,723,1378
+
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 20
+#define SET_STR_DC_THRESHOLD 298
+#define SET_STR_PRECOMPUTE_THRESHOLD 960
+
+#define FAC_DSC_THRESHOLD 212
+#define FAC_ODD_THRESHOLD 71
+
+#define MATRIX22_STRASSEN_THRESHOLD 26
+#define HGCD2_DIV1_METHOD 3 /* 0.68% faster than 1 */
+#define HGCD_THRESHOLD 80
+#define HGCD_APPR_THRESHOLD 138
+#define HGCD_REDUCE_THRESHOLD 4455
+#define GCD_DC_THRESHOLD 365
+#define GCDEXT_DC_THRESHOLD 245
+#define JACOBI_BASE_METHOD 4 /* 23.41% faster than 1 */
+
+/* Tuneup completed successfully, took 63807 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/popcount.asm b/Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/popcount.asm
index 729f4aa7692..c7f442699d1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/popcount.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/pentium4/sse2/popcount.asm
@@ -1,6 +1,6 @@
dnl X86-32 and X86-64 mpn_popcount using SSE2.
-dnl Copyright 2006, 2007, 2011, 2015 Free Software Foundation, Inc.
+dnl Copyright 2006, 2007, 2011, 2015, 2020 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -120,12 +120,8 @@ LIMB32(`push %ebx ')
pxor %xmm3, %xmm3 C zero grand total count
LIMB64(`pxor zero, zero ')
-ifdef(`PIC',`
+
LEAL( cnsts, breg)
-',`
-LIMB32(`mov $cnsts, breg ')
-LIMB64(`movabs $cnsts, breg ')
-')
movdqa -48(breg), mm01010101
movdqa -32(breg), mm00110011
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/silvermont/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/silvermont/gmp-mparam.h
new file mode 100644
index 00000000000..e9f1d8fd76b
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/silvermont/gmp-mparam.h
@@ -0,0 +1,222 @@
+/* Intel Silvermont/32 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* 2400 MHz Intel Atom C2758 Silvermont/Rangeley */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-30, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 5
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 11
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 16
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 64.62% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 32
+
+#define DIV_1_VS_MUL_1_PERCENT 204
+
+#define MUL_TOOM22_THRESHOLD 26
+#define MUL_TOOM33_THRESHOLD 105
+#define MUL_TOOM44_THRESHOLD 236
+#define MUL_TOOM6H_THRESHOLD 351
+#define MUL_TOOM8H_THRESHOLD 502
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 105
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 163
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 137
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 174
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 215
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 36
+#define SQR_TOOM3_THRESHOLD 138
+#define SQR_TOOM4_THRESHOLD 360
+#define SQR_TOOM6_THRESHOLD 494
+#define SQR_TOOM8_THRESHOLD 620
+
+#define MULMID_TOOM42_THRESHOLD 58
+
+#define MULMOD_BNM1_THRESHOLD 15
+#define SQRMOD_BNM1_THRESHOLD 19
+
+#define MUL_FFT_MODF_THRESHOLD 460 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 460, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 12, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 21, 7}, { 11, 6}, { 25, 7}, { 13, 6}, \
+ { 27, 7}, { 15, 6}, { 31, 7}, { 17, 6}, \
+ { 35, 7}, { 19, 6}, { 39, 7}, { 21, 8}, \
+ { 11, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
+ { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
+ { 47, 8}, { 95,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95,11}, \
+ { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
+ { 287,10}, { 159,11}, { 95,10}, { 191,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543,10}, { 287, 9}, { 575,11}, \
+ { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
+ { 671,10}, { 351, 9}, { 703,11}, { 191,10}, \
+ { 383, 9}, { 767,10}, { 415, 9}, { 831,12}, \
+ { 127,11}, { 255,10}, { 543, 9}, { 1087,11}, \
+ { 287,10}, { 607, 9}, { 1215,11}, { 319,10}, \
+ { 671,11}, { 351,10}, { 735,12}, { 191,11}, \
+ { 383,10}, { 767,11}, { 415,10}, { 831,13}, \
+ { 127,12}, { 255,11}, { 543,10}, { 1087,11}, \
+ { 607,10}, { 1215,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,10}, { 1471,12}, { 383,11}, \
+ { 863,10}, { 1727,12}, { 447,11}, { 959,13}, \
+ { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
+ { 1215,10}, { 2431,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
+ { 1535,12}, { 831,11}, { 1727,10}, { 3455,12}, \
+ { 959,11}, { 1919,14}, { 255,13}, { 511,12}, \
+ { 1215,11}, { 2431,13}, { 639,12}, { 1471,11}, \
+ { 2943,13}, { 767,12}, { 1727,11}, { 3455,13}, \
+ { 895,12}, { 1919,14}, { 511,13}, { 1023,12}, \
+ { 2111,13}, { 1151,12}, { 2431,13}, { 1407,12}, \
+ { 2943,14}, { 767,13}, { 1663,12}, { 3455,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,12}, { 7935,15}, { 1023,14}, { 2047,13}, \
+ { 4479,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
+ { 2815,13}, { 5887,15}, { 1535,14}, { 3839,13}, \
+ { 7935,16} }
+#define MUL_FFT_TABLE3_SIZE 177
+#define MUL_FFT_THRESHOLD 4544
+
+#define SQR_FFT_MODF_THRESHOLD 400 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 400, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 12, 5}, { 25, 6}, { 13, 5}, { 28, 6}, \
+ { 21, 7}, { 11, 6}, { 25, 7}, { 13, 6}, \
+ { 28, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
+ { 35, 7}, { 19, 6}, { 39, 7}, { 21, 8}, \
+ { 11, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
+ { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
+ { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 63, 9}, { 127,10}, \
+ { 79, 9}, { 159,10}, { 95,11}, { 63,10}, \
+ { 127, 9}, { 255,10}, { 143, 9}, { 287, 8}, \
+ { 575,10}, { 159,11}, { 95,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,10}, { 287, 9}, { 575,11}, { 159,10}, \
+ { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
+ { 351, 9}, { 735,11}, { 191,10}, { 383, 9}, \
+ { 799,10}, { 415, 9}, { 831,11}, { 223,12}, \
+ { 127,11}, { 255,10}, { 543, 9}, { 1087,11}, \
+ { 287,10}, { 607, 9}, { 1215,11}, { 319,10}, \
+ { 671,11}, { 351,10}, { 735, 9}, { 1471,12}, \
+ { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
+ { 863,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 1087,11}, { 607,10}, { 1215,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,10}, { 1471,12}, \
+ { 383,11}, { 863,10}, { 1727,12}, { 447,11}, \
+ { 959,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,10}, { 2431,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
+ { 767,11}, { 1535,12}, { 831,11}, { 1727,12}, \
+ { 959,14}, { 255,13}, { 511,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
+ { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
+ { 1919,14}, { 511,13}, { 1023,12}, { 2111,13}, \
+ { 1151,12}, { 2431,13}, { 1407,12}, { 2943,14}, \
+ { 767,13}, { 1663,12}, { 3455,13}, { 1919,15}, \
+ { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
+ { 2431,14}, { 1279,13}, { 2943,12}, { 5887,14}, \
+ { 1535,13}, { 3455,14}, { 1791,13}, { 3967,15}, \
+ { 1023,14}, { 2047,13}, { 4479,14}, { 2303,13}, \
+ { 4991,12}, { 9983,14}, { 2815,13}, { 5887,15}, \
+ { 1535,14}, { 3839,13}, { 7679,16} }
+#define SQR_FFT_TABLE3_SIZE 175
+#define SQR_FFT_THRESHOLD 3712
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 56
+#define MULLO_MUL_N_THRESHOLD 8907
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 137
+#define SQRLO_SQR_THRESHOLD 7373
+
+#define DC_DIV_QR_THRESHOLD 76
+#define DC_DIVAPPR_Q_THRESHOLD 336
+#define DC_BDIV_QR_THRESHOLD 66
+#define DC_BDIV_Q_THRESHOLD 218
+
+#define INV_MULMOD_BNM1_THRESHOLD 50
+#define INV_NEWTON_THRESHOLD 345
+#define INV_APPR_THRESHOLD 342
+
+#define BINV_NEWTON_THRESHOLD 366
+#define REDC_1_TO_REDC_N_THRESHOLD 91
+
+#define MU_DIV_QR_THRESHOLD 1652
+#define MU_DIVAPPR_Q_THRESHOLD 1858
+#define MUPI_DIV_QR_THRESHOLD 171
+#define MU_BDIV_QR_THRESHOLD 1442
+#define MU_BDIV_Q_THRESHOLD 1830
+
+#define POWM_SEC_TABLE 3,17,102,404,1185
+
+#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_PRECOMPUTE_THRESHOLD 21
+#define SET_STR_DC_THRESHOLD 272
+#define SET_STR_PRECOMPUTE_THRESHOLD 788
+
+#define FAC_DSC_THRESHOLD 132
+#define FAC_ODD_THRESHOLD 34
+
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD2_DIV1_METHOD 1 /* 0.59% faster than 3 */
+#define HGCD_THRESHOLD 142
+#define HGCD_APPR_THRESHOLD 181
+#define HGCD_REDUCE_THRESHOLD 2681
+#define GCD_DC_THRESHOLD 492
+#define GCDEXT_DC_THRESHOLD 365
+#define JACOBI_BASE_METHOD 1 /* 0.41% faster than 2 */
+
+/* Tuneup completed successfully, took 147027 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/skylake/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/skylake/gmp-mparam.h
new file mode 100644
index 00000000000..fb87957609c
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/skylake/gmp-mparam.h
@@ -0,0 +1,211 @@
+/* x86/skylake gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* 3600-4000 MHz Intel Xeon E3-1270v5 Skylake */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-21, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 15
+#define MOD_1_UNNORM_THRESHOLD 16
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 10
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 8
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 10
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 5.63% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 12
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 17
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 18
+
+#define DIV_1_VS_MUL_1_PERCENT 348
+
+#define MUL_TOOM22_THRESHOLD 24
+#define MUL_TOOM33_THRESHOLD 81
+#define MUL_TOOM44_THRESHOLD 208
+#define MUL_TOOM6H_THRESHOLD 303
+#define MUL_TOOM8H_THRESHOLD 454
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 149
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 137
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 145
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 196
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 40
+#define SQR_TOOM3_THRESHOLD 129
+#define SQR_TOOM4_THRESHOLD 220
+#define SQR_TOOM6_THRESHOLD 354
+#define SQR_TOOM8_THRESHOLD 608
+
+#define MULMID_TOOM42_THRESHOLD 72
+
+#define MULMOD_BNM1_THRESHOLD 17
+#define SQRMOD_BNM1_THRESHOLD 21
+
+#define MUL_FFT_MODF_THRESHOLD 530 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 530, 5}, { 29, 6}, { 15, 5}, { 31, 6}, \
+ { 29, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
+ { 36, 7}, { 19, 6}, { 39, 7}, { 21, 6}, \
+ { 43, 7}, { 23, 6}, { 47, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 43, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 7}, { 55, 9}, \
+ { 15, 8}, { 31, 7}, { 63, 8}, { 43, 9}, \
+ { 23, 8}, { 51, 9}, { 31, 8}, { 67, 9}, \
+ { 39, 8}, { 83, 9}, { 47, 8}, { 95, 9}, \
+ { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 63, 9}, { 135,10}, \
+ { 79, 9}, { 159,10}, { 95, 9}, { 191,10}, \
+ { 111,11}, { 63,10}, { 143, 9}, { 287,10}, \
+ { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543,10}, { 287,11}, { 159,10}, { 351,11}, \
+ { 191,10}, { 415,12}, { 127,11}, { 255,10}, \
+ { 543,11}, { 287,10}, { 607,11}, { 319,10}, \
+ { 671,11}, { 351,12}, { 191,11}, { 383,10}, \
+ { 799,11}, { 415,13}, { 127,12}, { 255,11}, \
+ { 543,10}, { 1087,11}, { 607,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 959,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
+ { 703,13}, { 383,12}, { 767,11}, { 1599,12}, \
+ { 831,11}, { 1727,12}, { 959,14}, { 255,13}, \
+ { 511,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1471,13}, { 767,12}, \
+ { 1727,13}, { 895,12}, { 1919,14}, { 511,13}, \
+ { 1023,12}, { 2239,13}, { 1151,12}, { 2431,13}, \
+ { 1279,12}, { 2623,13}, { 1407,12}, { 2815,14}, \
+ { 767,13}, { 1663,12}, { 3455,13}, { 1919,15}, \
+ { 511,14}, { 1023,13}, { 2175,12}, { 4479,13}, \
+ { 2431,14}, { 1279,13}, { 2943,12}, { 5887,14}, \
+ { 1535,13}, { 3455,14}, { 1791,13}, { 3967,15}, \
+ { 1023,14}, { 2047,13}, { 4479,14}, { 2303,13}, \
+ { 4991,12}, { 9983,14}, { 2815,13}, { 5887,15}, \
+ { 1535,14}, { 3839,16} }
+#define MUL_FFT_TABLE3_SIZE 154
+#define MUL_FFT_THRESHOLD 6784
+
+#define SQR_FFT_MODF_THRESHOLD 460 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 460, 5}, { 29, 6}, { 15, 5}, { 31, 6}, \
+ { 29, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
+ { 36, 7}, { 19, 6}, { 39, 7}, { 29, 8}, \
+ { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
+ { 23, 7}, { 49, 8}, { 27, 7}, { 55, 9}, \
+ { 15, 8}, { 31, 7}, { 63, 8}, { 43, 9}, \
+ { 23, 8}, { 55,10}, { 15, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
+ { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
+ { 135,10}, { 79, 9}, { 159,10}, { 95,11}, \
+ { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
+ { 287,10}, { 159,11}, { 95,12}, { 63,11}, \
+ { 127,10}, { 271, 9}, { 543,10}, { 287,11}, \
+ { 159,10}, { 319, 9}, { 639,10}, { 351,11}, \
+ { 191,10}, { 415,12}, { 127,11}, { 255,10}, \
+ { 543,11}, { 287,10}, { 575,11}, { 319,10}, \
+ { 671,11}, { 351,10}, { 703,12}, { 191,11}, \
+ { 383,10}, { 799,11}, { 415,10}, { 831,13}, \
+ { 127,12}, { 255,11}, { 511,10}, { 1023,11}, \
+ { 543,10}, { 1087,11}, { 607,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 927,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1407,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,12}, { 895,11}, \
+ { 1791,14}, { 255,13}, { 511,12}, { 1087,11}, \
+ { 2239,12}, { 1215,13}, { 639,12}, { 1471,13}, \
+ { 767,12}, { 1727,13}, { 895,12}, { 1919,14}, \
+ { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
+ { 2431,13}, { 1279,12}, { 2623,13}, { 1407,12}, \
+ { 2815,14}, { 767,13}, { 1663,12}, { 3455,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
+ { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3967,15}, { 1023,14}, { 2047,13}, { 4479,14}, \
+ { 2303,13}, { 4991,12}, { 9983,14}, { 2815,13}, \
+ { 5887,15}, { 1535,14}, { 3839,16} }
+#define SQR_FFT_TABLE3_SIZE 155
+#define SQR_FFT_THRESHOLD 5568
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 68
+#define MULLO_MUL_N_THRESHOLD 13555
+#define SQRLO_BASECASE_THRESHOLD 0 /* always */
+#define SQRLO_DC_THRESHOLD 117
+#define SQRLO_SQR_THRESHOLD 10988
+
+#define DC_DIV_QR_THRESHOLD 42
+#define DC_DIVAPPR_Q_THRESHOLD 163
+#define DC_BDIV_QR_THRESHOLD 66
+#define DC_BDIV_Q_THRESHOLD 160
+
+#define INV_MULMOD_BNM1_THRESHOLD 46
+#define INV_NEWTON_THRESHOLD 165
+#define INV_APPR_THRESHOLD 157
+
+#define BINV_NEWTON_THRESHOLD 300
+#define REDC_1_TO_REDC_N_THRESHOLD 68
+
+#define MU_DIV_QR_THRESHOLD 1718
+#define MU_DIVAPPR_Q_THRESHOLD 1685
+#define MUPI_DIV_QR_THRESHOLD 62
+#define MU_BDIV_QR_THRESHOLD 1589
+#define MU_BDIV_Q_THRESHOLD 1830
+
+#define POWM_SEC_TABLE 1,17,129,547,1317
+
+#define GET_STR_DC_THRESHOLD 10
+#define GET_STR_PRECOMPUTE_THRESHOLD 16
+#define SET_STR_DC_THRESHOLD 354
+#define SET_STR_PRECOMPUTE_THRESHOLD 860
+
+#define FAC_DSC_THRESHOLD 141
+#define FAC_ODD_THRESHOLD 34
+
+#define MATRIX22_STRASSEN_THRESHOLD 20
+#define HGCD2_DIV1_METHOD 5 /* 1.04% faster than 3 */
+#define HGCD_THRESHOLD 114
+#define HGCD_APPR_THRESHOLD 132
+#define HGCD_REDUCE_THRESHOLD 3524
+#define GCD_DC_THRESHOLD 474
+#define GCDEXT_DC_THRESHOLD 379
+#define JACOBI_BASE_METHOD 1 /* 27.39% faster than 4 */
+
+/* Tuneup completed successfully, took 31721 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/x86-defs.m4 b/Build/source/libs/gmp/gmp-src/mpn/x86/x86-defs.m4
index 56dfa03e681..81309b22427 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/x86-defs.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/x86-defs.m4
@@ -78,7 +78,7 @@ define(CPUVEC_FUNCS_LIST,
`copyi',
`divexact_1',
`divrem_1',
-`gcd_1',
+`gcd_11',
`lshift',
`lshiftc',
`mod_1',
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/zn1/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/zn1/gmp-mparam.h
new file mode 100644
index 00000000000..8e6c0523d19
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/zn1/gmp-mparam.h
@@ -0,0 +1,220 @@
+/* AMD zn1/32 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* 3700-4300 MHz Pinnacle Ridge */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-21, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 3
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 14.00% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 4
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 22
+
+#define DIV_1_VS_MUL_1_PERCENT 248
+
+#define MUL_TOOM22_THRESHOLD 28
+#define MUL_TOOM33_THRESHOLD 91
+#define MUL_TOOM44_THRESHOLD 137
+#define MUL_TOOM6H_THRESHOLD 222
+#define MUL_TOOM8H_THRESHOLD 454
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 85
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 103
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 88
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 105
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 130
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 63
+#define SQR_TOOM3_THRESHOLD 98
+#define SQR_TOOM4_THRESHOLD 172
+#define SQR_TOOM6_THRESHOLD 286
+#define SQR_TOOM8_THRESHOLD 478
+
+#define MULMID_TOOM42_THRESHOLD 64
+
+#define MULMOD_BNM1_THRESHOLD 21
+#define SQRMOD_BNM1_THRESHOLD 17
+
+#define MUL_FFT_MODF_THRESHOLD 606 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 606, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 15, 5}, { 31, 6}, { 27, 7}, { 15, 6}, \
+ { 33, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
+ { 43, 9}, { 23, 8}, { 51, 9}, { 31, 8}, \
+ { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
+ { 95,10}, { 31, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 63, 9}, { 127,10}, \
+ { 79, 9}, { 159,10}, { 95,11}, { 63,10}, \
+ { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
+ { 543, 8}, { 1087,11}, { 159,10}, { 319, 9}, \
+ { 639,10}, { 335, 9}, { 671,11}, { 191,10}, \
+ { 383, 9}, { 767,10}, { 399,11}, { 223,12}, \
+ { 127,11}, { 255,10}, { 543, 9}, { 1087,11}, \
+ { 287,10}, { 607, 9}, { 1215,11}, { 319,10}, \
+ { 671, 9}, { 1343,11}, { 351,12}, { 191,11}, \
+ { 383,10}, { 799,11}, { 415,13}, { 127,12}, \
+ { 255,11}, { 543,10}, { 1087,11}, { 607,10}, \
+ { 1215,12}, { 319,11}, { 671,10}, { 1343,11}, \
+ { 735,10}, { 1471,12}, { 383,11}, { 799,10}, \
+ { 1599,11}, { 863,10}, { 1727,12}, { 447,11}, \
+ { 959,10}, { 1919,11}, { 991,13}, { 255,12}, \
+ { 511,11}, { 1087,12}, { 575,11}, { 1215,10}, \
+ { 2431,12}, { 639,11}, { 1343,12}, { 703,11}, \
+ { 1471,10}, { 2943,13}, { 383,12}, { 767,11}, \
+ { 1599,12}, { 831,11}, { 1727,10}, { 3455,12}, \
+ { 959,11}, { 1919,14}, { 255,13}, { 511,12}, \
+ { 1087,11}, { 2239,12}, { 1215,11}, { 2431,13}, \
+ { 639,12}, { 1471,11}, { 2943,13}, { 767,12}, \
+ { 1727,11}, { 3455,13}, { 895,12}, { 1983,14}, \
+ { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
+ { 2495,13}, { 1279,12}, { 2623,13}, { 1407,12}, \
+ { 2943,14}, { 767,13}, { 1663,12}, { 3455,13}, \
+ { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
+ { 2175,12}, { 4479,13}, { 2431,14}, { 1279,13}, \
+ { 2943,12}, { 5887,14}, { 1535,13}, { 3455,14}, \
+ { 1791,13}, { 3967,12}, { 7935,11}, { 15871,15}, \
+ { 1023,14}, { 2047,13}, { 4479,14}, { 2303,13}, \
+ { 4991,12}, { 9983,14}, { 2815,13}, { 5887,15}, \
+ { 1535,14}, { 3839,13}, { 7935,12}, { 15871,16} }
+#define MUL_FFT_TABLE3_SIZE 172
+#define MUL_FFT_THRESHOLD 5760
+
+#define SQR_FFT_MODF_THRESHOLD 464 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 464, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 25, 7}, { 13, 6}, { 28, 7}, { 15, 6}, \
+ { 31, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 39, 9}, { 23, 8}, \
+ { 51,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
+ { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
+ { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 63, 9}, { 135,10}, \
+ { 79, 9}, { 159,10}, { 95,11}, { 63,10}, \
+ { 127, 9}, { 255,10}, { 143, 9}, { 287,10}, \
+ { 159,11}, { 95,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
+ { 287, 9}, { 575,11}, { 159, 9}, { 639,10}, \
+ { 335, 9}, { 671,10}, { 351, 9}, { 703,11}, \
+ { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
+ { 799,10}, { 415,12}, { 127,11}, { 255,10}, \
+ { 543,11}, { 287,10}, { 607,11}, { 319,10}, \
+ { 671,11}, { 351,10}, { 703,12}, { 191,11}, \
+ { 383,10}, { 799,11}, { 415,10}, { 831,13}, \
+ { 127,12}, { 255,11}, { 543,10}, { 1087,11}, \
+ { 607,10}, { 1215,12}, { 319,11}, { 671,10}, \
+ { 1343,11}, { 735,10}, { 1471,12}, { 383,11}, \
+ { 799,10}, { 1599,11}, { 863,12}, { 447,11}, \
+ { 959,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,10}, { 2431,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 831,11}, { 1727,10}, \
+ { 3455,12}, { 959,11}, { 1919,14}, { 255,13}, \
+ { 511,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
+ { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
+ { 1919,14}, { 511,13}, { 1023,12}, { 2239,13}, \
+ { 1151,12}, { 2431,13}, { 1279,12}, { 2623,13}, \
+ { 1407,12}, { 2943,14}, { 767,13}, { 1663,12}, \
+ { 3455,13}, { 1919,12}, { 3839,15}, { 511,14}, \
+ { 1023,13}, { 2175,12}, { 4479,13}, { 2431,14}, \
+ { 1279,13}, { 2943,12}, { 5887,14}, { 1535,13}, \
+ { 3455,14}, { 1791,13}, { 3839,12}, { 7679,13}, \
+ { 3967,12}, { 7935,15}, { 1023,14}, { 2047,13}, \
+ { 4479,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
+ { 2815,13}, { 5887,15}, { 1535,14}, { 3839,13}, \
+ { 7935,16} }
+#define SQR_FFT_TABLE3_SIZE 173
+#define SQR_FFT_THRESHOLD 4736
+
+#define MULLO_BASECASE_THRESHOLD 3
+#define MULLO_DC_THRESHOLD 60
+#define MULLO_MUL_N_THRESHOLD 11278
+#define SQRLO_BASECASE_THRESHOLD 8
+#define SQRLO_DC_THRESHOLD 161
+#define SQRLO_SQR_THRESHOLD 9335
+
+#define DC_DIV_QR_THRESHOLD 71
+#define DC_DIVAPPR_Q_THRESHOLD 206
+#define DC_BDIV_QR_THRESHOLD 63
+#define DC_BDIV_Q_THRESHOLD 126
+
+#define INV_MULMOD_BNM1_THRESHOLD 78
+#define INV_NEWTON_THRESHOLD 274
+#define INV_APPR_THRESHOLD 228
+
+#define BINV_NEWTON_THRESHOLD 274
+#define REDC_1_TO_REDC_N_THRESHOLD 71
+
+#define MU_DIV_QR_THRESHOLD 1652
+#define MU_DIVAPPR_Q_THRESHOLD 1718
+#define MUPI_DIV_QR_THRESHOLD 122
+#define MU_BDIV_QR_THRESHOLD 1470
+#define MU_BDIV_Q_THRESHOLD 1589
+
+#define POWM_SEC_TABLE 3,28,54,386,1337
+
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 19
+#define SET_STR_DC_THRESHOLD 262
+#define SET_STR_PRECOMPUTE_THRESHOLD 558
+
+#define FAC_DSC_THRESHOLD 109
+#define FAC_ODD_THRESHOLD 39
+
+#define MATRIX22_STRASSEN_THRESHOLD 21
+#define HGCD2_DIV1_METHOD 1 /* 7.49% faster than 3 */
+#define HGCD_THRESHOLD 74
+#define HGCD_APPR_THRESHOLD 70
+#define HGCD_REDUCE_THRESHOLD 3389
+#define GCD_DC_THRESHOLD 440
+#define GCDEXT_DC_THRESHOLD 327
+#define JACOBI_BASE_METHOD 1 /* 11.98% faster than 3 */
+
+/* Tuneup completed successfully, took 36916 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/zn2/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86/zn2/gmp-mparam.h
new file mode 100644
index 00000000000..152e6b7d2dc
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86/zn2/gmp-mparam.h
@@ -0,0 +1,226 @@
+/* AMD zn2/32 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 32
+#define GMP_LIMB_BYTES 4
+
+/* 3600-4400 MHz Matisse */
+/* FFT tuning limit = 67,000,000 */
+/* Generated by tuneup.c, 2019-10-23, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 15
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1N_PI1_METHOD 1 /* 4.78% faster than 2 */
+#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 7
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 23
+
+#define DIV_1_VS_MUL_1_PERCENT 274
+
+#define MUL_TOOM22_THRESHOLD 24
+#define MUL_TOOM33_THRESHOLD 85
+#define MUL_TOOM44_THRESHOLD 166
+#define MUL_TOOM6H_THRESHOLD 290
+#define MUL_TOOM8H_THRESHOLD 430
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 114
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 97
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 130
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 26
+#define SQR_TOOM3_THRESHOLD 153
+#define SQR_TOOM4_THRESHOLD 214
+#define SQR_TOOM6_THRESHOLD 318
+#define SQR_TOOM8_THRESHOLD 478
+
+#define MULMID_TOOM42_THRESHOLD 48
+
+#define MULMOD_BNM1_THRESHOLD 18
+#define SQRMOD_BNM1_THRESHOLD 24
+
+#define MUL_FFT_MODF_THRESHOLD 444 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 444, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 12, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
+ { 31, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
+ { 39, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
+ { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
+ { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
+ { 47,10}, { 31, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 63, 9}, { 127,10}, \
+ { 79, 9}, { 159,10}, { 95,11}, { 63,10}, \
+ { 127, 9}, { 255, 8}, { 511,10}, { 143, 9}, \
+ { 287, 8}, { 575,10}, { 159,11}, { 95,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543,10}, { 287, 9}, { 575,11}, \
+ { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
+ { 671, 8}, { 1343,10}, { 351, 9}, { 703,10}, \
+ { 367, 9}, { 735,11}, { 191,10}, { 383, 9}, \
+ { 767,10}, { 415,11}, { 223,10}, { 447,12}, \
+ { 127,11}, { 255,10}, { 543, 9}, { 1087,11}, \
+ { 287,10}, { 607,11}, { 319,10}, { 671, 9}, \
+ { 1343,11}, { 351,10}, { 735,12}, { 191,11}, \
+ { 383,10}, { 767,11}, { 415,10}, { 831,11}, \
+ { 447,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 1087,11}, { 607,10}, { 1215,12}, { 319,11}, \
+ { 671,10}, { 1343,11}, { 735,10}, { 1471, 9}, \
+ { 2943,12}, { 383,11}, { 799,10}, { 1599,11}, \
+ { 863,12}, { 447,11}, { 959,10}, { 1919,13}, \
+ { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
+ { 1215,10}, { 2431,12}, { 639,11}, { 1343,12}, \
+ { 703,11}, { 1471,10}, { 2943,13}, { 383,12}, \
+ { 767,11}, { 1599,12}, { 831,11}, { 1727,10}, \
+ { 3455,12}, { 959,11}, { 1919,10}, { 3839,14}, \
+ { 255,13}, { 511,12}, { 1215,11}, { 2431,13}, \
+ { 639,12}, { 1471,11}, { 2943,10}, { 5887,13}, \
+ { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
+ { 1919,11}, { 3839,14}, { 511,13}, { 1023,12}, \
+ { 2111,13}, { 1151,12}, { 2431,13}, { 1407,12}, \
+ { 2943,11}, { 5887,14}, { 767,13}, { 1663,12}, \
+ { 3455,13}, { 1919,12}, { 3839,15}, { 511,14}, \
+ { 1023,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
+ { 5887,14}, { 1535,13}, { 3455,14}, { 1791,13}, \
+ { 3839,12}, { 7679,13}, { 3967,12}, { 7935,11}, \
+ { 15871,15}, { 1023,14}, { 2047,13}, { 4351,14}, \
+ { 2303,13}, { 4991,12}, { 9983,14}, { 2815,13}, \
+ { 5887,15}, { 1535,14}, { 3839,13}, { 7935,12}, \
+ { 15871,16} }
+#define MUL_FFT_TABLE3_SIZE 189
+#define MUL_FFT_THRESHOLD 4736
+
+#define SQR_FFT_MODF_THRESHOLD 404 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 404, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 12, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
+ { 31, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
+ { 47, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
+ { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
+ { 27, 9}, { 15, 8}, { 39, 9}, { 23, 8}, \
+ { 47,10}, { 15, 9}, { 31, 8}, { 63, 9}, \
+ { 39, 8}, { 79, 9}, { 47,10}, { 31, 9}, \
+ { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
+ { 127,10}, { 95,11}, { 63,10}, { 127, 9}, \
+ { 255, 8}, { 511, 9}, { 271,10}, { 143, 9}, \
+ { 287, 8}, { 607, 7}, { 1215,11}, { 95,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543, 8}, { 1087, 9}, { 607, 8}, \
+ { 1215,11}, { 159, 9}, { 671, 8}, { 1343,10}, \
+ { 351, 9}, { 735, 8}, { 1471,11}, { 191,10}, \
+ { 383, 9}, { 767,10}, { 415,11}, { 223,12}, \
+ { 127,11}, { 255,10}, { 543, 9}, { 1087,10}, \
+ { 607, 9}, { 1215, 8}, { 2431,10}, { 671, 9}, \
+ { 1343,10}, { 735, 9}, { 1471,12}, { 191,11}, \
+ { 383,10}, { 767,11}, { 415,10}, { 831,13}, \
+ { 127,12}, { 255,11}, { 543,10}, { 1087,11}, \
+ { 607,10}, { 1215, 9}, { 2431,11}, { 671,10}, \
+ { 1343,11}, { 735,10}, { 1471, 9}, { 2943,12}, \
+ { 383,11}, { 863,12}, { 447,11}, { 959,10}, \
+ { 1919,13}, { 255,12}, { 511,11}, { 1087,12}, \
+ { 575,11}, { 1215,10}, { 2431,12}, { 639,11}, \
+ { 1343,12}, { 703,11}, { 1471,10}, { 2943, 9}, \
+ { 5887,12}, { 767,11}, { 1599,12}, { 831,11}, \
+ { 1727,12}, { 959,11}, { 1919,10}, { 3839,14}, \
+ { 255,13}, { 511,12}, { 1215,11}, { 2431,13}, \
+ { 639,12}, { 1471,11}, { 2943,10}, { 5887,13}, \
+ { 767,12}, { 1727,13}, { 895,12}, { 1919,11}, \
+ { 3839,14}, { 511,13}, { 1023,12}, { 2111,13}, \
+ { 1151,12}, { 2431,13}, { 1279,12}, { 2623,13}, \
+ { 1407,12}, { 2943,11}, { 5887,14}, { 767,13}, \
+ { 1663,12}, { 3455,13}, { 1919,12}, { 3839,15}, \
+ { 511,14}, { 1023,13}, { 2431,14}, { 1279,13}, \
+ { 2943,12}, { 5887,14}, { 1535,13}, { 3455,14}, \
+ { 1791,13}, { 3839,12}, { 7679,13}, { 3967,12}, \
+ { 7935,11}, { 15871,15}, { 1023,14}, { 2047,13}, \
+ { 4223,14}, { 2303,13}, { 4991,12}, { 9983,14}, \
+ { 2815,13}, { 5887,15}, { 1535,14}, { 3839,13}, \
+ { 7935,12}, { 15871,16} }
+#define SQR_FFT_TABLE3_SIZE 178
+#define SQR_FFT_THRESHOLD 3712
+
+#define MULLO_BASECASE_THRESHOLD 4
+#define MULLO_DC_THRESHOLD 62
+#define MULLO_MUL_N_THRESHOLD 8907
+#define SQRLO_BASECASE_THRESHOLD 8
+#define SQRLO_DC_THRESHOLD 107
+#define SQRLO_SQR_THRESHOLD 6633
+
+#define DC_DIV_QR_THRESHOLD 54
+#define DC_DIVAPPR_Q_THRESHOLD 206
+#define DC_BDIV_QR_THRESHOLD 55
+#define DC_BDIV_Q_THRESHOLD 136
+
+#define INV_MULMOD_BNM1_THRESHOLD 74
+#define INV_NEWTON_THRESHOLD 212
+#define INV_APPR_THRESHOLD 204
+
+#define BINV_NEWTON_THRESHOLD 292
+#define REDC_1_TO_REDC_N_THRESHOLD 67
+
+#define MU_DIV_QR_THRESHOLD 1442
+#define MU_DIVAPPR_Q_THRESHOLD 1528
+#define MUPI_DIV_QR_THRESHOLD 97
+#define MU_BDIV_QR_THRESHOLD 1142
+#define MU_BDIV_Q_THRESHOLD 1470
+
+#define POWM_SEC_TABLE 1,16,96,386,1555
+
+#define GET_STR_DC_THRESHOLD 10
+#define GET_STR_PRECOMPUTE_THRESHOLD 16
+#define SET_STR_DC_THRESHOLD 303
+#define SET_STR_PRECOMPUTE_THRESHOLD 748
+
+#define FAC_DSC_THRESHOLD 141
+#define FAC_ODD_THRESHOLD 55
+
+#define MATRIX22_STRASSEN_THRESHOLD 20
+#define HGCD2_DIV1_METHOD 1 /* 14.03% faster than 3 */
+#define HGCD_THRESHOLD 103
+#define HGCD_APPR_THRESHOLD 127
+#define HGCD_REDUCE_THRESHOLD 3014
+#define GCD_DC_THRESHOLD 396
+#define GCDEXT_DC_THRESHOLD 265
+#define JACOBI_BASE_METHOD 1 /* 47.88% faster than 4 */
+
+/* Tuneup completed successfully, took 29014 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/aorrlshC_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/aorrlshC_n.asm
index 5a9fd4dfb9d..de00154a176 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/aorrlshC_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/aorrlshC_n.asm
@@ -31,13 +31,25 @@ dnl see https://www.gnu.org/licenses/.
C cycles/limb
-C AMD K8,K9 2
-C AMD K10 2
+C AMD K8,K9 2.1
+C AMD K10 2.0
+C AMD bd1 ~2.7
+C AMD bd2 ~2.7
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen 2.0
+C AMD bt1 3.3
+C AMD bt2 3.0
C Intel P4 ?
-C Intel core2 3
+C Intel PNR 3.0
C Intel NHM 2.75
C Intel SBR 2.55
-C Intel atom ?
+C Intel IBR 2.49
+C Intel HWL 2.25
+C Intel BWL 1.89
+C Intel SKL 1.90
+C Intel atom 8.4
+C Intel SLM 4.0
C VIA nano ?
C INPUT PARAMETERS
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/aors_n.asm
index 8941f7a17b9..d5a314ac513 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/aors_n.asm
@@ -34,13 +34,22 @@ C cycles/limb
C AMD K8,K9 1.5
C AMD K10 1.5
C AMD bd1 1.8
-C AMD bobcat 2.5
-C Intel P4
+C AMD bd2 1.74
+C AMD bd3 ?
+C AMD bd4 1.78
+C AMD zen 1.5
+C AMD bt1 2.54
+C AMD bt2 2.15
+C Intel P4 11.5
C Intel core2 4.9
-C Intel NHM 5.5
-C Intel SBR 1.61
-C Intel IBR 1.61
+C Intel NHM 5.53
+C Intel SBR 1.59
+C Intel IBR 1.55
+C Intel HWL 1.44
+C Intel BWL 1.14
+C Intel SKL 1.21
C Intel atom 4
+C Intel SLM 3
C VIA nano 3.25
C The loop of this code is the result of running a code generation and
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/aorsmul_1.asm
index e3fc005757f..dfe4dc43dcd 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/aorsmul_1.asm
@@ -31,15 +31,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9 2.5
-C AMD K10 2.5
-C AMD bd1 5.0
-C AMD bobcat 6.17
-C Intel P4 14.9
-C Intel core2 5.09
-C Intel NHM 4.9
-C Intel SBR 4.0
+C AMD K8,K9 2.52
+C AMD K10 2.51
+C AMD bd1 4.43
+C AMD bd2 5.03 5.63
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen ?
+C AMD bobcat 6.20
+C AMD jaguar 5.57 6.56
+C Intel P4 14.9 17.1
+C Intel core2 5.15
+C Intel NHM 4.93
+C Intel SBR 3.95
+C Intel IBR 3.75
+C Intel HWL 3.62
+C Intel BWL 2.53
+C Intel SKL 2.53
C Intel atom 21.3
+C Intel SLM 9.0
C VIA nano 5.0
C The loop of this code is the result of running a code generation and
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aors_n.asm
index 2c0b7b31a88..83b8df9a101 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aors_n.asm
@@ -1,6 +1,9 @@
-dnl X86-64 mpn_add_n, mpn_sub_n, optimized for Intel Atom.
+dnl X86-64 mpn_add_n, mpn_sub_n, optimised for Intel Atom.
-dnl Copyright 2003-2005, 2007, 2008, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2011, 2017 Free Software Foundation, Inc.
+
+dnl Contributed to the GNU project by Marco Bodrato. Ported to 64-bit by
+dnl Torbjörn Granlund.
dnl This file is part of the GNU MP Library.
dnl
@@ -30,8 +33,96 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
+C cycles/limb
+C AMD K8,K9 2
+C AMD K10 2
+C AMD bull 2.34\2.63
+C AMD pile 2.27\2.52
+C AMD steam
+C AMD excavator
+C AMD bobcat 2.79
+C AMD jaguar 2.78
+C Intel P4 11
+C Intel core2 7.5
+C Intel NHM 8.5
+C Intel SBR 2.11
+C Intel IBR 2.07
+C Intel HWL 1.75
+C Intel BWL 1.51
+C Intel SKL 1.52
+C Intel atom 3
+C Intel SLM 4
+C VIA nano
+
+define(`rp', `%rdi') C rcx
+define(`up', `%rsi') C rdx
+define(`vp', `%rdx') C r8
+define(`n', `%rcx') C r9
+define(`cy', `%r8') C rsp+40 (mpn_add_nc and mpn_sub_nc)
+
+ifdef(`OPERATION_add_n', `
+ define(ADCSBB, adc)
+ define(func_n, mpn_add_n)
+ define(func_nc, mpn_add_nc)')
+ifdef(`OPERATION_sub_n', `
+ define(ADCSBB, sbb)
+ define(func_n, mpn_sub_n)
+ define(func_nc, mpn_sub_nc)')
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
-include_mpn(`x86_64/coreisbr/aors_n.asm')
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(func_n)
+ FUNC_ENTRY(4)
+ xor cy, cy C carry
+
+L(com): shr n C n >> 1
+ jz L(1) C n == 1
+ jc L(1m2) C n % 2 == 1
+
+L(0m2): shr cy
+ mov (up), %r10
+ lea 8(up), up
+ lea 8(vp), vp
+ lea -8(rp), rp
+ jmp L(mid)
+
+L(1): shr cy
+ mov (up), %r9
+ jmp L(end)
+
+L(1m2): shr cy
+ mov (up), %r9
+
+ ALIGN(16)
+L(top): ADCSBB (vp), %r9
+ lea 16(up), up
+ mov -8(up), %r10
+ lea 16(vp), vp
+ mov %r9, (rp)
+L(mid): ADCSBB -8(vp), %r10
+ lea 16(rp), rp
+ dec n
+ mov (up), %r9
+ mov %r10, -8(rp)
+ jnz L(top)
+
+L(end): ADCSBB (vp), %r9
+ mov $0, R32(%rax)
+ mov %r9, (rp)
+ adc R32(%rax), R32(%rax)
+ FUNC_EXIT()
+ ret
+EPILOGUE()
+
+PROLOGUE(func_nc)
+ FUNC_ENTRY(4)
+IFDOS(` mov 56(%rsp), cy ')
+ jmp L(com)
+EPILOGUE()
+ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aorsmul_1.asm
index e95315347cc..7cbc085fd9e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/aorsmul_1.asm
@@ -30,21 +30,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb best
-C AMD K8,K9
-C AMD K10
-C AMD bd1
-C AMD bd2
-C AMD bobcat
-C AMD jaguar
-C Intel P4
-C Intel PNR
-C Intel NHM
-C Intel SBR
-C Intel IBR
-C Intel HWL
-C Intel BWL
-C Intel atom 19.37 this
+C cycles/limb
+C AMD K8,K9 4.5
+C AMD K10 4.5
+C AMD bull 4.73
+C AMD pile 4.60 4.80
+C AMD steam
+C AMD excavator
+C AMD bobcat 5.48
+C AMD jaguar 5.61
+C Intel P4 16.6
+C Intel core2 5.09
+C Intel NHM 4.79
+C Intel SBR 3.88
+C Intel IBR 3.65
+C Intel HWL 3.53
+C Intel BWL 2.75
+C Intel SKL 2.76
+C Intel atom 19.4
+C Intel SLM 8
C VIA nano
C The loop of this code is the result of running a code generation and
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/cnd_add_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/cnd_add_n.asm
new file mode 100644
index 00000000000..fcb9a0f292d
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/cnd_add_n.asm
@@ -0,0 +1,38 @@
+dnl X86-64 mpn_cnd_add_n.
+
+dnl Copyright 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 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/.
+
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_cnd_add_n)
+include_mpn(`x86_64/coreisbr/cnd_add_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/cnd_sub_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/cnd_sub_n.asm
new file mode 100644
index 00000000000..9eee1c182c5
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/cnd_sub_n.asm
@@ -0,0 +1,38 @@
+dnl X86-64 mpn_cnd_sub_n.
+
+dnl Copyright 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 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/.
+
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_cnd_sub_n)
+include_mpn(`x86_64/coreisbr/cnd_sub_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/gmp-mparam.h
index 229d37bf5cd..2cd90f6fcee 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/gmp-mparam.h
@@ -1,7 +1,6 @@
/* Intel Atom/64 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2010, 2012, 2014, 2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -36,16 +35,16 @@ see https://www.gnu.org/licenses/. */
#define SHRD_SLOW 1
/* 1600 MHz Diamondville (Atom 330) */
-/* FFT tuning limit = 25 M */
-/* Generated by tuneup.c, 2015-10-06, gcc 4.7 */
+/* FFT tuning limit = 50,646,641 */
+/* Generated by tuneup.c, 2019-10-16, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1N_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
#define MOD_1_1_TO_MOD_1_2_THRESHOLD MP_SIZE_T_MAX
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 11
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 12
#define USE_PREINV_DIVREM_1 1 /* native */
#define DIV_QR_1_NORM_THRESHOLD 1
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
@@ -53,164 +52,171 @@ see https://www.gnu.org/licenses/. */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD 16
+#define DIV_1_VS_MUL_1_PERCENT 201
+
#define MUL_TOOM22_THRESHOLD 12
#define MUL_TOOM33_THRESHOLD 74
-#define MUL_TOOM44_THRESHOLD 118
-#define MUL_TOOM6H_THRESHOLD 157
-#define MUL_TOOM8H_THRESHOLD 236
+#define MUL_TOOM44_THRESHOLD 106
+#define MUL_TOOM6H_THRESHOLD 155
+#define MUL_TOOM8H_THRESHOLD 212
#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 84
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 81
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 80
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 77
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 73
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 72
#define MUL_TOOM43_TO_TOOM54_THRESHOLD 58
#define SQR_BASECASE_THRESHOLD 5
-#define SQR_TOOM2_THRESHOLD 24
-#define SQR_TOOM3_THRESHOLD 57
-#define SQR_TOOM4_THRESHOLD 179
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 260
+#define SQR_TOOM2_THRESHOLD 22
+#define SQR_TOOM3_THRESHOLD 73
+#define SQR_TOOM4_THRESHOLD 130
+#define SQR_TOOM6_THRESHOLD 159
+#define SQR_TOOM8_THRESHOLD 236
-#define MULMID_TOOM42_THRESHOLD 18
+#define MULMID_TOOM42_THRESHOLD 16
#define MULMOD_BNM1_THRESHOLD 9
-#define SQRMOD_BNM1_THRESHOLD 7
+#define SQRMOD_BNM1_THRESHOLD 9
-#define MUL_FFT_MODF_THRESHOLD 252 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 220 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 252, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
- { 13, 7}, { 7, 6}, { 17, 7}, { 9, 6}, \
- { 19, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
+ { { 220, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
+ { 13, 7}, { 7, 6}, { 15, 7}, { 8, 6}, \
+ { 17, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
{ 9, 7}, { 19, 8}, { 11, 7}, { 23, 8}, \
{ 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
- { 25,10}, { 7, 9}, { 15, 8}, { 31, 9}, \
- { 19, 8}, { 39, 9}, { 23, 8}, { 47,10}, \
- { 15, 9}, { 35,10}, { 23, 9}, { 47,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
- { 63, 9}, { 127, 8}, { 255,10}, { 71, 8}, \
- { 287,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31,11}, { 63,10}, { 127, 9}, { 255, 8}, \
- { 511,10}, { 143, 9}, { 287,11}, { 79,10}, \
- { 159, 9}, { 319,10}, { 175, 9}, { 351,11}, \
- { 95,10}, { 191, 9}, { 383,10}, { 207, 9}, \
- { 415,10}, { 223,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
- { 575,11}, { 159,10}, { 319,11}, { 175,10}, \
- { 351,12}, { 95,11}, { 191,10}, { 383,11}, \
- { 207,10}, { 415,11}, { 223,13}, { 63,12}, \
- { 127,11}, { 255,10}, { 511,11}, { 287,10}, \
- { 575,12}, { 159,11}, { 319,10}, { 639,11}, \
- { 351,10}, { 703,12}, { 191,11}, { 415,12}, \
- { 223,11}, { 447,10}, { 895,11}, { 479,13}, \
- { 127,12}, { 255,11}, { 511,12}, { 287,11}, \
- { 575,12}, { 319,11}, { 639,12}, { 351,11}, \
- { 703,13}, { 191,12}, { 479,14}, { 127,13}, \
- { 255,12}, { 575,13}, { 319,12}, { 703,11}, \
- { 1407,13}, { 383,12}, { 767,13}, { 447,12}, \
- { 895,14}, { 255,13}, { 511,12}, { 1023,13}, \
- { 575,12}, { 1151,13}, { 703,12}, { 1407,14}, \
- { 383,13}, { 831,12}, { 1663,13}, { 895,15}, \
- { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1151,14}, { 639,13}, { 1407,12}, { 2815,14}, \
- { 767,13}, { 1663,14}, { 895,13}, { 1919,15}, \
- { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
- { 2431,12}, { 4863,14}, { 1407,13}, { 2815,15}, \
+ { 25,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
+ { 19, 8}, { 39, 9}, { 23, 8}, { 47, 9}, \
+ { 27,10}, { 15, 9}, { 39,10}, { 23, 9}, \
+ { 47,11}, { 15,10}, { 31, 9}, { 67,10}, \
+ { 39, 9}, { 79,10}, { 47, 9}, { 95,11}, \
+ { 31,10}, { 63, 9}, { 127, 8}, { 255,10}, \
+ { 71, 9}, { 143, 8}, { 287,10}, { 79,11}, \
+ { 47,10}, { 95, 9}, { 191,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
+ { 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
+ { 319,10}, { 175, 9}, { 351,11}, { 95,10}, \
+ { 191, 9}, { 383,10}, { 207,11}, { 111,10}, \
+ { 223,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,11}, { 143,10}, { 287, 9}, { 575,11}, \
+ { 159,10}, { 319,11}, { 175,10}, { 351,12}, \
+ { 95,11}, { 191,10}, { 383,11}, { 207,10}, \
+ { 415,11}, { 223,13}, { 63,12}, { 127,11}, \
+ { 255,10}, { 511,11}, { 287,10}, { 575,12}, \
+ { 159,11}, { 319,10}, { 639,11}, { 351,12}, \
+ { 191,11}, { 383,10}, { 767,12}, { 223,11}, \
+ { 447,13}, { 127,12}, { 255,11}, { 511,12}, \
+ { 287,11}, { 575,12}, { 319,11}, { 639,12}, \
+ { 351,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 447,14}, { 127,13}, { 255,12}, { 575,13}, \
+ { 319,12}, { 703,13}, { 383,12}, { 767,13}, \
+ { 447,14}, { 255,13}, { 511,12}, { 1023,13}, \
+ { 575,12}, { 1151,13}, { 703,14}, { 383,13}, \
+ { 831,12}, { 1663,15}, { 255,14}, { 511,13}, \
+ { 1087,12}, { 2175,13}, { 1151,14}, { 639,13}, \
+ { 1407,12}, { 2815,14}, { 767,13}, { 1663,14}, \
+ { 895,13}, { 1791,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
+ { 1407,13}, { 2815,15}, { 767,14}, { 1791,16}, \
+ { 511,15}, { 1023,14}, { 2431,13}, { 4863,15}, \
+ { 1279,14}, { 2943,15}, { 1535,14}, { 16384,15}, \
{ 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
{ 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
{8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 161
+#define MUL_FFT_TABLE3_SIZE 169
#define MUL_FFT_THRESHOLD 2240
-#define SQR_FFT_MODF_THRESHOLD 208 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 184 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 208, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 13, 7}, { 7, 6}, \
- { 15, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 19, 8}, { 11, 7}, { 23, 8}, \
- { 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \
- { 25,10}, { 7, 9}, { 15, 8}, { 31, 9}, \
- { 19, 8}, { 39, 9}, { 23,10}, { 15, 9}, \
- { 39,10}, { 23, 9}, { 51,11}, { 15,10}, \
- { 31, 9}, { 63, 8}, { 127, 9}, { 67,10}, \
- { 39, 9}, { 79, 8}, { 159, 7}, { 319,10}, \
- { 47, 8}, { 191,11}, { 31,10}, { 63, 8}, \
- { 255,10}, { 71, 9}, { 143, 8}, { 287, 7}, \
- { 575, 9}, { 159, 8}, { 319,11}, { 47, 9}, \
+ { { 184, 5}, { 11, 6}, { 13, 7}, { 7, 6}, \
+ { 15, 7}, { 8, 6}, { 17, 7}, { 13, 8}, \
+ { 7, 7}, { 17, 8}, { 9, 7}, { 19, 8}, \
+ { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
+ { 19, 9}, { 11, 8}, { 25,10}, { 7, 9}, \
+ { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
+ { 23,10}, { 15, 9}, { 39,10}, { 23, 9}, \
+ { 47,11}, { 15,10}, { 31, 9}, { 63, 8}, \
+ { 127, 7}, { 255,10}, { 39, 8}, { 159,10}, \
+ { 47, 9}, { 95, 8}, { 191,11}, { 31,10}, \
+ { 63, 9}, { 127, 8}, { 255, 7}, { 511,10}, \
+ { 71, 9}, { 143, 8}, { 287, 7}, { 575, 9}, \
+ { 159, 8}, { 319,11}, { 47,10}, { 95, 9}, \
{ 191, 8}, { 383,12}, { 31,11}, { 63,10}, \
{ 127, 9}, { 255, 8}, { 511,10}, { 143, 9}, \
- { 287, 8}, { 575,10}, { 159, 9}, { 319,10}, \
- { 175, 9}, { 351, 8}, { 703,10}, { 191, 9}, \
- { 383,10}, { 207,11}, { 111,10}, { 223, 9}, \
+ { 287, 8}, { 575,10}, { 159, 9}, { 319, 8}, \
+ { 639,10}, { 175, 9}, { 351,11}, { 95,10}, \
+ { 191, 9}, { 383,11}, { 111,10}, { 223, 9}, \
{ 447,12}, { 63,11}, { 127,10}, { 255, 9}, \
{ 511,11}, { 143,10}, { 287, 9}, { 575,11}, \
- { 159,10}, { 319,11}, { 175,10}, { 351, 9}, \
- { 703,11}, { 191,10}, { 383,11}, { 207,10}, \
- { 415,11}, { 223,10}, { 447,13}, { 63,12}, \
+ { 159,10}, { 319, 9}, { 639,11}, { 175,10}, \
+ { 351,12}, { 95,11}, { 191,10}, { 383, 9}, \
+ { 767,11}, { 223,10}, { 447,13}, { 63,12}, \
{ 127,11}, { 255,10}, { 511,11}, { 287,10}, \
{ 575,12}, { 159,11}, { 319,10}, { 639,11}, \
- { 351,10}, { 703,12}, { 191,11}, { 415,12}, \
- { 223,11}, { 447,10}, { 895,13}, { 127,12}, \
- { 255,11}, { 511,12}, { 287,11}, { 575,12}, \
- { 319,11}, { 639,12}, { 351,11}, { 703,13}, \
- { 191,12}, { 447,11}, { 895,14}, { 127,13}, \
- { 255,12}, { 511,11}, { 1023,12}, { 575,13}, \
- { 319,12}, { 703,13}, { 383,12}, { 767,13}, \
- { 447,12}, { 895,14}, { 255,13}, { 511,12}, \
+ { 351,12}, { 191,11}, { 383,10}, { 767,12}, \
+ { 223,11}, { 447,13}, { 127,12}, { 255,11}, \
+ { 511,12}, { 287,11}, { 575,12}, { 319,11}, \
+ { 639,12}, { 351,13}, { 191,12}, { 383,11}, \
+ { 767,12}, { 447,14}, { 127,13}, { 255,12}, \
+ { 575,13}, { 319,12}, { 703,13}, { 383,12}, \
+ { 767,13}, { 447,14}, { 255,13}, { 511,12}, \
{ 1023,13}, { 575,12}, { 1151,13}, { 703,14}, \
- { 383,13}, { 831,12}, { 1663,13}, { 895,15}, \
- { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1151,14}, { 639,13}, { 1407,12}, { 2815,14}, \
- { 767,13}, { 1663,14}, { 895,13}, { 1791,12}, \
- { 3583,15}, { 511,14}, { 1023,13}, { 2175,14}, \
- { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
- { 2559,14}, { 1407,13}, { 2815,15}, { 32768,16}, \
+ { 383,13}, { 831,12}, { 1663,15}, { 255,14}, \
+ { 511,13}, { 1151,14}, { 639,13}, { 1407,12}, \
+ { 2815,14}, { 767,13}, { 1663,14}, { 895,13}, \
+ { 1791,15}, { 511,14}, { 1023,13}, { 2047,14}, \
+ { 1151,13}, { 2431,12}, { 4863,14}, { 1407,13}, \
+ { 2815,15}, { 767,14}, { 1791,16}, { 511,15}, \
+ { 1023,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
+ { 2943,15}, { 1535,14}, { 16384,15}, { 32768,16}, \
{ 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
{1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
#define SQR_FFT_TABLE3_SIZE 172
#define SQR_FFT_THRESHOLD 1728
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 39
+#define MULLO_DC_THRESHOLD 33
#define MULLO_MUL_N_THRESHOLD 4392
#define SQRLO_BASECASE_THRESHOLD 0 /* always */
-#define SQRLO_DC_THRESHOLD 107
+#define SQRLO_DC_THRESHOLD 85
#define SQRLO_SQR_THRESHOLD 3176
-#define DC_DIV_QR_THRESHOLD 43
-#define DC_DIVAPPR_Q_THRESHOLD 123
-#define DC_BDIV_QR_THRESHOLD 40
-#define DC_BDIV_Q_THRESHOLD 80
+#define DC_DIV_QR_THRESHOLD 34
+#define DC_DIVAPPR_Q_THRESHOLD 119
+#define DC_BDIV_QR_THRESHOLD 31
+#define DC_BDIV_Q_THRESHOLD 76
#define INV_MULMOD_BNM1_THRESHOLD 22
-#define INV_NEWTON_THRESHOLD 153
-#define INV_APPR_THRESHOLD 138
+#define INV_NEWTON_THRESHOLD 149
+#define INV_APPR_THRESHOLD 123
#define BINV_NEWTON_THRESHOLD 179
-#define REDC_1_TO_REDC_2_THRESHOLD 16
-#define REDC_2_TO_REDC_N_THRESHOLD 43
+#define REDC_1_TO_REDC_2_THRESHOLD 24
+#define REDC_2_TO_REDC_N_THRESHOLD 39
-#define MU_DIV_QR_THRESHOLD 855
-#define MU_DIVAPPR_Q_THRESHOLD 855
-#define MUPI_DIV_QR_THRESHOLD 78
-#define MU_BDIV_QR_THRESHOLD 762
+#define MU_DIV_QR_THRESHOLD 807
+#define MU_DIVAPPR_Q_THRESHOLD 807
+#define MUPI_DIV_QR_THRESHOLD 77
+#define MU_BDIV_QR_THRESHOLD 748
#define MU_BDIV_Q_THRESHOLD 807
-#define POWM_SEC_TABLE 1,16,126,452,1420
+#define POWM_SEC_TABLE 1,22,114,326,1486
-#define GET_STR_DC_THRESHOLD 14
-#define GET_STR_PRECOMPUTE_THRESHOLD 29
-#define SET_STR_DC_THRESHOLD 686
-#define SET_STR_PRECOMPUTE_THRESHOLD 1510
+#define GET_STR_DC_THRESHOLD 16
+#define GET_STR_PRECOMPUTE_THRESHOLD 30
+#define SET_STR_DC_THRESHOLD 381
+#define SET_STR_PRECOMPUTE_THRESHOLD 1565
-#define FAC_DSC_THRESHOLD 1065
+#define FAC_DSC_THRESHOLD 960
#define FAC_ODD_THRESHOLD 0 /* always */
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 104
-#define HGCD_APPR_THRESHOLD 104
-#define HGCD_REDUCE_THRESHOLD 1329
-#define GCD_DC_THRESHOLD 273
-#define GCDEXT_DC_THRESHOLD 213
-#define JACOBI_BASE_METHOD 2
+#define MATRIX22_STRASSEN_THRESHOLD 13
+#define HGCD2_DIV1_METHOD 3 /* 5.86% faster than 4 */
+#define HGCD_THRESHOLD 88
+#define HGCD_APPR_THRESHOLD 88
+#define HGCD_REDUCE_THRESHOLD 1182
+#define GCD_DC_THRESHOLD 241
+#define GCDEXT_DC_THRESHOLD 192
+#define JACOBI_BASE_METHOD 3 /* 9.43% faster than 2 */
+
+/* Tuneup completed successfully, took 193098 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_1.asm
index d76a3d3b8c9..a0dcf1eef9a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_1.asm
@@ -30,21 +30,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb best
-C AMD K8,K9
-C AMD K10
-C AMD bd1
-C AMD bd2
-C AMD bobcat
-C AMD jaguar
-C Intel P4
-C Intel PNR
-C Intel NHM
-C Intel SBR
-C Intel IBR
-C Intel HWL
-C Intel BWL
-C Intel atom 17.3 this
+C cycles/limb
+C AMD K8,K9 3.03
+C AMD K10 3.03
+C AMD bull 4.74
+C AMD pile 4.56
+C AMD steam
+C AMD excavator
+C AMD bobcat 5.56 6.04
+C AMD jaguar 5.55 5.84
+C Intel P4 13.05
+C Intel core2 4.03
+C Intel NHM 3.80
+C Intel SBR 2.75
+C Intel IBR 2.69
+C Intel HWL 2.50
+C Intel BWL 2.55
+C Intel SKL 2.57
+C Intel atom 17.3
+C Intel SLM 14.7
C VIA nano
C The loop of this code is the result of running a code generation and
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_2.asm
index f3fc3afdd1b..4bc22cd3937 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/atom/mul_2.asm
@@ -31,20 +31,24 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb best
-C AMD K8,K9
-C AMD K10
-C AMD bd1
-C AMD bd2
-C AMD bobcat
-C AMD jaguar
-C Intel P4
-C Intel PNR
-C Intel NHM
-C Intel SBR
-C Intel IBR
-C Intel HWL
-C Intel BWL
-C Intel atom 17.75 this
+C AMD K8,K9 5.78
+C AMD K10 5.78
+C AMD bull 9.10
+C AMD pile 9.17
+C AMD steam
+C AMD excavator
+C AMD bobcat 11.3
+C AMD jaguar 10.9
+C Intel P4 24.6
+C Intel core2 8.06
+C Intel NHM 7.65
+C Intel SBR 6.28
+C Intel IBR 6.10
+C Intel HWL 6.09
+C Intel BWL 4.73
+C Intel SKL 4.77
+C Intel atom 35.3
+C Intel SLM 25.6
C VIA nano
C The loop of this code is the result of running a code generation and
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/addmul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/addmul_2.asm
new file mode 100644
index 00000000000..b54e91af1e4
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/addmul_2.asm
@@ -0,0 +1,235 @@
+dnl AMD64 mpn_addmul_2 optimised for AMD Bulldozer.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C AMD K8,K9
+C AMD K10
+C AMD bd1 4.2
+C AMD bd2 4.4
+C AMD bd3
+C AMD bd4
+C AMD zen
+C AMD bt1
+C AMD bt2
+C Intel P4
+C Intel PNR
+C Intel NHM
+C Intel SBR
+C Intel IBR
+C Intel HWL
+C Intel BWL
+C Intel SKL
+C Intel atom
+C Intel SLM
+C VIA nano
+
+C The loop of this code is the result of running a code generation and
+C optimisation tool suite written by David Harvey and Torbjorn Granlund.
+
+define(`rp', `%rdi') C rcx
+define(`up', `%rsi') C rdx
+define(`n_param', `%rdx') C r8
+define(`vp', `%rcx') C r9
+
+define(`n', `%rcx')
+define(`v0', `%rbx')
+define(`v1', `%rbp')
+define(`X0', `%r12')
+define(`X1', `%r13')
+
+define(`w0', `%r8')
+define(`w1', `%r9')
+define(`w2', `%r10')
+define(`w3', `%r11')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_addmul_2)
+ FUNC_ENTRY(4)
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+
+ mov (vp), v0
+ mov 8(vp), v1
+
+ mov (up), %rax
+ mov $0, R32(w2) C abuse w2
+
+ lea (up,n_param,8), up
+ lea (rp,n_param,8), rp
+ sub n_param, w2
+ mul v0
+
+ test $1, R8(w2)
+ jnz L(bx1)
+
+L(bx0): mov %rdx, X0
+ mov %rax, X1
+ test $2, R8(w2)
+ jnz L(b10)
+
+L(b00): lea (w2), n C un = 4, 8, 12, ...
+ mov (up,w2,8), %rax
+ mov (rp,w2,8), w3
+ mul v1
+ mov %rax, w0
+ mov 8(up,w2,8), %rax
+ mov %rdx, w1
+ jmp L(lo0)
+
+L(b10): lea 2(w2), n C un = 2, 6, 10, ...
+ mov (up,w2,8), %rax
+ mov (rp,w2,8), w1
+ mul v1
+ mov %rdx, w3
+ mov %rax, w2
+ mov -8(up,n,8), %rax
+ test n, n
+ jz L(end)
+ jmp L(top)
+
+L(bx1): mov %rax, X0
+ mov %rdx, X1
+ test $2, R8(w2)
+ jz L(b11)
+
+L(b01): lea 1(w2), n C un = 1, 5, 9, ...
+ mov (up,w2,8), %rax
+ mul v1
+ mov (rp,w2,8), w2
+ mov %rdx, w0
+ mov %rax, w3
+ jmp L(lo1)
+
+L(b11): lea -1(w2), n C un = 3, 7, 11, ...
+ mov (up,w2,8), %rax
+ mul v1
+ mov (rp,w2,8), w0
+ mov %rax, w1
+ mov 8(up,w2,8), %rax
+ mov %rdx, w2
+ jmp L(lo3)
+
+ ALIGN(32)
+L(top):
+L(lo2): mul v0
+ add w1, X1
+ mov X1, -16(rp,n,8)
+ mov %rdx, X1
+ adc %rax, X0
+ adc $0, X1
+ mov -8(up,n,8), %rax
+ mul v1
+ mov -8(rp,n,8), w1
+ mov %rdx, w0
+ add w1, w2
+ adc %rax, w3
+ adc $0, w0
+L(lo1): mov (up,n,8), %rax
+ mul v0
+ add w2, X0
+ mov X0, -8(rp,n,8)
+ mov %rdx, X0
+ adc %rax, X1
+ mov (up,n,8), %rax
+ adc $0, X0
+ mov (rp,n,8), w2
+ mul v1
+ add w2, w3
+ adc %rax, w0
+ mov 8(up,n,8), %rax
+ mov %rdx, w1
+ adc $0, w1
+L(lo0): mul v0
+ add w3, X1
+ mov X1, (rp,n,8)
+ adc %rax, X0
+ mov 8(up,n,8), %rax
+ mov %rdx, X1
+ adc $0, X1
+ mov 8(rp,n,8), w3
+ mul v1
+ add w3, w0
+ adc %rax, w1
+ mov 16(up,n,8), %rax
+ mov %rdx, w2
+ adc $0, w2
+L(lo3): mul v0
+ add w0, X0
+ mov X0, 8(rp,n,8)
+ mov %rdx, X0
+ adc %rax, X1
+ adc $0, X0
+ mov 16(up,n,8), %rax
+ mov 16(rp,n,8), w0
+ mul v1
+ mov %rdx, w3
+ add w0, w1
+ adc %rax, w2
+ adc $0, w3
+ mov 24(up,n,8), %rax
+ add $4, n
+ jnc L(top)
+
+L(end): mul v0
+ add w1, X1
+ mov X1, -16(rp)
+ mov %rdx, X1
+ adc %rax, X0
+ adc $0, X1
+ mov -8(up), %rax
+ mul v1
+ mov -8(rp), w1
+ add w1, w2
+ adc %rax, w3
+ adc $0, %rdx
+ add w2, X0
+ adc $0, X1
+ mov X0, -8(rp)
+ add w3, X1
+ mov X1, (rp)
+ adc $0, %rdx
+ mov %rdx, %rax
+
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aorrlsh_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aorrlsh_n.asm
new file mode 100644
index 00000000000..5516c9df2a8
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aorrlsh_n.asm
@@ -0,0 +1,38 @@
+dnl X86-64 mpn_addlsh_n and mpn_rsblsh_n.
+
+dnl Copyright 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 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/.
+
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addlsh_n mpn_rsblsh_n)
+include_mpn(`x86_64/aorrlsh_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aors_n.asm
new file mode 100644
index 00000000000..143c42e810c
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aors_n.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_add_n, mpn_sub_n, optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+include_mpn(`x86_64/coreihwl/aors_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aorsmul_1.asm
index 96fec9f5ac5..fc0d2fe6add 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/aorsmul_1.asm
@@ -31,22 +31,31 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9
-C AMD K10
-C AMD bd1 4.5-4.7
-C AMD bobcat
-C Intel P4
-C Intel core2
-C Intel NHM
-C Intel SBR
-C Intel atom
+C AMD K8,K9 3.30 3.58
+C AMD K10 3.09
+C AMD bull 4.47 4.72
+C AMD pile 4.66
+C AMD steam
+C AMD excavator
+C AMD bobcat 6.30
+C AMD jaguar 6.29
+C Intel P4 17.3 17.8
+C Intel core2 5.13
+C Intel NHM 4.85
+C Intel SBR 3.83
+C Intel IBR 3.75
+C Intel HWL 3.45
+C Intel BWL 2.56
+C Intel SKL 2.53
+C Intel atom 20.3
+C Intel SLM 9
C VIA nano
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjorn Granlund.
C TODO
-C * Try to make loop run closer to 4 c/l.
+C * Try to make loop run closer to 4 c/l in Bulldozer and Piledriver.
define(`rp', `%rdi') C rcx
define(`up', `%rsi') C rdx
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/nano/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gcd_11.asm
index 3d8e5c7ab12..4723093bb46 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/nano/gcd_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gcd_11.asm
@@ -1,4 +1,4 @@
-dnl AMD64 mpn_gcd_1.
+dnl AMD64 mpn_gcd_11.
dnl Copyright 2012 Free Software Foundation, Inc.
@@ -33,5 +33,5 @@ include(`../config.m4')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-MULFUNC_PROLOGUE(mpn_gcd_1)
-include_mpn(`x86_64/core2/gcd_1.asm')
+MULFUNC_PROLOGUE(mpn_gcd_11)
+include_mpn(`x86_64/core2/gcd_11.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gmp-mparam.h
index c279bcda6d1..210f3824cd6 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gmp-mparam.h
@@ -1,7 +1,6 @@
/* AMD bd1 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2010, 2012, 2014, 2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,210 +31,235 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 3600 MHz Bulldozer Zambezi */
-/* FFT tuning limit = 100 M */
-/* Generated by tuneup.c, 2015-10-14, gcc 4.8 */
+/* 3600-3800 MHz Bulldozer Zambezi */
+/* FFT tuning limit = 464,627,200 */
+/* Generated by tuneup.c, 2019-10-20, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1N_TO_MOD_1_1_THRESHOLD 5
#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 18
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 31
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 31
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 12
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_NORM_THRESHOLD 2
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 22
+#define BMOD_1_TO_MOD_1_THRESHOLD 27
+
+#define DIV_1_VS_MUL_1_PERCENT 275
#define MUL_TOOM22_THRESHOLD 20
#define MUL_TOOM33_THRESHOLD 57
-#define MUL_TOOM44_THRESHOLD 166
-#define MUL_TOOM6H_THRESHOLD 274
+#define MUL_TOOM44_THRESHOLD 161
+#define MUL_TOOM6H_THRESHOLD 226
#define MUL_TOOM8H_THRESHOLD 339
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 61
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 108
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 148
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 91
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 21
-#define SQR_TOOM3_THRESHOLD 81
-#define SQR_TOOM4_THRESHOLD 232
-#define SQR_TOOM6_THRESHOLD 318
-#define SQR_TOOM8_THRESHOLD 430
+#define SQR_TOOM2_THRESHOLD 24
+#define SQR_TOOM3_THRESHOLD 85
+#define SQR_TOOM4_THRESHOLD 234
+#define SQR_TOOM6_THRESHOLD 286
+#define SQR_TOOM8_THRESHOLD 466
-#define MULMID_TOOM42_THRESHOLD 22
+#define MULMID_TOOM42_THRESHOLD 20
-#define MULMOD_BNM1_THRESHOLD 11
+#define MULMOD_BNM1_THRESHOLD 12
#define SQRMOD_BNM1_THRESHOLD 15
#define MUL_FFT_MODF_THRESHOLD 412 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 412, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 25, 7}, { 13, 6}, { 28, 7}, { 15, 6}, \
- { 31, 7}, { 20, 8}, { 11, 7}, { 25, 8}, \
- { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
- { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
- { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
- { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 55,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 83,10}, { 47, 9}, { 95,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 103,12}, \
- { 31,11}, { 63,10}, { 135,11}, { 79,10}, \
- { 167,11}, { 95,10}, { 191,11}, { 111,12}, \
- { 63,11}, { 127,10}, { 255,11}, { 143,10}, \
- { 287, 9}, { 575,11}, { 159,12}, { 95,11}, \
- { 191,13}, { 63,12}, { 127,11}, { 255,10}, \
- { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
- { 575,12}, { 159,11}, { 319,10}, { 639,11}, \
- { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
- { 767,11}, { 415,12}, { 223,11}, { 447,13}, \
- { 127,12}, { 255,11}, { 511,10}, { 1023,11}, \
- { 543,12}, { 287,11}, { 607,12}, { 319,11}, \
- { 639,10}, { 1279,11}, { 671,12}, { 351,11}, \
- { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
- { 415,11}, { 831,12}, { 447,14}, { 127,13}, \
- { 255,12}, { 543,11}, { 1087,10}, { 2175,12}, \
- { 575,11}, { 1151,12}, { 607,13}, { 319,12}, \
- { 639,11}, { 1279,12}, { 735,13}, { 383,12}, \
- { 767,11}, { 1535,12}, { 799,11}, { 1599,10}, \
- { 3199,12}, { 831,13}, { 447,12}, { 895,14}, \
- { 255,13}, { 511,12}, { 1087,13}, { 575,12}, \
- { 1215,11}, { 2431,10}, { 4863,13}, { 639,12}, \
- { 1279,11}, { 2687,13}, { 703,12}, { 1407,14}, \
- { 383,13}, { 767,12}, { 1535,11}, { 3071,12}, \
+ { { 412, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 11, 5}, { 23, 6}, { 25, 7}, { 13, 6}, \
+ { 28, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
+ { 15, 7}, { 32, 8}, { 17, 7}, { 35, 8}, \
+ { 19, 7}, { 39, 8}, { 27, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 55,11}, { 15,10}, { 31, 9}, \
+ { 71,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 99,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 103,12}, { 31,11}, { 63, 7}, \
+ { 1023, 8}, { 543, 9}, { 303,10}, { 167,11}, \
+ { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
+ { 255,11}, { 143,10}, { 287,11}, { 159,12}, \
+ { 95,11}, { 191,13}, { 63,12}, { 127,11}, \
+ { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
+ { 287,12}, { 159,11}, { 319,10}, { 639,11}, \
+ { 351,12}, { 191,11}, { 383,10}, { 767,12}, \
+ { 223,11}, { 447,13}, { 127,12}, { 255,11}, \
+ { 511,10}, { 1023,11}, { 543,12}, { 287,11}, \
+ { 575,10}, { 1151,11}, { 607,12}, { 319,11}, \
+ { 639,10}, { 1279,11}, { 671,12}, { 351,13}, \
+ { 191,12}, { 383,11}, { 767,12}, { 415,11}, \
+ { 831,12}, { 447,14}, { 127,13}, { 255,12}, \
+ { 511,11}, { 1023,12}, { 543,11}, { 1087,10}, \
+ { 2175,12}, { 575,11}, { 1151,12}, { 607,13}, \
+ { 319,12}, { 639,11}, { 1279,12}, { 671,11}, \
+ { 1343,10}, { 2687,12}, { 703,11}, { 1407,13}, \
+ { 383,12}, { 767,11}, { 1535,12}, { 799,11}, \
+ { 1599,12}, { 831,13}, { 447,12}, { 895,14}, \
+ { 255,13}, { 511,12}, { 1023,11}, { 2047,12}, \
+ { 1087,11}, { 2175,13}, { 575,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1343,11}, { 2687,13}, \
+ { 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
{ 1599,13}, { 831,12}, { 1727,11}, { 3455,13}, \
- { 895,15}, { 255,14}, { 511,13}, { 1087,12}, \
- { 2175,13}, { 1151,12}, { 2303,13}, { 1215,12}, \
- { 2431,11}, { 4863,14}, { 639,13}, { 1279,12}, \
+ { 895,15}, { 255,14}, { 511,13}, { 1023,12}, \
+ { 2047,13}, { 1087,12}, { 2175,13}, { 1215,12}, \
+ { 2431,11}, { 4863,14}, { 639,13}, { 1343,12}, \
{ 2687,13}, { 1471,12}, { 2943,11}, { 5887,14}, \
- { 767,13}, { 1535,12}, { 3071,13}, { 1599,12}, \
- { 3199,13}, { 1727,12}, { 3455,14}, { 895,13}, \
- { 1791,12}, { 3583,15}, { 511,14}, { 1023,13}, \
- { 2175,14}, { 1151,13}, { 2303,12}, { 4607,13}, \
- { 2431,12}, { 4863,14}, { 1279,13}, { 2687,14}, \
- { 1407,13}, { 2815,12}, { 5631,13}, { 2943,12}, \
- { 5887,15}, { 767,14}, { 1535,13}, { 3199,14}, \
- { 1663,13}, { 3455,12}, { 6911,14}, { 1791,13}, \
- { 3583,14}, { 1919,16}, { 511,15}, { 1023,14}, \
- { 2175,13}, { 4351,14}, { 2431,13}, { 4863,15}, \
+ { 767,13}, { 1599,12}, { 3199,13}, { 1727,12}, \
+ { 3455,14}, { 895,13}, { 1919,15}, { 511,14}, \
+ { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
+ { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
+ { 2815,12}, { 5631,13}, { 2943,12}, { 5887,15}, \
+ { 767,14}, { 1535,13}, { 3199,14}, { 1663,13}, \
+ { 3455,12}, { 6911,14}, { 1791,13}, { 3583,14}, \
+ { 1919,13}, { 3839,16}, { 511,15}, { 1023,14}, \
+ { 2175,13}, { 4479,14}, { 2431,13}, { 4863,15}, \
{ 1279,14}, { 2943,13}, { 5887,12}, { 11775,15}, \
{ 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
{ 3839,13}, { 7679,16}, { 1023,15}, { 2047,14}, \
- { 4351,15}, { 2303,14}, { 4863,15}, { 2559,14}, \
+ { 4479,15}, { 2303,14}, { 4863,15}, { 2559,14}, \
{ 5247,15}, { 2815,14}, { 5887,13}, { 11775,16}, \
- { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
- {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 224
+ { 1535,15}, { 3327,14}, { 6911,15}, { 3839,14}, \
+ { 7679,13}, { 15359,17}, { 1023,16}, { 2047,15}, \
+ { 4351,14}, { 8959,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
+ { 3583,15}, { 7679,14}, { 15359,15}, { 7935,17}, \
+ { 2047,16}, { 4095,15}, { 8959,16}, { 4607,15}, \
+ { 9983,14}, { 19967,16}, { 5119,15}, { 10239,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 251
#define MUL_FFT_THRESHOLD 4544
-#define SQR_FFT_MODF_THRESHOLD 380 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 364 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 380, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 27, 7}, { 18, 6}, { 37, 7}, { 25, 8}, \
- { 13, 7}, { 27, 8}, { 15, 7}, { 32, 8}, \
+ { { 364, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 11, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 25, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 31, 8}, \
{ 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
{ 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
{ 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
{ 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
{ 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 83,10}, { 47, 9}, { 95,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 135,11}, { 79,10}, { 159,11}, { 95,10}, \
- { 191,11}, { 111,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
- { 575,10}, { 303,11}, { 159,12}, { 95,11}, \
+ { 79,10}, { 47,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 135,11}, { 79,10}, { 159,11}, { 95, 7}, \
+ { 1535, 8}, { 799, 7}, { 1599, 8}, { 831, 9}, \
+ { 447,10}, { 239,11}, { 127,10}, { 255,11}, \
+ { 143,10}, { 303,11}, { 159,12}, { 95,11}, \
{ 191,10}, { 383,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
- { 287,10}, { 575,11}, { 303,12}, { 159,11}, \
- { 319,10}, { 639,11}, { 351,12}, { 191,11}, \
- { 383,10}, { 767,11}, { 415,12}, { 223,11}, \
- { 447,13}, { 127,12}, { 255,11}, { 511,10}, \
- { 1023,11}, { 543,12}, { 287,11}, { 575,10}, \
- { 1151,11}, { 607,12}, { 319,11}, { 639,12}, \
- { 351,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 255,10}, { 511,11}, { 303,12}, { 159,11}, \
+ { 351,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 415,12}, { 223,11}, { 447,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,12}, { 287,11}, \
+ { 575,10}, { 1151,11}, { 607,12}, { 319,11}, \
+ { 639,10}, { 1279,11}, { 671,12}, { 351,13}, \
+ { 191,12}, { 383,11}, { 767,10}, { 1535,12}, \
{ 415,11}, { 831,12}, { 447,14}, { 127,13}, \
- { 255,12}, { 543,11}, { 1087,12}, { 575,11}, \
- { 1151,12}, { 607,13}, { 319,12}, { 639,11}, \
- { 1279,12}, { 671,11}, { 1343,12}, { 703,13}, \
- { 383,12}, { 767,11}, { 1535,12}, { 799,11}, \
- { 1599,10}, { 3199,13}, { 447,12}, { 895,14}, \
- { 255,13}, { 511,12}, { 1087,11}, { 2175,13}, \
- { 575,12}, { 1151,11}, { 2431,13}, { 639,12}, \
- { 1343,13}, { 703,14}, { 383,13}, { 767,12}, \
- { 1599,11}, { 3199,13}, { 831,12}, { 1727,11}, \
- { 3455,13}, { 895,15}, { 255,14}, { 511,13}, \
- { 1087,12}, { 2175,13}, { 1215,12}, { 2431,11}, \
- { 4863,14}, { 639,13}, { 1343,12}, { 2687,13}, \
- { 1407,12}, { 2815,14}, { 767,13}, { 1535,12}, \
- { 3071,13}, { 1599,12}, { 3199,13}, { 1727,12}, \
- { 3455,14}, { 895,13}, { 1919,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2303,12}, \
- { 4607,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
- { 2687,14}, { 1407,15}, { 767,14}, { 1535,13}, \
- { 3199,14}, { 1663,13}, { 3327,12}, { 6655,13}, \
- { 3455,12}, { 6911,14}, { 1791,13}, { 3583,14}, \
- { 1919,16}, { 511,15}, { 1023,14}, { 2175,13}, \
- { 4479,14}, { 2303,13}, { 4607,14}, { 2431,13}, \
- { 4863,15}, { 1279,14}, { 2943,13}, { 5887,12}, \
- { 11775,15}, { 1535,14}, { 3455,13}, { 6911,15}, \
- { 1791,14}, { 3839,13}, { 7679,16}, { 1023,15}, \
- { 2047,14}, { 4223,13}, { 8447,14}, { 4479,15}, \
- { 2303,14}, { 4863,13}, { 9727,14}, { 4991,15}, \
- { 2559,14}, { 5247,15}, { 2815,14}, { 5631,13}, \
- { 11263,14}, { 5887,13}, { 11775,16}, { 65536,17}, \
+ { 255,12}, { 511,11}, { 1023,12}, { 543,11}, \
+ { 1087,10}, { 2175,12}, { 575,11}, { 1151,12}, \
+ { 607,13}, { 319,12}, { 639,11}, { 1279,12}, \
+ { 671,11}, { 1343,12}, { 703,11}, { 1407,12}, \
+ { 735,13}, { 383,12}, { 767,11}, { 1535,12}, \
+ { 799,11}, { 1599,12}, { 831,13}, { 447,12}, \
+ { 895,14}, { 255,13}, { 511,12}, { 1023,11}, \
+ { 2047,12}, { 1087,11}, { 2175,13}, { 575,12}, \
+ { 1151,11}, { 2303,12}, { 1215,11}, { 2431,13}, \
+ { 639,12}, { 1343,13}, { 703,12}, { 1407,14}, \
+ { 383,13}, { 767,12}, { 1599,11}, { 3199,13}, \
+ { 831,12}, { 1727,11}, { 3455,13}, { 895,15}, \
+ { 255,14}, { 511,13}, { 1023,12}, { 2047,13}, \
+ { 1087,12}, { 2175,13}, { 1151,12}, { 2303,13}, \
+ { 1215,12}, { 2431,14}, { 639,13}, { 1343,12}, \
+ { 2687,13}, { 1471,12}, { 2943,11}, { 5887,14}, \
+ { 767,13}, { 1599,12}, { 3199,13}, { 1727,12}, \
+ { 3455,11}, { 6911,14}, { 895,13}, { 1791,12}, \
+ { 3583,13}, { 1919,12}, { 3839,15}, { 511,14}, \
+ { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
+ { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
+ { 2943,12}, { 5887,11}, { 11775,15}, { 767,14}, \
+ { 1535,13}, { 3199,14}, { 1663,13}, { 3455,12}, \
+ { 6911,14}, { 1791,13}, { 3583,14}, { 1919,13}, \
+ { 3839,16}, { 511,15}, { 1023,14}, { 2175,13}, \
+ { 4351,12}, { 8703,13}, { 4479,12}, { 8959,14}, \
+ { 2303,13}, { 4607,14}, { 2431,13}, { 4863,15}, \
+ { 1279,14}, { 2815,13}, { 5631,14}, { 2943,13}, \
+ { 5887,12}, { 11775,15}, { 1535,14}, { 3455,13}, \
+ { 6911,15}, { 1791,14}, { 3839,13}, { 7679,16}, \
+ { 1023,15}, { 2047,14}, { 4351,13}, { 8703,14}, \
+ { 4479,13}, { 8959,15}, { 2303,14}, { 4991,13}, \
+ { 9983,15}, { 2559,14}, { 5119,15}, { 2815,14}, \
+ { 5887,13}, { 11775,16}, { 1535,15}, { 3071,14}, \
+ { 6143,15}, { 3327,14}, { 6911,15}, { 3839,14}, \
+ { 7679,13}, { 15359,17}, { 1023,16}, { 2047,15}, \
+ { 4095,14}, { 8191,15}, { 4351,14}, { 8959,15}, \
+ { 4863,14}, { 9983,16}, { 2559,15}, { 5887,14}, \
+ { 11775,16}, { 3071,15}, { 6911,16}, { 3583,15}, \
+ { 7679,14}, { 15359,15}, { 7935,14}, { 15871,17}, \
+ { 2047,16}, { 4095,15}, { 8959,16}, { 4607,15}, \
+ { 9983,14}, { 19967,16}, { 5119,15}, { 10239,16}, \
+ { 5631,15}, { 11775,17}, { 3071,16}, { 65536,17}, \
{ 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
{2097152,22}, {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 223
+#define SQR_FFT_TABLE3_SIZE 275
#define SQR_FFT_THRESHOLD 3264
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 39
-#define MULLO_MUL_N_THRESHOLD 8648
-#define SQRLO_BASECASE_THRESHOLD 8
+#define MULLO_DC_THRESHOLD 23
+#define MULLO_MUL_N_THRESHOLD 8907
+#define SQRLO_BASECASE_THRESHOLD 9
#define SQRLO_DC_THRESHOLD 0 /* never mpn_sqrlo_basecase */
#define SQRLO_SQR_THRESHOLD 6440
-#define DC_DIV_QR_THRESHOLD 54
-#define DC_DIVAPPR_Q_THRESHOLD 172
-#define DC_BDIV_QR_THRESHOLD 51
-#define DC_BDIV_Q_THRESHOLD 46
+#define DC_DIV_QR_THRESHOLD 52
+#define DC_DIVAPPR_Q_THRESHOLD 167
+#define DC_BDIV_QR_THRESHOLD 48
+#define DC_BDIV_Q_THRESHOLD 93
#define INV_MULMOD_BNM1_THRESHOLD 38
-#define INV_NEWTON_THRESHOLD 228
-#define INV_APPR_THRESHOLD 172
+#define INV_NEWTON_THRESHOLD 197
+#define INV_APPR_THRESHOLD 179
#define BINV_NEWTON_THRESHOLD 230
-#define REDC_1_TO_REDC_2_THRESHOLD 52
-#define REDC_2_TO_REDC_N_THRESHOLD 0 /* always */
+#define REDC_1_TO_REDC_2_THRESHOLD 32
+#define REDC_2_TO_REDC_N_THRESHOLD 55
-#define MU_DIV_QR_THRESHOLD 1442
+#define MU_DIV_QR_THRESHOLD 1387
#define MU_DIVAPPR_Q_THRESHOLD 1387
-#define MUPI_DIV_QR_THRESHOLD 108
+#define MUPI_DIV_QR_THRESHOLD 92
#define MU_BDIV_QR_THRESHOLD 1142
#define MU_BDIV_Q_THRESHOLD 1334
-#define POWM_SEC_TABLE 1,16,321,386,1167,2245
+#define POWM_SEC_TABLE 1,22,194,434,452
-#define GET_STR_DC_THRESHOLD 14
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 286
-#define SET_STR_PRECOMPUTE_THRESHOLD 1318
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 20
+#define SET_STR_DC_THRESHOLD 438
+#define SET_STR_PRECOMPUTE_THRESHOLD 1254
-#define FAC_DSC_THRESHOLD 402
-#define FAC_ODD_THRESHOLD 24
+#define FAC_DSC_THRESHOLD 189
+#define FAC_ODD_THRESHOLD 26
-#define MATRIX22_STRASSEN_THRESHOLD 16
-#define HGCD_THRESHOLD 109
-#define HGCD_APPR_THRESHOLD 51
+#define MATRIX22_STRASSEN_THRESHOLD 14
+#define HGCD2_DIV1_METHOD 3 /* 2.31% faster than 4 */
+#define HGCD_THRESHOLD 104
+#define HGCD_APPR_THRESHOLD 52
#define HGCD_REDUCE_THRESHOLD 2681
-#define GCD_DC_THRESHOLD 354
-#define GCDEXT_DC_THRESHOLD 330
-#define JACOBI_BASE_METHOD 4
+#define GCD_DC_THRESHOLD 465
+#define GCDEXT_DC_THRESHOLD 283
+#define JACOBI_BASE_METHOD 4 /* 5.81% faster than 1 */
+
+/* Tuneup completed successfully, took 554602 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/hamdist.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/hamdist.asm
index 93e1e5632b2..29e78a32450 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/hamdist.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/hamdist.asm
@@ -1,6 +1,6 @@
-dnl AMD64 mpn_hamdist -- hamming distance.
+dnl AMD64 SSSE3/XOP mpn_hamdist -- hamming distance.
-dnl Copyright 2008, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2010-2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,8 +31,176 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
+C cycles/limb good for cpu?
+C AMD K8,K9 n/a
+C AMD K10 n/a
+C AMD bd1 1.51-2.0 y
+C AMD bd2 1.50-1.9 y
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen n/a
+C AMD bobcat n/a
+C AMD jaguar n/a
+C Intel P4 n/a
+C Intel PNR n/a
+C Intel NHM n/a
+C Intel SBR n/a
+C Intel IBR n/a
+C Intel HWL n/a
+C Intel BWL n/a
+C Intel SKL n/a
+C Intel atom n/a
+C Intel SLM n/a
+C VIA nano n/a
+
+C TODO
+C * We need to use .byte for vpshlb, vpperm, vphaddubq, and all popcnt if we
+C intend to support old systems.
+
+C We use vpshlb and vpperm below, which are XOP extensions to AVX. Some
+C systems, e.g., NetBSD, set OSXSAVE but nevertheless trigger SIGILL for AVX.
+C We fall back to the core2 code.
+ifdef(`GMP_AVX_NOT_REALLY_AVAILABLE',`
+MULFUNC_PROLOGUE(mpn_hamdist)
+include_mpn(`x86_64/core2/hamdist.asm')
+',`
+
+define(`up', `%rdi')
+define(`vp', `%rsi')
+define(`n', `%rdx')
+
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-MULFUNC_PROLOGUE(mpn_hamdist)
-include_mpn(`x86_64/k10/hamdist.asm')
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_hamdist)
+ FUNC_ENTRY(3)
+ cmp $5, n
+ jl L(sma)
+
+ lea L(cnsts)(%rip), %r9
+
+ xor R32(%r10), R32(%r10)
+ test $8, R8(vp)
+ jz L(ali)
+ mov (up), %r8
+ xor (vp), %r8
+ add $8, up
+ add $8, vp
+ dec n
+ popcnt %r8, %r10
+L(ali):
+
+ifdef(`PIC', `define(`OFF1',16) define(`OFF2',32) define(`OFF3',48)',
+ `define(`OFF1',32) define(`OFF2',48) define(`OFF3',64)')
+ movdqa OFF1`'(%r9), %xmm7 C nibble counts table
+ movdqa OFF2`'(%r9), %xmm6 C splat shift counts
+ movdqa OFF3`'(%r9), %xmm5 C masks
+ pxor %xmm4, %xmm4
+ pxor %xmm8, %xmm8 C grand total count
+
+ mov R32(n), R32(%rax)
+ and $6, R32(%rax)
+ lea -64(up,%rax,8), up
+ lea -64(vp,%rax,8), vp
+ifdef(`PIC',`
+ movslq (%r9,%rax,2), %r11
+ add %r9, %r11
+ jmp *%r11
+',`
+ jmp *(%r9,%rax,4)
+')
+
+L(0): add $64, up
+ add $64, vp
+ sub $2, n
+
+ ALIGN(32)
+L(top): lddqu (up), %xmm0
+ pxor (vp), %xmm0
+ .byte 0x8f,0xe9,0x48,0x94,0xc8 C vpshlb %xmm6, %xmm0, %xmm1
+ pand %xmm5, %xmm0
+ pand %xmm5, %xmm1
+ .byte 0x8f,0xe8,0x40,0xa3,0xd7,0x00 C vpperm %xmm0,%xmm7,%xmm7,%xmm2
+ .byte 0x8f,0xe8,0x40,0xa3,0xdf,0x10 C vpperm %xmm1,%xmm7,%xmm7,%xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(6): lddqu 16(up), %xmm0
+ pxor 16(vp), %xmm0
+ .byte 0x8f,0xe9,0x48,0x94,0xc8 C vpshlb %xmm6, %xmm0, %xmm1
+ pand %xmm5, %xmm0
+ pand %xmm5, %xmm1
+ .byte 0x8f,0xe8,0x40,0xa3,0xd7,0x00 C vpperm %xmm0,%xmm7,%xmm7,%xmm2
+ .byte 0x8f,0xe8,0x40,0xa3,0xdf,0x10 C vpperm %xmm1,%xmm7,%xmm7,%xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(4): lddqu 32(up), %xmm0
+ pxor 32(vp), %xmm0
+ .byte 0x8f,0xe9,0x48,0x94,0xc8 C vpshlb %xmm6, %xmm0, %xmm1
+ pand %xmm5, %xmm0
+ pand %xmm5, %xmm1
+ .byte 0x8f,0xe8,0x40,0xa3,0xd7,0x00 C vpperm %xmm0,%xmm7,%xmm7,%xmm2
+ .byte 0x8f,0xe9,0x78,0xd3,0xc4 C vphaddubq %xmm4, %xmm0
+ .byte 0x8f,0xe8,0x40,0xa3,0xe7,0x10 C vpperm %xmm1,%xmm7,%xmm7,%xmm4
+ paddb %xmm2, %xmm3
+ paddb %xmm2, %xmm4
+ paddq %xmm0, %xmm8 C sum to 2 x 64-bit counts
+L(2): mov 48(up), %r8
+ mov 56(up), %r9
+ add $64, up
+ xor 48(vp), %r8
+ xor 56(vp), %r9
+ add $64, vp
+ popcnt %r8, %r8
+ popcnt %r9, %r9
+ add %r8, %r10
+ add %r9, %r10
+ sub $8, n
+ jg L(top)
+
+ test $1, R8(n)
+ jz L(x)
+ mov (up), %r8
+ xor (vp), %r8
+ popcnt %r8, %r8
+ add %r8, %r10
+L(x): .byte 0x8f,0xe9,0x78,0xd3,0xc4 C vphaddubq %xmm4, %xmm0
+ paddq %xmm0, %xmm8
+ pshufd $14, %xmm8, %xmm0
+ paddq %xmm8, %xmm0
+ movq %xmm0, %rax
+ add %r10, %rax
+ FUNC_EXIT()
+ ret
+
+L(sma): mov (up), %r8
+ xor (vp), %r8
+ popcnt %r8, %rax
+ dec n
+ jz L(ed)
+L(tp): mov 8(up), %r8
+ add $8, up
+ xor 8(vp), %r8
+ add $8, vp
+ popcnt %r8, %r8
+ add %r8, %rax
+ dec n
+ jnz L(tp)
+L(ed): FUNC_EXIT()
+ ret
+EPILOGUE()
+DEF_OBJECT(L(cnsts),16,`JUMPTABSECT')
+ JMPENT( L(0), L(cnsts))
+ JMPENT( L(2), L(cnsts))
+ JMPENT( L(4), L(cnsts))
+ JMPENT( L(6), L(cnsts))
+ .byte 0x00,0x01,0x01,0x02,0x01,0x02,0x02,0x03
+ .byte 0x01,0x02,0x02,0x03,0x02,0x03,0x03,0x04
+ .byte -4,-4,-4,-4,-4,-4,-4,-4
+ .byte -4,-4,-4,-4,-4,-4,-4,-4
+ .byte 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f
+ .byte 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f
+END_OBJECT(L(cnsts))
+')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_1.asm
index e59667c0853..2fb097fe612 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_1.asm
@@ -31,16 +31,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9
-C AMD K10
-C AMD bd1 4
-C AMD bobcat
-C Intel P4
-C Intel core2
-C Intel NHM
-C Intel SBR
-C Intel atom
-C VIA nano
+C AMD K8,K9 3.65
+C AMD K10 3.30 3.68
+C AMD bull 4.04 4.29
+C AMD pile 4.33
+C AMD steam
+C AMD excavator
+C AMD bobcat 5.73
+C AMD jaguar 5.87
+C Intel P4 12.5
+C Intel core2 4.38
+C Intel NHM 4.28
+C Intel SBR 2.69
+C Intel IBR 2.55
+C Intel HWL 2.41
+C Intel BWL 2.49
+C Intel SKL 2.50
+C Intel atom 20.3
+C Intel SLM 7.8
+C VIA nano 4.25
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjorn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_2.asm
index 4ed5f305614..85fa7aa33ce 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/mul_2.asm
@@ -33,26 +33,29 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9
-C AMD K10
-C AMD bull 4.36 average, quite fluctuating
-C AMD pile 4.38 slighty fluctuating
-C AMD steam
-C AMD bobcat
-C AMD jaguar
-C Intel P4
-C Intel core
-C Intel NHM
-C Intel SBR
-C Intel IBR
-C Intel HWL
-C Intel BWL
-C Intel atom
+C AMD K8,K9 6.78
+C AMD K10 6.78
+C AMD bd1 8.39 8.65
+C AMD bd2 8.47
+C AMD bd3
+C AMD bd4
+C AMD zen
+C AMD bt1 12.1
+C AMD bt2 11.5
+C Intel P4 24.0
+C Intel PNR 8.14
+C Intel NHM 7.78
+C Intel SBR 6.34
+C Intel IBR 6.15
+C Intel HWL 6.04
+C Intel BWL 4.33
+C Intel SKL 4.41
+C Intel atom 39.5
+C Intel SLM 27.8
C VIA nano
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjorn Granlund.
-C Scheme: genxmul --mul
define(`rp', `%rdi') C rcx
define(`up', `%rsi') C rdx
@@ -176,13 +179,13 @@ L(lo2): add %rax, w3
add $4, n
jnc L(top)
-L(end): mov -8(up,n,8), %rax
+L(end): mov -8(up), %rax
mul v1
- mov w2, -16(rp,n,8)
+ mov w2, -16(rp)
add %rax, w0
- mov w3, -8(rp,n,8)
+ mov w3, -8(rp)
adc %rdx, w1
- mov w0, (rp,n,8)
+ mov w0, (rp)
mov w1, %rax
pop %rbp
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/popcount.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/popcount.asm
index 8f22a715b66..28ce4616cc0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/popcount.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/popcount.asm
@@ -1,6 +1,6 @@
-dnl AMD64 mpn_popcount -- population count.
+dnl AMD64 SSSE3/XOP mpn_popcount -- population count.
-dnl Copyright 2008, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2010-2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,8 +31,161 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
+C cycles/limb good for cpu?
+C AMD K8,K9 n/a
+C AMD K10 n/a
+C AMD bd1 1.27 y
+C AMD bd2 1.24 y
+C AMD bd3 ?
+C AMD bd4 1.22
+C AMD zen n/a
+C AMD bobcat n/a
+C AMD jaguar n/a
+C Intel P4 n/a
+C Intel CNR n/a
+C Intel PNR n/a
+C Intel NHM n/a
+C Intel SBR n/a
+C Intel IBR n/a
+C Intel HWL n/a
+C Intel BWL n/a
+C Intel SKL n/a
+C Intel atom n/a
+C Intel SLM n/a
+C VIA nano n/a
+
+C TODO
+C * We need to use .byte for vpshlb, vpperm, vphaddubq, and all popcnt if we
+C intend to support old systems.
+
+C We use vpshlb and vpperm below, which are XOP extensions to AVX. Some
+C systems, e.g., NetBSD, set OSXSAVE but nevertheless trigger SIGILL for AVX.
+C We fall back to the core2 code.
+ifdef(`GMP_AVX_NOT_REALLY_AVAILABLE',`
+MULFUNC_PROLOGUE(mpn_popcount)
+include_mpn(`x86_64/core2/popcount.asm')
+',`
+
+define(`up', `%rdi')
+define(`n', `%rsi')
+
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-MULFUNC_PROLOGUE(mpn_popcount)
-include_mpn(`x86_64/k10/popcount.asm')
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_popcount)
+ FUNC_ENTRY(3)
+ lea L(cnsts)(%rip), %r9
+
+ifdef(`PIC', `define(`OFF1',32) define(`OFF2',48) define(`OFF3',64)',
+ `define(`OFF1',64) define(`OFF2',80) define(`OFF3',96)')
+ movdqa OFF1`'(%r9), %xmm7 C nibble counts table
+ movdqa OFF2`'(%r9), %xmm6 C splat shift counts
+ movdqa OFF3`'(%r9), %xmm9 C masks
+ pxor %xmm4, %xmm4
+ pxor %xmm5, %xmm5 C 0-reg
+ pxor %xmm8, %xmm8 C grand total count
+
+ xor R32(%rdx), R32(%rdx)
+
+ mov R32(n), R32(%rax)
+ and $7, R32(%rax)
+ifdef(`PIC',`
+ movslq (%r9,%rax,4), %rax
+ add %r9, %rax
+ jmp *%rax
+',`
+ jmp *(%r9,%rax,8)
+')
+
+L(1): .byte 0xf3,0x48,0x0f,0xb8,0x17 C popcnt (up),%rdx
+ add $8, up
+ dec n
+ jnz L(top)
+ mov %rdx, %rax
+ FUNC_EXIT()
+ ret
+
+L(2): add $-48, up
+ jmp L(e2)
+
+L(3): .byte 0xf3,0x48,0x0f,0xb8,0x17 C popcnt (up), %rdx
+ add $-40, up
+ jmp L(e2)
+
+L(4): add $-32, up
+ jmp L(e4)
+
+L(5): .byte 0xf3,0x48,0x0f,0xb8,0x17 C popcnt (up), %rdx
+ add $-24, up
+ jmp L(e4)
+
+L(6): add $-16, up
+ jmp L(e6)
+
+L(7): .byte 0xf3,0x48,0x0f,0xb8,0x17 C popcnt (up), %rdx
+ add $-8, up
+ jmp L(e6)
+
+ ALIGN(32)
+L(top): lddqu (up), %xmm0
+ .byte 0x8f,0xe9,0x48,0x94,0xc8 C vpshlb %xmm6, %xmm0, %xmm1
+ pand %xmm9, %xmm0
+ pand %xmm9, %xmm1
+ .byte 0x8f,0xe8,0x40,0xa3,0xd7,0x00 C vpperm %xmm0,%xmm7,%xmm7,%xmm2
+ .byte 0x8f,0xe8,0x40,0xa3,0xdf,0x10 C vpperm %xmm1, %xmm7, %xmm7, %xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(e6): lddqu 16(up), %xmm0
+ .byte 0x8f,0xe9,0x48,0x94,0xc8 C vpshlb %xmm6, %xmm0, %xmm1
+ pand %xmm9, %xmm0
+ pand %xmm9, %xmm1
+ .byte 0x8f,0xe8,0x40,0xa3,0xd7,0x00 C vpperm %xmm0,%xmm7,%xmm7,%xmm2
+ .byte 0x8f,0xe8,0x40,0xa3,0xdf,0x10 C vpperm %xmm1,%xmm7,%xmm7,%xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(e4): lddqu 32(up), %xmm0
+ .byte 0x8f,0xe9,0x48,0x94,0xc8 C vpshlb %xmm6, %xmm0, %xmm1
+ pand %xmm9, %xmm0
+ pand %xmm9, %xmm1
+ .byte 0x8f,0xe8,0x40,0xa3,0xd7,0x00 C vpperm %xmm0, %xmm7, %xmm7, %xmm2
+ .byte 0x8f,0xe9,0x78,0xd3,0xec C vphaddubq %xmm4, %xmm5
+ .byte 0x8f,0xe8,0x40,0xa3,0xe7,0x10 C vpperm %xmm1,%xmm7,%xmm7,%xmm4
+ paddb %xmm2, %xmm4
+L(e2): popcnt 48(up), %r8
+ popcnt 56(up), %r9
+ add $64, up
+ paddq %xmm5, %xmm8 C sum to 2 x 64-bit counts
+ add %r8, %rdx
+ add %r9, %rdx
+ sub $8, n
+ jg L(top)
+
+ .byte 0x8f,0xe9,0x78,0xd3,0xec C vphaddubq %xmm4, %xmm5
+ paddq %xmm5, %xmm8
+ pshufd $14, %xmm8, %xmm0
+ paddq %xmm8, %xmm0
+ movq %xmm0, %rax
+ add %rdx, %rax
+ FUNC_EXIT()
+ ret
+EPILOGUE()
+DEF_OBJECT(L(cnsts),16,`JUMPTABSECT')
+ JMPENT( L(top), L(cnsts))
+ JMPENT( L(1), L(cnsts))
+ JMPENT( L(2), L(cnsts))
+ JMPENT( L(3), L(cnsts))
+ JMPENT( L(4), L(cnsts))
+ JMPENT( L(5), L(cnsts))
+ JMPENT( L(6), L(cnsts))
+ JMPENT( L(7), L(cnsts))
+ .byte 0x00,0x01,0x01,0x02,0x01,0x02,0x02,0x03
+ .byte 0x01,0x02,0x02,0x03,0x02,0x03,0x03,0x04
+ .byte -4,-4,-4,-4,-4,-4,-4,-4
+ .byte -4,-4,-4,-4,-4,-4,-4,-4
+ .byte 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f
+ .byte 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f
+END_OBJECT(L(cnsts))
+')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_11.asm
new file mode 100644
index 00000000000..b1670770d34
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_11.asm
@@ -0,0 +1,96 @@
+dnl AMD64 mpn_gcd_11 optimised for AMD BD2, BD3, BT2.
+
+dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
+dnl Granlund.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011, 2012, 2017, 2019 Free Software
+dnl 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit (approx)
+C AMD K8,K9 ?
+C AMD K10 ?
+C AMD bd1 5.4
+C AMD bd2 3.72
+C AMD bd3 ?
+C AMD bd4 4.12
+C AMD bt1 9.0
+C AMD bt2 3.97
+C AMD zn1 3.36
+C AMD zn2 3.33
+C Intel P4 ?
+C Intel CNR ?
+C Intel PNR ?
+C Intel NHM ?
+C Intel WSM ?
+C Intel SBR ?
+C Intel IBR ?
+C Intel HWL ?
+C Intel BWL ?
+C Intel SKL ?
+C Intel atom ?
+C Intel SLM ?
+C Intel GLM ?
+C Intel GLM+ ?
+C VIA nano ?
+
+define(`u0', `%rdi')
+define(`v0', `%rsi')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_11)
+ FUNC_ENTRY(2)
+ mov v0, %rdx
+ sub u0, %rdx
+ jz L(end)
+
+ ALIGN(16)
+L(top): rep;bsf %rdx, %rcx C tzcnt!
+ mov u0, %rax
+ sub v0, u0 C u - v
+ cmovc %rdx, u0 C u = |u - v|
+ cmovc %rax, v0 C v = min(u,v)
+ shr R8(%rcx), u0
+ mov v0, %rdx
+ sub u0, %rdx C v - u
+ jnz L(top)
+
+L(end): mov v0, %rax
+ C rax = result
+ C rdx = 0 for the benefit of internal gcd_22 call
+ FUNC_EXIT()
+ ret
+EPILOGUE()
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
new file mode 100644
index 00000000000..a4f30eadda9
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gcd_22.asm
@@ -0,0 +1,142 @@
+dnl AMD64 mpn_gcd_22. Assumes useless bsf, useless shrd, tzcnt, no shlx.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+
+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 bd3 ?
+C AMD bd4 6.7
+C AMD bt1 13.6
+C AMD bt2 8.9
+C AMD zn1 5.7
+C AMD zn2 5.6
+C Intel P4 ?
+C Intel CNR 9.7
+C Intel PNR 9.7
+C Intel NHM 9.4
+C Intel WSM 9.5
+C Intel SBR 10.3
+C Intel IBR ?
+C Intel HWL 8.2
+C Intel BWL 7.4
+C Intel SKL 7.3
+C Intel atom 26.5
+C Intel SLM 17.4
+C Intel GLM 13.4
+C Intel GLM+ 12.4
+C VIA nano ?
+
+
+define(`u1', `%rdi')
+define(`u0', `%rsi')
+define(`v1', `%rdx')
+define(`v0_param', `%rcx')
+
+define(`v0', `%rax')
+define(`cnt', `%rcx')
+
+define(`s0', `%r8')
+define(`s1', `%r9')
+define(`t0', `%r10')
+define(`t1', `%r11')
+
+dnl ABI_SUPPORT(DOS64) C returns mp_double_limb_t in memory
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_22)
+ FUNC_ENTRY(4)
+ mov v0_param, v0
+
+ ALIGN(16)
+L(top): mov v0, t0
+ sub u0, t0
+ jz L(lowz) C jump when low limb result = 0
+ mov v1, t1
+ sbb u1, t1
+
+ rep;bsf t0, cnt C tzcnt!
+ mov u0, s0
+ mov u1, s1
+
+ sub v0, u0
+ sbb v1, u1
+
+L(bck): cmovc t0, u0 C u = |u - v|
+ cmovc t1, u1 C u = |u - v|
+ cmovc s0, v0 C v = min(u,v)
+ cmovc s1, v1 C v = min(u,v)
+
+C Rightshift (u1,,u0) into (u1,,u0)
+L(shr): shr R8(cnt), u0
+ mov u1, t1
+ shr R8(cnt), u1
+ neg cnt
+ shl R8(cnt), t1
+ or t1, u0
+
+ test v1, v1
+ jnz L(top)
+ test u1, u1
+ jnz L(top)
+
+L(gcd_11):
+ mov v0, %rdi
+C mov u0, %rsi
+ TCALL( mpn_gcd_11)
+
+L(lowz):C We come here when v0 - u0 = 0
+ C 1. If v1 - u1 = 0, then gcd is u = v.
+ C 2. Else compute gcd_21({v1,v0}, |u1-v1|)
+ mov v1, t0
+ sub u1, t0
+ je L(end)
+
+ xor t1, t1
+ rep;bsf t0, cnt C tzcnt!
+ mov u0, s0
+ mov u1, s1
+ mov u1, u0
+ xor u1, u1
+ sub v1, u0
+ jmp L(bck)
+
+L(end): C mov v0, %rax
+ C mov v1, %rdx
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gmp-mparam.h
index 5285b9332c6..61573eac7cf 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd2/gmp-mparam.h
@@ -1,7 +1,6 @@
/* AMD bd2 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2010, 2012, 2014, 2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,17 +31,17 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 3200 MHz Piledriver Vishera */
-/* FFT tuning limit = 200 M */
-/* Generated by tuneup.c, 2015-10-07, gcc 4.8 */
+/* 4000-4200 MHz Piledriver Vishera */
+/* FFT tuning limit = 464,626,631 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 17
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 23
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 34
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 12
#define USE_PREINV_DIVREM_1 1 /* native */
#define DIV_QR_1_NORM_THRESHOLD 2
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
@@ -50,207 +49,215 @@ see https://www.gnu.org/licenses/. */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD 22
+#define DIV_1_VS_MUL_1_PERCENT 293
+
#define MUL_TOOM22_THRESHOLD 16
-#define MUL_TOOM33_THRESHOLD 54
-#define MUL_TOOM44_THRESHOLD 154
-#define MUL_TOOM6H_THRESHOLD 274
-#define MUL_TOOM8H_THRESHOLD 454
+#define MUL_TOOM33_THRESHOLD 57
+#define MUL_TOOM44_THRESHOLD 152
+#define MUL_TOOM6H_THRESHOLD 230
+#define MUL_TOOM8H_THRESHOLD 309
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 101
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 103
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 107
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 105
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 146
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 103
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 142
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 22
-#define SQR_TOOM3_THRESHOLD 81
-#define SQR_TOOM4_THRESHOLD 202
-#define SQR_TOOM6_THRESHOLD 303
+#define SQR_TOOM2_THRESHOLD 20
+#define SQR_TOOM3_THRESHOLD 73
+#define SQR_TOOM4_THRESHOLD 200
+#define SQR_TOOM6_THRESHOLD 286
#define SQR_TOOM8_THRESHOLD 430
#define MULMID_TOOM42_THRESHOLD 20
#define MULMOD_BNM1_THRESHOLD 11
-#define SQRMOD_BNM1_THRESHOLD 14
+#define SQRMOD_BNM1_THRESHOLD 13
-#define MUL_FFT_MODF_THRESHOLD 400 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 372 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 400, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 11, 5}, { 23, 6}, { 25, 7}, { 13, 6}, \
- { 27, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
- { 13, 7}, { 27, 8}, { 15, 7}, { 32, 8}, \
- { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { { 372, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
+ { 10, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 21, 8}, \
+ { 11, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
+ { 15, 7}, { 32, 8}, { 17, 7}, { 35, 8}, \
{ 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
{ 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
- { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 83,10}, { 47, 9}, \
- { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
- { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
- { 135,11}, { 79,10}, { 159,11}, { 95,10}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 31, 8}, \
+ { 63, 9}, { 39,10}, { 23, 9}, { 55,11}, \
+ { 15,10}, { 31, 9}, { 71,10}, { 39, 9}, \
+ { 83,10}, { 47, 9}, { 95,10}, { 55,11}, \
+ { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
+ { 31,11}, { 63,10}, { 135,11}, { 79, 8}, \
+ { 639, 9}, { 335,10}, { 175, 9}, { 351,10}, \
{ 191,12}, { 63,11}, { 127,10}, { 255,11}, \
- { 143,10}, { 287, 9}, { 575,10}, { 303,11}, \
- { 159,12}, { 95,11}, { 191,13}, { 63,12}, \
- { 127,11}, { 287,10}, { 575,11}, { 303,12}, \
- { 159,11}, { 319,10}, { 639,11}, { 351,10}, \
- { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
- { 415,12}, { 223,11}, { 447,13}, { 127,12}, \
- { 255,11}, { 543,12}, { 287,11}, { 575,10}, \
- { 1151,11}, { 607,12}, { 319,11}, { 671,12}, \
- { 351,11}, { 703,13}, { 191,12}, { 383,11}, \
- { 767,12}, { 415,11}, { 831,10}, { 1663,12}, \
- { 447,14}, { 127,13}, { 255,12}, { 511,11}, \
- { 1023,12}, { 543,11}, { 1087,10}, { 2175,12}, \
- { 575,11}, { 1151,12}, { 607,11}, { 1215,13}, \
- { 319,12}, { 671,11}, { 1343,12}, { 703,11}, \
- { 1407,12}, { 735,13}, { 383,12}, { 767,11}, \
- { 1535,12}, { 831,11}, { 1663,13}, { 447,12}, \
- { 895,11}, { 1791,12}, { 959,14}, { 255,13}, \
- { 511,12}, { 1087,11}, { 2175,13}, { 575,12}, \
- { 1215,11}, { 2431,10}, { 4863,13}, { 639,12}, \
- { 1343,11}, { 2687,13}, { 703,12}, { 1407,11}, \
- { 2815,14}, { 383,13}, { 767,12}, { 1599,13}, \
- { 831,12}, { 1727,13}, { 959,15}, { 255,14}, \
- { 511,13}, { 1023,12}, { 2047,13}, { 1087,12}, \
- { 2175,13}, { 1215,12}, { 2431,11}, { 4863,14}, \
- { 639,13}, { 1343,12}, { 2687,13}, { 1407,12}, \
- { 2815,13}, { 1471,12}, { 2943,11}, { 5887,14}, \
- { 767,13}, { 1599,12}, { 3199,13}, { 1727,14}, \
- { 895,13}, { 1919,12}, { 3839,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2303,12}, \
- { 4607,13}, { 2431,12}, { 4863,13}, { 2495,14}, \
- { 1279,13}, { 2687,14}, { 1407,13}, { 2943,12}, \
- { 5887,11}, { 11775,15}, { 767,14}, { 1535,13}, \
- { 3199,14}, { 1663,13}, { 3327,12}, { 6655,13}, \
+ { 143,10}, { 287,11}, { 159,12}, { 95,11}, \
+ { 191,13}, { 63,12}, { 127,11}, { 271,10}, \
+ { 543,11}, { 287,12}, { 159,11}, { 351,12}, \
+ { 191,11}, { 383,10}, { 767,11}, { 415,12}, \
+ { 223,11}, { 447,13}, { 127,12}, { 255,11}, \
+ { 511,10}, { 1023,11}, { 543,12}, { 287,11}, \
+ { 575,12}, { 319,11}, { 639,10}, { 1279,12}, \
+ { 351,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 415,11}, { 831,10}, { 1663,12}, { 447,14}, \
+ { 127,13}, { 255,12}, { 511,11}, { 1023,12}, \
+ { 543,11}, { 1087,10}, { 2175,12}, { 575,11}, \
+ { 1151,13}, { 319,12}, { 639,11}, { 1279,12}, \
+ { 671,11}, { 1343,10}, { 2687,12}, { 703,11}, \
+ { 1407,13}, { 383,12}, { 767,11}, { 1535,12}, \
+ { 799,11}, { 1599,12}, { 831,11}, { 1663,13}, \
+ { 447,12}, { 895,14}, { 255,13}, { 511,12}, \
+ { 1087,11}, { 2175,13}, { 575,12}, { 1215,11}, \
+ { 2431,10}, { 4863,13}, { 639,12}, { 1343,11}, \
+ { 2687,13}, { 703,12}, { 1407,11}, { 2815,14}, \
+ { 383,13}, { 767,12}, { 1599,13}, { 831,12}, \
+ { 1727,11}, { 3455,13}, { 895,15}, { 255,14}, \
+ { 511,13}, { 1087,12}, { 2175,13}, { 1215,12}, \
+ { 2431,11}, { 4863,14}, { 639,13}, { 1343,12}, \
+ { 2687,13}, { 1407,12}, { 2815,13}, { 1471,12}, \
+ { 2943,11}, { 5887,14}, { 767,13}, { 1599,12}, \
+ { 3199,13}, { 1727,12}, { 3455,14}, { 895,13}, \
+ { 1791,12}, { 3583,13}, { 1919,12}, { 3839,11}, \
+ { 7679,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2303,12}, { 4607,13}, { 2431,12}, \
+ { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
+ { 2815,12}, { 5631,13}, { 2943,12}, { 5887,15}, \
+ { 767,14}, { 1535,13}, { 3199,14}, { 1663,13}, \
{ 3455,12}, { 6911,14}, { 1791,13}, { 3583,14}, \
- { 1919,13}, { 3839,16}, { 511,15}, { 1023,14}, \
- { 2175,13}, { 4479,14}, { 2303,13}, { 4607,14}, \
- { 2431,13}, { 4863,15}, { 1279,14}, { 2815,13}, \
- { 5631,14}, { 2943,13}, { 5887,12}, { 11775,15}, \
- { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
- { 3839,13}, { 7679,12}, { 15359,16}, { 1023,15}, \
- { 2047,14}, { 4351,13}, { 8703,14}, { 4479,15}, \
- { 2303,14}, { 4991,15}, { 2559,14}, { 5247,15}, \
- { 2815,14}, { 5887,13}, { 11775,16}, { 1535,15}, \
- { 3071,14}, { 6399,15}, { 3327,14}, { 6911,15}, \
- { 3839,14}, { 7679,13}, { 15359,17}, { 1023,16}, \
- { 2047,15}, { 4095,14}, { 8447,15}, { 4351,14}, \
- { 8959,15}, { 4863,16}, { 2559,15}, { 5887,14}, \
- { 11775,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 253
+ { 1919,13}, { 3839,12}, { 7679,16}, { 511,15}, \
+ { 1023,14}, { 2175,13}, { 4479,14}, { 2303,13}, \
+ { 4607,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
+ { 2815,13}, { 5631,14}, { 2943,13}, { 5887,12}, \
+ { 11775,15}, { 1535,14}, { 3455,13}, { 6911,15}, \
+ { 1791,14}, { 3839,13}, { 7679,16}, { 1023,15}, \
+ { 2047,14}, { 4479,13}, { 8959,15}, { 2303,14}, \
+ { 4863,15}, { 2815,14}, { 5887,13}, { 11775,16}, \
+ { 1535,15}, { 3327,14}, { 6911,15}, { 3839,14}, \
+ { 7679,13}, { 15359,17}, { 1023,16}, { 2047,15}, \
+ { 4351,14}, { 8959,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
+ { 3583,15}, { 7679,14}, { 15359,15}, { 7935,14}, \
+ { 15871,17}, { 2047,16}, { 4095,15}, { 8959,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 262
#define MUL_FFT_THRESHOLD 4544
-#define SQR_FFT_MODF_THRESHOLD 368 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 344 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 368, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 20, 8}, \
- { 11, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
+ { { 344, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 11, 5}, { 23, 6}, { 25, 7}, { 13, 6}, \
+ { 27, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
{ 15, 7}, { 31, 8}, { 17, 7}, { 35, 8}, \
{ 19, 7}, { 39, 8}, { 21, 9}, { 11, 8}, \
{ 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
- { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
{ 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 63,10}, { 39, 9}, \
- { 83,10}, { 47, 9}, { 95,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 135,11}, { 79,10}, { 159,11}, { 95,10}, \
- { 191,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 271,11}, { 143,10}, { 287, 9}, \
- { 575,10}, { 303,11}, { 159,12}, { 95,11}, \
- { 191,13}, { 63,12}, { 127,11}, { 255,10}, \
- { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
- { 575,11}, { 303,12}, { 159,11}, { 319,10}, \
- { 671,11}, { 351,12}, { 191,11}, { 383,10}, \
- { 767,11}, { 415,12}, { 223,11}, { 447,13}, \
- { 127,12}, { 255,11}, { 543,12}, { 287,11}, \
- { 575,10}, { 1151,11}, { 607,12}, { 319,11}, \
- { 671,12}, { 351,13}, { 191,12}, { 383,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 47,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 127, 9}, { 255,10}, { 135,11}, { 79,10}, \
+ { 159,11}, { 95,10}, { 191,12}, { 63, 9}, \
+ { 511,10}, { 271,11}, { 143,10}, { 303,11}, \
+ { 159,12}, { 95,11}, { 191,13}, { 63,12}, \
+ { 127,11}, { 287,10}, { 575,11}, { 303,12}, \
+ { 159,11}, { 351,12}, { 191,11}, { 383,12}, \
+ { 223,11}, { 447,13}, { 127,12}, { 255,11}, \
+ { 511,10}, { 1023,12}, { 287,11}, { 575,10}, \
+ { 1151,11}, { 607,12}, { 319,11}, { 639,10}, \
+ { 1279,12}, { 351,13}, { 191,12}, { 383,11}, \
{ 767,12}, { 415,11}, { 831,10}, { 1663,12}, \
{ 447,14}, { 127,13}, { 255,12}, { 511,11}, \
{ 1023,12}, { 543,11}, { 1087,10}, { 2175,12}, \
{ 575,11}, { 1151,12}, { 607,13}, { 319,12}, \
- { 703,11}, { 1407,12}, { 735,13}, { 383,12}, \
+ { 639,11}, { 1279,12}, { 671,11}, { 1343,10}, \
+ { 2687,12}, { 703,11}, { 1407,13}, { 383,12}, \
{ 767,11}, { 1535,12}, { 799,11}, { 1599,12}, \
- { 831,11}, { 1663,13}, { 447,12}, { 895,11}, \
- { 1791,14}, { 255,13}, { 511,12}, { 1087,11}, \
- { 2175,13}, { 575,12}, { 1215,11}, { 2431,10}, \
- { 4863,13}, { 639,12}, { 1279,13}, { 703,12}, \
+ { 831,11}, { 1663,13}, { 447,12}, { 895,14}, \
+ { 255,13}, { 511,12}, { 1087,11}, { 2175,13}, \
+ { 575,12}, { 1215,11}, { 2431,10}, { 4863,13}, \
+ { 639,12}, { 1343,11}, { 2687,13}, { 703,12}, \
{ 1407,14}, { 383,13}, { 767,12}, { 1599,13}, \
- { 831,12}, { 1727,11}, { 3455,13}, { 895,15}, \
- { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1215,12}, { 2431,11}, { 4863,14}, { 639,13}, \
- { 1279,12}, { 2687,13}, { 1471,12}, { 2943,11}, \
- { 5887,14}, { 767,13}, { 1599,12}, { 3199,13}, \
- { 1727,12}, { 3455,14}, { 895,13}, { 1791,12}, \
- { 3583,13}, { 1919,12}, { 3839,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2303,12}, \
- { 4607,13}, { 2431,12}, { 4863,13}, { 2495,14}, \
- { 1279,13}, { 2687,14}, { 1407,13}, { 2943,12}, \
- { 5887,15}, { 767,14}, { 1535,13}, { 3199,14}, \
- { 1663,13}, { 3327,12}, { 6655,13}, { 3455,12}, \
- { 6911,14}, { 1791,13}, { 3583,14}, { 1919,13}, \
- { 3839,16}, { 511,15}, { 1023,14}, { 2175,13}, \
- { 4479,14}, { 2303,13}, { 4607,14}, { 2431,13}, \
- { 4863,15}, { 1279,14}, { 2687,13}, { 5375,14}, \
- { 2815,13}, { 5631,14}, { 2943,13}, { 5887,12}, \
- { 11775,15}, { 1535,14}, { 3327,13}, { 6655,14}, \
- { 3455,13}, { 6911,15}, { 1791,14}, { 3839,13}, \
- { 7679,16}, { 1023,15}, { 2047,14}, { 4479,15}, \
- { 2303,14}, { 4991,13}, { 9983,15}, { 2559,14}, \
- { 5375,15}, { 2815,14}, { 5887,13}, { 11775,16}, \
- { 1535,15}, { 3071,14}, { 6143,15}, { 3327,14}, \
- { 6911,15}, { 3839,14}, { 7679,17}, { 1023,16}, \
- { 2047,15}, { 4351,14}, { 8959,15}, { 4863,14}, \
- { 9983,16}, { 2559,15}, { 5887,14}, { 11775,16}, \
- { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
- {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 252
-#define SQR_FFT_THRESHOLD 3264
+ { 831,12}, { 1727,13}, { 895,15}, { 255,14}, \
+ { 511,13}, { 1087,12}, { 2175,13}, { 1151,12}, \
+ { 2303,13}, { 1215,12}, { 2431,11}, { 4863,14}, \
+ { 639,13}, { 1343,12}, { 2687,13}, { 1407,12}, \
+ { 2815,13}, { 1471,12}, { 2943,11}, { 5887,14}, \
+ { 767,13}, { 1599,12}, { 3199,13}, { 1727,12}, \
+ { 3455,14}, { 895,13}, { 1791,12}, { 3583,13}, \
+ { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2303,12}, { 4607,13}, \
+ { 2431,12}, { 4863,14}, { 1279,13}, { 2687,14}, \
+ { 1407,13}, { 2943,12}, { 5887,11}, { 11775,15}, \
+ { 767,14}, { 1535,13}, { 3199,14}, { 1663,13}, \
+ { 3455,12}, { 6911,14}, { 1791,13}, { 3583,14}, \
+ { 1919,13}, { 3839,16}, { 511,15}, { 1023,14}, \
+ { 2175,13}, { 4479,14}, { 2303,13}, { 4607,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2815,13}, \
+ { 5631,14}, { 2943,13}, { 5887,12}, { 11775,15}, \
+ { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
+ { 3839,13}, { 7679,16}, { 1023,15}, { 2047,14}, \
+ { 4479,13}, { 8959,15}, { 2303,14}, { 4863,15}, \
+ { 2815,14}, { 5887,13}, { 11775,16}, { 1535,15}, \
+ { 3327,14}, { 6911,15}, { 3839,14}, { 7679,17}, \
+ { 1023,16}, { 2047,15}, { 4351,14}, { 8959,15}, \
+ { 4863,16}, { 2559,15}, { 5887,14}, { 11775,16}, \
+ { 3071,15}, { 6911,16}, { 3583,15}, { 7679,14}, \
+ { 15359,15}, { 7935,14}, { 15871,17}, { 2047,16}, \
+ { 4095,15}, { 8959,16}, { 4607,15}, { 9983,14}, \
+ { 19967,16}, { 5119,15}, { 10239,16}, { 5631,15}, \
+ { 11775,17}, { 3071,16}, { 65536,17}, { 131072,18}, \
+ { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+ {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 254
+#define SQR_FFT_THRESHOLD 2880
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 34
+#define MULLO_DC_THRESHOLD 30
#define MULLO_MUL_N_THRESHOLD 8907
#define SQRLO_BASECASE_THRESHOLD 8
-#define SQRLO_DC_THRESHOLD 57
-#define SQRLO_SQR_THRESHOLD 6440
+#define SQRLO_DC_THRESHOLD 53
+#define SQRLO_SQR_THRESHOLD 5724
-#define DC_DIV_QR_THRESHOLD 51
-#define DC_DIVAPPR_Q_THRESHOLD 166
+#define DC_DIV_QR_THRESHOLD 52
+#define DC_DIVAPPR_Q_THRESHOLD 159
#define DC_BDIV_QR_THRESHOLD 44
-#define DC_BDIV_Q_THRESHOLD 76
+#define DC_BDIV_Q_THRESHOLD 79
#define INV_MULMOD_BNM1_THRESHOLD 30
-#define INV_NEWTON_THRESHOLD 204
-#define INV_APPR_THRESHOLD 171
+#define INV_NEWTON_THRESHOLD 172
+#define INV_APPR_THRESHOLD 172
-#define BINV_NEWTON_THRESHOLD 234
-#define REDC_1_TO_REDC_2_THRESHOLD 51
-#define REDC_2_TO_REDC_N_THRESHOLD 0 /* always */
+#define BINV_NEWTON_THRESHOLD 226
+#define REDC_1_TO_REDC_2_THRESHOLD 40
+#define REDC_2_TO_REDC_N_THRESHOLD 51
-#define MU_DIV_QR_THRESHOLD 1258
-#define MU_DIVAPPR_Q_THRESHOLD 1387
-#define MUPI_DIV_QR_THRESHOLD 91
+#define MU_DIV_QR_THRESHOLD 1308
+#define MU_DIVAPPR_Q_THRESHOLD 1258
+#define MUPI_DIV_QR_THRESHOLD 85
#define MU_BDIV_QR_THRESHOLD 1142
-#define MU_BDIV_Q_THRESHOLD 1308
+#define MU_BDIV_Q_THRESHOLD 1210
+
+#define POWM_SEC_TABLE 3,16,129,523,1297
-#define POWM_SEC_TABLE 1,16,139,515,1240
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 20
+#define SET_STR_DC_THRESHOLD 228
+#define SET_STR_PRECOMPUTE_THRESHOLD 1033
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 212
-#define SET_STR_PRECOMPUTE_THRESHOLD 1138
+#define FAC_DSC_THRESHOLD 172
+#define FAC_ODD_THRESHOLD 28
-#define FAC_DSC_THRESHOLD 232
-#define FAC_ODD_THRESHOLD 24
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD2_DIV1_METHOD 1 /* 8.54% faster than 3 */
+#define HGCD_THRESHOLD 108
+#define HGCD_APPR_THRESHOLD 50
+#define HGCD_REDUCE_THRESHOLD 2681
+#define GCD_DC_THRESHOLD 393
+#define GCDEXT_DC_THRESHOLD 278
+#define JACOBI_BASE_METHOD 4 /* 13.69% faster than 1 */
-#define MATRIX22_STRASSEN_THRESHOLD 23
-#define HGCD_THRESHOLD 111
-#define HGCD_APPR_THRESHOLD 105
-#define HGCD_REDUCE_THRESHOLD 2479
-#define GCD_DC_THRESHOLD 403
-#define GCDEXT_DC_THRESHOLD 285
-#define JACOBI_BASE_METHOD 4
+/* Tuneup completed successfully, took 463931 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/aorrlsh_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/aorrlsh_n.asm
new file mode 100644
index 00000000000..ff0d27b4278
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/aorrlsh_n.asm
@@ -0,0 +1,38 @@
+dnl X86-64 mpn_addlsh_n and mpn_rsblsh_n.
+
+dnl Copyright 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 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/.
+
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addlsh_n mpn_rsblsh_n)
+include_mpn(`x86_64/zen/aorrlsh_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gcd_11.asm
new file mode 100644
index 00000000000..4176b85c85f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gcd_11.asm
@@ -0,0 +1,96 @@
+dnl AMD64 mpn_gcd_11 optimised for AMD BD4, ZN1.
+
+dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
+dnl Granlund.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011, 2012, 2017, 2019 Free Software
+dnl 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit (approx)
+C AMD K8,K9 -
+C AMD K10 -
+C AMD bd1 -
+C AMD bd2 -
+C AMD bd3 -
+C AMD bd4 3.73
+C AMD bt1 -
+C AMD bt2 -
+C AMD zn1 3.33
+C AMD zn2 3.48
+C Intel P4 -
+C Intel CNR -
+C Intel PNR -
+C Intel NHM -
+C Intel WSM -
+C Intel SBR -
+C Intel IBR -
+C Intel HWL ?
+C Intel BWL ?
+C Intel SKL ?
+C Intel atom -
+C Intel SLM -
+C Intel GLM -
+C Intel GLM+ -
+C VIA nano -
+
+define(`u0', `%rdi')
+define(`v0', `%rsi')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_11)
+ FUNC_ENTRY(2)
+ mov u0, %rax
+ mov v0, %rdx
+ sub u0, %rdx C v - u
+ jz L(end)
+
+ ALIGN(16)
+L(top): rep;bsf %rdx, %rcx C tzcnt!
+ sub v0, u0 C u - v
+ cmovc %rdx, u0 C u = |u - v|
+ cmovc %rax, v0 C v = min(u,v)
+ shrx( %rcx, u0, %rax)
+ shrx( %rcx, u0, u0)
+ mov v0, %rdx
+ sub %rax, %rdx C v - u
+ jnz L(top)
+
+L(end): C rax = result
+ C rdx = 0 for the benefit of internal gcd_22 call
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gcd_22.asm
new file mode 100644
index 00000000000..5dfd9e3c0b7
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gcd_22.asm
@@ -0,0 +1,37 @@
+dnl AMD64 mpn_gcd_22.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+dnl ABI_SUPPORT(DOS64) C returns mp_double_limb_t in memory
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_gcd_22)
+include_mpn(`x86_64/coreihwl/gcd_22.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gmp-mparam.h
new file mode 100644
index 00000000000..9d2038ceaf9
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd4/gmp-mparam.h
@@ -0,0 +1,266 @@
+/* AMD bd4 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 3800-4200 MHz Excavator/Bristol Ridge */
+/* FFT tuning limit = 461,179,335 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 6
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 17
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 52
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 13
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 25
+
+#define DIV_1_VS_MUL_1_PERCENT 298
+
+#define MUL_TOOM22_THRESHOLD 16
+#define MUL_TOOM33_THRESHOLD 53
+#define MUL_TOOM44_THRESHOLD 142
+#define MUL_TOOM6H_THRESHOLD 206
+#define MUL_TOOM8H_THRESHOLD 292
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 83
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 102
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 97
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 98
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 82
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 20
+#define SQR_TOOM3_THRESHOLD 71
+#define SQR_TOOM4_THRESHOLD 202
+#define SQR_TOOM6_THRESHOLD 298
+#define SQR_TOOM8_THRESHOLD 466
+
+#define MULMID_TOOM42_THRESHOLD 20
+
+#define MULMOD_BNM1_THRESHOLD 11
+#define SQRMOD_BNM1_THRESHOLD 14
+
+#define MUL_FFT_MODF_THRESHOLD 316 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 316, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 21, 7}, { 11, 6}, { 23, 7}, { 12, 6}, \
+ { 25, 7}, { 21, 8}, { 11, 7}, { 24, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 31, 8}, \
+ { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
+ { 33, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 67,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 99,10}, { 55,11}, { 31,10}, { 87,11}, \
+ { 47,10}, { 95, 9}, { 191,10}, { 103,12}, \
+ { 31,11}, { 63,10}, { 127, 9}, { 255,10}, \
+ { 135, 9}, { 271, 5}, { 4351, 6}, { 2303, 7}, \
+ { 1215, 8}, { 639,10}, { 175,11}, { 95,10}, \
+ { 191, 9}, { 383,10}, { 207, 9}, { 415,11}, \
+ { 111,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 271, 9}, { 543,11}, { 143,10}, \
+ { 287, 9}, { 575,10}, { 303,11}, { 159,10}, \
+ { 319, 9}, { 639,11}, { 175,12}, { 95,11}, \
+ { 191,10}, { 383,11}, { 207,10}, { 415, 9}, \
+ { 831,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 303,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 351,12}, { 191,11}, { 383,10}, \
+ { 767,11}, { 415,10}, { 831,12}, { 223,11}, \
+ { 447,10}, { 895,11}, { 479,13}, { 127,12}, \
+ { 255,11}, { 543,12}, { 287,11}, { 607,12}, \
+ { 319,11}, { 639,12}, { 351,13}, { 191,12}, \
+ { 383,11}, { 767,12}, { 415,11}, { 831,12}, \
+ { 447,11}, { 895,12}, { 479,14}, { 127,13}, \
+ { 255,12}, { 543,11}, { 1087,12}, { 607,13}, \
+ { 319,12}, { 671,11}, { 1343,10}, { 2687,12}, \
+ { 703,13}, { 383,12}, { 767,11}, { 1535,12}, \
+ { 831,13}, { 447,12}, { 895,11}, { 1791,12}, \
+ { 959,14}, { 255,13}, { 511,12}, { 1087,13}, \
+ { 575,12}, { 1151,11}, { 2303,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1343,11}, { 2687,13}, \
+ { 703,14}, { 383,13}, { 767,12}, { 1535,13}, \
+ { 831,12}, { 1663,13}, { 959,15}, { 255,14}, \
+ { 511,13}, { 1087,12}, { 2175,13}, { 1151,12}, \
+ { 2303,13}, { 1215,12}, { 2431,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1407,12}, { 2815,13}, \
+ { 1471,14}, { 767,13}, { 1535,12}, { 3071,13}, \
+ { 1663,14}, { 895,13}, { 1791,12}, { 3583,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2303,12}, { 4607,13}, { 2431,12}, \
+ { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
+ { 2815,15}, { 767,14}, { 1535,13}, { 3071,14}, \
+ { 1663,13}, { 3455,12}, { 6911,14}, { 1791,13}, \
+ { 3583,14}, { 1919,16}, { 511,15}, { 1023,14}, \
+ { 2303,13}, { 4607,14}, { 2431,13}, { 4863,15}, \
+ { 1279,14}, { 2943,13}, { 5887,15}, { 1535,14}, \
+ { 3455,13}, { 6911,15}, { 1791,14}, { 3839,13}, \
+ { 7679,16}, { 1023,15}, { 2047,14}, { 4351,15}, \
+ { 2303,14}, { 4863,15}, { 2815,14}, { 5887,16}, \
+ { 1535,15}, { 3071,14}, { 6143,15}, { 3327,14}, \
+ { 6911,15}, { 3839,14}, { 7679,17}, { 1023,16}, \
+ { 2047,15}, { 4863,16}, { 2559,15}, { 5887,14}, \
+ { 11775,16}, { 3071,15}, { 6911,16}, { 3583,15}, \
+ { 7679,17}, { 2047,16}, { 4095,15}, { 8191,16}, \
+ { 4607,15}, { 9983,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 253
+#define MUL_FFT_THRESHOLD 4224
+
+#define SQR_FFT_MODF_THRESHOLD 300 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 300, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 23, 7}, { 12, 6}, { 25, 7}, { 21, 8}, \
+ { 11, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
+ { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
+ { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 63,10}, { 39, 9}, \
+ { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
+ { 31,10}, { 79,11}, { 47,10}, { 95, 9}, \
+ { 191, 8}, { 383,10}, { 103,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255, 8}, { 511, 9}, \
+ { 271, 8}, { 543,11}, { 79,10}, { 159, 9}, \
+ { 319, 8}, { 639,10}, { 175,11}, { 95,10}, \
+ { 191, 9}, { 383, 5}, { 6399, 6}, { 3327, 7}, \
+ { 1727, 6}, { 3455, 7}, { 1791,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
+ { 287, 9}, { 575,10}, { 303,11}, { 159,10}, \
+ { 319, 9}, { 639,11}, { 175,10}, { 351,12}, \
+ { 95,11}, { 191,10}, { 383,11}, { 207,10}, \
+ { 415, 9}, { 831,13}, { 63,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 303,10}, { 607,12}, { 159,11}, \
+ { 319,10}, { 639,11}, { 351,10}, { 703,12}, \
+ { 191,11}, { 383,10}, { 767,11}, { 415,10}, \
+ { 831,12}, { 223,11}, { 447,10}, { 895,11}, \
+ { 479,12}, { 255,11}, { 511,10}, { 1023,11}, \
+ { 543,12}, { 287,11}, { 575,10}, { 1151,11}, \
+ { 607,12}, { 319,11}, { 639,12}, { 351,11}, \
+ { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 415,11}, { 831,12}, { 447,11}, { 895,12}, \
+ { 479,13}, { 255,12}, { 511,11}, { 1023,12}, \
+ { 543,11}, { 1087,12}, { 575,11}, { 1151,12}, \
+ { 607,13}, { 319,12}, { 639,11}, { 1279,12}, \
+ { 671,11}, { 1343,12}, { 703,13}, { 383,12}, \
+ { 767,11}, { 1535,12}, { 831,11}, { 1663,13}, \
+ { 447,12}, { 959,14}, { 255,13}, { 511,12}, \
+ { 1087,13}, { 575,12}, { 1151,11}, { 2303,12}, \
+ { 1215,11}, { 2431,13}, { 639,12}, { 1343,13}, \
+ { 703,14}, { 383,13}, { 767,12}, { 1535,13}, \
+ { 831,12}, { 1663,13}, { 895,12}, { 1791,13}, \
+ { 959,15}, { 255,14}, { 511,13}, { 1023,12}, \
+ { 2047,13}, { 1087,12}, { 2175,13}, { 1151,12}, \
+ { 2303,13}, { 1215,12}, { 2431,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1407,12}, { 2815,13}, \
+ { 1471,14}, { 767,13}, { 1599,12}, { 3199,13}, \
+ { 1663,14}, { 895,13}, { 1791,12}, { 3583,15}, \
+ { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
+ { 2303,12}, { 4607,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,13}, { 2815,15}, \
+ { 767,14}, { 1535,13}, { 3199,14}, { 1663,13}, \
+ { 3455,14}, { 1791,13}, { 3583,14}, { 1919,16}, \
+ { 511,15}, { 1023,14}, { 2303,13}, { 4607,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2815,13}, \
+ { 5631,14}, { 2943,13}, { 5887,15}, { 1535,14}, \
+ { 3455,15}, { 1791,14}, { 3583,13}, { 7167,14}, \
+ { 3839,13}, { 7679,16}, { 1023,15}, { 2047,14}, \
+ { 4223,15}, { 2303,14}, { 4863,15}, { 2815,14}, \
+ { 5887,16}, { 1535,15}, { 3071,14}, { 6143,15}, \
+ { 3327,14}, { 6911,15}, { 3583,14}, { 7167,15}, \
+ { 3839,14}, { 7679,17}, { 1023,16}, { 2047,15}, \
+ { 4095,14}, { 8191,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
+ { 3583,15}, { 7679,14}, { 15359,17}, { 2047,16}, \
+ { 4095,15}, { 8447,16}, { 4607,15}, { 9983,16}, \
+ { 5119,15}, { 10239,16}, { 5631,15}, { 11775,17}, \
+ { 3071,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 273
+#define SQR_FFT_THRESHOLD 2752
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 43
+#define MULLO_MUL_N_THRESHOLD 8397
+#define SQRLO_BASECASE_THRESHOLD 6
+#define SQRLO_DC_THRESHOLD 54
+#define SQRLO_SQR_THRESHOLD 5397
+
+#define DC_DIV_QR_THRESHOLD 39
+#define DC_DIVAPPR_Q_THRESHOLD 165
+#define DC_BDIV_QR_THRESHOLD 39
+#define DC_BDIV_Q_THRESHOLD 76
+
+#define INV_MULMOD_BNM1_THRESHOLD 30
+#define INV_NEWTON_THRESHOLD 177
+#define INV_APPR_THRESHOLD 155
+
+#define BINV_NEWTON_THRESHOLD 230
+#define REDC_1_TO_REDC_2_THRESHOLD 28
+#define REDC_2_TO_REDC_N_THRESHOLD 43
+
+#define MU_DIV_QR_THRESHOLD 1142
+#define MU_DIVAPPR_Q_THRESHOLD 1142
+#define MUPI_DIV_QR_THRESHOLD 66
+#define MU_BDIV_QR_THRESHOLD 998
+#define MU_BDIV_Q_THRESHOLD 1142
+
+#define POWM_SEC_TABLE 1,16,175,269,839,1420
+
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 19
+#define SET_STR_DC_THRESHOLD 552
+#define SET_STR_PRECOMPUTE_THRESHOLD 1038
+
+#define FAC_DSC_THRESHOLD 151
+#define FAC_ODD_THRESHOLD 23
+
+#define MATRIX22_STRASSEN_THRESHOLD 17
+#define HGCD2_DIV1_METHOD 1 /* 8.11% faster than 3 */
+#define HGCD_THRESHOLD 87
+#define HGCD_APPR_THRESHOLD 96
+#define HGCD_REDUCE_THRESHOLD 2121
+#define GCD_DC_THRESHOLD 327
+#define GCDEXT_DC_THRESHOLD 241
+#define JACOBI_BASE_METHOD 4 /* 21.40% faster than 1 */
+
+/* Tuneup completed successfully, took 431056 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bdiv_q_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bdiv_q_1.asm
index 02eacbe6a8b..85538c9bbf9 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bdiv_q_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bdiv_q_1.asm
@@ -1,8 +1,7 @@
-dnl AMD64 mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- schoolbook Hensel division by
-dnl 1-limb divisor, returning quotient only.
+dnl AMD64 mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- Hensel division by 1-limb divisor.
-dnl Copyright 2001, 2002, 2004-2006, 2009, 2011, 2012 Free Software
-dnl Foundation, Inc.
+dnl Copyright 2001, 2002, 2004-2006, 2010-2012, 2017 Free Software Foundation,
+dnl Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -32,16 +31,27 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-
-C cycles/limb
-C AMD K8,K9 10
-C AMD K10 10
-C Intel P4 33
-C Intel core2 13.25
-C Intel corei 14
-C Intel atom 42
-C VIA nano ?
-
+C cycles/limb cycles/limb
+C norm unorm
+C AMD K8,K9 11 11
+C AMD K10 11 11
+C AMD bull 13.5 14
+C AMD pile 14 15
+C AMD steam
+C AMD excavator
+C AMD bobcat 14 14
+C AMD jaguar 14.5 15
+C Intel P4 33 33
+C Intel core2 13.5 13.25
+C Intel NHM 14 14
+C Intel SBR 8 8.25
+C Intel IBR 7.75 7.85
+C Intel HWL 8 8
+C Intel BWL 8 8
+C Intel SKL 8 8
+C Intel atom 34 36
+C Intel SLM 13.7 13.5
+C VIA nano 19.25 19.25 needs re-measuring
C INPUT PARAMETERS
define(`rp', `%rdi')
@@ -66,7 +76,7 @@ PROLOGUE(mpn_bdiv_q_1)
mov %rdx, %r10
bt $0, R32(%rax)
- jnc L(evn) C skip bsfq unless divisor is even
+ jnc L(evn) C skip bsf unless divisor is even
L(odd): mov %rax, %rbx
shr R32(%rax)
@@ -93,7 +103,7 @@ L(odd): mov %rax, %rbx
imul %rbx, %rax C inv*inv*d
sub %rax, %r8 C inv = 2*inv - inv*inv*d, 64 bits
- jmp L(com)
+ jmp L(pi1)
L(evn): bsf %rax, %rcx
shr R8(%rcx), %rax
@@ -110,50 +120,68 @@ IFDOS(` mov 64(%rsp), %r9 ')
mov %rdx, %r10 C n
mov %r9, %rcx C ncnt
-L(com): mov (up), %rax C up[0]
+L(pi1): mov (up), %rax C up[0]
dec %r10
jz L(one)
- mov 8(up), %rdx C up[1]
- lea (up,%r10,8), up C up end
+ lea 8(up,%r10,8), up C up end
lea (rp,%r10,8), rp C rp end
neg %r10 C -n
- shrd R8(%rcx), %rdx, %rax
-
+ test R32(%rcx), R32(%rcx)
+ jnz L(unorm) C branch if count != 0
xor R32(%rbx), R32(%rbx)
- jmp L(ent)
+ jmp L(nent)
ALIGN(8)
-L(top):
- C rax q
- C rbx carry bit, 0 or 1
- C rcx ncnt
- C rdx
- C r10 counter, limbs, negative
-
- mul %r11 C carry limb in rdx
- mov (up,%r10,8), %rax
- mov 8(up,%r10,8), %r9
- shrd R8(%rcx), %r9, %rax
- nop
+L(ntop):mul %r11 C carry limb in rdx 0 10
+ mov -8(up,%r10,8), %rax C
sub %rbx, %rax C apply carry bit
- setc R8(%rbx)
- sub %rdx, %rax C apply carry limb
- adc $0, %rbx
-L(ent): imul %r8, %rax
- mov %rax, (rp,%r10,8)
- inc %r10
- jnz L(top)
-
- mul %r11 C carry limb in rdx
- mov (up), %rax C up high limb
- shr R8(%rcx), %rax
+ setc R8(%rbx) C
+ sub %rdx, %rax C apply carry limb 5
+ adc $0, R32(%rbx) C 6
+L(nent):imul %r8, %rax C 6
+ mov %rax, (rp,%r10,8) C
+ inc %r10 C
+ jnz L(ntop)
+
+ mov -8(up), %r9 C up high limb
+ jmp L(com)
+
+L(unorm):
+ mov (up,%r10,8), %r9 C up[1]
+ shr R8(%rcx), %rax C
+ neg R32(%rcx)
+ shl R8(%rcx), %r9 C
+ neg R32(%rcx)
+ or %r9, %rax
+ xor R32(%rbx), R32(%rbx)
+ jmp L(uent)
+
+ ALIGN(8)
+L(utop):mul %r11 C carry limb in rdx 0 10
+ mov (up,%r10,8), %rax C
+ shl R8(%rcx), %rax C
+ neg R32(%rcx)
+ or %r9, %rax
sub %rbx, %rax C apply carry bit
- sub %rdx, %rax C apply carry limb
- imul %r8, %rax
- mov %rax, (rp)
+ setc R8(%rbx) C
+ sub %rdx, %rax C apply carry limb 5
+ adc $0, R32(%rbx) C 6
+L(uent):imul %r8, %rax C 6
+ mov (up,%r10,8), %r9 C
+ shr R8(%rcx), %r9 C
+ neg R32(%rcx)
+ mov %rax, (rp,%r10,8) C
+ inc %r10 C
+ jnz L(utop)
+
+L(com): mul %r11 C carry limb in rdx
+ sub %rbx, %r9 C apply carry bit
+ sub %rdx, %r9 C apply carry limb
+ imul %r8, %r9
+ mov %r9, (rp)
pop %rbx
FUNC_EXIT()
ret
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/gmp-mparam.h
deleted file mode 100644
index 9511a8c6dd5..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/gmp-mparam.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* AMD Bobcat gmp-mparam.h -- Compiler/machine parameter header file.
-
-Copyright 1991, 1993, 1994, 2000-2012, 2014, 2015 Free Software Foundation,
-Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-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/. */
-
-#define GMP_LIMB_BITS 64
-#define GMP_LIMB_BYTES 8
-
-/* Disable use of slow functions. FIXME: We should disable lib inclusion. */
-#undef HAVE_NATIVE_mpn_mul_2
-#undef HAVE_NATIVE_mpn_addmul_2
-
-/* 1600 MHz AMD Bobcat Zacate E-350 */
-/* FFT tuning limit = 50 M */
-/* Generated by tuneup.c, 2015-10-06, gcc 4.5 */
-
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 30
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 48
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
-#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1_NORM_THRESHOLD 1
-#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 17
-
-#define MUL_TOOM22_THRESHOLD 24
-#define MUL_TOOM33_THRESHOLD 35
-#define MUL_TOOM44_THRESHOLD 268
-#define MUL_TOOM6H_THRESHOLD 393
-#define MUL_TOOM8H_THRESHOLD 527
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 69
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 190
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 178
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 196
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 100
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 26
-#define SQR_TOOM3_THRESHOLD 93
-#define SQR_TOOM4_THRESHOLD 378
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 454
-
-#define MULMID_TOOM42_THRESHOLD 26
-
-#define MULMOD_BNM1_THRESHOLD 11
-#define SQRMOD_BNM1_THRESHOLD 13
-
-#define MUL_FFT_MODF_THRESHOLD 400 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 400, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 10, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 21, 7}, { 11, 6}, { 23, 7}, { 21, 8}, \
- { 11, 7}, { 24, 8}, { 13, 7}, { 27, 8}, \
- { 15, 7}, { 31, 8}, { 17, 7}, { 36, 8}, \
- { 19, 7}, { 39, 8}, { 21, 9}, { 11, 8}, \
- { 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
- { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
- { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 83,10}, { 47, 9}, \
- { 99,10}, { 55,11}, { 31,10}, { 71, 9}, \
- { 143,10}, { 79,11}, { 47,10}, { 103,12}, \
- { 31,11}, { 63,10}, { 143,11}, { 79,10}, \
- { 167,11}, { 95,10}, { 191, 9}, { 383,11}, \
- { 111,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,11}, { 143,10}, { 287,11}, { 159,10}, \
- { 319,12}, { 95,11}, { 191,10}, { 383,11}, \
- { 207,10}, { 415,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
- { 287,12}, { 159,11}, { 319,10}, { 639,11}, \
- { 351,10}, { 703,11}, { 367,12}, { 191,11}, \
- { 415,12}, { 223,11}, { 447,13}, { 127,12}, \
- { 255,11}, { 543,12}, { 287,11}, { 607,12}, \
- { 319,11}, { 639,12}, { 351,11}, { 703,13}, \
- { 191,12}, { 383,11}, { 767,12}, { 415,11}, \
- { 831,12}, { 447,14}, { 127,13}, { 255,12}, \
- { 607,13}, { 319,12}, { 703,13}, { 383,12}, \
- { 831,13}, { 447,12}, { 895,14}, { 255,13}, \
- { 511,12}, { 1023,13}, { 575,12}, { 1151,13}, \
- { 703,14}, { 383,13}, { 831,12}, { 1663,13}, \
- { 895,15}, { 255,14}, { 511,13}, { 1087,12}, \
- { 2175,13}, { 1151,14}, { 639,13}, { 1343,12}, \
- { 2687,13}, { 1407,14}, { 767,13}, { 1535,12}, \
- { 3071,13}, { 1663,14}, { 895,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
- { 4863,14}, { 1279,13}, { 2687,14}, { 1407,15}, \
- { 767,14}, { 1535,13}, { 3071,14}, { 1663,13}, \
- { 3327,16}, { 511,15}, { 1023,14}, { 2175,13}, \
- { 4479,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
- { 2943,13}, { 5887,15}, { 32768,16}, { 65536,17}, \
- { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
- {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 171
-#define MUL_FFT_THRESHOLD 5504
-
-#define SQR_FFT_MODF_THRESHOLD 376 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 376, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 11, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
- { 21, 7}, { 11, 6}, { 25, 7}, { 13, 6}, \
- { 27, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
- { 15, 7}, { 31, 8}, { 17, 7}, { 35, 8}, \
- { 19, 7}, { 39, 8}, { 27, 9}, { 15, 8}, \
- { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
- { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 83,10}, { 47, 9}, \
- { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
- { 47,10}, { 103,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 135, 9}, { 271,11}, \
- { 79,10}, { 159, 9}, { 319,11}, { 95,10}, \
- { 191, 9}, { 383,11}, { 111,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271,11}, \
- { 143,10}, { 287, 9}, { 575,10}, { 303,11}, \
- { 159,10}, { 319,12}, { 95,11}, { 191,10}, \
- { 383,11}, { 207,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
- { 287,10}, { 575,11}, { 303,12}, { 159,11}, \
- { 319,10}, { 639,11}, { 335,10}, { 671,11}, \
- { 351,10}, { 703,12}, { 191,11}, { 415,12}, \
- { 223,11}, { 479,13}, { 127,12}, { 255,11}, \
- { 543,12}, { 287,11}, { 607,12}, { 319,11}, \
- { 671,12}, { 351,11}, { 703,13}, { 191,12}, \
- { 383,11}, { 767,12}, { 415,11}, { 831,12}, \
- { 479,14}, { 127,13}, { 255,12}, { 607,13}, \
- { 319,12}, { 703,13}, { 383,12}, { 831,13}, \
- { 447,12}, { 895,14}, { 255,13}, { 511,12}, \
- { 1023,13}, { 575,12}, { 1151,13}, { 703,14}, \
- { 383,13}, { 831,12}, { 1663,13}, { 895,15}, \
- { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1151,14}, { 639,13}, { 1343,12}, { 2687,14}, \
- { 767,13}, { 1599,12}, { 3199,13}, { 1663,14}, \
- { 895,15}, { 511,14}, { 1023,13}, { 2175,14}, \
- { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
- { 2687,14}, { 1407,15}, { 767,14}, { 1535,13}, \
- { 3199,14}, { 1663,16}, { 511,15}, { 1023,14}, \
- { 2175,13}, { 4351,14}, { 2431,13}, { 4863,15}, \
- { 1279,14}, { 2943,13}, { 5887,15}, { 32768,16}, \
- { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
- {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 172
-#define SQR_FFT_THRESHOLD 3712
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 43
-#define MULLO_MUL_N_THRESHOLD 10950
-#define SQRLO_BASECASE_THRESHOLD 9
-#define SQRLO_DC_THRESHOLD 65
-#define SQRLO_SQR_THRESHOLD 7246
-
-#define DC_DIV_QR_THRESHOLD 59
-#define DC_DIVAPPR_Q_THRESHOLD 202
-#define DC_BDIV_QR_THRESHOLD 59
-#define DC_BDIV_Q_THRESHOLD 141
-
-#define INV_MULMOD_BNM1_THRESHOLD 46
-#define INV_NEWTON_THRESHOLD 242
-#define INV_APPR_THRESHOLD 236
-
-#define BINV_NEWTON_THRESHOLD 242
-#define REDC_1_TO_REDC_2_THRESHOLD 68
-#define REDC_2_TO_REDC_N_THRESHOLD 0 /* always */
-
-#define MU_DIV_QR_THRESHOLD 1499
-#define MU_DIVAPPR_Q_THRESHOLD 1499
-#define MUPI_DIV_QR_THRESHOLD 116
-#define MU_BDIV_QR_THRESHOLD 1334
-#define MU_BDIV_Q_THRESHOLD 1470
-
-#define POWM_SEC_TABLE 1,22,194,386,452,1259
-
-#define GET_STR_DC_THRESHOLD 16
-#define GET_STR_PRECOMPUTE_THRESHOLD 26
-#define SET_STR_DC_THRESHOLD 306
-#define SET_STR_PRECOMPUTE_THRESHOLD 1105
-
-#define FAC_DSC_THRESHOLD 802
-#define FAC_ODD_THRESHOLD 44
-
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 90
-#define HGCD_APPR_THRESHOLD 51
-#define HGCD_REDUCE_THRESHOLD 3014
-#define GCD_DC_THRESHOLD 492
-#define GCDEXT_DC_THRESHOLD 303
-#define JACOBI_BASE_METHOD 2
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/aors_n.asm
index 22287b85589..9b6b5c77bd5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/aors_n.asm
@@ -30,17 +30,26 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C AMD K8,K9
-C AMD K10
-C AMD bd1
-C AMD bobcat 2.28
-C Intel P4
-C Intel core2
-C Intel NHM
-C Intel SBR
-C Intel IBR
-C Intel atom
+C cycles/limb
+C AMD K8,K9 1.77
+C AMD K10 1.76\1.82
+C AMD bd1 1.67\2.12
+C AMD bd2 1.62\1.82
+C AMD bd3
+C AMD bd4 1.55\2.2
+C AMD zen
+C AMD bt1 2.54
+C AMD bt2 2
+C Intel P4 11
+C Intel PNR 4.76
+C Intel NHM 5.27
+C Intel SBR 2
+C Intel IBR 1.94
+C Intel HWL 1.63
+C Intel BWL 1.51
+C Intel SKL 1.51
+C Intel atom 3.56
+C Intel SLM 4
C VIA nano
C The loop of this code is the result of running a code generation and
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/aorsmul_1.asm
index 415a17cb7ff..41e1d8abaf4 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/aorsmul_1.asm
@@ -1,6 +1,7 @@
-dnl AMD64 mpn_addmul_1 and mpn_submul_1 optimised for AMD bobcat.
+dnl AMD64 mpn_addmul_1 and mpn_submul_1 optimised for AMD bt1/bt2.
-dnl Copyright 2003-2005, 2007, 2008, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2003-2005, 2007, 2008, 2011, 2012, 2018-2019 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,16 +32,29 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9 4.5
-C AMD K10 4.5
-C AMD bd1 4.75
-C AMD bobcat 5
-C Intel P4 17.7
-C Intel core2 5.5
-C Intel NHM 5.43
-C Intel SBR 3.92
-C Intel atom 23
-C VIA nano 5.63
+C AMD K8,K9 4.52 old measurement
+C AMD K10 4.51 old measurement
+C AMD bd1 4.66 old measurement
+C AMD bd2 4.57 old measurement
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen ?
+C AMD bt1 5.04
+C AMD bt2 5.07
+C Intel P4 16.8 18.6 old measurement
+C Intel PNR 5.59 old measurement
+C Intel NHM 5.39 old measurement
+C Intel SBR 3.93 old measurement
+C Intel IBR 3.59 old measurement
+C Intel HWL 3.61 old measurement
+C Intel BWL 2.76 old measurement
+C Intel SKL 2.77 old measurement
+C Intel atom 23 old measurement
+C Intel SLM 8 old measurement
+C Intel GLM ?
+C VIA nano 5.63 old measurement
+
+C The ALIGNment here might look completely ad-hoc. They are not.
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
@@ -82,7 +96,7 @@ IFDOS(` define(`w3', `%r11') ') dnl
ASM_START()
TEXT
- ALIGN(16)
+ ALIGN(64)
PROLOGUE(func)
IFDOS(` push %rsi ')
IFDOS(` push %rdi ')
@@ -91,91 +105,85 @@ IFDOS(` mov %rdx, %rsi ')
push %rbx
mov (up), %rax
- lea -16(rp,n_param,8), rp
- lea -16(up,n_param,8), up
-
+ lea (rp,n_param,8), rp
+ lea (up,n_param,8), up
mov n_param, n
- and $3, R32(n_param)
- jz L(b0)
- cmp $2, R32(n_param)
- ja L(b3)
- jz L(b2)
-
-L(b1): mul v0
- cmp $1, n
- jz L(n1)
- mov %rax, w2
- mov %rdx, w3
+
+ test $1, R8(n_param)
+ jne L(bx1)
+
+L(bx0): mul v0
neg n
- add $3, n
- jmp L(L1)
-L(n1): ADDSUB %rax, 8(rp)
- adc $0, %rdx
- mov %rdx, %rax
- pop %rbx
-IFDOS(` pop %rdi ')
-IFDOS(` pop %rsi ')
- ret
+ mov %rax, w0
+ mov %rdx, w1
+ test $2, R8(n)
+ jne L(L2)
-L(b3): mul v0
- mov %rax, w2
+L(b00): add $2, n
+ jmp L(L0)
+
+ ALIGN(16)
+L(bx1): mul v0
+ test $2, R8(n)
+ je L(b01)
+
+L(b11): mov %rax, w2
mov %rdx, w3
neg n
inc n
jmp L(L3)
-L(b0): mul v0
- mov %rax, w0
- mov %rdx, w1
- neg n
- add $2, n
- jmp L(L0)
-
-L(b2): mul v0
- mov %rax, w0
- mov %rdx, w1
+ ALIGN(16)
+L(b01): sub $3, n
+ jc L(n1)
+ mov %rax, w2
+ mov %rdx, w3
neg n
- jmp L(L2)
ALIGN(16)
-L(top): ADDSUB w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
-L(L1): mov 0(up,n,8), %rax
+L(top): mov -16(up,n,8), %rax
mul v0
mov %rax, w0
mov %rdx, w1
- ADDSUB w2, -8(rp,n,8)
+ ADDSUB w2, -24(rp,n,8)
adc w3, w0
adc $0, w1
-L(L0): mov 8(up,n,8), %rax
+L(L0): mov -8(up,n,8), %rax
mul v0
mov %rax, w2
mov %rdx, w3
- ADDSUB w0, 0(rp,n,8)
+ ADDSUB w0, -16(rp,n,8)
adc w1, w2
adc $0, w3
-L(L3): mov 16(up,n,8), %rax
+L(L3): mov (up,n,8), %rax
mul v0
mov %rax, w0
mov %rdx, w1
- ADDSUB w2, 8(rp,n,8)
+ ADDSUB w2, -8(rp,n,8)
adc w3, w0
adc $0, w1
-L(L2): mov 24(up,n,8), %rax
+L(L2): mov 8(up,n,8), %rax
mul v0
mov %rax, w2
mov %rdx, w3
+ ADDSUB w0, (rp,n,8)
+ adc w1, w2
+ adc $0, w3
add $4, n
js L(top)
-L(end): ADDSUB w0, (rp)
- adc w1, w2
- adc $0, w3
- ADDSUB w2, 8(rp)
- adc $0, w3
- mov w3, %rax
+L(end): xor R32(%rax), R32(%rax)
+ ADDSUB w2, -8(rp)
+ adc w3, %rax
+ pop %rbx
+IFDOS(` pop %rdi ')
+IFDOS(` pop %rsi ')
+ ret
+ ALIGN(32)
+L(n1): ADDSUB %rax, -8(rp)
+ mov $0, R32(%rax)
+ adc %rdx, %rax
pop %rbx
IFDOS(` pop %rdi ')
IFDOS(` pop %rsi ')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/copyd.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/copyd.asm
index 877714e903c..877714e903c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/copyd.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/copyd.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/copyi.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/copyi.asm
index ee0f578652b..ee0f578652b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/copyi.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/copyi.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gcd_11.asm
new file mode 100644
index 00000000000..ef53392506c
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gcd_11.asm
@@ -0,0 +1,119 @@
+dnl AMD64 mpn_gcd_11 -- 1 x 1 gcd.
+
+dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
+dnl Granlund.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011, 2012, 2017 Free Software
+dnl 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit
+C AMD K8,K9 ?
+C AMD K10 ?
+C AMD bd1 ?
+C AMD bd2 ?
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD bt1 5.4
+C AMD bt2 ?
+C AMD zn1 ?
+C AMD zn2 ?
+C Intel P4 ?
+C Intel CNR ?
+C Intel PNR ?
+C Intel NHM ?
+C Intel WSM ?
+C Intel SBR ?
+C Intel IBR ?
+C Intel HWL ?
+C Intel BWL ?
+C Intel SKL ?
+C Intel atom ?
+C Intel SLM ?
+C Intel GLM ?
+C Intel GLM+ ?
+C VIA nano ?
+
+
+C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
+
+deflit(MAXSHIFT, 8)
+deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
+
+DEF_OBJECT(ctz_table,64)
+ .byte MAXSHIFT
+forloop(i,1,MASK,
+` .byte m4_count_trailing_zeros(i)
+')
+END_OBJECT(ctz_table)
+
+define(`u0', `%rdi')
+define(`v0', `%rsi')
+
+define(`cnt', `%rcx')
+define(`s0', `%rax')
+define(`t0', `%rdx')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_11)
+ FUNC_ENTRY(2)
+ LEA( ctz_table, %r10)
+ mov v0, t0
+ sub u0, t0
+ jz L(end)
+
+ ALIGN(16)
+L(top): mov u0, s0
+ sub v0, u0
+ cmovc t0, u0 C u = |u - v|
+ cmovc s0, v0 C v = min(u,v)
+ and $MASK, R32(t0)
+ movzbl (%r10,t0), R32(cnt)
+ jz L(count_better)
+L(shr): shr R8(cnt), u0
+ mov v0, t0
+ sub u0, t0
+ jnz L(top)
+
+L(end): mov v0, %rax
+ C rdx = 0 for the benefit of internal gcd_22 call
+ FUNC_EXIT()
+ ret
+
+L(count_better):
+ bsf u0, cnt
+ jmp L(shr)
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gcd_22.asm
new file mode 100644
index 00000000000..c9f221e1b7f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gcd_22.asm
@@ -0,0 +1,37 @@
+dnl AMD64 mpn_gcd_22.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+dnl ABI_SUPPORT(DOS64) C returns mp_double_limb_t in memory
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_gcd_22)
+include_mpn(`x86_64/gcd_22.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gmp-mparam.h
new file mode 100644
index 00000000000..977a209e7fa
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/gmp-mparam.h
@@ -0,0 +1,230 @@
+/* AMD Bobcat gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* Disable use of slow functions. FIXME: We should disable lib inclusion. */
+#undef HAVE_NATIVE_mpn_mul_2
+#undef HAVE_NATIVE_mpn_addmul_2
+
+/* 1600 MHz AMD Bobcat/Zacate */
+/* FFT tuning limit = 110,472,704 */
+/* Generated by tuneup.c, 2019-10-12, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 31
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 71
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 14
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 20
+
+#define DIV_1_VS_MUL_1_PERCENT 270
+
+#define MUL_TOOM22_THRESHOLD 24
+#define MUL_TOOM33_THRESHOLD 66
+#define MUL_TOOM44_THRESHOLD 190
+#define MUL_TOOM6H_THRESHOLD 274
+#define MUL_TOOM8H_THRESHOLD 381
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 129
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 138
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 127
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 131
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 100
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 30
+#define SQR_TOOM3_THRESHOLD 101
+#define SQR_TOOM4_THRESHOLD 278
+#define SQR_TOOM6_THRESHOLD 372
+#define SQR_TOOM8_THRESHOLD 478
+
+#define MULMID_TOOM42_THRESHOLD 22
+
+#define MULMOD_BNM1_THRESHOLD 11
+#define SQRMOD_BNM1_THRESHOLD 13
+
+#define MUL_FFT_MODF_THRESHOLD 444 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 444, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 21, 8}, \
+ { 11, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
+ { 15, 7}, { 31, 8}, { 17, 7}, { 35, 8}, \
+ { 19, 7}, { 39, 8}, { 27, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 49, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 55,11}, { 15,10}, { 31, 9}, \
+ { 71,10}, { 39, 9}, { 83, 5}, { 1343, 4}, \
+ { 2687, 5}, { 1407, 6}, { 735, 7}, { 415, 8}, \
+ { 223,10}, { 79,11}, { 47,10}, { 103,12}, \
+ { 31,11}, { 63,10}, { 135,11}, { 79,10}, \
+ { 167,11}, { 95,10}, { 191,11}, { 111,12}, \
+ { 63,11}, { 127,10}, { 255,11}, { 143,10}, \
+ { 287, 9}, { 575,11}, { 159,12}, { 95,11}, \
+ { 191,10}, { 383,11}, { 207,10}, { 415,13}, \
+ { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 271,10}, { 543,11}, { 287,10}, { 575,12}, \
+ { 159,11}, { 319,10}, { 639,11}, { 351,10}, \
+ { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 415,12}, { 223,13}, { 127,12}, { 255,11}, \
+ { 543,12}, { 287,11}, { 607,12}, { 319,11}, \
+ { 671,12}, { 351,11}, { 703,13}, { 191,12}, \
+ { 383,11}, { 767,12}, { 415,11}, { 831,12}, \
+ { 447,14}, { 127,13}, { 255,12}, { 607,13}, \
+ { 319,12}, { 703,13}, { 383,12}, { 831,13}, \
+ { 447,12}, { 959,14}, { 255,13}, { 511,12}, \
+ { 1023,13}, { 575,12}, { 1151,13}, { 703,14}, \
+ { 383,13}, { 831,12}, { 1663,13}, { 959,15}, \
+ { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
+ { 1151,14}, { 639,13}, { 1343,12}, { 2687,13}, \
+ { 1407,14}, { 767,13}, { 1599,12}, { 3199,13}, \
+ { 1663,14}, { 895,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,15}, { 767,14}, \
+ { 1535,13}, { 3199,14}, { 1663,13}, { 3455,16}, \
+ { 511,15}, { 1023,14}, { 2175,13}, { 4479,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
+ { 5887,15}, { 1535,14}, { 3455,13}, { 6911,15}, \
+ { 1791,14}, { 3839,16}, { 1023,15}, { 2047,14}, \
+ { 4479,15}, { 2303,14}, { 4991,15}, { 2559,14}, \
+ { 5247,15}, { 2815,14}, { 5887,16}, { 1535,15}, \
+ { 3327,14}, { 16384,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 183
+#define MUL_FFT_THRESHOLD 5760
+
+#define SQR_FFT_MODF_THRESHOLD 380 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 380, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 25, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
+ { 15, 7}, { 31, 8}, { 17, 7}, { 35, 8}, \
+ { 19, 7}, { 39, 8}, { 27, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 31, 8}, \
+ { 63, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
+ { 31,10}, { 63, 6}, { 1087, 7}, { 575, 8}, \
+ { 303, 9}, { 159,10}, { 103,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255,10}, { 135,11}, \
+ { 79,10}, { 159, 9}, { 319,11}, { 95,10}, \
+ { 191, 9}, { 383,11}, { 111,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271,11}, \
+ { 143,10}, { 287, 9}, { 575,10}, { 303,11}, \
+ { 159,10}, { 319,12}, { 95,11}, { 191,10}, \
+ { 383,11}, { 207,13}, { 63,12}, { 127,11}, \
+ { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
+ { 287,10}, { 575,11}, { 303,12}, { 159,11}, \
+ { 319,10}, { 639,11}, { 335,10}, { 671,11}, \
+ { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
+ { 767,11}, { 415,12}, { 223,11}, { 447,13}, \
+ { 127,12}, { 255,11}, { 543,12}, { 287,11}, \
+ { 607,12}, { 319,11}, { 671,12}, { 351,11}, \
+ { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 415,11}, { 831,12}, { 479,14}, { 127,13}, \
+ { 255,12}, { 607,13}, { 319,12}, { 703,13}, \
+ { 383,12}, { 831,13}, { 447,12}, { 895,14}, \
+ { 255,13}, { 511,12}, { 1023,13}, { 703,14}, \
+ { 383,13}, { 831,12}, { 1663,13}, { 895,15}, \
+ { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
+ { 1151,14}, { 639,13}, { 1343,12}, { 2687,13}, \
+ { 1407,14}, { 767,13}, { 1599,12}, { 3199,13}, \
+ { 1663,14}, { 895,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,15}, { 767,14}, \
+ { 1535,13}, { 3199,14}, { 1663,13}, { 3455,16}, \
+ { 511,15}, { 1023,14}, { 2175,13}, { 4351,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
+ { 5887,15}, { 1535,14}, { 3455,15}, { 1791,14}, \
+ { 3839,16}, { 1023,15}, { 2047,14}, { 4479,15}, \
+ { 2303,14}, { 4863,15}, { 2559,14}, { 5247,15}, \
+ { 2815,14}, { 5887,16}, { 1535,15}, { 3327,14}, \
+ { 16384,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
+ { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+ {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 186
+#define SQR_FFT_THRESHOLD 3712
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 42
+#define MULLO_MUL_N_THRESHOLD 10950
+#define SQRLO_BASECASE_THRESHOLD 7
+#define SQRLO_DC_THRESHOLD 100
+#define SQRLO_SQR_THRESHOLD 7293
+
+#define DC_DIV_QR_THRESHOLD 70
+#define DC_DIVAPPR_Q_THRESHOLD 204
+#define DC_BDIV_QR_THRESHOLD 59
+#define DC_BDIV_Q_THRESHOLD 148
+
+#define INV_MULMOD_BNM1_THRESHOLD 46
+#define INV_NEWTON_THRESHOLD 246
+#define INV_APPR_THRESHOLD 236
+
+#define BINV_NEWTON_THRESHOLD 252
+#define REDC_1_TO_REDC_2_THRESHOLD 67
+#define REDC_2_TO_REDC_N_THRESHOLD 0 /* always */
+
+#define MU_DIV_QR_THRESHOLD 1589
+#define MU_DIVAPPR_Q_THRESHOLD 1589
+#define MUPI_DIV_QR_THRESHOLD 108
+#define MU_BDIV_QR_THRESHOLD 1442
+#define MU_BDIV_Q_THRESHOLD 1470
+
+#define POWM_SEC_TABLE 1,16,194,960,1603,1811,2499
+
+#define GET_STR_DC_THRESHOLD 20
+#define GET_STR_PRECOMPUTE_THRESHOLD 34
+#define SET_STR_DC_THRESHOLD 345
+#define SET_STR_PRECOMPUTE_THRESHOLD 1787
+
+#define FAC_DSC_THRESHOLD 781
+#define FAC_ODD_THRESHOLD 104
+
+#define MATRIX22_STRASSEN_THRESHOLD 17
+#define HGCD2_DIV1_METHOD 3 /* 3.20% faster than 5 */
+#define HGCD_THRESHOLD 110
+#define HGCD_APPR_THRESHOLD 50
+#define HGCD_REDUCE_THRESHOLD 2681
+#define GCD_DC_THRESHOLD 474
+#define GCDEXT_DC_THRESHOLD 293
+#define JACOBI_BASE_METHOD 2 /* 9.38% faster than 1 */
+
+/* Tuneup completed successfully, took 358881 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/mul_1.asm
index ab428a88a09..4394d6e1fb4 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/mul_1.asm
@@ -1,6 +1,7 @@
-dnl AMD64 mpn_mul_1 optimised for AMD bobcat.
+dnl AMD64 mpn_mul_1 optimised for AMD bt1/bt2.
-dnl Copyright 2003-2005, 2007, 2008, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2003-2005, 2007, 2008, 2011, 2012, 2019 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,16 +32,27 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9 4.5
-C AMD K10 4.5
-C AMD bd1 4.62
-C AMD bobcat 5
-C Intel P4 14
-C Intel core2 4.5
-C Intel NHM 4.23
-C Intel SBR 3.0
-C Intel atom 21
-C VIA nano 4.94
+C AMD K8,K9 4.53 old measurement
+C AMD K10 4.53 old measurement
+C AMD bd1 4.56 old measurement
+C AMD bd2 4.47 old measurement
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen ?
+C AMD bt1 5.12
+C AMD bt2 5.17
+C Intel P4 12.6 old measurement
+C Intel PNR 4.53 old measurement
+C Intel NHM 4.36 old measurement
+C Intel SBR 3.0 old measurement
+C Intel IBR 2.55 old measurement
+C Intel HWL 2.28 old measurement
+C Intel BWL 2.36 old measurement
+C Intel SKL 2.39 old measurement
+C Intel atom 21.0 old measurement
+C Intel SLM 9 old measurement
+C Intel GLM ?
+C VIA nano ?
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjorn Granlund.
@@ -74,112 +86,154 @@ IFDOS(` define(`w1', `%rdi') ') dnl
IFDOS(` define(`w2', `%r10') ') dnl
IFDOS(` define(`w3', `%r11') ') dnl
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mul_1c)
-IFDOS(` push %rsi ')
-IFDOS(` push %rdi ')
-IFDOS(` mov %rdx, %rsi ')
- mov cy, w2
- jmp L(com)
-EPILOGUE()
-
+ ALIGN(64)
PROLOGUE(mpn_mul_1)
IFDOS(` push %rsi ')
IFDOS(` push %rdi ')
IFDOS(` mov %rdx, %rsi ')
- xor w2, w2
-L(com): push %rbx
- mov (up), %rax
- lea -16(rp,n_param,8), rp
- lea -16(up,n_param,8), up
+ push %rbx
+ mov (up), %rax
+ lea (rp,n_param,8), rp
+ lea (up,n_param,8), up
mov n_param, n
- and $3, R32(n_param)
- jz L(b0)
- cmp $2, R32(n_param)
- ja L(b3)
- jz L(b2)
-
-L(b1): mul v0
- cmp $1, n
- jz L(n1)
+
+ test $1, R8(n_param)
+ jne L(bx1)
+
+L(bx0): mul v0
neg n
- add $3, n
- add %rax, w2
- mov %rdx, w3
- jmp L(L1)
-L(n1): add %rax, w2
- mov %rdx, %rax
- mov w2, 8(rp)
- adc $0, %rax
- pop %rbx
-IFDOS(` pop %rdi ')
-IFDOS(` pop %rsi ')
- ret
+ mov %rax, w0
+ mov %rdx, w1
+ test $2, R8(n)
+ jne L(L2)
+
+L(b00): add $2, n
+ jmp L(L0)
-L(b3): mul v0
+ ALIGN(16)
+L(b11): mov %rax, w2
+ mov %rdx, w3
neg n
inc n
- add %rax, w2
- mov %rdx, w3
jmp L(L3)
-L(b0): mul v0
- mov %rax, w0
- mov %rdx, w1
- neg n
- add $2, n
- add w2, w0
- jmp L(L0)
+ ALIGN(16)
+L(bx1): mul v0
+ test $2, R8(n)
+ jne L(b11)
-L(b2): mul v0
- mov %rax, w0
- mov %rdx, w1
+L(b01): sub $3, n
+ jc L(n1)
+ mov %rax, w2
+ mov %rdx, w3
neg n
- add w2, w0
- jmp L(L2)
ALIGN(16)
-L(top): mov w0, -16(rp,n,8)
- add w1, w2
-L(L1): adc $0, w3
- mov 0(up,n,8), %rax
+L(top): mov -16(up,n,8), %rax
mul v0
mov %rax, w0
mov %rdx, w1
- mov w2, -8(rp,n,8)
+ mov w2, -24(rp,n,8)
add w3, w0
-L(L0): adc $0, w1
- mov 8(up,n,8), %rax
+ adc $0, w1
+L(L0): mov -8(up,n,8), %rax
mul v0
mov %rax, w2
mov %rdx, w3
- mov w0, 0(rp,n,8)
+ mov w0, -16(rp,n,8)
add w1, w2
-L(L3): adc $0, w3
- mov 16(up,n,8), %rax
+ adc $0, w3
+L(L3): mov (up,n,8), %rax
mul v0
mov %rax, w0
mov %rdx, w1
- mov w2, 8(rp,n,8)
+ mov w2, -8(rp,n,8)
add w3, w0
-L(L2): adc $0, w1
- mov 24(up,n,8), %rax
+ adc $0, w1
+L(L2): mov 8(up,n,8), %rax
mul v0
mov %rax, w2
mov %rdx, w3
+ mov w0, (rp,n,8)
+ add w1, w2
+ adc $0, w3
add $4, n
js L(top)
-L(end): mov w0, (rp)
- add w1, w2
- adc $0, w3
- mov w2, 8(rp)
+L(end): mov w2, -8(rp)
mov w3, %rax
+ pop %rbx
+IFDOS(` pop %rdi ')
+IFDOS(` pop %rsi ')
+ ret
+
+ ALIGN(32)
+L(n1): mov %rax, -8(rp)
+ mov %rdx, %rax
+ pop %rbx
+IFDOS(` pop %rdi ')
+IFDOS(` pop %rsi ')
+ ret
+EPILOGUE()
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_mul_1c)
+IFDOS(` push %rsi ')
+IFDOS(` push %rdi ')
+IFDOS(` mov %rdx, %rsi ')
+ mov cy, w2
+ push %rbx
+ mov (up), %rax
+
+ lea (rp,n_param,8), rp
+ lea (up,n_param,8), up
+ mov n_param, n
+ test $1, R8(n_param)
+ jne L(cx1)
+
+L(cx0): mul v0
+ neg n
+ mov %rax, w0
+ mov %rdx, w1
+ add w2, w0
+ adc $0, w1
+ test $2, R8(n)
+ jne L(L2)
+
+L(c00): add $2, n
+ jmp L(L0)
+
+ ALIGN(16)
+L(cx1): mul v0
+ test $2, R8(n)
+ je L(c01)
+
+L(c11): neg n
+ inc n
+ add %rax, w2
+ mov %rdx, w3
+ adc $0, w3
+ jmp L(L3)
+
+L(c01): cmp $1, n
+ jz L(m1)
+ neg n
+ add $3, n
+ add %rax, w2
+ mov %rdx, w3
+ adc $0, w3
+ jmp L(top)
+
+ ALIGN(32)
+L(m1): add %rax, w2
+ mov %rdx, %rax
+ mov w2, -8(rp)
+ adc $0, %rax
pop %rbx
IFDOS(` pop %rdi ')
IFDOS(` pop %rsi ')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/mul_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/mul_basecase.asm
index e7d46bfcff6..e7d46bfcff6 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/mul_basecase.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/mul_basecase.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/redc_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/redc_1.asm
index d55b1e5b378..d55b1e5b378 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/redc_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/redc_1.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/sqr_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/sqr_basecase.asm
index 0e417a1ebeb..0e417a1ebeb 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bobcat/sqr_basecase.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt1/sqr_basecase.asm
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/com.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/com.asm
new file mode 100644
index 00000000000..87085ea18e6
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/com.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_com.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_com)
+include_mpn(`x86_64/fastsse/com.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/copyd.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/copyd.asm
new file mode 100644
index 00000000000..83c061817b5
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/copyd.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_copyd.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_copyd)
+include_mpn(`x86_64/fastsse/copyd.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/copyi.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/copyi.asm
new file mode 100644
index 00000000000..148d0e5a062
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/copyi.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_copyi.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_copyi)
+include_mpn(`x86_64/fastsse/copyi.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gcd_11.asm
index 3d8e5c7ab12..0ffb6caa03c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bd1/gcd_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gcd_11.asm
@@ -1,4 +1,4 @@
-dnl AMD64 mpn_gcd_1.
+dnl AMD64 mpn_gcd_11.
dnl Copyright 2012 Free Software Foundation, Inc.
@@ -33,5 +33,5 @@ include(`../config.m4')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-MULFUNC_PROLOGUE(mpn_gcd_1)
-include_mpn(`x86_64/core2/gcd_1.asm')
+MULFUNC_PROLOGUE(mpn_gcd_11)
+include_mpn(`x86_64/bd2/gcd_11.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gcd_22.asm
new file mode 100644
index 00000000000..d69362812b6
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gcd_22.asm
@@ -0,0 +1,37 @@
+dnl AMD64 mpn_gcd_22.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+dnl ABI_SUPPORT(DOS64) C returns mp_double_limb_t in memory
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_gcd_22)
+include_mpn(`x86_64/bd2/gcd_22.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gmp-mparam.h
new file mode 100644
index 00000000000..3e26726d842
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/bt2/gmp-mparam.h
@@ -0,0 +1,240 @@
+/* AMD Jaguar gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* Disable use of slow functions. FIXME: We should disable lib inclusion. */
+#undef HAVE_NATIVE_mpn_mul_2
+#undef HAVE_NATIVE_mpn_addmul_2
+
+/* 2050 MHz AMD Jaguar/Kabini */
+/* FFT tuning limit = 225,381,546 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 4
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 65
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1_NORM_THRESHOLD 4
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 15
+
+#define DIV_1_VS_MUL_1_PERCENT 267
+
+#define MUL_TOOM22_THRESHOLD 25
+#define MUL_TOOM33_THRESHOLD 32
+#define MUL_TOOM44_THRESHOLD 93
+#define MUL_TOOM6H_THRESHOLD 366
+#define MUL_TOOM8H_THRESHOLD 537
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 63
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 172
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 63
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 67
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 91
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 20
+#define SQR_TOOM3_THRESHOLD 97
+#define SQR_TOOM4_THRESHOLD 220
+#define SQR_TOOM6_THRESHOLD 318
+#define SQR_TOOM8_THRESHOLD 434
+
+#define MULMID_TOOM42_THRESHOLD 20
+
+#define MULMOD_BNM1_THRESHOLD 11
+#define SQRMOD_BNM1_THRESHOLD 13
+
+#define MUL_FFT_MODF_THRESHOLD 348 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 348, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
+ { 23, 7}, { 21, 8}, { 11, 7}, { 24, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 31, 8}, \
+ { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { 21, 9}, { 11, 8}, { 29, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 49, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 55,11}, { 15,10}, { 31, 9}, \
+ { 67,10}, { 39, 9}, { 79,10}, { 55,11}, \
+ { 31,10}, { 63, 6}, { 1087, 8}, { 303, 9}, \
+ { 159,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 127, 9}, { 255,11}, { 79,10}, { 159, 9}, \
+ { 319,10}, { 167,11}, { 95,10}, { 191, 9}, \
+ { 383,10}, { 207, 9}, { 415,11}, { 111,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271,11}, { 143,10}, { 287, 9}, { 575,10}, \
+ { 303,11}, { 159,10}, { 319,12}, { 95,11}, \
+ { 191,10}, { 383,11}, { 207,10}, { 415,11}, \
+ { 223,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 303,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 351,12}, { 191,11}, { 415,12}, \
+ { 223,11}, { 479,13}, { 127,12}, { 255,11}, \
+ { 543,12}, { 287,11}, { 607,12}, { 319,11}, \
+ { 639,12}, { 351,13}, { 191,12}, { 383,11}, \
+ { 767,12}, { 415,11}, { 831,12}, { 479,14}, \
+ { 127,13}, { 255,12}, { 543,11}, { 1087,12}, \
+ { 607,13}, { 319,12}, { 703,13}, { 383,12}, \
+ { 831,13}, { 447,12}, { 895,14}, { 255,13}, \
+ { 511,12}, { 1023,13}, { 575,12}, { 1151,13}, \
+ { 639,12}, { 1279,13}, { 703,14}, { 383,13}, \
+ { 831,12}, { 1663,13}, { 895,15}, { 255,14}, \
+ { 511,13}, { 1087,12}, { 2175,13}, { 1151,14}, \
+ { 639,13}, { 1343,12}, { 2687,14}, { 767,13}, \
+ { 1663,14}, { 895,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,14}, { 1279,13}, \
+ { 2687,15}, { 767,14}, { 1663,13}, { 3327,16}, \
+ { 511,15}, { 1023,14}, { 2175,13}, { 4351,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
+ { 5887,15}, { 1535,14}, { 3455,13}, { 6911,15}, \
+ { 1791,14}, { 3839,13}, { 7679,16}, { 1023,15}, \
+ { 2047,14}, { 4223,13}, { 8447,14}, { 4479,15}, \
+ { 2303,14}, { 4863,15}, { 2559,14}, { 5247,15}, \
+ { 2815,14}, { 5887,16}, { 1535,15}, { 3071,14}, \
+ { 6271,15}, { 3327,14}, { 6911,15}, { 3839,14}, \
+ { 7679,17}, { 1023,16}, { 2047,15}, { 4095,14}, \
+ { 8447,15}, { 4351,14}, { 8959,15}, { 4863,16}, \
+ { 2559,15}, { 5887,14}, { 11775,16}, { 3071,15}, \
+ { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 201
+#define MUL_FFT_THRESHOLD 3200
+
+#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 340, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
+ { 23, 7}, { 12, 6}, { 25, 7}, { 13, 6}, \
+ { 27, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
+ { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
+ { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 63,10}, { 39, 9}, { 79,10}, { 47,11}, \
+ { 31,10}, { 79,11}, { 47,10}, { 95, 6}, \
+ { 1663, 7}, { 895, 9}, { 239, 8}, { 479,10}, \
+ { 127, 9}, { 255, 8}, { 511,10}, { 135, 9}, \
+ { 271,11}, { 79, 9}, { 319,11}, { 95,10}, \
+ { 191, 9}, { 383,10}, { 207,11}, { 111,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543,10}, { 287, 9}, { 575,10}, \
+ { 303, 9}, { 607,10}, { 319, 9}, { 639,12}, \
+ { 95,11}, { 191,10}, { 383,11}, { 207,10}, \
+ { 415,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 303,10}, { 607,11}, { 319,10}, \
+ { 639,11}, { 351,10}, { 703,11}, { 367,12}, \
+ { 191,11}, { 383,10}, { 767,11}, { 415,12}, \
+ { 223,11}, { 479,13}, { 127,12}, { 255,11}, \
+ { 543,12}, { 287,11}, { 607,12}, { 319,11}, \
+ { 639,12}, { 351,11}, { 703,13}, { 191,12}, \
+ { 383,11}, { 767,12}, { 415,11}, { 831,12}, \
+ { 479,14}, { 127,13}, { 255,12}, { 607,13}, \
+ { 319,12}, { 735,13}, { 383,12}, { 831,13}, \
+ { 447,12}, { 895,14}, { 255,13}, { 511,12}, \
+ { 1023,13}, { 575,12}, { 1151,13}, { 703,14}, \
+ { 383,13}, { 831,12}, { 1663,13}, { 895,15}, \
+ { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
+ { 1151,14}, { 639,13}, { 1343,12}, { 2687,13}, \
+ { 1407,14}, { 767,13}, { 1599,12}, { 3199,13}, \
+ { 1663,14}, { 895,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,14}, { 1279,13}, \
+ { 2687,14}, { 1407,15}, { 767,14}, { 1535,13}, \
+ { 3199,14}, { 1663,13}, { 3455,16}, { 511,15}, \
+ { 1023,14}, { 2175,13}, { 4479,14}, { 2431,13}, \
+ { 4863,15}, { 1279,14}, { 2943,13}, { 5887,15}, \
+ { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
+ { 3839,13}, { 7679,16}, { 1023,15}, { 2047,14}, \
+ { 4479,15}, { 2303,14}, { 4991,15}, { 2815,14}, \
+ { 5887,16}, { 1535,15}, { 3071,14}, { 6143,15}, \
+ { 3327,14}, { 6911,15}, { 3839,14}, { 7679,17}, \
+ { 1023,16}, { 2047,15}, { 4095,14}, { 8191,15}, \
+ { 4351,14}, { 8959,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 32768,16}, \
+ { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+ {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 208
+#define SQR_FFT_THRESHOLD 2880
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 63
+#define MULLO_MUL_N_THRESHOLD 6253
+#define SQRLO_BASECASE_THRESHOLD 8
+#define SQRLO_DC_THRESHOLD 54
+#define SQRLO_SQR_THRESHOLD 5558
+
+#define DC_DIV_QR_THRESHOLD 72
+#define DC_DIVAPPR_Q_THRESHOLD 195
+#define DC_BDIV_QR_THRESHOLD 50
+#define DC_BDIV_Q_THRESHOLD 90
+
+#define INV_MULMOD_BNM1_THRESHOLD 46
+#define INV_NEWTON_THRESHOLD 195
+#define INV_APPR_THRESHOLD 197
+
+#define BINV_NEWTON_THRESHOLD 230
+#define REDC_1_TO_REDC_2_THRESHOLD 67
+#define REDC_2_TO_REDC_N_THRESHOLD 0 /* always */
+
+#define MU_DIV_QR_THRESHOLD 1334
+#define MU_DIVAPPR_Q_THRESHOLD 1334
+#define MUPI_DIV_QR_THRESHOLD 104
+#define MU_BDIV_QR_THRESHOLD 1017
+#define MU_BDIV_Q_THRESHOLD 1187
+
+#define POWM_SEC_TABLE 1,16,194,712,779,2387
+
+#define GET_STR_DC_THRESHOLD 15
+#define GET_STR_PRECOMPUTE_THRESHOLD 29
+#define SET_STR_DC_THRESHOLD 216
+#define SET_STR_PRECOMPUTE_THRESHOLD 994
+
+#define FAC_DSC_THRESHOLD 153
+#define FAC_ODD_THRESHOLD 0 /* always */
+
+#define MATRIX22_STRASSEN_THRESHOLD 17
+#define HGCD2_DIV1_METHOD 1 /* 9.38% faster than 3 */
+#define HGCD_THRESHOLD 77
+#define HGCD_APPR_THRESHOLD 50
+#define HGCD_REDUCE_THRESHOLD 2121
+#define GCD_DC_THRESHOLD 440
+#define GCDEXT_DC_THRESHOLD 273
+#define JACOBI_BASE_METHOD 1 /* 7.74% faster than 4 */
+
+/* Tuneup completed successfully, took 495910 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aors_n.asm
index 74a1bce48a2..f9e003987f9 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aors_n.asm
@@ -30,15 +30,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-
-C cycles/limb
+C cycles/limb
C AMD K8,K9 2
-C AMD K10 2
+C AMD K10 1.93\2
+C AMD bull 1.62\2.1
+C AMD pile 1.6\1.7
+C AMD steam
+C AMD excavator
+C AMD bobcat 2.79
+C AMD jaguar 2.54
C Intel P4 10
C Intel core2 2
C Intel NHM 2
C Intel SBR 2
+C Intel IBR 1.95
+C Intel HWL 1.72
+C Intel BWL 1.54
+C Intel SKL 1.52
C Intel atom 9
+C Intel SLM 6.5
C VIA nano 3
C INPUT PARAMETERS
@@ -138,4 +148,3 @@ PROLOGUE(func_nc)
IFDOS(` mov 56(%rsp), %r8 ')
jmp L(start)
EPILOGUE()
-
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aorsmul_1.asm
index 6b313dd836e..a7a5d6e5980 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/aorsmul_1.asm
@@ -31,16 +31,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9 4
-C AMD K10 4
-C AMD bd1 5.1
-C AMD bobcat
-C Intel P4 ?
-C Intel core2 4.3-4.5 (fluctuating)
-C Intel NHM 5.0
-C Intel SBR 4.1
-C Intel atom ?
-C VIA nano 5.25
+C AMD K8,K9 4.52
+C AMD K10 4.01
+C AMD bull 4.98
+C AMD pile 4.83
+C AMD steam
+C AMD excavator
+C AMD bobcat 5.56
+C AMD jaguar 5.54
+C Intel P4 16.3 17.3
+C Intel core2 4.32 4.61
+C Intel NHM 5.08
+C Intel SBR 4.04
+C Intel IBR 3.95
+C Intel HWL 3.66
+C Intel BWL 2.87
+C Intel SKL 2.79
+C Intel atom 20.6
+C Intel SLM 7.6
+C VIA nano 5.25
C INPUT PARAMETERS
define(`rp', `%rdi')
@@ -107,23 +116,24 @@ PROLOGUE(func)
mul %rcx
L(start_nc):
- bt $0, R32(%rbx)
- jc L(odd)
+ test $1, R8(%rbx)
+ jnz L(odd)
lea (%rax), %r11
mov 8(up,%rbx,8), %rax
lea (%rdx), %rbp
mul %rcx
add $2, %rbx
- jns L(n2)
+ jz L(n2)
lea (%rax), %r8
mov (up,%rbx,8), %rax
lea (%rdx), %r9
jmp L(mid)
-L(odd): add $1, %rbx
- jns L(n1)
+ ALIGN(8)
+L(odd): inc %rbx
+ jz L(n1)
lea (%rax), %r8
mov (up,%rbx,8), %rax
@@ -160,16 +170,16 @@ L(e): add $2, %rbx
ADDSUB %r8, %r10
adc %r9, %r11
mov %r10, -8(rp)
- adc $0, %rbp
+ adc %rbx, %rbp C rbx = 0
L(n2): mov (rp), %r10
ADDSUB %r11, %r10
adc %rbp, %rax
mov %r10, (rp)
- adc $0, %rdx
+ adc %rbx, %rdx C rbx = 0
L(n1): mov 8(rp), %r10
ADDSUB %rax, %r10
mov %r10, 8(rp)
- mov R32(%rbx), R32(%rax) C zero rax
+ mov R32(%rbx), R32(%rax) C rbx = 0
adc %rdx, %rax
pop %rbp
pop %rbx
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/com.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/com.asm
new file mode 100644
index 00000000000..d7d9f794f65
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/com.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_com.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_com)
+include_mpn(`x86_64/fastsse/com-palignr.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyd.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyd.asm
index f0dc54a55e7..57ea0e55d93 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyd.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyd.asm
@@ -1,4 +1,4 @@
-dnl X86-64 mpn_copyd optimised for Intel Sandy Bridge.
+dnl X86-64 mpn_copyd.
dnl Copyright 2012 Free Software Foundation, Inc.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyi.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyi.asm
index 9c26e00c522..f0c760739e9 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyi.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/copyi.asm
@@ -1,4 +1,4 @@
-dnl X86-64 mpn_copyi optimised for Intel Sandy Bridge.
+dnl X86-64 mpn_copyi.
dnl Copyright 2012 Free Software Foundation, Inc.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_1.asm
deleted file mode 100644
index bdb940c3ab9..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_1.asm
+++ /dev/null
@@ -1,146 +0,0 @@
-dnl AMD64 mpn_gcd_1 optimised for Intel C2, NHM, SBR and AMD K10, BD.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011, 2012 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/.
-
-include(`../config.m4')
-
-
-C cycles/bit (approx)
-C AMD K8,K9 8.50
-C AMD K10 4.30
-C AMD bd1 5.00
-C AMD bobcat 10.0
-C Intel P4 18.6
-C Intel core2 3.83
-C Intel NHM 5.17
-C Intel SBR 4.69
-C Intel atom 17.0
-C VIA nano 5.44
-C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
-
-C TODO
-C * Optimise inner-loop for specific CPUs.
-C * Use DIV for 1-by-1 reductions, at least for some CPUs.
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 6)
-
-C INPUT PARAMETERS
-define(`up', `%rdi')
-define(`n', `%rsi')
-define(`v0', `%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-IFDOS(`define(`STACK_ALLOC', 40)')
-IFSTD(`define(`STACK_ALLOC', 8)')
-
-C Undo some configure cleverness.
-C The problem is that C only defines the '1c' variant, and that configure
-C therefore considers modexact_1c to be the base function. It then adds a
-C special fat rule for mpn_modexact_1_odd, messing up things when a cpudep
-C gcd_1 exists without a corresponding cpudep mode1o.
-ifdef(`WANT_FAT_BINARY', `
- define(`mpn_modexact_1_odd', `MPN_PREFIX`modexact_1_odd_x86_64'')')
-
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- FUNC_ENTRY(3)
- mov (up), %rax C U low limb
- or v0, %rax
- bsf %rax, %rax C min(ctz(u0),ctz(v0))
-
- bsf v0, %rcx
- shr R8(%rcx), v0
-
- push %rax C preserve common twos over call
- push v0 C preserve v0 argument over call
- sub $STACK_ALLOC, %rsp C maintain ABI required rsp alignment
-
- cmp $1, n
- jnz L(reduce_nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- mov (up), %r8
- mov %r8, %rax
- shr $BMOD_THRES_LOG2, %r8
- cmp %r8, v0
- ja L(reduced)
- jmp L(bmod)
-
-L(reduce_nby1):
- cmp $BMOD_1_TO_MOD_1_THRESHOLD, n
- jl L(bmod)
-IFDOS(` mov %rdx, %r8 ')
-IFDOS(` mov %rsi, %rdx ')
-IFDOS(` mov %rdi, %rcx ')
- ASSERT(nz, `test $15, %rsp')
- CALL( mpn_mod_1)
- jmp L(reduced)
-L(bmod):
-IFDOS(` mov %rdx, %r8 ')
-IFDOS(` mov %rsi, %rdx ')
-IFDOS(` mov %rdi, %rcx ')
- ASSERT(nz, `test $15, %rsp')
- CALL( mpn_modexact_1_odd)
-L(reduced):
-
- add $STACK_ALLOC, %rsp
- pop %rdx
-
- bsf %rax, %rcx
-C test %rax, %rax C FIXME: does this lower latency?
- jnz L(mid)
- jmp L(end)
-
- ALIGN(16) C K10 BD C2 NHM SBR
-L(top): cmovc %r10, %rax C if x-y < 0 0,3 0,3 0,6 0,5 0,5
- cmovc %r9, %rdx C use x,y-x 0,3 0,3 2,8 1,7 1,7
-L(mid): shr R8(%rcx), %rax C 1,7 1,6 2,8 2,8 2,8
- mov %rdx, %r10 C 1 1 4 3 3
- sub %rax, %r10 C 2 2 5 4 4
- bsf %r10, %rcx C 3 3 6 5 5
- mov %rax, %r9 C 2 2 3 3 4
- sub %rdx, %rax C 2 2 4 3 4
- jnz L(top) C
-
-L(end): pop %rcx
- mov %rdx, %rax
- shl R8(%rcx), %rax
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_11.asm
new file mode 100644
index 00000000000..b00451f90a7
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_11.asm
@@ -0,0 +1,93 @@
+dnl AMD64 mpn_gcd_11 optimised for Intel CNR, PNR, SBR, IBR.
+
+dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
+dnl Granlund.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011, 2012, 2017, 2019 Free Software
+dnl 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit (approx)
+C AMD K8,K9 ?
+C AMD K10 ?
+C AMD bd1 ?
+C AMD bd2 ?
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD bt1 ?
+C AMD bt2 ?
+C AMD zn1 ?
+C AMD zn2 ?
+C Intel P4 ?
+C Intel CNR 4.22 *
+C Intel PNR 4.22 *
+C Intel NHM 4.97
+C Intel WSM 5.17
+C Intel SBR 4.83 *
+C Intel IBR 4.16 *
+C Intel HWL 3.84
+C Intel BWL 3.76
+C Intel SKL 3.83
+C Intel atom ?
+C Intel SLM ?
+C Intel GLM ?
+C Intel GLM+ ?
+C VIA nano ?
+
+define(`u0', `%rdi')
+define(`v0', `%rsi')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_11)
+ FUNC_ENTRY(2)
+ jmp L(odd)
+
+ ALIGN(16)
+L(top): cmovc %rdx, u0 C u = |u - v|
+ cmovc %rax, v0 C v = min(u,v)
+ shr R8(%rcx), u0
+L(odd): mov v0, %rdx
+ sub u0, %rdx C v - u
+ bsf %rdx, %rcx
+ mov u0, %rax
+ sub v0, u0 C u - v
+ jnz L(top)
+
+L(end): C rax = result
+ C rdx = 0 for the benefit of internal gcd_22 call
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_22.asm
new file mode 100644
index 00000000000..b5aa73ba97a
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gcd_22.asm
@@ -0,0 +1,137 @@
+dnl AMD64 mpn_gcd_22. Assumes useful bsf, useful shrd, no tzcnt, no shlx.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit
+C AMD K8,K9 ?
+C AMD K10 ?
+C AMD bd1 ?
+C AMD bd2 ?
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD bt1 ?
+C AMD bt2 ?
+C AMD zn1 ?
+C AMD zn2 ?
+C Intel P4 ?
+C Intel CNR 8.7
+C Intel PNR 8.7
+C Intel NHM 9.2
+C Intel WSM 9.2
+C Intel SBR 9.1
+C Intel IBR ?
+C Intel HWL ?
+C Intel BWL ?
+C Intel SKL ?
+C Intel atom ?
+C Intel SLM ?
+C Intel GLM ?
+C Intel GLM+ ?
+C VIA nano ?
+
+
+define(`u1', `%rdi')
+define(`u0', `%rsi')
+define(`v1', `%rdx')
+define(`v0_param', `%rcx')
+
+define(`v0', `%rax')
+define(`cnt', `%rcx')
+
+define(`s0', `%r8')
+define(`s1', `%r9')
+define(`t0', `%r10')
+define(`t1', `%r11')
+
+dnl ABI_SUPPORT(DOS64) C returns mp_double_limb_t in memory
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_22)
+ FUNC_ENTRY(4)
+ mov v0_param, v0
+
+ ALIGN(16)
+L(top): mov v0, t0
+ sub u0, t0
+ jz L(lowz) C jump when low limb result = 0
+ mov v1, t1
+ sbb u1, t1
+
+ mov u0, s0
+ mov u1, s1
+
+ bsf t0, cnt
+
+ sub v0, u0
+ sbb v1, u1
+
+L(bck): cmovc t0, u0 C u = |u - v|
+ cmovc t1, u1 C u = |u - v|
+ cmovc s0, v0 C v = min(u,v)
+ cmovc s1, v1 C v = min(u,v)
+
+ shrd R8(cnt), u1, u0
+ shr R8(cnt), u1
+
+ mov v1, t1
+ or u1, t1
+ jnz L(top)
+
+L(gcd_11):
+ mov v0, %rdi
+C mov u0, %rsi
+ TCALL( mpn_gcd_11)
+
+L(lowz):C We come here when v0 - u0 = 0
+ C 1. If v1 - u1 = 0, then gcd is u = v.
+ C 2. Else compute gcd_21({v1,v0}, |u1-v1|)
+ mov v1, t0
+ sub u1, t0
+ je L(end)
+
+ xor t1, t1
+ mov u0, s0
+ mov u1, s1
+ bsf t0, cnt
+ mov u1, u0
+ xor u1, u1
+ sub v1, u0
+ jmp L(bck)
+
+L(end): C mov v0, %rax
+ C mov v1, %rdx
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gmp-mparam.h
index 28714e2753c..44f1494d6b2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/gmp-mparam.h
@@ -1,7 +1,6 @@
/* Core 2 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2010, 2012, 2014, 2015 Free Software
-Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,196 +31,192 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 2133 MHz Core 2 (65nm) */
-/* FFT tuning limit = 65 M */
-/* Generated by tuneup.c, 2015-10-08, gcc 4.5 */
+/* 3000 MHz Penryn */
+/* FFT tuning limit = 116,220,984 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 15
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 2
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 11
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 18
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 8
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_NORM_THRESHOLD 3
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 16
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 24
+#define BMOD_1_TO_MOD_1_THRESHOLD 26
-#define MUL_TOOM22_THRESHOLD 23
+#define DIV_1_VS_MUL_1_PERCENT 284
+
+#define MUL_TOOM22_THRESHOLD 24
#define MUL_TOOM33_THRESHOLD 65
-#define MUL_TOOM44_THRESHOLD 178
-#define MUL_TOOM6H_THRESHOLD 254
-#define MUL_TOOM8H_THRESHOLD 357
+#define MUL_TOOM44_THRESHOLD 184
+#define MUL_TOOM6H_THRESHOLD 256
+#define MUL_TOOM8H_THRESHOLD 381
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 69
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 131
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 122
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 73
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 78
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 79
#define MUL_TOOM43_TO_TOOM54_THRESHOLD 106
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 28
#define SQR_TOOM3_THRESHOLD 102
#define SQR_TOOM4_THRESHOLD 160
-#define SQR_TOOM6_THRESHOLD 222
-#define SQR_TOOM8_THRESHOLD 309
+#define SQR_TOOM6_THRESHOLD 366
+#define SQR_TOOM8_THRESHOLD 478
-#define MULMID_TOOM42_THRESHOLD 28
+#define MULMID_TOOM42_THRESHOLD 32
-#define MULMOD_BNM1_THRESHOLD 15
-#define SQRMOD_BNM1_THRESHOLD 13
+#define MULMOD_BNM1_THRESHOLD 11
+#define SQRMOD_BNM1_THRESHOLD 17
-#define MUL_FFT_MODF_THRESHOLD 372 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 368 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 372, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
+ { { 368, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
+ { 10, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
{ 21, 7}, { 11, 6}, { 23, 7}, { 12, 6}, \
{ 25, 7}, { 21, 8}, { 11, 7}, { 24, 8}, \
{ 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
- { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
- { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
- { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
- { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 83,10}, { 47, 9}, \
- { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
- { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 135, 9}, { 271,11}, \
- { 79,10}, { 159, 9}, { 319,10}, { 167,11}, \
- { 95,10}, { 191, 9}, { 383,10}, { 207,11}, \
- { 111,12}, { 63,11}, { 127,10}, { 271, 9}, \
- { 543,11}, { 143,10}, { 287, 9}, { 575,10}, \
- { 303,11}, { 159,10}, { 319,12}, { 95,11}, \
- { 191,10}, { 383,11}, { 207,10}, { 415,11}, \
- { 223,13}, { 63,12}, { 127,11}, { 271,10}, \
- { 543,11}, { 287,10}, { 575,11}, { 303,12}, \
- { 159,11}, { 319,10}, { 639,11}, { 351,12}, \
+ { 19, 7}, { 39, 8}, { 21, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 83,10}, { 47, 9}, { 95,11}, { 31,10}, \
+ { 79,11}, { 47,10}, { 95,12}, { 31, 9}, \
+ { 255,10}, { 135,11}, { 79,10}, { 159, 9}, \
+ { 319,11}, { 95,10}, { 191, 9}, { 383,11}, \
+ { 111,12}, { 63,11}, { 127,10}, { 271,11}, \
+ { 143,10}, { 287, 9}, { 575,10}, { 303,11}, \
+ { 159,10}, { 319,12}, { 95,11}, { 191,10}, \
+ { 383,11}, { 207,10}, { 415,13}, { 63,12}, \
+ { 127,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 319,10}, { 639,11}, { 351,12}, \
{ 191,11}, { 415,12}, { 223,11}, { 479,13}, \
{ 127,12}, { 255,11}, { 543,12}, { 287,11}, \
- { 575,12}, { 351,11}, { 703,13}, { 191,12}, \
- { 415,11}, { 831,12}, { 479,14}, { 127,13}, \
+ { 607,12}, { 319,11}, { 639,12}, { 351,11}, \
+ { 703,13}, { 191,12}, { 479,14}, { 127,13}, \
{ 255,12}, { 575,13}, { 319,12}, { 703,13}, \
- { 383,12}, { 831,13}, { 447,12}, { 959,14}, \
+ { 383,12}, { 799,13}, { 447,12}, { 959,14}, \
{ 255,13}, { 511,12}, { 1023,13}, { 575,12}, \
- { 1215,13}, { 639,12}, { 1279,13}, { 703,14}, \
- { 383,13}, { 831,12}, { 1663,13}, { 959,15}, \
- { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1215,14}, { 639,13}, { 1343,12}, { 2687,13}, \
- { 1407,14}, { 767,13}, { 1535,12}, { 3199,13}, \
- { 1663,14}, { 895,15}, { 511,14}, { 1023,13}, \
- { 2175,14}, { 1151,13}, { 2303,12}, { 4607,13}, \
- { 2431,12}, { 4863,14}, { 1279,13}, { 2687,14}, \
- { 1407,15}, { 767,14}, { 1535,13}, { 3199,14}, \
- { 1663,13}, { 3327,12}, { 6655,13}, { 3455,12}, \
+ { 1151,13}, { 703,14}, { 383,13}, { 831,12}, \
+ { 1663,13}, { 959,15}, { 255,14}, { 511,13}, \
+ { 1087,12}, { 2175,13}, { 1215,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1471,14}, { 767,13}, \
+ { 1663,14}, { 895,13}, { 1791,15}, { 511,14}, \
+ { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
+ { 4863,14}, { 1279,13}, { 2559,14}, { 1407,13}, \
+ { 2815,15}, { 767,14}, { 1663,13}, { 3455,12}, \
{ 6911,14}, { 1791,16}, { 511,15}, { 1023,14}, \
- { 2175,13}, { 4351,12}, { 8703,14}, { 2303,13}, \
- { 4607,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
- { 2815,13}, { 5631,14}, { 2943,13}, { 5887,12}, \
- { 11775,15}, { 1535,14}, { 3199,13}, { 6399,14}, \
- { 3327,13}, { 6655,14}, { 3455,13}, { 6911,15}, \
- { 1791,14}, { 3583,13}, { 7167,14}, { 3839,13}, \
- { 7679,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 193
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
+ { 5887,12}, { 11775,15}, { 1535,14}, { 3455,13}, \
+ { 6911,15}, { 1791,14}, { 3839,13}, { 7679,16}, \
+ { 1023,15}, { 2047,14}, { 4223,15}, { 2303,14}, \
+ { 4991,15}, { 2815,14}, { 5887,13}, { 11775,16}, \
+ { 1535,15}, { 3327,14}, { 6911,15}, { 32768,16}, \
+ { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+ {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 176
#define MUL_FFT_THRESHOLD 4736
-#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 308 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 340, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \
- { 9, 5}, { 19, 6}, { 21, 7}, { 11, 6}, \
- { 23, 7}, { 12, 6}, { 25, 7}, { 21, 8}, \
- { 11, 7}, { 24, 8}, { 13, 7}, { 27, 8}, \
- { 15, 7}, { 31, 8}, { 17, 7}, { 35, 8}, \
+ { { 308, 5}, { 17, 6}, { 23, 7}, { 12, 6}, \
+ { 25, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
+ { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
{ 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
- { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 33, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
{ 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
{ 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 79,10}, { 47, 9}, \
- { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
- { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511, 9}, { 271, 8}, \
- { 543,11}, { 79, 9}, { 319, 8}, { 639,10}, \
- { 175,11}, { 95,10}, { 191, 9}, { 383,10}, \
- { 207, 9}, { 415,12}, { 63,11}, { 127,10}, \
- { 271, 9}, { 543,10}, { 287, 9}, { 575,10}, \
- { 303, 9}, { 607,10}, { 319, 9}, { 639,11}, \
- { 175,12}, { 95,11}, { 191,10}, { 383,11}, \
- { 207,10}, { 415,13}, { 63,12}, { 127,11}, \
- { 271,10}, { 543,11}, { 287,10}, { 575,11}, \
- { 303,10}, { 607,11}, { 319,10}, { 639,11}, \
- { 351,12}, { 191,11}, { 415,12}, { 223,11}, \
+ { 63,10}, { 39, 9}, { 79,10}, { 47,11}, \
+ { 31,10}, { 79,11}, { 47,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255,11}, { 79,10}, \
+ { 159, 6}, { 2559, 7}, { 1343, 6}, { 2687, 7}, \
+ { 1407, 9}, { 383,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,11}, \
+ { 143,10}, { 287, 9}, { 575,11}, { 159,10}, \
+ { 319,11}, { 175,12}, { 95,11}, { 191,10}, \
+ { 383,11}, { 207,10}, { 415,13}, { 63,12}, \
+ { 127,11}, { 255,10}, { 511,11}, { 271,10}, \
+ { 543,11}, { 287,10}, { 575,12}, { 159,11}, \
+ { 319,10}, { 639,11}, { 351,12}, { 191,11}, \
+ { 383,10}, { 767,11}, { 415,12}, { 223,11}, \
{ 479,13}, { 127,12}, { 255,11}, { 543,12}, \
- { 287,11}, { 607,12}, { 319,11}, { 639,12}, \
- { 351,13}, { 191,12}, { 415,11}, { 831,12}, \
- { 479,14}, { 127,13}, { 255,12}, { 607,13}, \
- { 319,12}, { 703,13}, { 383,12}, { 831,13}, \
- { 447,12}, { 959,14}, { 255,13}, { 511,12}, \
- { 1023,13}, { 575,12}, { 1215,13}, { 639,12}, \
- { 1279,13}, { 703,14}, { 383,13}, { 831,12}, \
- { 1663,13}, { 959,15}, { 255,14}, { 511,13}, \
+ { 287,11}, { 575,12}, { 319,11}, { 639,12}, \
+ { 351,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 479,14}, { 127,13}, { 255,12}, { 575,13}, \
+ { 319,12}, { 703,13}, { 383,12}, { 799,13}, \
+ { 447,12}, { 895,14}, { 255,13}, { 511,12}, \
+ { 1023,13}, { 575,12}, { 1151,13}, { 639,12}, \
+ { 1279,13}, { 703,14}, { 383,13}, { 767,12}, \
+ { 1535,13}, { 959,15}, { 255,14}, { 511,13}, \
{ 1087,12}, { 2175,13}, { 1215,14}, { 639,13}, \
- { 1343,12}, { 2687,13}, { 1407,12}, { 2815,14}, \
- { 767,13}, { 1535,12}, { 3199,13}, { 1663,14}, \
- { 895,15}, { 511,14}, { 1023,13}, { 2175,14}, \
- { 1151,13}, { 2303,12}, { 4607,13}, { 2431,12}, \
- { 4863,14}, { 1279,13}, { 2687,14}, { 1407,15}, \
- { 767,14}, { 1535,13}, { 3199,14}, { 1663,13}, \
- { 3327,12}, { 6655,13}, { 3455,14}, { 1791,16}, \
- { 511,15}, { 1023,14}, { 2175,13}, { 4351,12}, \
- { 8703,14}, { 2303,13}, { 4607,14}, { 2431,13}, \
- { 4863,15}, { 1279,14}, { 2815,13}, { 5631,14}, \
+ { 1343,12}, { 2687,13}, { 1407,14}, { 767,13}, \
+ { 1599,12}, { 3199,13}, { 1663,14}, { 895,15}, \
+ { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
+ { 2303,12}, { 4607,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,15}, { 767,14}, \
+ { 1535,13}, { 3199,14}, { 1663,13}, { 3455,12}, \
+ { 6911,16}, { 511,15}, { 1023,14}, { 2303,13}, \
+ { 4607,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
{ 2943,13}, { 5887,12}, { 11775,15}, { 1535,14}, \
- { 3199,13}, { 6399,14}, { 3327,13}, { 6655,14}, \
{ 3455,15}, { 1791,14}, { 3583,13}, { 7167,14}, \
- { 3839,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 193
-#define SQR_FFT_THRESHOLD 3200
+ { 3839,16}, { 1023,15}, { 2047,14}, { 4223,15}, \
+ { 2303,14}, { 4863,15}, { 2815,14}, { 5887,13}, \
+ { 11775,16}, { 1535,15}, { 3071,14}, { 6143,15}, \
+ { 3327,14}, { 6911,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 183
+#define SQR_FFT_THRESHOLD 3520
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 62
+#define MULLO_DC_THRESHOLD 67
#define MULLO_MUL_N_THRESHOLD 9174
-#define SQRLO_BASECASE_THRESHOLD 8
-#define SQRLO_DC_THRESHOLD 0 /* never mpn_sqrlo_basecase */
-#define SQRLO_SQR_THRESHOLD 6253
+#define SQRLO_BASECASE_THRESHOLD 10
+#define SQRLO_DC_THRESHOLD 11
+#define SQRLO_SQR_THRESHOLD 7035
-#define DC_DIV_QR_THRESHOLD 46
-#define DC_DIVAPPR_Q_THRESHOLD 157
-#define DC_BDIV_QR_THRESHOLD 50
-#define DC_BDIV_Q_THRESHOLD 92
+#define DC_DIV_QR_THRESHOLD 53
+#define DC_DIVAPPR_Q_THRESHOLD 163
+#define DC_BDIV_QR_THRESHOLD 46
+#define DC_BDIV_Q_THRESHOLD 76
#define INV_MULMOD_BNM1_THRESHOLD 46
-#define INV_NEWTON_THRESHOLD 156
-#define INV_APPR_THRESHOLD 156
+#define INV_NEWTON_THRESHOLD 158
+#define INV_APPR_THRESHOLD 167
-#define BINV_NEWTON_THRESHOLD 228
-#define REDC_1_TO_REDC_2_THRESHOLD 22
-#define REDC_2_TO_REDC_N_THRESHOLD 51
+#define BINV_NEWTON_THRESHOLD 248
+#define REDC_1_TO_REDC_N_THRESHOLD 44
#define MU_DIV_QR_THRESHOLD 1187
-#define MU_DIVAPPR_Q_THRESHOLD 1187
+#define MU_DIVAPPR_Q_THRESHOLD 1210
#define MUPI_DIV_QR_THRESHOLD 73
#define MU_BDIV_QR_THRESHOLD 1017
#define MU_BDIV_Q_THRESHOLD 1187
-#define POWM_SEC_TABLE 3,64,127,386,1486
+#define POWM_SEC_TABLE 1,64,105,579,1486
-#define GET_STR_DC_THRESHOLD 11
-#define GET_STR_PRECOMPUTE_THRESHOLD 18
-#define SET_STR_DC_THRESHOLD 552
-#define SET_STR_PRECOMPUTE_THRESHOLD 1416
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 17
+#define SET_STR_DC_THRESHOLD 134
+#define SET_STR_PRECOMPUTE_THRESHOLD 1752
-#define FAC_DSC_THRESHOLD 753
-#define FAC_ODD_THRESHOLD 23
+#define FAC_DSC_THRESHOLD 351
+#define FAC_ODD_THRESHOLD 27
-#define MATRIX22_STRASSEN_THRESHOLD 19
-#define HGCD_THRESHOLD 117
-#define HGCD_APPR_THRESHOLD 152
+#define MATRIX22_STRASSEN_THRESHOLD 18
+#define HGCD2_DIV1_METHOD 3 /* 2.14% faster than 5 */
+#define HGCD_THRESHOLD 118
+#define HGCD_APPR_THRESHOLD 161
#define HGCD_REDUCE_THRESHOLD 2121
-#define GCD_DC_THRESHOLD 330
-#define GCDEXT_DC_THRESHOLD 342
-#define JACOBI_BASE_METHOD 4
+#define GCD_DC_THRESHOLD 416
+#define GCDEXT_DC_THRESHOLD 351
+#define JACOBI_BASE_METHOD 4 /* 3.56% faster than 1 */
+
+/* Tuneup completed successfully, took 132491 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/hamdist.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/hamdist.asm
new file mode 100644
index 00000000000..a78753dcf56
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/hamdist.asm
@@ -0,0 +1,210 @@
+dnl AMD64 SSSE3 mpn_hamdist -- hamming distance.
+
+dnl Copyright 2010-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 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/.
+
+
+include(`../config.m4')
+
+C cycles/limb good for cpu?
+C AMD K8,K9 n/a
+C AMD K10 n/a
+C AMD bd1 ?
+C AMD bd2 ?
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen ?
+C AMD bobcat ?
+C AMD jaguar ?
+C Intel P4 n/a
+C Intel CNR 4.50 y
+C Intel PNR 3.28 y
+C Intel NHM ?
+C Intel SBR ?
+C Intel IBR ?
+C Intel HWL ?
+C Intel BWL ?
+C Intel SKL ?
+C Intel atom ?
+C Intel SLM ?
+C VIA nano ?
+
+C TODO
+C * This was hand-written without too much thought about optimal insn
+C selection; check to see of it can be improved.
+C * Consider doing some instruction scheduling.
+
+define(`up', `%rdi')
+define(`vp', `%rsi')
+define(`n', `%rdx')
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_hamdist)
+ lea L(cnsts)(%rip), %r9
+
+ifdef(`PIC', `define(`OFF1',32) define(`OFF2',48)',
+ `define(`OFF1',64) define(`OFF2',80)')
+ movdqa OFF1`'(%r9), %xmm7
+ movdqa OFF2`'(%r9), %xmm6
+ pxor %xmm4, %xmm4
+ pxor %xmm5, %xmm5
+ pxor %xmm8, %xmm8
+
+ mov R32(n), R32(%rax)
+ and $7, R32(%rax)
+ifdef(`PIC',`
+ movslq (%r9,%rax,4), %rax
+ add %r9, %rax
+ jmp *%rax
+',`
+ jmp *(%r9,%rax,8)
+')
+
+L(1): movq (up), %xmm1
+ add $8, up
+ movq (vp), %xmm10
+ add $8, vp
+ pxor %xmm10, %xmm1
+ jmp L(e1)
+
+L(2): add $-48, up
+ add $-48, vp
+ jmp L(e2)
+
+L(3): movq (up), %xmm1
+ add $-40, up
+ movq (vp), %xmm10
+ add $-40, vp
+ pxor %xmm10, %xmm1
+ jmp L(e3)
+
+L(4): add $-32, up
+ add $-32, vp
+ jmp L(e4)
+
+L(5): movq (up), %xmm1
+ add $-24, up
+ movq (vp), %xmm10
+ add $-24, vp
+ pxor %xmm10, %xmm1
+ jmp L(e5)
+
+L(6): add $-16, up
+ add $-16, vp
+ jmp L(e6)
+
+L(7): movq (up), %xmm1
+ add $-8, up
+ movq (vp), %xmm10
+ add $-8, vp
+ pxor %xmm10, %xmm1
+ jmp L(e7)
+
+ ALIGN(32)
+L(top): lddqu (up), %xmm1
+ lddqu (vp), %xmm10
+ pxor %xmm10, %xmm1
+L(e7): movdqa %xmm6, %xmm0 C copy mask register
+ movdqa %xmm7, %xmm2 C copy count register
+ movdqa %xmm7, %xmm3 C copy count register
+ pand %xmm1, %xmm0
+ psrlw $4, %xmm1
+ pand %xmm6, %xmm1
+ pshufb %xmm0, %xmm2
+ pshufb %xmm1, %xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(e6): lddqu 16(up), %xmm1
+ lddqu 16(vp), %xmm10
+ pxor %xmm10, %xmm1
+L(e5): movdqa %xmm6, %xmm0
+ movdqa %xmm7, %xmm2
+ movdqa %xmm7, %xmm3
+ pand %xmm1, %xmm0
+ psrlw $4, %xmm1
+ pand %xmm6, %xmm1
+ pshufb %xmm0, %xmm2
+ pshufb %xmm1, %xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(e4): lddqu 32(up), %xmm1
+ lddqu 32(vp), %xmm10
+ pxor %xmm10, %xmm1
+L(e3): movdqa %xmm6, %xmm0
+ movdqa %xmm7, %xmm2
+ movdqa %xmm7, %xmm3
+ pand %xmm1, %xmm0
+ psrlw $4, %xmm1
+ pand %xmm6, %xmm1
+ pshufb %xmm0, %xmm2
+ pshufb %xmm1, %xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(e2): lddqu 48(up), %xmm1
+ add $64, up
+ lddqu 48(vp), %xmm10
+ add $64, vp
+ pxor %xmm10, %xmm1
+L(e1): movdqa %xmm6, %xmm0
+ movdqa %xmm7, %xmm2
+ movdqa %xmm7, %xmm3
+ pand %xmm1, %xmm0
+ psrlw $4, %xmm1
+ pand %xmm6, %xmm1
+ pshufb %xmm0, %xmm2
+ pshufb %xmm1, %xmm3
+ psadbw %xmm5, %xmm4 C sum to 8 x 16-bit counts
+ paddb %xmm2, %xmm3
+ paddq %xmm4, %xmm8 C sum to 2 x 64-bit counts
+ movdqa %xmm3, %xmm4
+ sub $8, n
+ jg L(top)
+
+ psadbw %xmm5, %xmm4
+ paddq %xmm4, %xmm8
+ pshufd $14, %xmm8, %xmm0
+ paddq %xmm8, %xmm0
+ movq %xmm0, %rax
+ ret
+EPILOGUE()
+DEF_OBJECT(L(cnsts),16,`JUMPTABSECT')
+ JMPENT( L(top), L(cnsts))
+ JMPENT( L(1), L(cnsts))
+ JMPENT( L(2), L(cnsts))
+ JMPENT( L(3), L(cnsts))
+ JMPENT( L(4), L(cnsts))
+ JMPENT( L(5), L(cnsts))
+ JMPENT( L(6), L(cnsts))
+ JMPENT( L(7), L(cnsts))
+ .byte 0x00,0x01,0x01,0x02,0x01,0x02,0x02,0x03
+ .byte 0x01,0x02,0x02,0x03,0x02,0x03,0x03,0x04
+ .byte 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f
+ .byte 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f
+END_OBJECT(L(cnsts))
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/logops_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/logops_n.asm
new file mode 100644
index 00000000000..5ff174c78c8
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/logops_n.asm
@@ -0,0 +1,285 @@
+dnl AMD64 logops.
+
+dnl Copyright 2004-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 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/.
+
+include(`../config.m4')
+
+
+C c/l c/l c/l good
+C var-1 var-2 var-3 for cpu?
+C AMD K8,K9
+C AMD K10 1.52 1.75 1.75 n
+C AMD bd1
+C AMD bd2
+C AMD bd3
+C AMD bd4
+C AMD bt1 2.67 ~2.79 ~2.79 =
+C AMD bt2 2.15 2.65 2.65 n
+C AMD zen 1.5 1.5 1.5 =
+C Intel P4
+C Intel PNR 2.0 2.0 2.0 =
+C Intel NHM 2.0 2.0 2.0 =
+C Intel SBR 1.5 1.5 1.5 y
+C Intel IBR 1.47 1.48 1.48 y
+C Intel HWL 1.11 1.35 1.35 y
+C Intel BWL 1.09 1.30 1.30 y
+C Intel SKL 1.21 1.27 1.27 y
+C Intel atom 3.31 3.57 3.57 y
+C Intel SLM 3.0 3.0 3.0 =
+C VIA nano
+
+ifdef(`OPERATION_and_n',`
+ define(`func',`mpn_and_n')
+ define(`VARIANT_1')
+ define(`LOGOP',`and')')
+ifdef(`OPERATION_andn_n',`
+ define(`func',`mpn_andn_n')
+ define(`VARIANT_2')
+ define(`LOGOP',`and')')
+ifdef(`OPERATION_nand_n',`
+ define(`func',`mpn_nand_n')
+ define(`VARIANT_3')
+ define(`LOGOP',`and')')
+ifdef(`OPERATION_ior_n',`
+ define(`func',`mpn_ior_n')
+ define(`VARIANT_1')
+ define(`LOGOP',`or')')
+ifdef(`OPERATION_iorn_n',`
+ define(`func',`mpn_iorn_n')
+ define(`VARIANT_2')
+ define(`LOGOP',`or')')
+ifdef(`OPERATION_nior_n',`
+ define(`func',`mpn_nior_n')
+ define(`VARIANT_3')
+ define(`LOGOP',`or')')
+ifdef(`OPERATION_xor_n',`
+ define(`func',`mpn_xor_n')
+ define(`VARIANT_1')
+ define(`LOGOP',`xor')')
+ifdef(`OPERATION_xnor_n',`
+ define(`func',`mpn_xnor_n')
+ define(`VARIANT_2')
+ define(`LOGOP',`xor')')
+
+define(`addptr', `lea $1($2), $2')
+
+MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n)
+
+C INPUT PARAMETERS
+define(`rp',`%rdi')
+define(`up',`%rsi')
+define(`vp',`%rdx')
+define(`n',`%rcx')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+
+ifdef(`VARIANT_1',`
+ TEXT
+ ALIGN(32)
+PROLOGUE(func)
+ FUNC_ENTRY(4)
+ mov (vp), %r8
+ mov R32(%rcx), R32(%rax)
+ and $3, R32(%rax)
+ je L(b00)
+ cmp $2, R32(%rax)
+ jc L(b01)
+ je L(b10)
+
+L(b11): LOGOP (up), %r8
+ mov %r8, (rp)
+ inc n
+ addptr( -8, up)
+ addptr( -8, vp)
+ addptr( -8, rp)
+ jmp L(e11)
+L(b10): add $2, n
+ addptr( -16, up)
+ addptr( -16, vp)
+ addptr( -16, rp)
+ jmp L(e10)
+L(b01): LOGOP (up), %r8
+ mov %r8, (rp)
+ dec n
+ jz L(ret)
+ addptr( 8, up)
+ addptr( 8, vp)
+ addptr( 8, rp)
+
+ ALIGN(16)
+L(top): mov (vp), %r8
+L(b00): mov 8(vp), %r9
+ LOGOP (up), %r8
+ LOGOP 8(up), %r9
+ mov %r8, (rp)
+ mov %r9, 8(rp)
+L(e11): mov 16(vp), %r8
+L(e10): mov 24(vp), %r9
+ addptr( 32, vp)
+ LOGOP 16(up), %r8
+ LOGOP 24(up), %r9
+ addptr( 32, up)
+ mov %r8, 16(rp)
+ mov %r9, 24(rp)
+ addptr( 32, rp)
+ sub $4, n
+ jnz L(top)
+
+L(ret): FUNC_EXIT()
+ ret
+EPILOGUE()
+')
+
+ifdef(`VARIANT_2',`
+ TEXT
+ ALIGN(32)
+PROLOGUE(func)
+ FUNC_ENTRY(4)
+ mov (vp), %r8
+ not %r8
+ mov R32(%rcx), R32(%rax)
+ and $3, R32(%rax)
+ je L(b00)
+ cmp $2, R32(%rax)
+ jc L(b01)
+ je L(b10)
+
+L(b11): LOGOP (up), %r8
+ mov %r8, (rp)
+ inc n
+ addptr( -8, up)
+ addptr( -8, vp)
+ addptr( -8, rp)
+ jmp L(e11)
+L(b10): add $2, n
+ addptr( -16, up)
+ addptr( -16, vp)
+ addptr( -16, rp)
+ jmp L(e10)
+L(b01): LOGOP (up), %r8
+ mov %r8, (rp)
+ dec n
+ jz L(ret)
+ addptr( 8, up)
+ addptr( 8, vp)
+ addptr( 8, rp)
+
+ ALIGN(16)
+L(top): mov (vp), %r8
+ not %r8
+L(b00): mov 8(vp), %r9
+ not %r9
+ LOGOP (up), %r8
+ LOGOP 8(up), %r9
+ mov %r8, (rp)
+ mov %r9, 8(rp)
+L(e11): mov 16(vp), %r8
+ not %r8
+L(e10): mov 24(vp), %r9
+ not %r9
+ addptr( 32, vp)
+ LOGOP 16(up), %r8
+ LOGOP 24(up), %r9
+ addptr( 32, up)
+ mov %r8, 16(rp)
+ mov %r9, 24(rp)
+ addptr( 32, rp)
+ sub $4, n
+ jnz L(top)
+
+L(ret): FUNC_EXIT()
+ ret
+EPILOGUE()
+')
+
+ifdef(`VARIANT_3',`
+ TEXT
+ ALIGN(32)
+PROLOGUE(func)
+ FUNC_ENTRY(4)
+ mov (vp), %r8
+ mov R32(%rcx), R32(%rax)
+ and $3, R32(%rax)
+ je L(b00)
+ cmp $2, R32(%rax)
+ jc L(b01)
+ je L(b10)
+
+L(b11): LOGOP (up), %r8
+ not %r8
+ mov %r8, (rp)
+ inc n
+ addptr( -8, up)
+ addptr( -8, vp)
+ addptr( -8, rp)
+ jmp L(e11)
+L(b10): add $2, n
+ addptr( -16, up)
+ addptr( -16, vp)
+ addptr( -16, rp)
+ jmp L(e10)
+L(b01): LOGOP (up), %r8
+ not %r8
+ mov %r8, (rp)
+ dec n
+ jz L(ret)
+ addptr( 8, up)
+ addptr( 8, vp)
+ addptr( 8, rp)
+
+ ALIGN(16)
+L(top): mov (vp), %r8
+L(b00): mov 8(vp), %r9
+ LOGOP (up), %r8
+ not %r8
+ LOGOP 8(up), %r9
+ not %r9
+ mov %r8, (rp)
+ mov %r9, 8(rp)
+L(e11): mov 16(vp), %r8
+L(e10): mov 24(vp), %r9
+ addptr( 32, vp)
+ LOGOP 16(up), %r8
+ not %r8
+ LOGOP 24(up), %r9
+ addptr( 32, up)
+ not %r9
+ mov %r8, 16(rp)
+ mov %r9, 24(rp)
+ addptr( 32, rp)
+ sub $4, n
+ jnz L(top)
+
+L(ret): FUNC_EXIT()
+ ret
+EPILOGUE()
+')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshift.asm
index 8ccafeca6c6..9016a71ff2b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshift.asm
@@ -1,6 +1,6 @@
-dnl x86-64 mpn_lshift optimized for "Core 2".
+dnl x86-64 mpn_lshift optimised for Conroe/Penryn and Nehalem.
-dnl Copyright 2007, 2009, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2007, 2009, 2011, 2012, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -30,17 +30,27 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-
C cycles/limb
-C AMD K8,K9 4.25
-C AMD K10 4.25
-C Intel P4 14.7
-C Intel core2 1.27
-C Intel NHM 1.375 (up to about n = 260, then 1.5)
-C Intel SBR 1.87
-C Intel atom ?
-C VIA nano ?
-
+C AMD K8,K9
+C AMD K10
+C AMD bd1
+C AMD bd2
+C AMD bd3
+C AMD bd4
+C AMD zen
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel core2 1.32
+C Intel NHM 1.30 (drops to 2.5 for n > 256)
+C Intel SBR
+C Intel IBR
+C Intel HWL
+C Intel BWL
+C Intel SKL
+C Intel atom
+C Intel SLM
+C VIA nano
C INPUT PARAMETERS
define(`rp', `%rdi')
@@ -56,69 +66,55 @@ ASM_START()
ALIGN(16)
PROLOGUE(mpn_lshift)
FUNC_ENTRY(4)
- lea -8(rp,n,8), rp
- lea -8(up,n,8), up
- mov R32(%rdx), R32(%rax)
- and $3, R32(%rax)
- jne L(nb00)
-L(b00): C n = 4, 8, 12, ...
+ xor R32(%rax), R32(%rax)
+
+ test $1, R8(n)
+ jnz L(bx1)
+L(bx0): test $2, R8(n)
+ jnz L(b10)
+
+L(b00): lea -8(up,n,8), up
+ lea 16(rp,n,8), rp
mov (up), %r10
mov -8(up), %r11
- xor R32(%rax), R32(%rax)
shld R8(cnt), %r10, %rax
mov -16(up), %r8
- lea 24(rp), rp
- sub $4, n
+ shr $2, n
jmp L(00)
-L(nb00):C n = 1, 5, 9, ...
- cmp $2, R32(%rax)
- jae L(nb01)
-L(b01): mov (up), %r9
- xor R32(%rax), R32(%rax)
+L(bx1): test $2, R8(n)
+ jnz L(b11)
+
+L(b01): lea -16(up,n,8), up
+ lea 8(rp,n,8), rp
+ mov 8(up), %r9
shld R8(cnt), %r9, %rax
- sub $2, n
- jb L(le1)
- mov -8(up), %r10
- mov -16(up), %r11
- lea -8(up), up
- lea 16(rp), rp
+ shr $2, n
+ jz L(1)
+ mov (up), %r10
+ mov -8(up), %r11
jmp L(01)
-L(le1): shl R8(cnt), %r9
- mov %r9, (rp)
- FUNC_EXIT()
- ret
-L(nb01):C n = 2, 6, 10, ...
- jne L(b11)
-L(b10): mov (up), %r8
- mov -8(up), %r9
- xor R32(%rax), R32(%rax)
+L(b10): lea -24(up,n,8), up
+ lea (rp,n,8), rp
+ mov 16(up), %r8
+ mov 8(up), %r9
shld R8(cnt), %r8, %rax
- sub $3, n
- jb L(le2)
- mov -16(up), %r10
- lea -16(up), up
- lea 8(rp), rp
+ shr $2, n
+ jz L(2)
+ mov (up), %r10
jmp L(10)
-L(le2): shld R8(cnt), %r9, %r8
- mov %r8, (rp)
- shl R8(cnt), %r9
- mov %r9, -8(rp)
- FUNC_EXIT()
- ret
- ALIGN(16) C performance critical!
-L(b11): C n = 3, 7, 11, ...
- mov (up), %r11
- mov -8(up), %r8
- xor R32(%rax), R32(%rax)
+ ALIGN(16)
+L(b11): lea -32(up,n,8), up
+ lea -8(rp,n,8), rp
+ mov 24(up), %r11
+ mov 16(up), %r8
+ mov 8(up), %r9
shld R8(cnt), %r11, %rax
- mov -16(up), %r9
- lea -24(up), up
- sub $4, n
- jb L(end)
+ shr $2, n
+ jz L(end)
ALIGN(16)
L(top): shld R8(cnt), %r8, %r11
@@ -132,17 +128,17 @@ L(01): shld R8(cnt), %r10, %r9
mov %r9, -16(rp)
L(00): shld R8(cnt), %r11, %r10
mov -24(up), %r9
- mov %r10, -24(rp)
add $-32, up
- lea -32(rp), rp
- sub $4, n
- jnc L(top)
+ mov %r10, -24(rp)
+ add $-32, rp
+ dec n
+ jnz L(top)
L(end): shld R8(cnt), %r8, %r11
mov %r11, (rp)
- shld R8(cnt), %r9, %r8
+L(2): shld R8(cnt), %r9, %r8
mov %r8, -8(rp)
- shl R8(cnt), %r9
+L(1): shl R8(cnt), %r9
mov %r9, -16(rp)
FUNC_EXIT()
ret
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshiftc.asm
index 65c7b2f1b86..c428f13ca0c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshiftc.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/lshiftc.asm
@@ -1,6 +1,6 @@
-dnl x86-64 mpn_lshiftc optimized for "Core 2".
+dnl x86-64 mpn_lshiftc optimised for Conroe/Penryn and Nehalem.
-dnl Copyright 2007, 2009, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2007, 2009, 2011, 2012, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -30,17 +30,27 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-
C cycles/limb
-C AMD K8,K9 ?
-C AMD K10 ?
-C Intel P4 ?
-C Intel core2 1.5
-C Intel NHM 2.25 (up to about n = 260, then 1.875)
-C Intel SBR 2.25
-C Intel atom ?
-C VIA nano ?
-
+C AMD K8,K9
+C AMD K10
+C AMD bd1
+C AMD bd2
+C AMD bd3
+C AMD bd4
+C AMD zen
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel core2 1.52
+C Intel NHM 1.78 (just 2.15 for n < 256)
+C Intel SBR
+C Intel IBR
+C Intel HWL
+C Intel BWL
+C Intel SKL
+C Intel atom
+C Intel SLM
+C VIA nano
C INPUT PARAMETERS
define(`rp', `%rdi')
@@ -48,6 +58,10 @@ define(`up', `%rsi')
define(`n', `%rdx')
define(`cnt', `%rcx')
+C TODO
+C * This runs poorly on Nehalem compared to plain lshift, in particular for
+C n < 256.
+
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
@@ -56,102 +70,88 @@ ASM_START()
ALIGN(16)
PROLOGUE(mpn_lshiftc)
FUNC_ENTRY(4)
- lea -8(rp,n,8), rp
- lea -8(up,n,8), up
- mov R32(%rdx), R32(%rax)
- and $3, R32(%rax)
- jne L(nb00)
-L(b00): C n = 4, 8, 12, ...
+ xor R32(%rax), R32(%rax)
+
+ test $1, R8(n)
+ jnz L(bx1)
+L(bx0): test $2, R8(n)
+ jnz L(b10)
+
+L(b00): lea -8(up,n,8), up
+ lea 16(rp,n,8), rp
mov (up), %r10
mov -8(up), %r11
- xor R32(%rax), R32(%rax)
shld R8(cnt), %r10, %rax
mov -16(up), %r8
- lea 24(rp), rp
- sub $4, n
+ shr $2, n
+ shld R8(cnt), %r11, %r10
jmp L(00)
-L(nb00):C n = 1, 5, 9, ...
- cmp $2, R32(%rax)
- jae L(nb01)
-L(b01): mov (up), %r9
- xor R32(%rax), R32(%rax)
+L(bx1): test $2, R8(n)
+ jnz L(b11)
+
+L(b01): lea -16(up,n,8), up
+ lea 8(rp,n,8), rp
+ mov 8(up), %r9
shld R8(cnt), %r9, %rax
- sub $2, n
- jb L(le1)
- mov -8(up), %r10
- mov -16(up), %r11
- lea -8(up), up
- lea 16(rp), rp
+ shr $2, n
+ jz L(1)
+ mov (up), %r10
+ mov -8(up), %r11
+ shld R8(cnt), %r10, %r9
jmp L(01)
-L(le1): shl R8(cnt), %r9
- not %r9
- mov %r9, (rp)
- FUNC_EXIT()
- ret
-L(nb01):C n = 2, 6, 10, ...
- jne L(b11)
-L(b10): mov (up), %r8
- mov -8(up), %r9
- xor R32(%rax), R32(%rax)
+L(b10): lea -24(up,n,8), up
+ lea (rp,n,8), rp
+ mov 16(up), %r8
+ mov 8(up), %r9
shld R8(cnt), %r8, %rax
- sub $3, n
- jb L(le2)
- mov -16(up), %r10
- lea -16(up), up
- lea 8(rp), rp
+ shr $2, n
+ jz L(2)
+ mov (up), %r10
+ shld R8(cnt), %r9, %r8
jmp L(10)
-L(le2): shld R8(cnt), %r9, %r8
- not %r8
- mov %r8, (rp)
- shl R8(cnt), %r9
- not %r9
- mov %r9, -8(rp)
- FUNC_EXIT()
- ret
- ALIGN(16) C performance critical!
-L(b11): C n = 3, 7, 11, ...
- mov (up), %r11
- mov -8(up), %r8
- xor R32(%rax), R32(%rax)
+ ALIGN(16)
+L(b11): lea -32(up,n,8), up
+ lea -8(rp,n,8), rp
+ mov 24(up), %r11
+ mov 16(up), %r8
+ mov 8(up), %r9
shld R8(cnt), %r11, %rax
- mov -16(up), %r9
- lea -24(up), up
- sub $4, n
- jb L(end)
+ shr $2, n
+ jz L(end)
ALIGN(16)
L(top): shld R8(cnt), %r8, %r11
mov (up), %r10
not %r11
+ shld R8(cnt), %r9, %r8
mov %r11, (rp)
-L(10): shld R8(cnt), %r9, %r8
- mov -8(up), %r11
+L(10): mov -8(up), %r11
not %r8
+ shld R8(cnt), %r10, %r9
mov %r8, -8(rp)
-L(01): shld R8(cnt), %r10, %r9
- mov -16(up), %r8
+L(01): mov -16(up), %r8
not %r9
+ shld R8(cnt), %r11, %r10
mov %r9, -16(rp)
-L(00): shld R8(cnt), %r11, %r10
- mov -24(up), %r9
+L(00): mov -24(up), %r9
not %r10
- mov %r10, -24(rp)
add $-32, up
- lea -32(rp), rp
- sub $4, n
- jnc L(top)
+ mov %r10, -24(rp)
+ add $-32, rp
+ dec n
+ jnz L(top)
L(end): shld R8(cnt), %r8, %r11
not %r11
mov %r11, (rp)
- shld R8(cnt), %r9, %r8
+L(2): shld R8(cnt), %r9, %r8
not %r8
mov %r8, -8(rp)
- shl R8(cnt), %r9
+L(1): shl R8(cnt), %r9
not %r9
mov %r9, -16(rp)
FUNC_EXIT()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/popcount.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/popcount.asm
index e935cf18920..39d8c5ded1b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/popcount.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/popcount.asm
@@ -1,6 +1,6 @@
-dnl x86-64 mpn_popcount optimized for "Core 2".
+dnl AMD64 SSSE3 mpn_popcount -- population count.
-dnl Copyright 2007 Free Software Foundation, Inc.
+dnl Copyright 2010-2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,5 +31,155 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-MULFUNC_PROLOGUE(mpn_popcount)
-include_mpn(`x86/pentium4/sse2/popcount.asm')
+C cycles/limb good for cpu?
+C AMD K8,K9 n/a
+C AMD K10 n/a
+C AMD bd1 1.79-1.91 n
+C AMD bd2 1.73-1.85 n
+C AMD bd3 ?
+C AMD bd4 1.73-1.85 n
+C AMD zen 1.47 n
+C AMD bobcat 8.0 n
+C AMD jaguar 4.78 n
+C Intel P4 n/a
+C Intel CNR 3.75
+C Intel PNR 2.61 y
+C Intel NHM 2.03 n
+C Intel SBR 1.87 n
+C Intel IBR 1.52-1.58 n
+C Intel HWL 1.52-1.58 n
+C Intel BWL 1.52-1.58 n
+C Intel SKL 1.51 n
+C Intel atom 12.3 n
+C Intel SLM 9.1 n
+C VIA nano ?
+
+C TODO
+C * This was hand-written without too much thought about optimal insn
+C selection; check to see of it can be improved.
+C * Consider doing some instruction scheduling.
+
+define(`up', `%rdi')
+define(`n', `%rsi')
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_popcount)
+ lea L(cnsts)(%rip), %r9
+
+ifdef(`PIC', `define(`OFF1',32) define(`OFF2',48)',
+ `define(`OFF1',64) define(`OFF2',80)')
+ movdqa OFF1`'(%r9), %xmm7
+ movdqa OFF2`'(%r9), %xmm6
+ pxor %xmm4, %xmm4
+ pxor %xmm5, %xmm5
+ pxor %xmm8, %xmm8
+
+ mov R32(n), R32(%rax)
+ and $7, R32(%rax)
+ifdef(`PIC',`
+ movslq (%r9,%rax,4), %rax
+ add %r9, %rax
+ jmp *%rax
+',`
+ jmp *(%r9,%rax,8)
+')
+
+L(1): movq (up), %xmm1
+ add $8, up
+ jmp L(e1)
+
+L(2): add $-48, up
+ jmp L(e2)
+
+L(3): movq (up), %xmm1
+ add $-40, up
+ jmp L(e3)
+
+L(4): add $-32, up
+ jmp L(e4)
+
+L(5): movq (up), %xmm1
+ add $-24, up
+ jmp L(e5)
+
+L(6): add $-16, up
+ jmp L(e6)
+
+L(7): movq (up), %xmm1
+ add $-8, up
+ jmp L(e7)
+
+ ALIGN(32)
+L(top): lddqu (up), %xmm1
+L(e7): movdqa %xmm6, %xmm0 C copy mask register
+ movdqa %xmm7, %xmm2 C copy count register
+ movdqa %xmm7, %xmm3 C copy count register
+ pand %xmm1, %xmm0
+ psrlw $4, %xmm1
+ pand %xmm6, %xmm1
+ pshufb %xmm0, %xmm2
+ pshufb %xmm1, %xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(e6): lddqu 16(up), %xmm1
+L(e5): movdqa %xmm6, %xmm0
+ movdqa %xmm7, %xmm2
+ movdqa %xmm7, %xmm3
+ pand %xmm1, %xmm0
+ psrlw $4, %xmm1
+ pand %xmm6, %xmm1
+ pshufb %xmm0, %xmm2
+ pshufb %xmm1, %xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(e4): lddqu 32(up), %xmm1
+L(e3): movdqa %xmm6, %xmm0
+ movdqa %xmm7, %xmm2
+ movdqa %xmm7, %xmm3
+ pand %xmm1, %xmm0
+ psrlw $4, %xmm1
+ pand %xmm6, %xmm1
+ pshufb %xmm0, %xmm2
+ pshufb %xmm1, %xmm3
+ paddb %xmm2, %xmm3
+ paddb %xmm3, %xmm4
+L(e2): lddqu 48(up), %xmm1
+ add $64, up
+L(e1): movdqa %xmm6, %xmm0
+ movdqa %xmm7, %xmm2
+ movdqa %xmm7, %xmm3
+ pand %xmm1, %xmm0
+ psrlw $4, %xmm1
+ pand %xmm6, %xmm1
+ pshufb %xmm0, %xmm2
+ pshufb %xmm1, %xmm3
+ psadbw %xmm5, %xmm4 C sum to 8 x 16-bit counts
+ paddb %xmm2, %xmm3
+ paddq %xmm4, %xmm8 C sum to 2 x 64-bit counts
+ movdqa %xmm3, %xmm4
+ sub $8, n
+ jg L(top)
+
+ psadbw %xmm5, %xmm4
+ paddq %xmm4, %xmm8
+ pshufd $14, %xmm8, %xmm0
+ paddq %xmm8, %xmm0
+ movq %xmm0, %rax
+ ret
+EPILOGUE()
+DEF_OBJECT(L(cnsts),16,`JUMPTABSECT')
+ JMPENT( L(top), L(cnsts))
+ JMPENT( L(1), L(cnsts))
+ JMPENT( L(2), L(cnsts))
+ JMPENT( L(3), L(cnsts))
+ JMPENT( L(4), L(cnsts))
+ JMPENT( L(5), L(cnsts))
+ JMPENT( L(6), L(cnsts))
+ JMPENT( L(7), L(cnsts))
+ .byte 0x00,0x01,0x01,0x02,0x01,0x02,0x02,0x03
+ .byte 0x01,0x02,0x02,0x03,0x02,0x03,0x03,0x04
+ .byte 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f
+ .byte 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f
+END_OBJECT(L(cnsts))
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/rshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/rshift.asm
index ab32ec85dff..7578a5349eb 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/rshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/rshift.asm
@@ -1,6 +1,6 @@
-dnl x86-64 mpn_rshift optimized for "Core 2".
+dnl x86-64 mpn_rshift optimised for Conroe/Penryn and Nehalem.
-dnl Copyright 2007, 2009, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2007, 2009, 2011, 2012, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -30,17 +30,27 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-
C cycles/limb
-C AMD K8,K9 4.25
-C AMD K10 4.25
-C Intel P4 14.7
-C Intel core2 1.27
-C Intel NHM 1.375 (up to about n = 260, then 1.5)
-C Intel SBR 1.77
-C Intel atom ?
-C VIA nano ?
-
+C AMD K8,K9
+C AMD K10
+C AMD bd1
+C AMD bd2
+C AMD bd3
+C AMD bd4
+C AMD zen
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel core2 1.32
+C Intel NHM 1.30 (drops to 2.5 for n > 256)
+C Intel SBR
+C Intel IBR
+C Intel HWL
+C Intel BWL
+C Intel SKL
+C Intel atom
+C Intel SLM
+C VIA nano
C INPUT PARAMETERS
define(`rp', `%rdi')
@@ -56,67 +66,53 @@ ASM_START()
ALIGN(16)
PROLOGUE(mpn_rshift)
FUNC_ENTRY(4)
- mov R32(%rdx), R32(%rax)
- and $3, R32(%rax)
- jne L(nb00)
-L(b00): C n = 4, 8, 12, ...
- mov (up), %r10
- mov 8(up), %r11
+
xor R32(%rax), R32(%rax)
- shrd R8(cnt), %r10, %rax
- mov 16(up), %r8
- lea 8(up), up
+
+ test $1, R8(n)
+ jnz L(bx1)
+L(bx0): test $2, R8(n)
+ jnz L(b10)
+
+L(b00): lea 8(up), up
lea -24(rp), rp
- sub $4, n
+ mov -8(up), %r10
+ mov (up), %r11
+ shrd R8(cnt), %r10, %rax
+ mov 8(up), %r8
+ shr $2, n
jmp L(00)
-L(nb00):C n = 1, 5, 9, ...
- cmp $2, R32(%rax)
- jae L(nb01)
-L(b01): mov (up), %r9
- xor R32(%rax), R32(%rax)
- shrd R8(cnt), %r9, %rax
- sub $2, n
- jb L(le1)
- mov 8(up), %r10
- mov 16(up), %r11
- lea 16(up), up
+L(bx1): test $2, R8(n)
+ jnz L(b11)
+
+L(b01): lea 16(up), up
lea -16(rp), rp
+ mov -16(up), %r9
+ shrd R8(cnt), %r9, %rax
+ shr $2, n
+ jz L(1)
+ mov -8(up), %r10
+ mov (up), %r11
jmp L(01)
-L(le1): shr R8(cnt), %r9
- mov %r9, (rp)
- FUNC_EXIT()
- ret
-L(nb01):C n = 2, 6, 10, ...
- jne L(b11)
-L(b10): mov (up), %r8
- mov 8(up), %r9
- xor R32(%rax), R32(%rax)
- shrd R8(cnt), %r8, %rax
- sub $3, n
- jb L(le2)
- mov 16(up), %r10
- lea 24(up), up
+L(b10): lea 24(up), up
lea -8(rp), rp
+ mov -24(up), %r8
+ mov -16(up), %r9
+ shrd R8(cnt), %r8, %rax
+ shr $2, n
+ jz L(2)
+ mov -8(up), %r10
jmp L(10)
-L(le2): shrd R8(cnt), %r9, %r8
- mov %r8, (rp)
- shr R8(cnt), %r9
- mov %r9, 8(rp)
- FUNC_EXIT()
- ret
- ALIGN(16)
-L(b11): C n = 3, 7, 11, ...
- mov (up), %r11
- mov 8(up), %r8
- xor R32(%rax), R32(%rax)
+L(b11): lea 32(up), up
+ mov -32(up), %r11
+ mov -24(up), %r8
+ mov -16(up), %r9
shrd R8(cnt), %r11, %rax
- mov 16(up), %r9
- lea 32(up), up
- sub $4, n
- jb L(end)
+ shr $2, n
+ jz L(end)
ALIGN(16)
L(top): shrd R8(cnt), %r8, %r11
@@ -130,17 +126,17 @@ L(01): shrd R8(cnt), %r10, %r9
mov %r9, 16(rp)
L(00): shrd R8(cnt), %r11, %r10
mov 16(up), %r9
- mov %r10, 24(rp)
add $32, up
- lea 32(rp), rp
- sub $4, n
- jnc L(top)
+ mov %r10, 24(rp)
+ add $32, rp
+ dec n
+ jnz L(top)
L(end): shrd R8(cnt), %r8, %r11
mov %r11, (rp)
- shrd R8(cnt), %r9, %r8
+L(2): shrd R8(cnt), %r9, %r8
mov %r8, 8(rp)
- shr R8(cnt), %r9
+L(1): shr R8(cnt), %r9
mov %r9, 16(rp)
FUNC_EXIT()
ret
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/sublshC_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/sublshC_n.asm
index 5acc46b032a..272700db5e2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/sublshC_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/core2/sublshC_n.asm
@@ -1,4 +1,4 @@
-dnl AMD64 mpn_sublshC_n -- rp[] = up[] - (vp[] << 1), optimised for Core 2 and
+dnl AMD64 mpn_sublshC_n -- rp[] = up[] - (vp[] << C), optimised for Core 2 and
dnl Core iN.
dnl Contributed to the GNU project by Torbjorn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/addmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/addmul_1.asm
index aaa58e72518..ee7e4eeab86 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/addmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/addmul_1.asm
@@ -1,6 +1,6 @@
dnl AMD64 mpn_addmul_1 optimised for Intel Broadwell.
-dnl Copyright 2015 Free Software Foundation, Inc.
+dnl Copyright 2015, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -33,19 +33,21 @@ include(`../config.m4')
C cycles/limb
C AMD K8,K9 n/a
C AMD K10 n/a
-C AMD bull n/a
-C AMD pile n/a
-C AMD steam n/a
-C AMD excavator ?
-C AMD bobcat n/a
-C AMD jaguar n/a
+C AMD bd1 n/a
+C AMD bd2 n/a
+C AMD bd3 n/a
+C AMD bd4 ?
+C AMD zen ?
+C AMD bt1 n/a
+C AMD bt2 n/a
C Intel P4 n/a
-C Intel core2 n/a
+C Intel PNR n/a
C Intel NHM n/a
C Intel SBR n/a
C Intel IBR n/a
C Intel HWL n/a
-C Intel BWL 1.8-1.9
+C Intel BWL 1.67 1.74
+C Intel SKL 1.63 1.71
C Intel atom n/a
C Intel SLM n/a
C VIA nano n/a
@@ -57,7 +59,7 @@ C TODO
C * Put an initial mulx before switching, targeting some free registers.
C * Tune feed-in code.
C * Trim nop execution after L(f2).
-C * Port to DOS64, not forgetting nop execution.
+C * For DOS64, fix nop execution.
define(`rp', `%rdi') C rcx
define(`up', `%rsi') C rdx
@@ -66,7 +68,7 @@ define(`v0_param',`%rcx') C r9
define(`n', `%rcx')
-dnl ABI_SUPPORT(DOS64)
+ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
dnl IFDOS(` define(`up', ``%rsi'') ') dnl
@@ -80,6 +82,7 @@ ASM_START()
TEXT
ALIGN(32)
PROLOGUE(mpn_addmul_1)
+ FUNC_ENTRY(4)
mov v0_param, %r10
mov n_param, n
@@ -139,12 +142,14 @@ L(f1): mulx( (up), %r9, %rax)
L(1): add (rp), %r9
mov %r9, (rp)
adc %rcx, %rax C relies on rcx = 0
+ FUNC_EXIT()
ret
L(end): adox( (rp), %r9)
mov %r9, (rp)
adox( %rcx, %rax) C relies on rcx = 0
adc %rcx, %rax C relies on rcx = 0
+ FUNC_EXIT()
ret
ifdef(`PIC',
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/gmp-mparam.h
index 1f2cc67980e..91c91b5373a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/gmp-mparam.h
@@ -1,6 +1,6 @@
/* Broadwell gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2015 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,195 +35,212 @@ see https://www.gnu.org/licenses/. */
#undef HAVE_NATIVE_mpn_mul_2
#undef HAVE_NATIVE_mpn_addmul_2
-/* 2100 MHz Intel i3-5100 */
-/* FFT tuning limit = 200 M */
-/* Generated by tuneup.c, 2015-10-12, gcc 4.8 */
+/* 3400-3800 MHz Intel Xeon E3-1285Lv4 Broadwell */
+/* FFT tuning limit = 467,964,472 */
+/* Generated by tuneup.c, 2019-10-17, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 15
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 26
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 14
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 24
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
#define USE_PREINV_DIVREM_1 1 /* native */
#define DIV_QR_1_NORM_THRESHOLD 1
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 24
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 20
+#define BMOD_1_TO_MOD_1_THRESHOLD 22
-#define MUL_TOOM22_THRESHOLD 28
-#define MUL_TOOM33_THRESHOLD 75
-#define MUL_TOOM44_THRESHOLD 218
-#define MUL_TOOM6H_THRESHOLD 354
-#define MUL_TOOM8H_THRESHOLD 434
+#define DIV_1_VS_MUL_1_PERCENT 455
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 75
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 163
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 147
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 149
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 215
+#define MUL_TOOM22_THRESHOLD 26
+#define MUL_TOOM33_THRESHOLD 73
+#define MUL_TOOM44_THRESHOLD 202
+#define MUL_TOOM6H_THRESHOLD 303
+#define MUL_TOOM8H_THRESHOLD 406
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 141
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 152
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 137
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 151
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 198
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 38
-#define SQR_TOOM3_THRESHOLD 113
-#define SQR_TOOM4_THRESHOLD 442
-#define SQR_TOOM6_THRESHOLD 517
-#define SQR_TOOM8_THRESHOLD 572
+#define SQR_TOOM2_THRESHOLD 34
+#define SQR_TOOM3_THRESHOLD 117
+#define SQR_TOOM4_THRESHOLD 336
+#define SQR_TOOM6_THRESHOLD 426
+#define SQR_TOOM8_THRESHOLD 547
#define MULMID_TOOM42_THRESHOLD 46
#define MULMOD_BNM1_THRESHOLD 16
-#define SQRMOD_BNM1_THRESHOLD 17
+#define SQRMOD_BNM1_THRESHOLD 18
-#define MUL_FFT_MODF_THRESHOLD 428 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 460 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 428, 5}, { 23, 6}, { 25, 7}, { 13, 6}, \
- { 27, 7}, { 14, 6}, { 29, 7}, { 24, 8}, \
- { 13, 7}, { 29, 8}, { 15, 7}, { 31, 8}, \
+ { { 460, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 12, 5}, { 25, 6}, { 25, 7}, { 13, 6}, \
+ { 28, 7}, { 15, 6}, { 31, 7}, { 25, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 31, 8}, \
{ 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
{ 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
{ 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
- { 49, 9}, { 27,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 55,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 83,10}, { 47, 9}, \
- { 99,10}, { 55,11}, { 31,10}, { 71, 6}, \
- { 1215, 7}, { 639, 8}, { 335, 9}, { 179,12}, \
- { 31,11}, { 63,10}, { 143,11}, { 79,10}, \
- { 167,11}, { 111,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
- { 287, 9}, { 575,10}, { 303,11}, { 159,10}, \
- { 319,12}, { 95,11}, { 191,10}, { 383,13}, \
+ { 49, 9}, { 27,10}, { 15, 9}, { 39, 8}, \
+ { 79,10}, { 23, 9}, { 55,11}, { 15,10}, \
+ { 31, 9}, { 71,10}, { 39, 9}, { 83,10}, \
+ { 47, 9}, { 99,10}, { 55,11}, { 31,10}, \
+ { 87,11}, { 47,10}, { 103,12}, { 31,11}, \
+ { 63,10}, { 135,11}, { 79,10}, { 167,11}, \
+ { 95,10}, { 199,11}, { 111,12}, { 63, 8}, \
+ { 1087,10}, { 287, 9}, { 575,10}, { 303,11}, \
+ { 159,12}, { 95,11}, { 191,10}, { 383,13}, \
{ 63,12}, { 127,11}, { 255,10}, { 511,11}, \
- { 271,10}, { 543,11}, { 287,10}, { 575,12}, \
- { 159,11}, { 319,10}, { 639,11}, { 335,10}, \
- { 671,11}, { 351,10}, { 703,12}, { 191,11}, \
- { 383,10}, { 767,11}, { 415,10}, { 831,12}, \
- { 223,11}, { 447,13}, { 127,11}, { 543,12}, \
- { 287,11}, { 607,10}, { 1215,12}, { 319,11}, \
- { 671,12}, { 351,11}, { 703,13}, { 191,12}, \
- { 383,11}, { 799,12}, { 415,11}, { 831,12}, \
- { 447,14}, { 127,13}, { 255,12}, { 543,11}, \
- { 1087,12}, { 607,13}, { 319,12}, { 671,11}, \
- { 1343,12}, { 735,13}, { 383,12}, { 831,13}, \
- { 447,12}, { 959,13}, { 511,12}, { 1023,13}, \
- { 575,12}, { 1151,13}, { 639,12}, { 1343,13}, \
- { 703,12}, { 1407,14}, { 383,13}, { 831,12}, \
- { 1663,13}, { 895,14}, { 511,13}, { 1087,12}, \
- { 2175,13}, { 1151,14}, { 639,13}, { 1343,12}, \
+ { 271,10}, { 543,11}, { 287,10}, { 575,11}, \
+ { 303,10}, { 607,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
+ { 703,11}, { 367,12}, { 191,11}, { 383,10}, \
+ { 767,11}, { 415,10}, { 831,11}, { 447,13}, \
+ { 127,12}, { 255,11}, { 543,12}, { 287,11}, \
+ { 607,12}, { 319,11}, { 671,12}, { 351,11}, \
+ { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 415,11}, { 831,12}, { 447,14}, { 127,13}, \
+ { 255,12}, { 607,13}, { 319,12}, { 735,13}, \
+ { 383,12}, { 831,13}, { 447,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1023,13}, { 575,12}, \
+ { 1151,13}, { 639,12}, { 1279,13}, { 703,14}, \
+ { 383,13}, { 831,12}, { 1663,13}, { 959,14}, \
+ { 511,13}, { 1087,12}, { 2175,13}, { 1151,14}, \
+ { 639,13}, { 1279,12}, { 2559,13}, { 1343,12}, \
{ 2687,13}, { 1407,14}, { 767,13}, { 1535,12}, \
- { 3199,13}, { 1663,14}, { 895,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
- { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
- { 2943,15}, { 767,14}, { 1535,13}, { 3199,14}, \
- { 1663,13}, { 3455,14}, { 1791,16}, { 511,15}, \
- { 1023,14}, { 2175,13}, { 4479,14}, { 2431,13}, \
- { 4863,15}, { 1279,14}, { 2943,13}, { 5887,15}, \
- { 1535,14}, { 3455,15}, { 1791,14}, { 3839,16}, \
- { 1023,15}, { 2047,14}, { 4479,15}, { 2303,14}, \
- { 4863,15}, { 2559,14}, { 5247,15}, { 2815,14}, \
- { 5887,16}, { 1535,15}, { 3327,14}, { 6911,15}, \
- { 3839,17}, { 1023,16}, { 2047,15}, { 4863,16}, \
- { 2559,15}, { 5887,16}, { 65536,17}, { 131072,18}, \
- { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
- {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 194
-#define MUL_FFT_THRESHOLD 4736
-
-#define SQR_FFT_MODF_THRESHOLD 396 /* k = 5 */
+ { 3071,13}, { 1599,12}, { 3199,13}, { 1663,14}, \
+ { 895,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
+ { 2687,14}, { 1407,15}, { 767,14}, { 1535,13}, \
+ { 3199,14}, { 1663,13}, { 3455,12}, { 6911,16}, \
+ { 511,15}, { 1023,14}, { 2175,13}, { 4479,14}, \
+ { 2303,13}, { 4607,14}, { 2431,13}, { 4863,15}, \
+ { 1279,14}, { 2815,13}, { 5631,14}, { 2943,13}, \
+ { 5887,15}, { 1535,14}, { 3455,13}, { 6911,15}, \
+ { 1791,14}, { 3839,13}, { 7679,16}, { 1023,15}, \
+ { 2047,14}, { 4479,15}, { 2303,14}, { 4863,15}, \
+ { 2559,14}, { 5247,15}, { 2815,14}, { 5887,16}, \
+ { 1535,15}, { 3327,14}, { 6911,15}, { 3839,14}, \
+ { 7679,17}, { 1023,16}, { 2047,15}, { 4351,14}, \
+ { 8703,15}, { 4863,16}, { 2559,15}, { 5887,14}, \
+ { 11775,16}, { 3071,15}, { 6911,16}, { 3583,15}, \
+ { 7679,14}, { 15359,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 219
+#define MUL_FFT_THRESHOLD 5760
+
+#define SQR_FFT_MODF_THRESHOLD 400 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 396, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 14, 6}, \
- { 29, 7}, { 15, 6}, { 31, 7}, { 25, 8}, \
- { 13, 7}, { 28, 8}, { 15, 7}, { 32, 8}, \
- { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
- { 33, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
- { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 79,10}, { 55,11}, \
+ { { 400, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
+ { 28, 7}, { 15, 6}, { 31, 7}, { 25, 8}, \
+ { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
+ { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
{ 31,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31, 9}, { 255,10}, { 135,11}, { 79,10}, \
- { 159,11}, { 95,10}, { 191, 9}, { 383,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271,11}, { 143,10}, { 287, 9}, { 575,10}, \
- { 303, 9}, { 607,11}, { 159,10}, { 319, 9}, \
- { 639,12}, { 95,10}, { 383, 9}, { 767,13}, \
- { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
- { 271,10}, { 543,11}, { 287,10}, { 607,12}, \
- { 159,11}, { 319,10}, { 639,11}, { 335,10}, \
- { 671,11}, { 351,10}, { 703,11}, { 367,10}, \
- { 735,11}, { 383,10}, { 767,11}, { 415,10}, \
- { 831,12}, { 223,11}, { 479,13}, { 127,12}, \
+ { 31,11}, { 63,10}, { 127,11}, { 79,10}, \
+ { 159,11}, { 95,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
+ { 575,10}, { 303,11}, { 159,10}, { 319,12}, \
+ { 95, 8}, { 1599, 9}, { 831,11}, { 223,10}, \
+ { 447,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 271,10}, { 543,11}, { 287,10}, { 575,11}, \
+ { 303,10}, { 607,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
+ { 703,11}, { 367,10}, { 735,11}, { 415,10}, \
+ { 831,12}, { 223,11}, { 447,13}, { 127,12}, \
{ 255,11}, { 543,12}, { 287,11}, { 607,12}, \
{ 319,11}, { 671,12}, { 351,11}, { 735,12}, \
{ 383,11}, { 767,12}, { 415,11}, { 831,12}, \
- { 447,11}, { 895,12}, { 479,14}, { 127,13}, \
- { 255,12}, { 735,13}, { 383,12}, { 831,13}, \
- { 447,12}, { 927,14}, { 255,13}, { 511,12}, \
- { 1023,13}, { 575,12}, { 1151,13}, { 639,12}, \
- { 1279,13}, { 703,12}, { 1407,14}, { 383,13}, \
- { 767,12}, { 1535,13}, { 831,12}, { 1663,13}, \
- { 895,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1151,14}, { 639,13}, { 1343,12}, { 2687,13}, \
- { 1407,14}, { 767,13}, { 1599,12}, { 3199,13}, \
- { 1663,14}, { 895,13}, { 1791,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
- { 4863,14}, { 1279,13}, { 2687,14}, { 1407,15}, \
+ { 447,14}, { 127,13}, { 255,12}, { 607,13}, \
+ { 319,12}, { 735,13}, { 383,12}, { 799,13}, \
+ { 447,12}, { 959,13}, { 511,12}, { 1023,13}, \
+ { 575,12}, { 1151,13}, { 639,12}, { 1279,13}, \
+ { 703,14}, { 383,13}, { 767,12}, { 1535,13}, \
+ { 831,12}, { 1663,13}, { 959,14}, { 511,13}, \
+ { 1087,12}, { 2175,13}, { 1151,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1407,12}, { 2815,13}, \
+ { 1471,14}, { 767,13}, { 1599,12}, { 3199,13}, \
+ { 1663,14}, { 895,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,13}, { 2815,15}, \
{ 767,14}, { 1535,13}, { 3199,14}, { 1663,13}, \
- { 3455,14}, { 1791,16}, { 511,15}, { 1023,14}, \
- { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
- { 5887,15}, { 1535,14}, { 3455,15}, { 1791,14}, \
- { 3839,16}, { 1023,15}, { 2047,14}, { 4223,15}, \
- { 2303,14}, { 4863,15}, { 2559,14}, { 5119,15}, \
- { 2815,14}, { 5887,16}, { 1535,15}, { 3327,14}, \
- { 6911,15}, { 3839,17}, { 1023,16}, { 2047,15}, \
- { 4863,16}, { 2559,15}, { 5887,16}, { 65536,17}, \
+ { 3455,12}, { 6911,14}, { 1791,16}, { 511,15}, \
+ { 1023,14}, { 2047,13}, { 4095,14}, { 2175,13}, \
+ { 4351,14}, { 2303,13}, { 4607,14}, { 2431,13}, \
+ { 4863,15}, { 1279,14}, { 2943,13}, { 5887,15}, \
+ { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
+ { 3839,13}, { 7679,16}, { 1023,15}, { 2047,14}, \
+ { 4351,15}, { 2303,14}, { 4863,15}, { 2559,14}, \
+ { 5247,15}, { 2815,14}, { 5887,16}, { 1535,15}, \
+ { 3327,14}, { 6911,15}, { 3839,14}, { 7679,17}, \
+ { 1023,16}, { 2047,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
+ { 3583,15}, { 7679,14}, { 15359,15}, { 7935,17}, \
+ { 2047,16}, { 4095,15}, { 8447,16}, { 4607,15}, \
+ { 9471,14}, { 18943,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 SQR_FFT_TABLE3_SIZE 191
-#define SQR_FFT_THRESHOLD 3776
+#define SQR_FFT_TABLE3_SIZE 215
+#define SQR_FFT_THRESHOLD 3712
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 27
-#define MULLO_MUL_N_THRESHOLD 8648
+#define MULLO_DC_THRESHOLD 80
+#define MULLO_MUL_N_THRESHOLD 11025
#define SQRLO_BASECASE_THRESHOLD 9
-#define SQRLO_DC_THRESHOLD 172
-#define SQRLO_SQR_THRESHOLD 7487
+#define SQRLO_DC_THRESHOLD 109
+#define SQRLO_SQR_THRESHOLD 7293
-#define DC_DIV_QR_THRESHOLD 56
-#define DC_DIVAPPR_Q_THRESHOLD 191
+#define DC_DIV_QR_THRESHOLD 54
+#define DC_DIVAPPR_Q_THRESHOLD 183
#define DC_BDIV_QR_THRESHOLD 86
-#define DC_BDIV_Q_THRESHOLD 188
+#define DC_BDIV_Q_THRESHOLD 160
-#define INV_MULMOD_BNM1_THRESHOLD 70
-#define INV_NEWTON_THRESHOLD 179
-#define INV_APPR_THRESHOLD 181
+#define INV_MULMOD_BNM1_THRESHOLD 58
+#define INV_NEWTON_THRESHOLD 171
+#define INV_APPR_THRESHOLD 171
-#define BINV_NEWTON_THRESHOLD 309
+#define BINV_NEWTON_THRESHOLD 292
#define REDC_1_TO_REDC_2_THRESHOLD 33
-#define REDC_2_TO_REDC_N_THRESHOLD 78
+#define REDC_2_TO_REDC_N_THRESHOLD 63
-#define MU_DIV_QR_THRESHOLD 1718
-#define MU_DIVAPPR_Q_THRESHOLD 1718
-#define MUPI_DIV_QR_THRESHOLD 79
-#define MU_BDIV_QR_THRESHOLD 1652
-#define MU_BDIV_Q_THRESHOLD 1718
+#define MU_DIV_QR_THRESHOLD 1589
+#define MU_DIVAPPR_Q_THRESHOLD 1589
+#define MUPI_DIV_QR_THRESHOLD 67
+#define MU_BDIV_QR_THRESHOLD 1470
+#define MU_BDIV_Q_THRESHOLD 1866
-#define POWM_SEC_TABLE 1,9,191,779,839
+#define POWM_SEC_TABLE 2,10,191,494,712,1378
-#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_DC_THRESHOLD 12
#define GET_STR_PRECOMPUTE_THRESHOLD 20
-#define SET_STR_DC_THRESHOLD 711
-#define SET_STR_PRECOMPUTE_THRESHOLD 1664
+#define SET_STR_DC_THRESHOLD 644
+#define SET_STR_PRECOMPUTE_THRESHOLD 1658
-#define FAC_DSC_THRESHOLD 810
-#define FAC_ODD_THRESHOLD 23
+#define FAC_DSC_THRESHOLD 562
+#define FAC_ODD_THRESHOLD 48
-#define MATRIX22_STRASSEN_THRESHOLD 19
-#define HGCD_THRESHOLD 63
-#define HGCD_APPR_THRESHOLD 51
+#define MATRIX22_STRASSEN_THRESHOLD 16
+#define HGCD2_DIV1_METHOD 5 /* 0.38% faster than 3 */
+#define HGCD_THRESHOLD 73
+#define HGCD_APPR_THRESHOLD 67
#define HGCD_REDUCE_THRESHOLD 3014
#define GCD_DC_THRESHOLD 630
-#define GCDEXT_DC_THRESHOLD 416
-#define JACOBI_BASE_METHOD 4
+#define GCDEXT_DC_THRESHOLD 365
+#define JACOBI_BASE_METHOD 1 /* 29.65% faster than 4 */
+
+/* Tuneup completed successfully, took 239050 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_1.asm
index a271e6cc867..b7fae2f900a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_1.asm
@@ -31,23 +31,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9 n/a
-C AMD K10 n/a
-C AMD bull n/a
-C AMD pile n/a
-C AMD steam n/a
-C AMD bobcat n/a
-C AMD jaguar n/a
-C Intel P4 n/a
-C Intel core2 n/a
-C Intel NHM n/a
-C Intel SBR n/a
-C Intel IBR n/a
-C Intel HWL 1.68
-C Intel BWL 1.69
-C Intel atom n/a
-C Intel SLM n/a
-C VIA nano n/a
+C AMD K8,K9 -
+C AMD K10 -
+C AMD bull -
+C AMD pile -
+C AMD steam -
+C AMD excavator -
+C AMD bobcat -
+C AMD jaguar -
+C Intel P4 -
+C Intel core2 -
+C Intel NHM -
+C Intel SBR -
+C Intel IBR -
+C Intel HWL 1.70
+C Intel BWL 1.51
+C Intel SKL 1.52
+C Intel atom -
+C Intel SLM -
+C VIA nano -
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjorn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_basecase.asm
index 50f3ce5877e..42ca976a266 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_basecase.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mul_basecase.asm
@@ -33,19 +33,21 @@ include(`../config.m4')
C cycles/limb mul_1 addmul_1
C AMD K8,K9 n/a n/a
C AMD K10 n/a n/a
-C AMD bull n/a n/a
-C AMD pile n/a n/a
-C AMD steam n/a n/a
-C AMD excavator ? ?
-C AMD bobcat n/a n/a
-C AMD jaguar n/a n/a
+C AMD bd1 n/a n/a
+C AMD bd2 n/a n/a
+C AMD bd3 n/a n/a
+C AMD bd4 ? ?
+C AMD zen ? ?
+C AMD bt1 n/a n/a
+C AMD bt2 n/a n/a
C Intel P4 n/a n/a
-C Intel core2 n/a n/a
+C Intel PNR n/a n/a
C Intel NHM n/a n/a
C Intel SBR n/a n/a
C Intel IBR n/a n/a
C Intel HWL 1.68 n/a
-C Intel BWL 1.69 1.8-1.9
+C Intel BWL 1.51 1.67-1.74
+C Intel SKL 1.52 1.63-1.71
C Intel atom n/a n/a
C Intel SLM n/a n/a
C VIA nano n/a n/a
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mullo_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mullo_basecase.asm
new file mode 100644
index 00000000000..5cdb2091819
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/mullo_basecase.asm
@@ -0,0 +1,395 @@
+dnl X64-64 mpn_mullo_basecase optimised for Intel Broadwell.
+
+dnl Contributed to the GNU project by Torbjorn Granlund.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+C The inner loops of this code are the result of running a code generation and
+C optimisation tool suite written by David Harvey and Torbjorn Granlund.
+
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`vp_param', `%rdx')
+define(`n', `%rcx')
+
+define(`vp', `%r11')
+define(`jmpreg',`%rbx')
+define(`nn', `%rbp')
+
+C TODO
+C * Suppress more rp[] rewrites in corner.
+C * Rearrange feed-in jumps for short branch forms.
+C * Perhaps roll out the heavy artillery and 8-way unroll outer loop. Since
+C feed-in code implodes, the blow-up will not be more than perhaps 4x.
+C * Micro-optimise critical lead-in code block around L(ent).
+C * Write n < 4 code specifically for Broadwell (current code is for Haswell).
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_mullo_basecase)
+ FUNC_ENTRY(4)
+ cmp $4, R32(n)
+ jae L(big)
+
+ mov vp_param, vp
+ mov (up), %rdx
+
+ cmp $2, R32(n)
+ jae L(gt1)
+L(n1): imul (vp), %rdx
+ mov %rdx, (rp)
+ FUNC_EXIT()
+ ret
+L(gt1): ja L(gt2)
+L(n2): mov (vp), %r9
+ mulx( %r9, %rax, %rdx)
+ mov %rax, (rp)
+ mov 8(up), %rax
+ imul %r9, %rax
+ add %rax, %rdx
+ mov 8(vp), %r9
+ mov (up), %rcx
+ imul %r9, %rcx
+ add %rcx, %rdx
+ mov %rdx, 8(rp)
+ FUNC_EXIT()
+ ret
+L(gt2):
+L(n3): mov (vp), %r9
+ mulx( %r9, %rax, %r10) C u0 x v0
+ mov %rax, (rp)
+ mov 8(up), %rdx
+ mulx( %r9, %rax, %rdx) C u1 x v0
+ imul 16(up), %r9 C u2 x v0
+ add %rax, %r10
+ adc %rdx, %r9
+ mov 8(vp), %r8
+ mov (up), %rdx
+ mulx( %r8, %rax, %rdx) C u0 x v1
+ add %rax, %r10
+ adc %rdx, %r9
+ imul 8(up), %r8 C u1 x v1
+ add %r8, %r9
+ mov %r10, 8(rp)
+ mov 16(vp), %r10
+ mov (up), %rax
+ imul %rax, %r10 C u0 x v2
+ add %r10, %r9
+ mov %r9, 16(rp)
+ FUNC_EXIT()
+ ret
+
+ ALIGN(16)
+L(big): push %r14
+ push %r12
+ push %rbx
+ push %rbp
+ mov -8(vp_param,n,8), %r14 C FIXME Put at absolute end
+ imul (up), %r14 C FIXME Put at absolute end
+ lea -3(n), R32(nn)
+ lea 8(vp_param), vp
+ mov (vp_param), %rdx
+
+ mov R32(n), R32(%rax)
+ shr $3, R32(n)
+ and $7, R32(%rax) C clear OF, CF as side-effect
+ lea L(mtab)(%rip), %r10
+ifdef(`PIC',
+` movslq (%r10,%rax,4), %rax
+ lea (%rax, %r10), %r10
+ jmp *%r10
+',`
+ jmp *(%r10,%rax,8)
+')
+
+L(mf0): mulx( (up), %r10, %r8)
+ lea 56(up), up
+ lea -8(rp), rp
+ lea L(f7)(%rip), jmpreg
+ jmp L(mb0)
+
+L(mf3): mulx( (up), %r9, %rax)
+ lea 16(up), up
+ lea 16(rp), rp
+ jrcxz L(mc)
+ inc R32(n)
+ lea L(f2)(%rip), jmpreg
+ jmp L(mb3)
+
+L(mc): mulx( -8,(up), %r10, %r8)
+ add %rax, %r10
+ mov %r9, -16(rp)
+ mulx( (up), %r9, %rax)
+ mov %r10, -8(rp)
+ adc %r8, %r9
+ mov %r9, (rp)
+ jmp L(c2)
+
+L(mf4): mulx( (up), %r10, %r8)
+ lea 24(up), up
+ lea 24(rp), rp
+ inc R32(n)
+ lea L(f3)(%rip), jmpreg
+ jmp L(mb4)
+
+L(mf5): mulx( (up), %r9, %rax)
+ lea 32(up), up
+ lea 32(rp), rp
+ inc R32(n)
+ lea L(f4)(%rip), jmpreg
+ jmp L(mb5)
+
+L(mf6): mulx( (up), %r10, %r8)
+ lea 40(up), up
+ lea 40(rp), rp
+ inc R32(n)
+ lea L(f5)(%rip), jmpreg
+ jmp L(mb6)
+
+L(mf7): mulx( (up), %r9, %rax)
+ lea 48(up), up
+ lea 48(rp), rp
+ lea L(f6)(%rip), jmpreg
+ jmp L(mb7)
+
+L(mf1): mulx( (up), %r9, %rax)
+ lea L(f0)(%rip), jmpreg
+ jmp L(mb1)
+
+L(mf2): mulx( (up), %r10, %r8)
+ lea 8(up), up
+ lea 8(rp), rp
+ lea L(f1)(%rip), jmpreg
+ mulx( (up), %r9, %rax)
+
+C FIXME ugly fallthrough FIXME
+ ALIGN(32)
+L(mtop):mov %r10, -8(rp)
+ adc %r8, %r9
+L(mb1): mulx( 8,(up), %r10, %r8)
+ adc %rax, %r10
+ lea 64(up), up
+ mov %r9, (rp)
+L(mb0): mov %r10, 8(rp)
+ mulx( -48,(up), %r9, %rax)
+ lea 64(rp), rp
+ adc %r8, %r9
+L(mb7): mulx( -40,(up), %r10, %r8)
+ mov %r9, -48(rp)
+ adc %rax, %r10
+L(mb6): mov %r10, -40(rp)
+ mulx( -32,(up), %r9, %rax)
+ adc %r8, %r9
+L(mb5): mulx( -24,(up), %r10, %r8)
+ mov %r9, -32(rp)
+ adc %rax, %r10
+L(mb4): mulx( -16,(up), %r9, %rax)
+ mov %r10, -24(rp)
+ adc %r8, %r9
+L(mb3): mulx( -8,(up), %r10, %r8)
+ adc %rax, %r10
+ mov %r9, -16(rp)
+ dec R32(n)
+ mulx( (up), %r9, %rax)
+ jnz L(mtop)
+
+L(mend):mov %r10, -8(rp)
+ adc %r8, %r9
+ mov %r9, (rp)
+ adc %rcx, %rax
+
+ lea 8(,nn,8), %r12
+ neg %r12
+ shr $3, R32(nn)
+ jmp L(ent)
+
+L(f0): mulx( (up), %r10, %r8)
+ lea -8(up), up
+ lea -8(rp), rp
+ lea L(f7)(%rip), jmpreg
+ jmp L(b0)
+
+L(f1): mulx( (up), %r9, %rax)
+ lea -1(nn), R32(nn)
+ lea L(f0)(%rip), jmpreg
+ jmp L(b1)
+
+L(end): adox( (rp), %r9)
+ mov %r9, (rp)
+ adox( %rcx, %rax) C relies on rcx = 0
+ adc %rcx, %rax C FIXME suppress, use adc below; reqs ent path edits
+ lea 8(%r12), %r12
+L(ent): mulx( 8,(up), %r10, %r8) C r8 unused (use imul?)
+ add %rax, %r14
+ add %r10, %r14 C h
+ lea (up,%r12), up C reset up
+ lea 8(rp,%r12), rp C reset rp
+ mov (vp), %rdx
+ lea 8(vp), vp
+ or R32(nn), R32(n) C copy count, clear CF,OF (n = 0 prior)
+ jmp *jmpreg
+
+L(f7): mulx( (up), %r9, %rax)
+ lea -16(up), up
+ lea -16(rp), rp
+ lea L(f6)(%rip), jmpreg
+ jmp L(b7)
+
+L(f2): mulx( (up), %r10, %r8)
+ lea 8(up), up
+ lea 8(rp), rp
+ mulx( (up), %r9, %rax)
+ lea L(f1)(%rip), jmpreg
+
+C FIXME ugly fallthrough FIXME
+ ALIGN(32)
+L(top): adox( -8,(rp), %r10)
+ adcx( %r8, %r9)
+ mov %r10, -8(rp)
+ jrcxz L(end)
+L(b1): mulx( 8,(up), %r10, %r8)
+ adox( (rp), %r9)
+ lea -1(n), R32(n)
+ mov %r9, (rp)
+ adcx( %rax, %r10)
+L(b0): mulx( 16,(up), %r9, %rax)
+ adcx( %r8, %r9)
+ adox( 8,(rp), %r10)
+ mov %r10, 8(rp)
+L(b7): mulx( 24,(up), %r10, %r8)
+ lea 64(up), up
+ adcx( %rax, %r10)
+ adox( 16,(rp), %r9)
+ mov %r9, 16(rp)
+L(b6): mulx( -32,(up), %r9, %rax)
+ adox( 24,(rp), %r10)
+ adcx( %r8, %r9)
+ mov %r10, 24(rp)
+L(b5): mulx( -24,(up), %r10, %r8)
+ adcx( %rax, %r10)
+ adox( 32,(rp), %r9)
+ mov %r9, 32(rp)
+L(b4): mulx( -16,(up), %r9, %rax)
+ adox( 40,(rp), %r10)
+ adcx( %r8, %r9)
+ mov %r10, 40(rp)
+L(b3): adox( 48,(rp), %r9)
+ mulx( -8,(up), %r10, %r8)
+ mov %r9, 48(rp)
+ lea 64(rp), rp
+ adcx( %rax, %r10)
+ mulx( (up), %r9, %rax)
+ jmp L(top)
+
+L(f6): mulx( (up), %r10, %r8)
+ lea 40(up), up
+ lea -24(rp), rp
+ lea L(f5)(%rip), jmpreg
+ jmp L(b6)
+
+L(f5): mulx( (up), %r9, %rax)
+ lea 32(up), up
+ lea -32(rp), rp
+ lea L(f4)(%rip), jmpreg
+ jmp L(b5)
+
+L(f4): mulx( (up), %r10, %r8)
+ lea 24(up), up
+ lea -40(rp), rp
+ lea L(f3)(%rip), jmpreg
+ jmp L(b4)
+
+L(f3): mulx( (up), %r9, %rax)
+ lea 16(up), up
+ lea -48(rp), rp
+ jrcxz L(cor)
+ lea L(f2)(%rip), jmpreg
+ jmp L(b3)
+
+L(cor): adox( 48,(rp), %r9)
+ mulx( -8,(up), %r10, %r8)
+ mov %r9, 48(rp)
+ lea 64(rp), rp
+ adcx( %rax, %r10)
+ mulx( (up), %r9, %rax)
+ adox( -8,(rp), %r10)
+ adcx( %r8, %r9)
+ mov %r10, -8(rp) C FIXME suppress
+ adox( (rp), %r9)
+ mov %r9, (rp) C FIXME suppress
+ adox( %rcx, %rax)
+L(c2):
+ mulx( 8,(up), %r10, %r8)
+ adc %rax, %r14
+ add %r10, %r14
+ mov (vp), %rdx
+ test R32(%rcx), R32(%rcx)
+ mulx( -16,(up), %r10, %r8)
+ mulx( -8,(up), %r9, %rax)
+ adox( -8,(rp), %r10)
+ adcx( %r8, %r9)
+ mov %r10, -8(rp)
+ adox( (rp), %r9)
+ adox( %rcx, %rax)
+ adc %rcx, %rax
+ mulx( (up), %r10, %r8)
+ add %rax, %r14
+ add %r10, %r14
+ mov 8(vp), %rdx
+ mulx( -16,(up), %rcx, %rax)
+ add %r9, %rcx
+ mov %rcx, (rp)
+ adc $0, %rax
+ mulx( -8,(up), %r10, %r8)
+ add %rax, %r14
+ add %r10, %r14
+ mov %r14, 8(rp)
+ pop %rbp
+ pop %rbx
+ pop %r12
+ pop %r14
+ FUNC_EXIT()
+ ret
+EPILOGUE()
+ JUMPTABSECT
+ ALIGN(8)
+L(mtab):JMPENT( L(mf7), L(mtab))
+ JMPENT( L(mf0), L(mtab))
+ JMPENT( L(mf1), L(mtab))
+ JMPENT( L(mf2), L(mtab))
+ JMPENT( L(mf3), L(mtab))
+ JMPENT( L(mf4), L(mtab))
+ JMPENT( L(mf5), L(mtab))
+ JMPENT( L(mf6), L(mtab))
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/sqr_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/sqr_basecase.asm
index 447ba00e435..e81b01b3486 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/sqr_basecase.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreibwl/sqr_basecase.asm
@@ -1,6 +1,6 @@
dnl AMD64 mpn_sqr_basecase optimised for Intel Broadwell.
-dnl Copyright 2015 Free Software Foundation, Inc.
+dnl Copyright 2015, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -33,19 +33,21 @@ include(`../config.m4')
C cycles/limb mul_1 addmul_1
C AMD K8,K9 n/a n/a
C AMD K10 n/a n/a
-C AMD bull n/a n/a
-C AMD pile n/a n/a
-C AMD steam n/a n/a
-C AMD excavator ? ?
-C AMD bobcat n/a n/a
-C AMD jaguar n/a n/a
+C AMD bd1 n/a n/a
+C AMD bd2 n/a n/a
+C AMD bd3 n/a n/a
+C AMD bd4 ? ?
+C AMD zen ? ?
+C AMD bt1 n/a n/a
+C AMD bt2 n/a n/a
C Intel P4 n/a n/a
-C Intel core2 n/a n/a
+C Intel PNR n/a n/a
C Intel NHM n/a n/a
C Intel SBR n/a n/a
C Intel IBR n/a n/a
C Intel HWL 1.68 n/a
-C Intel BWL 1.69 1.8-1.9
+C Intel BWL 1.51 1.67-1.74
+C Intel SKL 1.52 1.63-1.71
C Intel atom n/a n/a
C Intel SLM n/a n/a
C VIA nano n/a n/a
@@ -59,12 +61,11 @@ C on switching code, since a circularly updated computed goto target will
C hardly allow correct branch prediction. On 2nd thought, we now might make
C each of the 8 loop branches be poorly predicted since they will be
C executed fewer times for each time. With just one addmul_1 loop, the loop
-C count will change only once each 8th time!
-C * Replace sqr_diag_addlsh1 code (from haswell) with adx-aware code. We have
-C 3 variants below, but the haswell code turns out to be fastest.
+C count will change only once each 8th time.
C * Do overlapped software pipelining.
-C * When changing this, make sure the code which falls into the inner loops
-C does not execute too many no-ops (for both PIC and non-PIC).
+C * Perhaps load in shrx/sarx, eliminating separate load insn.
+C * Schedule add+stored in small n code.
+C * Try swapping adox and adcx insn, making mulx have more time to run.
define(`rp', `%rdi')
define(`up', `%rsi')
@@ -161,12 +162,8 @@ L(gt2): cmp $4, un_param
L(gt3): push %rbx
- push rp
- push up
- push un_param
-
lea -3(un_param), R32(un_save)
- lea 5(un_param), n
+ lea 5(un_param), R32(n)
mov R32(un_param), R32(%rax)
and $-8, R32(un_save)
shr $3, R32(n) C count for mul_1 loop
@@ -184,45 +181,75 @@ ifdef(`PIC',
jmp *(%r10,%rax,8)
')
-L(mf0): mulx( 8,(up), w2, w3)
+L(mf0): mulx( u0, w0, w1) C up[0]^2
+ add u0, u0
+ mulx( 8,(up), w2, w3)
lea 64(up), up
-C lea (rp), rp
+ add w1, w2
jmp L(mb0)
-L(mf3): mulx( 8,(up), w0, w1)
+L(mf3): mulx( u0, w2, w3) C up[0]^2
+ add u0, u0
+ mov w2, (rp)
+ mulx( 8,(up), w0, w1)
lea 24(up), up
lea 24(rp), rp
+ add w3, w0
jmp L(mb3)
-L(mf4): mulx( 8,(up), w2, w3)
+L(mf4): mulx( u0, w0, w1) C up[0]^2
+ add u0, u0
+ mulx( 8,(up), w2, w3)
+ mov w0, (rp)
lea 32(up), up
lea 32(rp), rp
+ add w1, w2
jmp L(mb4)
-L(mf5): mulx( 8,(up), w0, w1)
+L(mf5): mulx( u0, w2, w3) C up[0]^2
+ add u0, u0
+ mulx( 8,(up), w0, w1)
+ mov w2, (rp)
lea 40(up), up
lea 40(rp), rp
+ add w3, w0
jmp L(mb5)
-L(mf6): mulx( 8,(up), w2, w3)
+L(mf6): mulx( u0, w0, w1) C up[0]^2
+ add u0, u0
+ mulx( 8,(up), w2, w3)
+ mov w0, (rp)
lea 48(up), up
lea 48(rp), rp
+ add w1, w2
jmp L(mb6)
-L(mf7): mulx( 8,(up), w0, w1)
+L(mf7): mulx( u0, w2, w3) C up[0]^2
+ add u0, u0
+ mulx( 8,(up), w0, w1)
+ mov w2, (rp)
lea 56(up), up
lea 56(rp), rp
+ add w3, w0
jmp L(mb7)
-L(mf1): mulx( 8,(up), w0, w1)
+L(mf1): mulx( u0, w2, w3) C up[0]^2
+ add u0, u0
+ mulx( 8,(up), w0, w1)
+ mov w2, (rp)
lea 8(up), up
lea 8(rp), rp
+ add w3, w0
jmp L(mb1)
-L(mf2): mulx( 8,(up), w2, w3)
+L(mf2): mulx( u0, w0, w1) C up[0]^2
+ add u0, u0
+ mulx( 8,(up), w2, w3)
+ mov w0, (rp)
lea 16(up), up
lea 16(rp), rp
dec R32(n)
+ add w1, w2
mulx( (up), w0, w1)
ALIGN(16)
@@ -231,8 +258,8 @@ L(top): mov w2, -8(rp)
L(mb1): mulx( 8,(up), w2, w3)
adc w1, w2
lea 64(up), up
- mov w0, (rp)
-L(mb0): mov w2, 8(rp)
+L(mb0): mov w0, (rp)
+ mov w2, 8(rp)
mulx( -48,(up), w0, w1)
lea 64(rp), rp
adc w3, w0
@@ -257,29 +284,35 @@ L(mb3): mulx( -8,(up), w2, w3)
L(end): mov w2, -8(rp)
adc w3, w0
- mov w0, (rp)
- adc %rcx, w1
- mov w1, 8(rp)
+C mov w0, (rp)
+C adc %rcx, w1
+C mov w1, 8(rp)
lea L(atab)(%rip), %r10
ifdef(`PIC',
` movslq (%r10,%rax,4), %r11
lea (%r11, %r10), %r11
- jmp *%r11
',`
- jmp *(%r10,%rax,8)
+ mov (%r10,%rax,8), %r11
')
+ mov $63, R32(%rax)
+ jmp *%r11
L(ed0): adox( (rp), w0)
adox( %rcx, w1) C relies on rcx = 0
- mov w0, (rp)
+L(f7): mov w0, (rp)
adc %rcx, w1 C relies on rcx = 0
mov w1, 8(rp)
-L(f7): lea -64(up,un_save,8), up
- or R32(un_save), R32(n)
- mov 8(up), u0
- mulx( 16,(up), w0, w1)
+ lea -64(up,un_save,8), up
+ mov R32(un_save), R32(n)
lea -56(rp,un_save,8), rp
+ mov (up), w1 C up[-1]
+ mov 8(up), u0 C up[0]
+ shrx( %rax, w1, w0)
+ sarx( %rax, w1, w1)
+ and u0, w1 C "ci" in C code
+ mulx( u0, w2, w3) C up[0]^2
+ lea (w0,u0,2), u0 C "u0" arg in C code
jmp L(b7)
ALIGN(16)
@@ -290,9 +323,9 @@ L(tp0): adox( -8,(rp), w2)
mulx( 8,(up), w2, w3)
adox( (rp), w0)
lea 8(n), R32(n)
- mov w0, (rp)
+L(b0): mov w0, (rp)
adcx( w1, w2)
-L(b0): mulx( 16,(up), w0, w1)
+ mulx( 16,(up), w0, w1)
adcx( w3, w0)
adox( 8,(rp), w2)
mov w2, 8(rp)
@@ -323,14 +356,22 @@ L(b0): mulx( 16,(up), w0, w1)
L(ed1): adox( (rp), w0)
adox( %rcx, w1) C relies on rcx = 0
- mov w0, (rp)
+L(f0): mov w0, (rp)
adc %rcx, w1 C relies on rcx = 0
mov w1, 8(rp)
-L(f0): lea -64(up,un_save,8), up
- or R32(un_save), R32(n)
- mov (up), u0
- mulx( 8,(up), w2, w3)
+ lea -64(up,un_save,8), up
+ mov R32(un_save), R32(n)
lea -56(rp,un_save,8), rp
+ mov -8(up), w3 C up[-1]
+ mov (up), u0 C up[0]
+ shrx( %rax, w3, w2)
+ sarx( %rax, w3, w3)
+ and u0, w3 C "ci" in C code
+ mulx( u0, w0, w1) C up[0]^2
+ lea (w2,u0,2), u0 C "u0" arg in C code
+ adcx( w3, w0)
+ mulx( 8,(up), w2, w3)
+ adox( (rp), w0)
jmp L(b0)
ALIGN(16)
@@ -374,15 +415,25 @@ L(b1): mulx( 8,(up), w2, w3)
L(ed2): adox( (rp), w0)
adox( %rcx, w1) C relies on rcx = 0
- mov w0, (rp)
+L(f1): mov w0, (rp)
adc %rcx, w1 C relies on rcx = 0
mov w1, 8(rp)
-L(f1): lea (up,un_save,8), up
- or R32(un_save), R32(n)
+ lea (up,un_save,8), up
+ mov R32(un_save), R32(n)
lea 8(un_save), un_save
- mov -8(up), u0
- mulx( (up), w0, w1)
lea -56(rp,un_save,8), rp
+ mov -16(up), w1 C up[-1]
+ mov -8(up), u0 C up[0]
+ shrx( %rax, w1, w0)
+ sarx( %rax, w1, w1)
+ and u0, w1 C "ci" in C code
+ mulx( u0, w2, w3) C up[0]^2
+ lea (w0,u0,2), u0 C "u0" arg in C code
+ adcx( w1, w2) C FIXME: crossjump?
+ mulx( (up), w0, w1)
+ adox( -8,(rp), w2)
+ adcx( w3, w0)
+ mov w2, -8(rp)
jmp L(b1)
ALIGN(16)
@@ -416,7 +467,7 @@ L(tp2): adox( -8,(rp), w2)
adox( 40,(rp), w2)
adcx( w3, w0)
mov w2, 40(rp)
- adox( 48,(rp), w0)
+L(b2): adox( 48,(rp), w0)
mulx( -8,(up), w2, w3)
mov w0, 48(rp)
lea 64(rp), rp
@@ -426,17 +477,22 @@ L(tp2): adox( -8,(rp), w2)
L(ed3): adox( (rp), w0)
adox( %rcx, w1) C relies on rcx = 0
- mov w0, (rp)
+L(f2): mov w0, (rp)
adc %rcx, w1 C relies on rcx = 0
mov w1, 8(rp)
-L(f2): lea (up,un_save,8), up
+ lea (up,un_save,8), up
or R32(un_save), R32(n)
- jz L(corner2)
- mov -16(up), u0
- mulx( -8,(up), w2, w3)
- lea 8(rp,un_save,8), rp
- mulx( (up), w0, w1)
- jmp L(tp2)
+ jz L(cor3)
+ lea -56(rp,un_save,8), rp
+ mov -24(up), w3 C up[-1]
+ mov -16(up), u0 C up[0]
+ shrx( %rax, w3, w2)
+ sarx( %rax, w3, w3)
+ and u0, w3 C "ci" in C code
+ mulx( u0, w0, w1) C up[0]^2
+ lea (w2,u0,2), u0 C "u0" arg in C code
+ adcx( w3, w0)
+ jmp L(b2)
ALIGN(16)
L(tp3): adox( -8,(rp), w2)
@@ -465,11 +521,11 @@ L(tp3): adox( -8,(rp), w2)
adcx( w1, w2)
adox( 32,(rp), w0)
mov w0, 32(rp)
- mulx( -16,(up), w0, w1)
+L(b3): mulx( -16,(up), w0, w1)
adox( 40,(rp), w2)
adcx( w3, w0)
mov w2, 40(rp)
-L(b3): adox( 48,(rp), w0)
+ adox( 48,(rp), w0)
mulx( -8,(up), w2, w3)
mov w0, 48(rp)
lea 64(rp), rp
@@ -479,15 +535,20 @@ L(b3): adox( 48,(rp), w0)
L(ed4): adox( (rp), w0)
adox( %rcx, w1) C relies on rcx = 0
- mov w0, (rp)
+L(f3): mov w0, (rp)
adc %rcx, w1 C relies on rcx = 0
mov w1, 8(rp)
-L(f3): lea (up,un_save,8), up
- or R32(un_save), R32(n)
- jz L(corner3)
- mov -24(up), u0
- mulx( -16,(up), w0, w1)
+ lea (up,un_save,8), up
+ mov R32(un_save), R32(n)
lea -56(rp,un_save,8), rp
+ mov -32(up), w1 C up[-1]
+ mov -24(up), u0 C up[0]
+ shrx( %rax, w1, w0)
+ sarx( %rax, w1, w1)
+ and u0, w1 C "ci" in C code
+ mulx( u0, w2, w3) C up[0]^2
+ lea (w0,u0,2), u0 C "u0" arg in C code
+ adcx( w1, w2)
jmp L(b3)
ALIGN(16)
@@ -513,11 +574,11 @@ L(tp4): adox( -8,(rp), w2)
adox( 24,(rp), w2)
adcx( w3, w0)
mov w2, 24(rp)
- mulx( -24,(up), w2, w3)
+L(b4): mulx( -24,(up), w2, w3)
adcx( w1, w2)
adox( 32,(rp), w0)
mov w0, 32(rp)
-L(b4): mulx( -16,(up), w0, w1)
+ mulx( -16,(up), w0, w1)
adox( 40,(rp), w2)
adcx( w3, w0)
mov w2, 40(rp)
@@ -531,14 +592,20 @@ L(b4): mulx( -16,(up), w0, w1)
L(ed5): adox( (rp), w0)
adox( %rcx, w1) C relies on rcx = 0
- mov w0, (rp)
+L(f4): mov w0, (rp)
adc %rcx, w1 C relies on rcx = 0
mov w1, 8(rp)
-L(f4): lea (up,un_save,8), up
- or R32(un_save), R32(n)
- mov -32(up), u0
- mulx( -24,(up), w2, w3)
+ lea (up,un_save,8), up
+ mov R32(un_save), R32(n)
lea -56(rp,un_save,8), rp
+ mov -40(up), w3 C up[-1]
+ mov -32(up), u0 C up[0]
+ shrx( %rax, w3, w2)
+ sarx( %rax, w3, w3)
+ and u0, w3 C "ci" in C code
+ mulx( u0, w0, w1) C up[0]^2
+ lea (w2,u0,2), u0 C "u0" arg in C code
+ adcx( w3, w0)
jmp L(b4)
ALIGN(16)
@@ -560,11 +627,11 @@ L(tp5): adox( -8,(rp), w2)
adcx( w1, w2)
adox( 16,(rp), w0)
mov w0, 16(rp)
- mulx( -32,(up), w0, w1)
+L(b5): mulx( -32,(up), w0, w1)
adox( 24,(rp), w2)
adcx( w3, w0)
mov w2, 24(rp)
-L(b5): mulx( -24,(up), w2, w3)
+ mulx( -24,(up), w2, w3)
adcx( w1, w2)
adox( 32,(rp), w0)
mov w0, 32(rp)
@@ -582,14 +649,20 @@ L(b5): mulx( -24,(up), w2, w3)
L(ed6): adox( (rp), w0)
adox( %rcx, w1) C relies on rcx = 0
- mov w0, (rp)
+L(f5): mov w0, (rp)
adc %rcx, w1 C relies on rcx = 0
mov w1, 8(rp)
-L(f5): lea (up,un_save,8), up
- or R32(un_save), R32(n)
- mov -40(up), u0
- mulx( -32,(up), w0, w1)
+ lea (up,un_save,8), up
+ mov R32(un_save), R32(n)
lea -56(rp,un_save,8), rp
+ mov -48(up), w1 C up[-1]
+ mov -40(up), u0 C up[0]
+ shrx( %rax, w1, w0)
+ sarx( %rax, w1, w1)
+ and u0, w1 C "ci" in C code
+ mulx( u0, w2, w3) C up[0]^2
+ lea (w0,u0,2), u0 C "u0" arg in C code
+ adcx( w1, w2)
jmp L(b5)
ALIGN(16)
@@ -608,10 +681,10 @@ L(tp6): adox( -8,(rp), w2)
mov w2, 8(rp)
mulx( 24,(up), w2, w3)
lea 64(up), up
- adcx( w1, w2)
+L(b6): adcx( w1, w2)
adox( 16,(rp), w0)
mov w0, 16(rp)
-L(b6): mulx( -32,(up), w0, w1)
+ mulx( -32,(up), w0, w1)
adox( 24,(rp), w2)
adcx( w3, w0)
mov w2, 24(rp)
@@ -633,14 +706,21 @@ L(b6): mulx( -32,(up), w0, w1)
L(ed7): adox( (rp), w0)
adox( %rcx, w1) C relies on rcx = 0
- mov w0, (rp)
+L(f6): mov w0, (rp)
adc %rcx, w1 C relies on rcx = 0
mov w1, 8(rp)
-L(f6): lea (up,un_save,8), up
- or R32(un_save), R32(n)
- mov -48(up), u0
- mulx( -40,(up), w2, w3)
+ lea (up,un_save,8), up
+ mov R32(un_save), R32(n)
lea -56(rp,un_save,8), rp
+ mov -56(up), w3 C up[-1]
+ mov -48(up), u0 C up[0]
+ shrx( %rax, w3, w2)
+ sarx( %rax, w3, w3)
+ and u0, w3 C "ci" in C code
+ mulx( u0, w0, w1) C up[0]^2
+ lea (w2,u0,2), u0 C "u0" arg in C code
+ adcx( w3, w0)
+ mulx( -40,(up), w2, w3)
jmp L(b6)
ALIGN(16)
@@ -652,12 +732,12 @@ L(tp7): adox( -8,(rp), w2)
adox( (rp), w0)
lea 8(n), R32(n)
mov w0, (rp)
- adcx( w1, w2)
+L(b7): adcx( w1, w2)
mulx( 16,(up), w0, w1)
adcx( w3, w0)
adox( 8,(rp), w2)
mov w2, 8(rp)
-L(b7): mulx( 24,(up), w2, w3)
+ mulx( 24,(up), w2, w3)
lea 64(up), up
adcx( w1, w2)
adox( 16,(rp), w0)
@@ -682,137 +762,56 @@ L(b7): mulx( 24,(up), w2, w3)
mulx( (up), w0, w1)
jmp L(tp7)
-L(corner3):
- mov -24(up), u0
- mulx( -16,(up), w0, w1)
- adox( -8,(rp), w0)
+L(cor3):lea -64(rp), rp
+ mov -24(up), w3 C up[-1]
+ mov -16(up), u0 C up[0]
+ shrx( %rax, w3, w2)
+ sarx( %rax, w3, w3)
+ and u0, w3 C "ci" in C code
+ mulx( u0, w0, w1) C up[0]^2
+ lea (w2,u0,2), u0 C "u0" arg in C code
+ adcx( w3, w0)
+ adox( 56,(rp), w0)
mulx( -8,(up), w2, w3)
- mov w0, -8(rp)
- lea 8(rp), rp
+ mov w0, 56(rp)
adcx( w1, w2)
- mulx( (up), w0, w1)
- adox( -8,(rp), w2)
- adcx( w3, w0)
- mov w2, -8(rp)
- adox( (rp), w0)
+ mulx( (up), %rbx, w1)
+ adox( 64,(rp), w2)
+ adcx( w3, %rbx)
+ mov w2, 64(rp)
+ adox( 72,(rp), %rbx)
adox( %rcx, w1) C relies on rcx = 0
- adcx( %rcx, w1) C relies on rcx = 0
-L(corner2):
- mov -16(up), u0
- mulx( -8,(up), w2, w3)
- mulx( (up), %rax, %rbx)
- adox( w0, w2)
- adcx( w3, %rax)
- mov w2, (rp)
- adox( w1, %rax)
- adox( %rcx, %rbx) C relies on rcx = 0
- mov %rax, 8(rp)
- adc %rcx, %rbx C relies on rcx = 0
- mov -8(up), %rdx
- mulx( (up), %rax, %rdx)
- add %rbx, %rax
- mov %rax, 16(rp)
- adc %rcx, %rdx C relies on rcx = 0
- mov %rdx, 24(rp)
-
-L(sqr_diag_addlsh1):
- pop n
- pop up
- pop rp
-
-ifdef(`SDA_VARIANT',,`define(`SDA_VARIANT', 2)')
-
-ifelse(SDA_VARIANT,1,`
- lea (n,n), %rax
- movq $0, -8(rp,%rax,8) C FIXME
- test R32(%rax), R32(%rax)
- mov (up), %rdx
- lea 8(up), up
- mulx( %rdx, %r8, %rdx)
- jmp L(dm)
-
- ALIGN(16)
-L(dtop):mov 8(rp), %r9
- adcx( %r9, %r9)
- adox( %rdx, %r9)
- mov %r9, 8(rp)
- lea 16(rp), rp
- jrcxz L(dend)
- mov (up), %rdx
- mulx( %rdx, %rax, %rdx)
- lea 8(up), up
- mov (rp), %r8
- adcx( %r8, %r8)
- adox( %rax, %r8)
-L(dm): mov %r8, (rp)
- lea -1(n), n
- jmp L(dtop)
-L(dend):
-')
-
-ifelse(SDA_VARIANT,2,`
- dec R32(n)
- mov (up), %rdx
- xor R32(%rbx), R32(%rbx) C clear CF as side effect
- mulx( %rdx, %rax, %r10)
- mov %rax, (rp)
- mov 8(rp), %r8
- mov 16(rp), %r9
- jmp L(dm)
-
- ALIGN(16)
-L(dtop):mov 24(rp), %r8
- mov 32(rp), %r9
- lea 16(rp), rp
- lea (%rdx,%rbx), %r10
-L(dm): adc %r8, %r8
- adc %r9, %r9
- setc R8(%rbx)
- mov 8(up), %rdx
- lea 8(up), up
- mulx( %rdx, %rax, %rdx)
- add %r10, %r8
- adc %rax, %r9
- mov %r8, 8(rp)
- mov %r9, 16(rp)
- dec R32(n)
- jnz L(dtop)
-
-L(dend):adc %rbx, %rdx
- mov %rdx, 24(rp)
-')
-
-ifelse(SDA_VARIANT,3,`
- dec R32(n)
- mov (up), %rdx
- test R32(%rbx), R32(%rbx) C clear CF and OF
- mulx( %rdx, %rax, %r10)
- mov %rax, (rp)
- mov 8(rp), %r8
- mov 16(rp), %r9
- jmp L(dm)
-
- ALIGN(16)
-L(dtop):jrcxz L(dend)
- mov 24(rp), %r8
- mov 32(rp), %r9
- lea 16(rp), rp
-L(dm): adcx( %r8, %r8)
- adcx( %r9, %r9)
- mov 8(up), %rdx
- lea 8(up), up
- adox( %r10, %r8)
- mulx( %rdx, %rax, %r10)
- adox( %rax, %r9)
- mov %r8, 8(rp)
- mov %r9, 16(rp)
- lea -1(n), R32(n)
- jmp L(dtop)
-
-L(dend):adcx( %rcx, %r10)
- adox( %rcx, %r10)
- mov %r10, 24(rp)
-')
+ adc %rcx, w1 C relies on rcx = 0
+ mov w1, 80(rp) C FIXME
+C wd2
+ mov -16(up), w1 C up[-1]
+ mov -8(up), u0 C up[0]
+ shrx( %rax, w1, w0)
+ sarx( %rax, w1, w1)
+ and u0, w1 C "ci" in C code
+ mulx( u0, w2, w3) C up[0]^2
+ lea (w0,u0,2), u0 C "u0" arg in C code
+ adcx( w1, w2)
+ mulx( (up), w0, %rax)
+ adox( %rbx, w2)
+ adcx( w3, w0)
+ mov w2, 72(rp)
+ adox( 80,(rp), w0)
+ adox( %rcx, %rax) C relies on rcx = 0
+ mov w0, 80(rp)
+ adc %rcx, %rax C relies on rcx = 0
+C wd1
+ mov -8(up), w3 C up[-1]
+ mov (up), u0 C up[0]
+ sar $63, w3
+ and u0, w3 C "ci" in C code
+ mulx( u0, w0, w1) C up[0]^2
+ adcx( w3, w0)
+ adox( %rax, w0)
+ mov w0, 88(rp)
+ adcx( %rcx, w1)
+ adox( %rcx, w1)
+ mov w1, 96(rp)
pop %rbx
FUNC_EXIT()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/addmul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/addmul_2.asm
index 54aebc888d7..9d1c40534ac 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/addmul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/addmul_2.asm
@@ -37,17 +37,20 @@ C AMD K8,K9 n/a
C AMD K10 n/a
C AMD bull n/a
C AMD pile n/a
-C AMD steam ?
+C AMD steam n/a
+C AMD excavator ?
C AMD bobcat n/a
-C AMD jaguar ?
+C AMD jaguar n/a
C Intel P4 n/a
C Intel core n/a
C Intel NHM n/a
C Intel SBR n/a
C Intel IBR n/a
C Intel HWL 2.15
-C Intel BWL ?
+C Intel BWL 2.33
+C Intel SKL 2.22
C Intel atom n/a
+C Intel SLM n/a
C VIA nano n/a
C The loop of this code is the result of running a code generation and
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aorrlsh_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aorrlsh_n.asm
new file mode 100644
index 00000000000..ff0d27b4278
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aorrlsh_n.asm
@@ -0,0 +1,38 @@
+dnl X86-64 mpn_addlsh_n and mpn_rsblsh_n.
+
+dnl Copyright 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 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/.
+
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addlsh_n mpn_rsblsh_n)
+include_mpn(`x86_64/zen/aorrlsh_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aors_n.asm
new file mode 100644
index 00000000000..fc996277fc6
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aors_n.asm
@@ -0,0 +1,261 @@
+dnl AMD64 mpn_add_n, mpn_sub_n
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C AMD K8,K9
+C AMD K10
+C AMD bd1 1.5 with fluctuations
+C AMD bd2 1.5 with fluctuations
+C AMD bd3
+C AMD bd4 1.6
+C AMD zen
+C AMD bt1
+C AMD bt2
+C Intel P4
+C Intel PNR
+C Intel NHM
+C Intel SBR
+C Intel IBR
+C Intel HWL 1.21
+C Intel BWL 1.04
+C Intel SKL
+C Intel atom
+C Intel SLM
+C VIA nano
+
+C The loop of this code is the result of running a code generation and
+C optimization tool suite written by David Harvey and Torbjorn Granlund.
+
+C INPUT PARAMETERS
+define(`rp', `%rdi') C rcx
+define(`up', `%rsi') C rdx
+define(`vp', `%rdx') C r8
+define(`n', `%rcx') C r9
+define(`cy', `%r8') C rsp+40 (mpn_add_nc and mpn_sub_nc)
+
+ifdef(`OPERATION_add_n', `
+ define(ADCSBB, adc)
+ define(func, mpn_add_n)
+ define(func_nc, mpn_add_nc)')
+ifdef(`OPERATION_sub_n', `
+ define(ADCSBB, sbb)
+ define(func, mpn_sub_n)
+ define(func_nc, mpn_sub_nc)')
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(func_nc)
+ FUNC_ENTRY(4)
+IFDOS(` mov 56(%rsp), %r8 ')
+
+ mov R32(n), R32(%rax)
+ shr $3, n
+ and $7, R32(%rax)
+
+ lea L(tab)(%rip), %r9
+ neg %r8 C set carry
+ifdef(`PIC',`
+ movslq (%r9,%rax,4), %rax
+ lea (%r9,%rax), %rax C lea not add to preserve carry
+ jmp *%rax
+',`
+ jmp *(%r9,%rax,8)
+')
+EPILOGUE()
+
+ ALIGN(16)
+PROLOGUE(func)
+ FUNC_ENTRY(4)
+
+ mov R32(n), R32(%rax)
+ shr $3, n
+ and $7, R32(%rax) C clear cy as side-effect
+
+ lea L(tab)(%rip), %r9
+ifdef(`PIC',`
+ movslq (%r9,%rax,4), %rax
+ lea (%r9,%rax), %rax C lea not add to preserve carry
+ jmp *%rax
+',`
+ jmp *(%r9,%rax,8)
+')
+
+L(0): mov (up), %r8
+ mov 8(up), %r9
+ ADCSBB (vp), %r8
+ jmp L(e0)
+
+L(4): mov (up), %r8
+ mov 8(up), %r9
+ ADCSBB (vp), %r8
+ lea -32(up), up
+ lea -32(vp), vp
+ lea -32(rp), rp
+ inc n
+ jmp L(e4)
+
+L(5): mov (up), %r11
+ mov 8(up), %r8
+ mov 16(up), %r9
+ ADCSBB (vp), %r11
+ lea -24(up), up
+ lea -24(vp), vp
+ lea -24(rp), rp
+ inc n
+ jmp L(e5)
+
+L(6): mov (up), %r10
+ ADCSBB (vp), %r10
+ mov 8(up), %r11
+ lea -16(up), up
+ lea -16(vp), vp
+ lea -16(rp), rp
+ inc n
+ jmp L(e6)
+
+L(7): mov (up), %r9
+ mov 8(up), %r10
+ ADCSBB (vp), %r9
+ ADCSBB 8(vp), %r10
+ lea -8(up), up
+ lea -8(vp), vp
+ lea -8(rp), rp
+ inc n
+ jmp L(e7)
+
+ ALIGN(16)
+L(top):
+L(e3): mov %r9, 40(rp)
+L(e2): mov %r10, 48(rp)
+L(e1): mov (up), %r8
+ mov 8(up), %r9
+ ADCSBB (vp), %r8
+ mov %r11, 56(rp)
+ lea 64(rp), rp
+L(e0): mov 16(up), %r10
+ ADCSBB 8(vp), %r9
+ ADCSBB 16(vp), %r10
+ mov %r8, (rp)
+L(e7): mov 24(up), %r11
+ mov %r9, 8(rp)
+L(e6): mov 32(up), %r8
+ mov 40(up), %r9
+ ADCSBB 24(vp), %r11
+ mov %r10, 16(rp)
+L(e5): ADCSBB 32(vp), %r8
+ mov %r11, 24(rp)
+L(e4): mov 48(up), %r10
+ mov 56(up), %r11
+ mov %r8, 32(rp)
+ lea 64(up), up
+ ADCSBB 40(vp), %r9
+ ADCSBB 48(vp), %r10
+ ADCSBB 56(vp), %r11
+ lea 64(vp), vp
+ dec n
+ jnz L(top)
+
+L(end): mov %r9, 40(rp)
+ mov %r10, 48(rp)
+ mov %r11, 56(rp)
+ mov R32(n), R32(%rax)
+ adc R32(n), R32(%rax)
+ FUNC_EXIT()
+ ret
+
+ ALIGN(16)
+L(3): mov (up), %r9
+ mov 8(up), %r10
+ mov 16(up), %r11
+ ADCSBB (vp), %r9
+ ADCSBB 8(vp), %r10
+ ADCSBB 16(vp), %r11
+ jrcxz L(x3)
+ lea 24(up), up
+ lea 24(vp), vp
+ lea -40(rp), rp
+ jmp L(e3)
+L(x3): mov %r9, (rp)
+ mov %r10, 8(rp)
+ mov %r11, 16(rp)
+ mov R32(n), R32(%rax)
+ adc R32(n), R32(%rax)
+ FUNC_EXIT()
+ ret
+
+ ALIGN(16)
+L(1): mov (up), %r11
+ ADCSBB (vp), %r11
+ jrcxz L(x1)
+ lea 8(up), up
+ lea 8(vp), vp
+ lea -56(rp), rp
+ jmp L(e1)
+L(x1): mov %r11, (rp)
+ mov R32(n), R32(%rax)
+ adc R32(n), R32(%rax)
+ FUNC_EXIT()
+ ret
+
+ ALIGN(16)
+L(2): mov (up), %r10
+ mov 8(up), %r11
+ ADCSBB (vp), %r10
+ ADCSBB 8(vp), %r11
+ jrcxz L(x2)
+ lea 16(up), up
+ lea 16(vp), vp
+ lea -48(rp), rp
+ jmp L(e2)
+L(x2): mov %r10, (rp)
+ mov %r11, 8(rp)
+ mov R32(n), R32(%rax)
+ adc R32(n), R32(%rax)
+ FUNC_EXIT()
+ ret
+EPILOGUE()
+ JUMPTABSECT
+ ALIGN(8)
+L(tab): JMPENT( L(0), L(tab))
+ JMPENT( L(1), L(tab))
+ JMPENT( L(2), L(tab))
+ JMPENT( L(3), L(tab))
+ JMPENT( L(4), L(tab))
+ JMPENT( L(5), L(tab))
+ JMPENT( L(6), L(tab))
+ JMPENT( L(7), L(tab))
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aorsmul_1.asm
index fd5a26d00f6..3f43afa78a2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/aorsmul_1.asm
@@ -33,22 +33,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9 n/a
-C AMD K10 n/a
-C AMD bull n/a
-C AMD pile n/a
-C AMD steam ?
-C AMD bobcat n/a
-C AMD jaguar ?
-C Intel P4 n/a
-C Intel core n/a
-C Intel NHM n/a
-C Intel SBR n/a
-C Intel IBR n/a
+C AMD K8,K9 -
+C AMD K10 -
+C AMD bull -
+C AMD pile -
+C AMD steam -
+C AMD excavator -
+C AMD bobcat -
+C AMD jaguar -
+C Intel P4 -
+C Intel core2 -
+C Intel NHM -
+C Intel SBR -
+C Intel IBR -
C Intel HWL 2.32
-C Intel BWL ?
-C Intel atom n/a
-C VIA nano n/a
+C Intel BWL 2.04
+C Intel SKL 1.95
+C Intel atom -
+C Intel SLM -
+C VIA nano -
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjörn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/gcd_22.asm
new file mode 100644
index 00000000000..b5863b60e16
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/gcd_22.asm
@@ -0,0 +1,138 @@
+dnl AMD64 mpn_gcd_22. Assumes useless bsf, useless shrd, useful tzcnt, shlx.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit
+C AMD K8,K9 -
+C AMD K10 -
+C AMD bd1 -
+C AMD bd2 -
+C AMD bd3 -
+C AMD bd4 6.7
+C AMD bt1 -
+C AMD bt2 -
+C AMD zn1 5.4
+C AMD zn2 5.5
+C Intel P4 -
+C Intel CNR -
+C Intel PNR -
+C Intel NHM -
+C Intel WSM -
+C Intel SBR -
+C Intel IBR -
+C Intel HWL 7.1
+C Intel BWL 5.5
+C Intel SKL 5.6
+C Intel atom -
+C Intel SLM -
+C Intel GLM -
+C Intel GLM+ -
+C VIA nano -
+
+
+define(`u1', `%rdi')
+define(`u0', `%rsi')
+define(`v1', `%rdx')
+define(`v0', `%rcx')
+
+define(`s0', `%r8')
+define(`s1', `%r9')
+define(`t0', `%r10')
+define(`t1', `%r11')
+define(`cnt', `%rax')
+
+dnl ABI_SUPPORT(DOS64) C returns mp_double_limb_t in memory
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_22)
+ FUNC_ENTRY(4)
+
+ ALIGN(16)
+L(top): mov v0, t0
+ sub u0, t0
+ jz L(lowz) C jump when low limb result = 0
+ mov v1, t1
+ sbb u1, t1
+
+ rep;bsf t0, cnt C tzcnt!
+
+ mov u0, s0
+ sub v0, u0
+ mov u1, s1
+ sbb v1, u1
+
+L(bck): cmovc t0, u0 C u = |u - v|
+ cmovc t1, u1 C u = |u - v|
+ cmovc s0, v0 C v = min(u,v)
+ cmovc s1, v1 C v = min(u,v)
+
+ xor R32(t0), R32(t0)
+ sub cnt, t0
+ shlx( t0, u1, s1)
+ shrx( cnt, u0, u0)
+ shrx( cnt, u1, u1)
+ or s1, u0
+
+ test v1, v1
+ jnz L(top)
+ test u1, u1
+ jnz L(top)
+
+L(gcd_11):
+ mov v0, %rdi
+C mov u0, %rsi
+ TCALL( mpn_gcd_11)
+
+L(lowz):C We come here when v0 - u0 = 0
+ C 1. If v1 - u1 = 0, then gcd is u = v.
+ C 2. Else compute gcd_21({v1,v0}, |u1-v1|)
+ mov v1, t0
+ sub u1, t0
+ je L(end)
+
+ xor t1, t1
+ mov u0, s0
+ mov u1, s1
+ rep;bsf t0, cnt C tzcnt!
+ mov u1, u0
+ xor u1, u1
+ sub v1, u0
+ jmp L(bck)
+
+L(end): mov v0, %rax
+ C mov v1, %rdx
+L(ret): FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/gmp-mparam.h
index 96e97fb2f35..c11aeec027d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/gmp-mparam.h
@@ -1,6 +1,6 @@
/* Haswell gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2015 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,216 +31,223 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 4000 MHz Haswell */
-/* FFT tuning limit = 200 M */
-/* Generated by tuneup.c, 2015-10-07, gcc 4.5 */
+/* 3600-4000 MHz Intel Xeon E3-1271v3 Haswell */
+/* FFT tuning limit = 467,964,359 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 9
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 26
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
#define USE_PREINV_DIVREM_1 1 /* native */
#define DIV_QR_1_NORM_THRESHOLD 1
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 9
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD 25
-#define MUL_TOOM22_THRESHOLD 22
+#define DIV_1_VS_MUL_1_PERCENT 427
+
+#define MUL_TOOM22_THRESHOLD 20
#define MUL_TOOM33_THRESHOLD 74
#define MUL_TOOM44_THRESHOLD 195
-#define MUL_TOOM6H_THRESHOLD 298
-#define MUL_TOOM8H_THRESHOLD 406
+#define MUL_TOOM6H_THRESHOLD 276
+#define MUL_TOOM8H_THRESHOLD 381
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 121
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 138
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 120
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 139
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 128
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 132
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 129
#define MUL_TOOM43_TO_TOOM54_THRESHOLD 170
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 34
+#define SQR_TOOM2_THRESHOLD 32
#define SQR_TOOM3_THRESHOLD 117
-#define SQR_TOOM4_THRESHOLD 336
-#define SQR_TOOM6_THRESHOLD 426
-#define SQR_TOOM8_THRESHOLD 562
+#define SQR_TOOM4_THRESHOLD 315
+#define SQR_TOOM6_THRESHOLD 414
+#define SQR_TOOM8_THRESHOLD 0 /* always */
#define MULMID_TOOM42_THRESHOLD 42
#define MULMOD_BNM1_THRESHOLD 13
#define SQRMOD_BNM1_THRESHOLD 17
-#define MUL_FFT_MODF_THRESHOLD 380 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 376 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 380, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
- { 24, 7}, { 13, 6}, { 27, 7}, { 21, 8}, \
- { 11, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
- { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
+ { { 376, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 21, 7}, { 11, 6}, { 25, 7}, { 13, 6}, \
+ { 27, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 31, 8}, \
+ { 17, 7}, { 35, 8}, { 21, 9}, { 11, 8}, \
{ 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
- { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 41, 9}, { 23, 8}, { 49, 9}, { 27,10}, \
{ 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 83,10}, { 47, 9}, { 95,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31,11}, { 63,10}, { 135,11}, { 79,10}, \
- { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
- { 383,11}, { 111,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,10}, { 271,11}, { 143,10}, \
- { 287, 9}, { 575,10}, { 303, 9}, { 607,11}, \
+ { 15,10}, { 31, 9}, { 71,10}, { 39, 9}, \
+ { 83,10}, { 47, 9}, { 95,11}, { 31,10}, \
+ { 79,11}, { 47,10}, { 95,12}, { 31,11}, \
+ { 63,10}, { 127, 9}, { 255,10}, { 135,11}, \
+ { 79,10}, { 167,11}, { 95,10}, { 191, 9}, \
+ { 383,11}, { 111,12}, { 63, 8}, { 1023,11}, \
+ { 143,10}, { 287, 9}, { 575,10}, { 303,11}, \
{ 159,10}, { 319,12}, { 95,11}, { 191,10}, \
{ 383,11}, { 207,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
- { 287,10}, { 575,11}, { 303,10}, { 607,12}, \
- { 159,11}, { 319,10}, { 639,11}, { 335,10}, \
- { 671,11}, { 351,10}, { 703,11}, { 367,10}, \
- { 735,12}, { 191,11}, { 383,10}, { 767,11}, \
- { 415,10}, { 831,12}, { 223,11}, { 447,10}, \
- { 895,11}, { 479,13}, { 127,12}, { 255,11}, \
- { 511,10}, { 1023,11}, { 543,10}, { 1087,12}, \
- { 287,11}, { 575,10}, { 1151,11}, { 607,12}, \
- { 319,11}, { 671,12}, { 351,11}, { 703,10}, \
- { 1407,11}, { 735,12}, { 383,11}, { 767,12}, \
- { 415,11}, { 831,10}, { 1663,12}, { 447,11}, \
- { 895,12}, { 479,14}, { 127,13}, { 255,12}, \
- { 543,11}, { 1087,12}, { 575,11}, { 1151,12}, \
- { 607,11}, { 1215,13}, { 319,12}, { 671,11}, \
- { 1343,12}, { 735,13}, { 383,12}, { 767,11}, \
- { 1535,12}, { 831,13}, { 447,12}, { 959,11}, \
- { 1919,13}, { 511,12}, { 1087,13}, { 575,12}, \
+ { 255,10}, { 543,11}, { 287,10}, { 575,11}, \
+ { 303,10}, { 607,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
+ { 703,11}, { 367,10}, { 735,11}, { 383,10}, \
+ { 767,11}, { 415,10}, { 831,11}, { 447,10}, \
+ { 895,11}, { 479,13}, { 127,11}, { 543,10}, \
+ { 1087,12}, { 287,11}, { 607,10}, { 1215,12}, \
+ { 319,11}, { 671,12}, { 351,11}, { 735,13}, \
+ { 191,12}, { 383,11}, { 767,12}, { 415,11}, \
+ { 831,12}, { 447,11}, { 895,12}, { 479,11}, \
+ { 959,14}, { 127,12}, { 543,11}, { 1087,12}, \
+ { 607,11}, { 1215,10}, { 2431,12}, { 671,11}, \
+ { 1343,12}, { 703,11}, { 1407,12}, { 735,13}, \
+ { 383,12}, { 831,13}, { 447,12}, { 959,13}, \
+ { 511,12}, { 1087,11}, { 2175,13}, { 575,12}, \
{ 1215,11}, { 2431,13}, { 639,12}, { 1343,13}, \
{ 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
- { 1535,13}, { 831,12}, { 1663,13}, { 959,12}, \
- { 1919,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1215,12}, { 2431,14}, { 639,13}, { 1279,12}, \
- { 2559,13}, { 1343,12}, { 2687,13}, { 1407,12}, \
- { 2815,13}, { 1471,12}, { 2943,14}, { 767,13}, \
- { 1599,12}, { 3199,13}, { 1663,14}, { 895,13}, \
- { 1791,12}, { 3583,13}, { 1919,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
- { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
- { 2943,15}, { 767,14}, { 1535,13}, { 3199,14}, \
- { 1663,13}, { 3455,12}, { 6911,14}, { 1791,13}, \
- { 3583,14}, { 1919,13}, { 3839,16}, { 511,15}, \
- { 1023,14}, { 2175,13}, { 4351,14}, { 2303,13}, \
- { 4607,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
- { 2943,13}, { 5887,15}, { 1535,14}, { 3455,13}, \
- { 6911,15}, { 1791,14}, { 3839,13}, { 7679,16}, \
- { 1023,15}, { 2047,14}, { 4351,15}, { 2303,14}, \
- { 4863,15}, { 2815,14}, { 5887,16}, { 1535,15}, \
- { 3071,14}, { 6143,15}, { 3327,14}, { 6911,15}, \
- { 3839,14}, { 7679,17}, { 1023,16}, { 2047,15}, \
- { 4863,16}, { 2559,15}, { 5887,14}, { 11775,16}, \
- { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
- {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 244
-#define MUL_FFT_THRESHOLD 4224
-
-#define SQR_FFT_MODF_THRESHOLD 368 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 368, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 11, 5}, { 23, 6}, { 25, 7}, { 13, 6}, \
- { 27, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
- { 13, 7}, { 28, 8}, { 15, 7}, { 31, 8}, \
- { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
- { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
- { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 63,10}, { 39, 9}, { 79,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 135,11}, { 79,10}, { 159, 9}, { 319,11}, \
- { 95,10}, { 191, 9}, { 383,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543,11}, { 143,10}, { 287, 9}, { 575,10}, \
- { 303, 9}, { 607,11}, { 159,10}, { 319, 9}, \
- { 639,12}, { 95,11}, { 191,10}, { 383, 9}, \
- { 767,11}, { 207,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
- { 287,10}, { 575,11}, { 303,10}, { 607,11}, \
- { 319,10}, { 639,11}, { 335,10}, { 671,11}, \
- { 351,10}, { 703,11}, { 367,12}, { 191,11}, \
- { 383,10}, { 767,11}, { 415,10}, { 831,12}, \
- { 223,11}, { 447,10}, { 895,11}, { 479,13}, \
- { 127,12}, { 255,11}, { 543,10}, { 1087,11}, \
- { 607,12}, { 319,11}, { 671,12}, { 351,11}, \
- { 735,12}, { 383,11}, { 767,12}, { 415,11}, \
- { 831,12}, { 447,11}, { 895,12}, { 479,14}, \
- { 127,12}, { 511,11}, { 1023,12}, { 543,11}, \
- { 1087,12}, { 607,11}, { 1215,13}, { 319,12}, \
- { 671,11}, { 1343,12}, { 735,13}, { 383,12}, \
- { 767,11}, { 1535,12}, { 831,13}, { 447,12}, \
- { 895,11}, { 1791,12}, { 959,13}, { 511,12}, \
- { 1087,13}, { 575,12}, { 1215,13}, { 639,12}, \
- { 1343,13}, { 703,12}, { 1407,14}, { 383,13}, \
- { 767,12}, { 1535,13}, { 831,12}, { 1663,13}, \
- { 895,12}, { 1791,13}, { 959,14}, { 511,13}, \
+ { 1535,13}, { 831,12}, { 1727,13}, { 959,12}, \
+ { 1919,14}, { 511,13}, { 1023,12}, { 2047,13}, \
{ 1087,12}, { 2175,13}, { 1215,14}, { 639,13}, \
{ 1343,12}, { 2687,13}, { 1407,12}, { 2815,13}, \
{ 1471,14}, { 767,13}, { 1599,12}, { 3199,13}, \
- { 1663,14}, { 895,13}, { 1791,12}, { 3583,13}, \
+ { 1727,14}, { 895,13}, { 1791,12}, { 3583,13}, \
{ 1919,15}, { 511,14}, { 1023,13}, { 2175,14}, \
{ 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
- { 2687,14}, { 1407,13}, { 2943,15}, { 767,14}, \
+ { 2687,14}, { 1407,13}, { 2815,15}, { 767,14}, \
{ 1535,13}, { 3199,14}, { 1663,13}, { 3455,12}, \
{ 6911,14}, { 1791,13}, { 3583,14}, { 1919,16}, \
- { 511,15}, { 1023,14}, { 2431,13}, { 4863,15}, \
- { 1279,14}, { 2943,13}, { 5887,15}, { 1535,14}, \
- { 3455,13}, { 6911,15}, { 1791,14}, { 3839,13}, \
- { 7679,16}, { 1023,15}, { 2047,14}, { 4223,15}, \
- { 2303,14}, { 4863,15}, { 2559,14}, { 5119,15}, \
- { 2815,14}, { 5887,16}, { 1535,15}, { 3071,14}, \
- { 6143,15}, { 3327,14}, { 6911,15}, { 3839,14}, \
+ { 511,15}, { 1023,14}, { 2175,13}, { 4351,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
+ { 5887,12}, { 11775,15}, { 1535,14}, { 3455,13}, \
+ { 6911,15}, { 1791,14}, { 3839,13}, { 7679,16}, \
+ { 1023,15}, { 2047,14}, { 4351,15}, { 2303,14}, \
+ { 4863,15}, { 2815,14}, { 5887,13}, { 11775,16}, \
+ { 1535,15}, { 3327,14}, { 6911,15}, { 3839,14}, \
{ 7679,17}, { 1023,16}, { 2047,15}, { 4863,16}, \
- { 2559,15}, { 5887,14}, { 11775,16}, { 65536,17}, \
- { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
- {2097152,22}, {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 227
+ { 2559,15}, { 5887,14}, { 11775,16}, { 3071,15}, \
+ { 6911,16}, { 3583,15}, { 7679,14}, { 15359,15}, \
+ { 7935,17}, { 2047,16}, { 4095,15}, { 8447,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 238
+#define MUL_FFT_THRESHOLD 4736
+
+#define SQR_FFT_MODF_THRESHOLD 368 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 368, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 21, 8}, \
+ { 11, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
+ { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 127, 9}, { 255,11}, { 79,10}, { 159, 9}, \
+ { 319,11}, { 95,10}, { 191,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271,11}, \
+ { 143,10}, { 287, 9}, { 575,10}, { 303, 9}, \
+ { 607,11}, { 159,10}, { 319, 6}, { 5631, 7}, \
+ { 2943, 6}, { 5887, 8}, { 1535,11}, { 207,10}, \
+ { 415,11}, { 223,10}, { 447,11}, { 239,10}, \
+ { 479,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 271,10}, { 543,11}, { 287,10}, { 575,11}, \
+ { 303,10}, { 607,11}, { 319,10}, { 639,11}, \
+ { 335,10}, { 671,11}, { 351,10}, { 703,11}, \
+ { 367,10}, { 735,11}, { 383,10}, { 767,11}, \
+ { 415,10}, { 831,11}, { 447,10}, { 895,11}, \
+ { 479,13}, { 127,11}, { 511,10}, { 1023,11}, \
+ { 543,10}, { 1087,12}, { 287,11}, { 607,10}, \
+ { 1215,11}, { 671,12}, { 351,11}, { 735,12}, \
+ { 383,11}, { 767,12}, { 415,11}, { 831,12}, \
+ { 447,11}, { 895,12}, { 479,11}, { 959,14}, \
+ { 127,12}, { 511,11}, { 1023,12}, { 543,11}, \
+ { 1087,12}, { 607,11}, { 1215,12}, { 735,13}, \
+ { 383,12}, { 831,13}, { 447,12}, { 959,13}, \
+ { 511,12}, { 1087,13}, { 575,12}, { 1151,13}, \
+ { 639,12}, { 1279,13}, { 703,12}, { 1407,11}, \
+ { 2815,14}, { 383,13}, { 767,12}, { 1535,13}, \
+ { 831,12}, { 1727,11}, { 3455,13}, { 959,14}, \
+ { 511,13}, { 1087,12}, { 2175,13}, { 1215,14}, \
+ { 639,13}, { 1279,12}, { 2559,13}, { 1343,12}, \
+ { 2687,13}, { 1407,12}, { 2815,13}, { 1471,14}, \
+ { 767,13}, { 1599,12}, { 3199,13}, { 1727,14}, \
+ { 895,13}, { 1791,12}, { 3583,13}, { 1919,15}, \
+ { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
+ { 2303,12}, { 4607,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,13}, { 2815,15}, \
+ { 767,14}, { 1535,13}, { 3199,14}, { 1663,13}, \
+ { 3455,12}, { 6911,14}, { 1791,13}, { 3583,14}, \
+ { 1919,16}, { 511,15}, { 1023,14}, { 2431,13}, \
+ { 4863,15}, { 1279,14}, { 2943,13}, { 5887,15}, \
+ { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
+ { 3839,13}, { 7679,16}, { 1023,15}, { 2047,14}, \
+ { 4351,15}, { 2303,14}, { 4863,15}, { 2815,14}, \
+ { 5887,16}, { 1535,15}, { 3071,14}, { 6143,15}, \
+ { 3327,14}, { 6911,15}, { 3839,14}, { 7679,17}, \
+ { 1023,16}, { 2047,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
+ { 3583,15}, { 7679,14}, { 15359,15}, { 7935,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}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 237
#define SQR_FFT_THRESHOLD 3264
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 78
-#define MULLO_MUL_N_THRESHOLD 8207
+#define MULLO_DC_THRESHOLD 68
+#define MULLO_MUL_N_THRESHOLD 8967
#define SQRLO_BASECASE_THRESHOLD 11
-#define SQRLO_DC_THRESHOLD 92
+#define SQRLO_DC_THRESHOLD 80
#define SQRLO_SQR_THRESHOLD 6481
-#define DC_DIV_QR_THRESHOLD 63
-#define DC_DIVAPPR_Q_THRESHOLD 195
-#define DC_BDIV_QR_THRESHOLD 56
-#define DC_BDIV_Q_THRESHOLD 128
+#define DC_DIV_QR_THRESHOLD 58
+#define DC_DIVAPPR_Q_THRESHOLD 182
+#define DC_BDIV_QR_THRESHOLD 60
+#define DC_BDIV_Q_THRESHOLD 123
-#define INV_MULMOD_BNM1_THRESHOLD 42
-#define INV_NEWTON_THRESHOLD 199
-#define INV_APPR_THRESHOLD 181
+#define INV_MULMOD_BNM1_THRESHOLD 38
+#define INV_NEWTON_THRESHOLD 179
+#define INV_APPR_THRESHOLD 182
-#define BINV_NEWTON_THRESHOLD 236
-#define REDC_1_TO_REDC_2_THRESHOLD 47
-#define REDC_2_TO_REDC_N_THRESHOLD 62
+#define BINV_NEWTON_THRESHOLD 230
+#define REDC_1_TO_REDC_2_THRESHOLD 48
+#define REDC_2_TO_REDC_N_THRESHOLD 63
#define MU_DIV_QR_THRESHOLD 1470
-#define MU_DIVAPPR_Q_THRESHOLD 1589
-#define MUPI_DIV_QR_THRESHOLD 78
-#define MU_BDIV_QR_THRESHOLD 1442
-#define MU_BDIV_Q_THRESHOLD 1470
+#define MU_DIVAPPR_Q_THRESHOLD 1528
+#define MUPI_DIV_QR_THRESHOLD 82
+#define MU_BDIV_QR_THRESHOLD 1334
+#define MU_BDIV_Q_THRESHOLD 1506
-#define POWM_SEC_TABLE 3,22,194,257,1099
+#define POWM_SEC_TABLE 1,22,194,473,1297,2698
#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 1432
-#define SET_STR_PRECOMPUTE_THRESHOLD 2729
+#define GET_STR_PRECOMPUTE_THRESHOLD 19
+#define SET_STR_DC_THRESHOLD 1391
+#define SET_STR_PRECOMPUTE_THRESHOLD 2654
-#define FAC_DSC_THRESHOLD 725
+#define FAC_DSC_THRESHOLD 562
#define FAC_ODD_THRESHOLD 0 /* always */
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 112
-#define HGCD_APPR_THRESHOLD 52
+#define MATRIX22_STRASSEN_THRESHOLD 15
+#define HGCD2_DIV1_METHOD 5 /* 3.49% faster than 3 */
+#define HGCD_THRESHOLD 96
+#define HGCD_APPR_THRESHOLD 92
#define HGCD_REDUCE_THRESHOLD 2681
-#define GCD_DC_THRESHOLD 807
-#define GCDEXT_DC_THRESHOLD 416
-#define JACOBI_BASE_METHOD 4
+#define GCD_DC_THRESHOLD 501
+#define GCDEXT_DC_THRESHOLD 365
+#define JACOBI_BASE_METHOD 1 /* 23.87% faster than 4 */
+
+/* Tuneup completed successfully, took 238360 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_1.asm
index 1e3c338f4ee..5e649e85455 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_1.asm
@@ -32,22 +32,26 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb best
-C AMD K8,K9 n/a
-C AMD K10 n/a
-C AMD bd1 n/a
-C AMD bd2 ?
-C AMD bobcat n/a
-C AMD jaguar ?
-C Intel P4 n/a
-C Intel PNR n/a
-C Intel NHM n/a
-C Intel SBR n/a
-C Intel IBR n/a
-C Intel HWL 1.57 this
-C Intel BWL ?
-C Intel atom n/a
-C VIA nano n/a
+C cycles/limb
+C AMD K8,K9 -
+C AMD K10 -
+C AMD bull -
+C AMD pile -
+C AMD steam -
+C AMD excavator -
+C AMD bobcat -
+C AMD jaguar -
+C Intel P4 -
+C Intel core2 -
+C Intel NHM -
+C Intel SBR -
+C Intel IBR -
+C Intel HWL 1.59
+C Intel BWL 1.76
+C Intel SKL 1.54
+C Intel atom -
+C Intel SLM -
+C VIA nano -
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjorn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_2.asm
index 5bdb1aa645e..f1f044f183e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mul_2.asm
@@ -33,22 +33,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9 n/a
-C AMD K10 n/a
-C AMD bull n/a
-C AMD pile n/a
-C AMD steam ?
-C AMD bobcat n/a
-C AMD jaguar ?
-C Intel P4 n/a
-C Intel core n/a
-C Intel NHM n/a
-C Intel SBR n/a
-C Intel IBR n/a
-C Intel HWL 1.86
-C Intel BWL ?
-C Intel atom n/a
-C VIA nano n/a
+C AMD K8,K9 -
+C AMD K10 -
+C AMD bull -
+C AMD pile -
+C AMD steam -
+C AMD excavator -
+C AMD bobcat -
+C AMD jaguar -
+C Intel P4 -
+C Intel core -
+C Intel NHM -
+C Intel SBR -
+C Intel IBR -
+C Intel HWL 3.74
+C Intel BWL 4.21
+C Intel SKL 4.20
+C Intel atom -
+C Intel SLM -
+C VIA nano -
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjörn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mullo_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mullo_basecase.asm
index 9986e8bcfa4..e65559ba28f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mullo_basecase.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreihwl/mullo_basecase.asm
@@ -57,10 +57,6 @@ C TODO
C * Implement proper cor2, replacing current cor0.
C * Micro-optimise.
-C When playing with pointers, set this to $2 to fall back to conservative
-C indexing in wind-down code.
-define(`I',`$1')
-
define(`rp', `%rdi')
define(`up', `%rsi')
define(`vp_param', `%rdx')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/aorsmul_1.asm
index b768905b939..1be829f2f8e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/aorsmul_1.asm
@@ -32,21 +32,24 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C AMD K8,K9
-C AMD K10
-C AMD bull
-C AMD pile
-C AMD bobcat
-C AMD jaguar
-C Intel P4
-C Intel core
-C Intel NHM 4.55 with minor fluctuations
-C Intel SBR
-C Intel IBR
-C Intel HWL
-C Intel BWL
-C Intel atom
+C cycles/limb
+C AMD K8,K9 4.0
+C AMD K10 4.0
+C AMD bull 5.0
+C AMD pile 4.84 5.39
+C AMD steam
+C AMD excavator
+C AMD bobcat 5.56
+C AMD jaguar 5.30
+C Intel P4 15.7 17.2
+C Intel core2 5.15
+C Intel NHM 4.56
+C Intel SBR 3.44
+C Intel HWL 3.03
+C Intel BWL 2.77
+C Intel SKL 2.76
+C Intel atom 21
+C Intel SLM 11
C VIA nano
C The loop of this code is the result of running a code generation and
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/gmp-mparam.h
index 67f068228d8..f56c128d9c0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/gmp-mparam.h
@@ -1,7 +1,6 @@
/* Nehalem gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2012, 2014, 2015 Free Software Foundation,
-Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,9 +31,9 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 2667 MHz Core i7 Nehalem */
-/* FFT tuning limit = 200 M */
-/* Generated by tuneup.c, 2015-10-07, gcc 4.5 */
+/* 2933-3200 MHz Intel Xeon X3470 Nehalem */
+/* FFT tuning limit = 468,424,931 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
@@ -42,192 +41,198 @@ see https://www.gnu.org/licenses/. */
#define MOD_1U_TO_MOD_1_1_THRESHOLD 2
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 11
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 16
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 7
#define USE_PREINV_DIVREM_1 1 /* native */
#define DIV_QR_1_NORM_THRESHOLD 1
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 10
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 16
+#define BMOD_1_TO_MOD_1_THRESHOLD 17
+
+#define DIV_1_VS_MUL_1_PERCENT 301
#define MUL_TOOM22_THRESHOLD 18
-#define MUL_TOOM33_THRESHOLD 61
+#define MUL_TOOM33_THRESHOLD 59
#define MUL_TOOM44_THRESHOLD 169
-#define MUL_TOOM6H_THRESHOLD 226
-#define MUL_TOOM8H_THRESHOLD 309
+#define MUL_TOOM6H_THRESHOLD 230
+#define MUL_TOOM8H_THRESHOLD 333
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 114
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 105
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 148
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 110
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 104
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 101
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 147
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 28
-#define SQR_TOOM3_THRESHOLD 93
+#define SQR_TOOM3_THRESHOLD 98
#define SQR_TOOM4_THRESHOLD 250
-#define SQR_TOOM6_THRESHOLD 318
-#define SQR_TOOM8_THRESHOLD 430
+#define SQR_TOOM6_THRESHOLD 351
+#define SQR_TOOM8_THRESHOLD 478
#define MULMID_TOOM42_THRESHOLD 28
-#define MULMOD_BNM1_THRESHOLD 11
+#define MULMOD_BNM1_THRESHOLD 13
#define SQRMOD_BNM1_THRESHOLD 13
-#define MUL_FFT_MODF_THRESHOLD 404 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 372 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 404, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 21, 7}, { 11, 6}, { 23, 7}, { 21, 8}, \
- { 11, 7}, { 24, 8}, { 13, 7}, { 27, 8}, \
- { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
- { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
- { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31,11}, { 63,10}, { 127, 9}, { 255,10}, \
+ { { 372, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
+ { 10, 5}, { 21, 6}, { 21, 7}, { 11, 6}, \
+ { 23, 7}, { 21, 8}, { 11, 7}, { 24, 8}, \
+ { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
+ { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
+ { 33, 9}, { 19, 8}, { 39, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 67,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31, 8}, { 511,10}, \
{ 135,11}, { 79,10}, { 159, 9}, { 319,11}, \
- { 95, 9}, { 383,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
- { 575,11}, { 159,10}, { 319,12}, { 95,10}, \
- { 383,13}, { 63,12}, { 127,11}, { 255,10}, \
- { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
- { 575,12}, { 159,11}, { 319,10}, { 639,11}, \
- { 335,10}, { 671,11}, { 351,10}, { 703,11}, \
- { 383,10}, { 767,11}, { 415,10}, { 831,12}, \
- { 223,11}, { 447,13}, { 127,12}, { 255,11}, \
- { 511,10}, { 1023,11}, { 543,12}, { 287,11}, \
- { 607,12}, { 319,11}, { 671,12}, { 351,11}, \
- { 703,12}, { 383,11}, { 767,12}, { 415,11}, \
- { 831,12}, { 447,11}, { 895,12}, { 479,14}, \
- { 127,13}, { 255,12}, { 511,11}, { 1023,12}, \
- { 543,11}, { 1087,12}, { 575,11}, { 1151,12}, \
- { 607,13}, { 319,12}, { 703,13}, { 383,12}, \
- { 767,11}, { 1535,12}, { 831,13}, { 447,12}, \
- { 959,14}, { 255,13}, { 511,12}, { 1087,13}, \
- { 575,12}, { 1215,13}, { 639,12}, { 1279,13}, \
- { 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
- { 1535,13}, { 831,12}, { 1663,13}, { 959,14}, \
- { 511,13}, { 1087,12}, { 2175,13}, { 1215,14}, \
- { 639,13}, { 1343,12}, { 2687,13}, { 1407,12}, \
- { 2815,14}, { 767,13}, { 1663,14}, { 895,13}, \
- { 1791,15}, { 511,14}, { 1023,13}, { 2175,14}, \
- { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
- { 2687,14}, { 1407,13}, { 2815,15}, { 767,14}, \
- { 1535,13}, { 3071,14}, { 1663,13}, { 3455,14}, \
- { 1791,16}, { 511,15}, { 1023,14}, { 2431,13}, \
+ { 95,10}, { 191, 9}, { 383,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,11}, { 143,10}, \
+ { 287, 9}, { 575,10}, { 303,11}, { 159,10}, \
+ { 319,12}, { 95,11}, { 191,10}, { 383,13}, \
+ { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 271,10}, { 543,11}, { 287,10}, { 575,11}, \
+ { 303,10}, { 607,11}, { 319,10}, { 639,11}, \
+ { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
+ { 767,11}, { 415,10}, { 831,12}, { 223,11}, \
+ { 447,10}, { 895,13}, { 127,12}, { 255,11}, \
+ { 543,12}, { 287,11}, { 607,12}, { 319,11}, \
+ { 639,12}, { 351,11}, { 703,13}, { 191,12}, \
+ { 383,11}, { 767,12}, { 415,11}, { 831,12}, \
+ { 447,11}, { 895,12}, { 479,14}, { 127,13}, \
+ { 255,12}, { 543,11}, { 1087,12}, { 607,13}, \
+ { 319,12}, { 703,13}, { 383,12}, { 831,13}, \
+ { 447,12}, { 959,14}, { 255,13}, { 511,12}, \
+ { 1087,13}, { 575,12}, { 1215,11}, { 2431,13}, \
+ { 639,12}, { 1279,13}, { 703,12}, { 1407,14}, \
+ { 383,13}, { 831,12}, { 1663,13}, { 959,14}, \
+ { 511,13}, { 1087,12}, { 2175,13}, { 1215,12}, \
+ { 2431,14}, { 639,13}, { 1343,12}, { 2687,13}, \
+ { 1407,12}, { 2815,13}, { 1471,14}, { 767,13}, \
+ { 1663,14}, { 895,13}, { 1791,15}, { 511,14}, \
+ { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
+ { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
+ { 2815,15}, { 767,14}, { 1663,13}, { 3455,14}, \
+ { 1919,16}, { 511,15}, { 1023,14}, { 2431,13}, \
{ 4863,15}, { 1279,14}, { 2943,13}, { 5887,15}, \
{ 1535,14}, { 3455,15}, { 1791,14}, { 3839,16}, \
{ 1023,15}, { 2047,14}, { 4223,15}, { 2303,14}, \
{ 4863,15}, { 2815,14}, { 5887,16}, { 1535,15}, \
{ 3327,14}, { 6911,15}, { 3839,17}, { 1023,16}, \
{ 2047,15}, { 4863,16}, { 2559,15}, { 5887,14}, \
- { 11775,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 197
+ { 11775,16}, { 3071,15}, { 6911,16}, { 3583,15}, \
+ { 7679,14}, { 15359,17}, { 2047,16}, { 4607,15}, \
+ { 9983,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 204
#define MUL_FFT_THRESHOLD 4224
-#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 336 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 340, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { { 336, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
{ 21, 7}, { 11, 6}, { 23, 7}, { 21, 8}, \
- { 11, 7}, { 24, 8}, { 13, 7}, { 27, 8}, \
+ { 11, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
{ 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
{ 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
- { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
{ 15, 9}, { 39,10}, { 23, 9}, { 47,11}, \
- { 15,10}, { 31, 9}, { 63,10}, { 39, 9}, \
- { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
- { 79,11}, { 47,10}, { 95,12}, { 31,11}, \
- { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
- { 135,11}, { 79, 9}, { 319,11}, { 95,10}, \
- { 191, 9}, { 383,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,10}, { 271, 9}, { 543,11}, \
- { 143,10}, { 287, 9}, { 575,10}, { 303, 9}, \
- { 607,10}, { 319,12}, { 95,11}, { 191,10}, \
- { 383,13}, { 63,12}, { 127,11}, { 255,10}, \
- { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
- { 575,11}, { 303,10}, { 607,11}, { 319,10}, \
- { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
- { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
- { 415,10}, { 831,12}, { 223,11}, { 447,10}, \
- { 895,11}, { 479,13}, { 127,12}, { 255,11}, \
- { 511,10}, { 1023,11}, { 543,12}, { 287,11}, \
- { 575,10}, { 1151,11}, { 607,12}, { 319,11}, \
- { 639,10}, { 1279,11}, { 671,12}, { 351,11}, \
- { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
- { 415,11}, { 831,12}, { 447,11}, { 895,12}, \
- { 479,14}, { 127,13}, { 255,12}, { 511,11}, \
- { 1023,12}, { 543,11}, { 1087,12}, { 575,11}, \
- { 1151,12}, { 607,13}, { 319,12}, { 639,11}, \
- { 1279,12}, { 671,11}, { 1343,12}, { 703,13}, \
- { 383,12}, { 767,11}, { 1535,12}, { 831,13}, \
- { 447,12}, { 959,13}, { 511,12}, { 1087,13}, \
- { 575,12}, { 1215,13}, { 639,12}, { 1343,13}, \
- { 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
- { 1535,13}, { 831,12}, { 1663,13}, { 959,14}, \
- { 511,13}, { 1087,12}, { 2175,13}, { 1215,14}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 47,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 127, 9}, { 255, 8}, { 511,10}, { 135,11}, \
+ { 79, 9}, { 319, 6}, { 2687, 7}, { 1407, 9}, \
+ { 383,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 271, 9}, { 543,11}, { 143,10}, \
+ { 287, 9}, { 575,10}, { 303, 9}, { 607,10}, \
+ { 319,12}, { 95,11}, { 191,10}, { 383,13}, \
+ { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 271,10}, { 543,11}, { 287,10}, { 575,11}, \
+ { 303,10}, { 607,11}, { 319,10}, { 639,11}, \
+ { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
+ { 767,11}, { 415,10}, { 831,12}, { 223,11}, \
+ { 447,10}, { 895,11}, { 479,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,11}, { 543,12}, \
+ { 287,11}, { 607,12}, { 319,11}, { 671,12}, \
+ { 351,11}, { 703,13}, { 191,12}, { 383,11}, \
+ { 767,12}, { 415,11}, { 831,12}, { 447,11}, \
+ { 895,12}, { 479,14}, { 127,13}, { 255,12}, \
+ { 511,11}, { 1023,12}, { 543,11}, { 1087,12}, \
+ { 575,11}, { 1151,12}, { 607,13}, { 319,12}, \
+ { 671,11}, { 1343,12}, { 703,13}, { 383,12}, \
+ { 767,11}, { 1535,12}, { 831,13}, { 447,12}, \
+ { 959,13}, { 511,12}, { 1087,13}, { 575,12}, \
+ { 1215,11}, { 2431,13}, { 639,12}, { 1343,13}, \
+ { 703,14}, { 383,13}, { 767,12}, { 1535,13}, \
+ { 831,12}, { 1663,13}, { 959,14}, { 511,13}, \
+ { 1087,12}, { 2175,13}, { 1215,12}, { 2431,14}, \
{ 639,13}, { 1343,12}, { 2687,13}, { 1407,12}, \
- { 2815,14}, { 767,13}, { 1535,12}, { 3071,13}, \
- { 1663,14}, { 895,13}, { 1791,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
- { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
- { 2815,15}, { 767,14}, { 1535,13}, { 3071,14}, \
- { 1663,13}, { 3455,14}, { 1791,16}, { 511,15}, \
- { 1023,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
- { 2943,13}, { 5887,15}, { 1535,14}, { 3455,15}, \
- { 1791,14}, { 3839,16}, { 1023,15}, { 2047,14}, \
- { 4223,15}, { 2303,14}, { 4863,15}, { 2815,14}, \
- { 5887,16}, { 1535,15}, { 3327,14}, { 6911,15}, \
- { 3839,17}, { 1023,16}, { 2047,15}, { 4863,16}, \
- { 2559,15}, { 5887,14}, { 11775,16}, { 65536,17}, \
- { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
- {2097152,22}, {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 215
+ { 2815,13}, { 1471,14}, { 767,13}, { 1663,14}, \
+ { 895,13}, { 1791,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,13}, { 2815,15}, \
+ { 767,14}, { 1535,13}, { 3071,14}, { 1663,13}, \
+ { 3455,14}, { 1919,16}, { 511,15}, { 1023,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
+ { 5887,15}, { 1535,14}, { 3455,15}, { 1791,14}, \
+ { 3839,16}, { 1023,15}, { 2047,14}, { 4223,15}, \
+ { 2303,14}, { 4863,15}, { 2815,14}, { 5887,16}, \
+ { 1535,15}, { 3327,14}, { 6911,15}, { 3839,17}, \
+ { 1023,16}, { 2047,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6655,16}, \
+ { 3583,15}, { 7679,14}, { 15359,17}, { 2047,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 SQR_FFT_TABLE3_SIZE 218
#define SQR_FFT_THRESHOLD 3520
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 45
+#define MULLO_DC_THRESHOLD 49
#define MULLO_MUL_N_THRESHOLD 8397
-#define SQRLO_BASECASE_THRESHOLD 8
-#define SQRLO_DC_THRESHOLD 0 /* never mpn_sqrlo_basecase */
+#define SQRLO_BASECASE_THRESHOLD 10
+#define SQRLO_DC_THRESHOLD 11
#define SQRLO_SQR_THRESHOLD 7035
-#define DC_DIV_QR_THRESHOLD 43
-#define DC_DIVAPPR_Q_THRESHOLD 135
-#define DC_BDIV_QR_THRESHOLD 39
+#define DC_DIV_QR_THRESHOLD 47
+#define DC_DIVAPPR_Q_THRESHOLD 151
+#define DC_BDIV_QR_THRESHOLD 40
#define DC_BDIV_Q_THRESHOLD 30
#define INV_MULMOD_BNM1_THRESHOLD 34
-#define INV_NEWTON_THRESHOLD 169
-#define INV_APPR_THRESHOLD 149
+#define INV_NEWTON_THRESHOLD 199
+#define INV_APPR_THRESHOLD 157
-#define BINV_NEWTON_THRESHOLD 246
-#define REDC_1_TO_REDC_2_THRESHOLD 32
-#define REDC_2_TO_REDC_N_THRESHOLD 51
+#define BINV_NEWTON_THRESHOLD 254
+#define REDC_1_TO_REDC_N_THRESHOLD 48
-#define MU_DIV_QR_THRESHOLD 1210
+#define MU_DIV_QR_THRESHOLD 1334
#define MU_DIVAPPR_Q_THRESHOLD 1334
-#define MUPI_DIV_QR_THRESHOLD 85
+#define MUPI_DIV_QR_THRESHOLD 83
#define MU_BDIV_QR_THRESHOLD 1142
-#define MU_BDIV_Q_THRESHOLD 1210
+#define MU_BDIV_Q_THRESHOLD 1308
-#define POWM_SEC_TABLE 3,49,194,452,1555
+#define POWM_SEC_TABLE 1,64,66,452,1486
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 19
-#define SET_STR_DC_THRESHOLD 230
-#define SET_STR_PRECOMPUTE_THRESHOLD 1421
+#define GET_STR_DC_THRESHOLD 11
+#define GET_STR_PRECOMPUTE_THRESHOLD 18
+#define SET_STR_DC_THRESHOLD 141
+#define SET_STR_PRECOMPUTE_THRESHOLD 1023
-#define FAC_DSC_THRESHOLD 406
-#define FAC_ODD_THRESHOLD 28
+#define FAC_DSC_THRESHOLD 182
+#define FAC_ODD_THRESHOLD 0 /* always */
-#define MATRIX22_STRASSEN_THRESHOLD 22
-#define HGCD_THRESHOLD 135
-#define HGCD_APPR_THRESHOLD 169
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD2_DIV1_METHOD 5 /* 2.91% faster than 3 */
+#define HGCD_THRESHOLD 116
+#define HGCD_APPR_THRESHOLD 164
#define HGCD_REDUCE_THRESHOLD 2205
-#define GCD_DC_THRESHOLD 330
-#define GCDEXT_DC_THRESHOLD 361
-#define JACOBI_BASE_METHOD 1
+#define GCD_DC_THRESHOLD 321
+#define GCDEXT_DC_THRESHOLD 358
+#define JACOBI_BASE_METHOD 4 /* 0.12% faster than 1 */
+
+/* Tuneup completed successfully, took 452116 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/hamdist.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/hamdist.asm
index 93e1e5632b2..a5a63e4b32b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/hamdist.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/hamdist.asm
@@ -1,6 +1,6 @@
dnl AMD64 mpn_hamdist -- hamming distance.
-dnl Copyright 2008, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,8 +31,166 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
+C cycles/limb
+C AMD K8,K9 n/a
+C AMD K10 3.26
+C AMD bd1 4.2
+C AMD bd2 4.2
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen 1.15
+C AMD bobcat 7.29
+C AMD jaguar 2.53
+C Intel P4 n/a
+C Intel core2 n/a
+C Intel NHM 2.03
+C Intel SBR 1.66
+C Intel IBR 1.62
+C Intel HWL 1.50
+C Intel BWL 1.50
+C Intel SKL 1.50
+C Intel atom n/a
+C Intel SLM 2.55
+C VIA nano n/a
+
+C TODO
+C * An AVX pshufb based variant should approach 0.5 c/l on Haswell and later
+C Intel hardware. Perhaps mix such a loop with popcnt instructions.
+C * The random placement of the L0, L1, L2, etc blocks are due to branch
+C shortening. More work could be done there.
+C * Combine the accumulators rax and rcx into one register to save some
+C bookkeeping and a push/pop pair. Unfortunately this cause a slight
+C slowdown for at leat NHM and SBR.
+
+define(`up', `%rdi')
+define(`vp', `%rsi')
+define(`n', `%rdx')
+
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-MULFUNC_PROLOGUE(mpn_hamdist)
-include_mpn(`x86_64/k10/hamdist.asm')
+define(`sum', `lea ($1,$2), $2')
+define(`sum', `add $1, $2')
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_hamdist)
+ FUNC_ENTRY(3)
+ push %rbx
+ push %rbp
+
+ mov (up), %r10
+ xor (vp), %r10
+
+ mov R32(n), R32(%r8)
+ and $3, R32(%r8)
+
+ xor R32(%rcx), R32(%rcx)
+ .byte 0xf3,0x49,0x0f,0xb8,0xc2 C popcnt %r10,%rax
+
+ lea L(tab)(%rip), %r9
+ifdef(`PIC',`
+ movslq (%r9,%r8,4), %r8
+ add %r9, %r8
+ jmp *%r8
+',`
+ jmp *(%r9,%r8,8)
+')
+
+L(3): mov 8(up), %r10
+ mov 16(up), %r11
+ xor 8(vp), %r10
+ xor 16(vp), %r11
+ xor R32(%rbp), R32(%rbp)
+ sub $4, n
+ jle L(x3)
+ mov 24(up), %r8
+ mov 32(up), %r9
+ add $24, up
+ add $24, vp
+ jmp L(e3)
+
+L(0): mov 8(up), %r9
+ xor 8(vp), %r9
+ mov 16(up), %r10
+ mov 24(up), %r11
+ xor R32(%rbx), R32(%rbx)
+ xor 16(vp), %r10
+ xor 24(vp), %r11
+ add $32, up
+ add $32, vp
+ sub $4, n
+ jle L(x4)
+
+ ALIGN(16)
+L(top):
+L(e0): .byte 0xf3,0x49,0x0f,0xb8,0xe9 C popcnt %r9,%rbp
+ mov (up), %r8
+ mov 8(up), %r9
+ sum( %rbx, %rax)
+L(e3): .byte 0xf3,0x49,0x0f,0xb8,0xda C popcnt %r10,%rbx
+ xor (vp), %r8
+ xor 8(vp), %r9
+ sum( %rbp, %rcx)
+L(e2): .byte 0xf3,0x49,0x0f,0xb8,0xeb C popcnt %r11,%rbp
+ mov 16(up), %r10
+ mov 24(up), %r11
+ add $32, up
+ sum( %rbx, %rax)
+L(e1): .byte 0xf3,0x49,0x0f,0xb8,0xd8 C popcnt %r8,%rbx
+ xor 16(vp), %r10
+ xor 24(vp), %r11
+ add $32, vp
+ sum( %rbp, %rcx)
+ sub $4, n
+ jg L(top)
+
+L(x4): .byte 0xf3,0x49,0x0f,0xb8,0xe9 C popcnt %r9,%rbp
+ sum( %rbx, %rax)
+L(x3): .byte 0xf3,0x49,0x0f,0xb8,0xda C popcnt %r10,%rbx
+ sum( %rbp, %rcx)
+ .byte 0xf3,0x49,0x0f,0xb8,0xeb C popcnt %r11,%rbp
+ sum( %rbx, %rax)
+ sum( %rbp, %rcx)
+L(x2): add %rcx, %rax
+L(x1): pop %rbp
+ pop %rbx
+ FUNC_EXIT()
+ ret
+
+L(2): mov 8(up), %r11
+ xor 8(vp), %r11
+ sub $2, n
+ jle L(n2)
+ mov 16(up), %r8
+ mov 24(up), %r9
+ xor R32(%rbx), R32(%rbx)
+ xor 16(vp), %r8
+ xor 24(vp), %r9
+ add $16, up
+ add $16, vp
+ jmp L(e2)
+L(n2): .byte 0xf3,0x49,0x0f,0xb8,0xcb C popcnt %r11,%rcx
+ jmp L(x2)
+
+L(1): dec n
+ jle L(x1)
+ mov 8(up), %r8
+ mov 16(up), %r9
+ xor 8(vp), %r8
+ xor 16(vp), %r9
+ xor R32(%rbp), R32(%rbp)
+ mov 24(up), %r10
+ mov 32(up), %r11
+ add $40, up
+ add $8, vp
+ jmp L(e1)
+
+EPILOGUE()
+ JUMPTABSECT
+ ALIGN(8)
+L(tab): JMPENT( L(0), L(tab))
+ JMPENT( L(1), L(tab))
+ JMPENT( L(2), L(tab))
+ JMPENT( L(3), L(tab))
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/popcount.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/popcount.asm
index 8f22a715b66..0a3c867bb43 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/popcount.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreinhm/popcount.asm
@@ -1,6 +1,6 @@
dnl AMD64 mpn_popcount -- population count.
-dnl Copyright 2008, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,8 +31,152 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
+C cycles/limb
+C AMD K8,K9 n/a
+C AMD K10 1.39
+C AMD bd1 4
+C AMD bd2 4
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen 0.72
+C AMD bobcat 5.78
+C AMD jaguar 1.27
+C Intel P4 n/a
+C Intel core2 n/a
+C Intel NHM 1.04
+C Intel SBR 1.02
+C Intel IBR 1.0
+C Intel HWL 1.0
+C Intel BWL 1.0
+C Intel SKL 1.0
+C Intel atom n/a
+C Intel SLM 1.34
+C VIA nano n/a
+
+C TODO
+C * We could approach 0.5 c/l for AMD Zen with more unrolling. That would
+C not cause any additional feed-in overhead as we already use a jump table.
+C * An AVX pshufb based variant should approach 0.5 c/l on Haswell and later
+C Intel hardware. Perhaps mix such a loop with popcnt instructions.
+C * The random placement of the L0, L1, L2, etc blocks are due to branch
+C shortening.
+
+define(`up', `%rdi')
+define(`n', `%rsi')
+
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-MULFUNC_PROLOGUE(mpn_popcount)
-include_mpn(`x86_64/k10/popcount.asm')
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_popcount)
+ FUNC_ENTRY(2)
+
+ mov R32(n), R32(%r8)
+ and $7, R32(%r8)
+
+ .byte 0xf3,0x48,0x0f,0xb8,0x07 C popcnt (up), %rax
+ xor R32(%rcx), R32(%rcx)
+
+ lea L(tab)(%rip), %r9
+ifdef(`PIC',`
+ movslq (%r9,%r8,4), %r8
+ add %r9, %r8
+ jmp *%r8
+',`
+ jmp *(%r9,%r8,8)
+')
+
+L(3): .byte 0xf3,0x4c,0x0f,0xb8,0x57,0x08 C popcnt 8(up), %r10
+ .byte 0xf3,0x4c,0x0f,0xb8,0x5f,0x10 C popcnt 16(up), %r11
+ add $24, up
+ sub $8, n
+ jg L(e34)
+ add %r10, %rax
+ add %r11, %rax
+L(s1): FUNC_EXIT()
+ ret
+
+L(1): sub $8, n
+ jle L(s1)
+ .byte 0xf3,0x4c,0x0f,0xb8,0x47,0x08 C popcnt 8(up), %r8
+ .byte 0xf3,0x4c,0x0f,0xb8,0x4f,0x10 C popcnt 16(up), %r9
+ add $8, up
+ jmp L(e12)
+
+L(7): .byte 0xf3,0x4c,0x0f,0xb8,0x57,0x08 C popcnt 0x8(%rdi),%r10
+ .byte 0xf3,0x4c,0x0f,0xb8,0x5f,0x10 C popcnt 0x10(%rdi),%r11
+ add $-8, up
+ jmp L(e07)
+
+L(0): .byte 0xf3,0x48,0x0f,0xb8,0x4f,0x08 C popcnt 0x8(%rdi),%rcx
+ .byte 0xf3,0x4c,0x0f,0xb8,0x57,0x10 C popcnt 0x10(%rdi),%r10
+ .byte 0xf3,0x4c,0x0f,0xb8,0x5f,0x18 C popcnt 0x18(%rdi),%r11
+ jmp L(e07)
+
+L(4): .byte 0xf3,0x48,0x0f,0xb8,0x4f,0x08 C popcnt 0x8(%rdi),%rcx
+ .byte 0xf3,0x4c,0x0f,0xb8,0x57,0x10 C popcnt 0x10(%rdi),%r10
+ .byte 0xf3,0x4c,0x0f,0xb8,0x5f,0x18 C popcnt 0x18(%rdi),%r11
+ add $32, up
+ sub $8, n
+ jle L(x4)
+
+ ALIGN(16)
+L(top):
+L(e34): .byte 0xf3,0x4c,0x0f,0xb8,0x07 C popcnt (%rdi),%r8
+ .byte 0xf3,0x4c,0x0f,0xb8,0x4f,0x08 C popcnt 0x8(%rdi),%r9
+ add %r10, %rcx
+ add %r11, %rax
+L(e12): .byte 0xf3,0x4c,0x0f,0xb8,0x57,0x10 C popcnt 0x10(%rdi),%r10
+ .byte 0xf3,0x4c,0x0f,0xb8,0x5f,0x18 C popcnt 0x18(%rdi),%r11
+ add %r8, %rcx
+ add %r9, %rax
+L(e07): .byte 0xf3,0x4c,0x0f,0xb8,0x47,0x20 C popcnt 0x20(%rdi),%r8
+ .byte 0xf3,0x4c,0x0f,0xb8,0x4f,0x28 C popcnt 0x28(%rdi),%r9
+ add %r10, %rcx
+ add %r11, %rax
+L(e56): .byte 0xf3,0x4c,0x0f,0xb8,0x57,0x30 C popcnt 0x30(%rdi),%r10
+ .byte 0xf3,0x4c,0x0f,0xb8,0x5f,0x38 C popcnt 0x38(%rdi),%r11
+ add $64, up
+ add %r8, %rcx
+ add %r9, %rax
+ sub $8, n
+ jg L(top)
+
+L(x4): add %r10, %rcx
+ add %r11, %rax
+L(x2): add %rcx, %rax
+
+ FUNC_EXIT()
+ ret
+
+L(2): .byte 0xf3,0x48,0x0f,0xb8,0x4f,0x08 C popcnt 0x8(%rdi),%rcx
+ sub $8, n
+ jle L(x2)
+ .byte 0xf3,0x4c,0x0f,0xb8,0x47,0x10 C popcnt 0x10(%rdi),%r8
+ .byte 0xf3,0x4c,0x0f,0xb8,0x4f,0x18 C popcnt 0x18(%rdi),%r9
+ add $16, up
+ jmp L(e12)
+
+L(5): .byte 0xf3,0x4c,0x0f,0xb8,0x47,0x08 C popcnt 0x8(%rdi),%r8
+ .byte 0xf3,0x4c,0x0f,0xb8,0x4f,0x10 C popcnt 0x10(%rdi),%r9
+ add $-24, up
+ jmp L(e56)
+
+L(6): .byte 0xf3,0x48,0x0f,0xb8,0x4f,0x08 C popcnt 0x8(%rdi),%rcx
+ .byte 0xf3,0x4c,0x0f,0xb8,0x47,0x10 C popcnt 0x10(%rdi),%r8
+ .byte 0xf3,0x4c,0x0f,0xb8,0x4f,0x18 C popcnt 0x18(%rdi),%r9
+ add $-16, up
+ jmp L(e56)
+EPILOGUE()
+ JUMPTABSECT
+ ALIGN(8)
+L(tab): JMPENT( L(0), L(tab))
+ JMPENT( L(1), L(tab))
+ JMPENT( L(2), L(tab))
+ JMPENT( L(3), L(tab))
+ JMPENT( L(4), L(tab))
+ JMPENT( L(5), L(tab))
+ JMPENT( L(6), L(tab))
+ JMPENT( L(7), L(tab))
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorrlsh2_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorrlsh2_n.asm
index 9416d5a1645..3b7bb22f705 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorrlsh2_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorrlsh2_n.asm
@@ -1,5 +1,5 @@
-dnl AMD64 mpn_addlsh2_n -- rp[] = up[] + (vp[] << 1)
-dnl AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 1) - up[]
+dnl AMD64 mpn_addlsh2_n -- rp[] = up[] + (vp[] << 2)
+dnl AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 2) - up[]
dnl Contributed to the GNU project by Torbjorn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aors_n.asm
index 01abf78a0d8..61fee3e3625 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aors_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aors_n.asm
@@ -33,26 +33,31 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C AMD K8,K9
-C AMD K10
-C AMD bull 1.82 average over 400-600
-C AMD pile 1.83 average over 400-600
-C AMD bobcat
-C AMD jaguar
-C Intel P4
-C Intel core
-C Intel NHM
-C Intel SBR 1.55 fluctuates
-C Intel IBR 1.55 fluctuates
-C Intel HWL 1.33 fluctuates
-C Intel BWL
-C Intel atom
-C VIA nano
+C cycles/limb
+C AMD K8,K9 1.75\2.52
+C AMD K10 1.5
+C AMD bd1 1.69\2.25
+C AMD bd2 1.65
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen 1.5
+C AMD bt1 2.67
+C AMD bt2 2.16
+C Intel P4 11.54
+C Intel PNR 5
+C Intel NHM 5.5
+C Intel SBR 1.54
+C Intel IBR 1.5
+C Intel HWL 1.32
+C Intel BWL 1.07
+C Intel SKL 1.21
+C Intel atom 4.3
+C Intel SLM 3
+C VIA nano ?
C The loop of this code was manually written. It runs close to optimally on
C Intel SBR, IBR, and HWL far as we know, except for the fluctuation problems.
-C It also runs slightly faster on average on AMD bull and pile.
+C It also runs slightly faster on average on AMD bd1 and bd2.
C
C No micro-optimisation has been done.
C
@@ -121,7 +126,7 @@ L(b10): neg %r8
ADCSBB 16(vp), %r8
ADCSBB 24(vp), %r9
lea 16(vp), vp
- lea (rp), rp
+C lea (rp), rp
jmp L(lo2)
L(e2): mov %r10, (rp)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorsmul_1.asm
index 9f01d9c0612..b4c15726228 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/aorsmul_1.asm
@@ -32,22 +32,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C AMD K8,K9
-C AMD K10
-C AMD bull
-C AMD pile
+C cycles/limb
+C AMD K8,K9 4.27
+C AMD K10 4.27 4.54
+C AMD bull 4.76
+C AMD pile 4.55
C AMD steam
-C AMD bobcat
-C AMD jaguar
-C Intel P4
-C Intel core
-C Intel NHM
-C Intel SBR 3.24 (average, fluctuating in 3.20-3.57)
-C Intel IBR 3.04
-C Intel HWL
-C Intel BWL
-C Intel atom
+C AMD excavator
+C AMD bobcat 5.30
+C AMD jaguar 5.28
+C Intel P4 16.2 17.1
+C Intel core2 5.26
+C Intel NHM 5.09
+C Intel SBR 3.21
+C Intel IBR 2.96
+C Intel HWL 2.81
+C Intel BWL 2.76
+C Intel SKL 2.76
+C Intel atom 21.5
+C Intel SLM 9.5
C VIA nano
C The loop of this code is the result of running a code generation and
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/cnd_add_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/cnd_add_n.asm
new file mode 100644
index 00000000000..43abcc86124
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/cnd_add_n.asm
@@ -0,0 +1,174 @@
+dnl AMD64 mpn_cnd_add_n.
+
+dnl Copyright 2011-2013, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C AMD K8,K9
+C AMD K10
+C AMD bd1
+C AMD bd2
+C AMD bd3
+C AMD bd4
+C AMD zen
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel PNR 3.0
+C Intel NHM 3.75
+C Intel SBR 1.93
+C Intel IBR 1.89
+C Intel HWL 1.78
+C Intel BWL 1.50
+C Intel SKL 1.50
+C Intel atom
+C Intel SLM 4.0
+C VIA nano
+
+C NOTES
+C * It might seem natural to use the cmov insn here, but since this function
+C is supposed to have the exact same execution pattern for cnd true and
+C false, and since cmov's documentation is not clear about whether it
+C actually reads both source operands and writes the register for a false
+C condition, we cannot use it.
+
+C INPUT PARAMETERS
+define(`cnd_arg', `%rdi') dnl rcx
+define(`rp', `%rsi') dnl rdx
+define(`up', `%rdx') dnl r8
+define(`vp', `%rcx') dnl r9
+define(`n', `%r8') dnl rsp+40
+
+define(`cnd', `%rbx')
+
+define(ADDSUB, add)
+define(ADCSBB, adc)
+define(func, mpn_cnd_add_n)
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(mpn_cnd_add_n)
+ FUNC_ENTRY(4)
+IFDOS(` mov 56(%rsp), R32(%r8)')
+ push %rbx
+
+ neg cnd_arg
+ sbb cnd, cnd C make cnd mask
+
+ test $1, R8(n)
+ jz L(x0)
+L(x1): test $2, R8(n)
+ jz L(b1)
+
+L(b3): mov (vp), %rdi
+ mov 8(vp), %r9
+ mov 16(vp), %r10
+ and cnd, %rdi
+ and cnd, %r9
+ and cnd, %r10
+ ADDSUB (up), %rdi
+ mov %rdi, (rp)
+ ADCSBB 8(up), %r9
+ mov %r9, 8(rp)
+ ADCSBB 16(up), %r10
+ mov %r10, 16(rp)
+ sbb R32(%rax), R32(%rax) C save carry
+ lea 24(up), up
+ lea 24(vp), vp
+ lea 24(rp), rp
+ sub $3, n
+ jnz L(top)
+ jmp L(end)
+
+L(x0): xor R32(%rax), R32(%rax)
+ test $2, R8(n)
+ jz L(top)
+
+L(b2): mov (vp), %rdi
+ mov 8(vp), %r9
+ and cnd, %rdi
+ and cnd, %r9
+ ADDSUB (up), %rdi
+ mov %rdi, (rp)
+ ADCSBB 8(up), %r9
+ mov %r9, 8(rp)
+ sbb R32(%rax), R32(%rax) C save carry
+ lea 16(up), up
+ lea 16(vp), vp
+ lea 16(rp), rp
+ sub $2, n
+ jnz L(top)
+ jmp L(end)
+
+L(b1): mov (vp), %rdi
+ and cnd, %rdi
+ ADDSUB (up), %rdi
+ mov %rdi, (rp)
+ sbb R32(%rax), R32(%rax) C save carry
+ lea 8(up), up
+ lea 8(vp), vp
+ lea 8(rp), rp
+ dec n
+ jz L(end)
+
+ ALIGN(16)
+L(top): mov (vp), %rdi
+ mov 8(vp), %r9
+ mov 16(vp), %r10
+ mov 24(vp), %r11
+ lea 32(vp), vp
+ and cnd, %rdi
+ and cnd, %r9
+ and cnd, %r10
+ and cnd, %r11
+ add R32(%rax), R32(%rax) C restore carry
+ ADCSBB (up), %rdi
+ mov %rdi, (rp)
+ ADCSBB 8(up), %r9
+ mov %r9, 8(rp)
+ ADCSBB 16(up), %r10
+ mov %r10, 16(rp)
+ ADCSBB 24(up), %r11
+ lea 32(up), up
+ mov %r11, 24(rp)
+ lea 32(rp), rp
+ sbb R32(%rax), R32(%rax) C save carry
+ sub $4, n
+ jnz L(top)
+
+L(end): neg R32(%rax)
+ pop %rbx
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/cnd_sub_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/cnd_sub_n.asm
new file mode 100644
index 00000000000..f55492b670a
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/cnd_sub_n.asm
@@ -0,0 +1,200 @@
+dnl AMD64 mpn_cnd_add_n, mpn_cnd_sub_n
+
+dnl Copyright 2011-2013, 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C AMD K8,K9
+C AMD K10
+C AMD bd1
+C AMD bd2
+C AMD bd3
+C AMD bd4
+C AMD zen
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel PNR 3.0
+C Intel NHM 2.75
+C Intel SBR 2.15
+C Intel IBR 1.96
+C Intel HWL 2.0
+C Intel BWL 1.65
+C Intel SKL 1.65
+C Intel atom
+C Intel SLM 4.5
+C VIA nano
+
+C NOTES
+C * It might seem natural to use the cmov insn here, but since this function
+C is supposed to have the exact same execution pattern for cnd true and
+C false, and since cmov's documentation is not clear about whether it
+C actually reads both source operands and writes the register for a false
+C condition, we cannot use it.
+C * Given that we have a dedicated cnd_add_n, it might look strange that this
+C file provides cnd_add_n and not just cnd_sub_n. But that's harmless, and
+C this file's generality might come in handy for some pipeline.
+
+C INPUT PARAMETERS
+define(`cnd_arg', `%rdi') dnl rcx
+define(`rp', `%rsi') dnl rdx
+define(`up', `%rdx') dnl r8
+define(`vp', `%rcx') dnl r9
+define(`n', `%r8') dnl rsp+40
+
+define(`cnd', `%rbx')
+
+ifdef(`OPERATION_cnd_add_n',`
+ define(ADDSUB, add)
+ define(ADCSBB, adc)
+ define(func, mpn_cnd_add_n)')
+ifdef(`OPERATION_cnd_sub_n',`
+ define(ADDSUB, sub)
+ define(ADCSBB, sbb)
+ define(func, mpn_cnd_sub_n)')
+
+MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n)
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(func)
+ FUNC_ENTRY(4)
+IFDOS(` mov 56(%rsp), R32(%r8)')
+ push %rbx
+ push %rbp
+ push %r12
+ push %r13
+
+ neg cnd_arg
+ sbb cnd, cnd C make cnd mask
+
+ test $1, R8(n)
+ jz L(x0)
+L(x1): test $2, R8(n)
+ jz L(b1)
+
+L(b3): mov (vp), %rdi
+ mov 8(vp), %r9
+ mov 16(vp), %r10
+ and cnd, %rdi
+ mov (up), %r12
+ and cnd, %r9
+ mov 8(up), %r13
+ and cnd, %r10
+ mov 16(up), %rbp
+ ADDSUB %rdi, %r12
+ mov %r12, (rp)
+ ADCSBB %r9, %r13
+ mov %r13, 8(rp)
+ ADCSBB %r10, %rbp
+ mov %rbp, 16(rp)
+ sbb R32(%rax), R32(%rax) C save carry
+ lea 24(up), up
+ lea 24(vp), vp
+ lea 24(rp), rp
+ sub $3, n
+ jnz L(top)
+ jmp L(end)
+
+L(x0): xor R32(%rax), R32(%rax)
+ test $2, R8(n)
+ jz L(top)
+
+L(b2): mov (vp), %rdi
+ mov 8(vp), %r9
+ mov (up), %r12
+ and cnd, %rdi
+ mov 8(up), %r13
+ and cnd, %r9
+ ADDSUB %rdi, %r12
+ mov %r12, (rp)
+ ADCSBB %r9, %r13
+ mov %r13, 8(rp)
+ sbb R32(%rax), R32(%rax) C save carry
+ lea 16(up), up
+ lea 16(vp), vp
+ lea 16(rp), rp
+ sub $2, n
+ jnz L(top)
+ jmp L(end)
+
+L(b1): mov (vp), %rdi
+ mov (up), %r12
+ and cnd, %rdi
+ ADDSUB %rdi, %r12
+ mov %r12, (rp)
+ sbb R32(%rax), R32(%rax) C save carry
+ lea 8(up), up
+ lea 8(vp), vp
+ lea 8(rp), rp
+ dec n
+ jz L(end)
+
+ ALIGN(16)
+L(top): mov (vp), %rdi
+ mov 8(vp), %r9
+ mov 16(vp), %r10
+ mov 24(vp), %r11
+ lea 32(vp), vp
+ and cnd, %rdi
+ mov (up), %r12
+ and cnd, %r9
+ mov 8(up), %r13
+ and cnd, %r10
+ mov 16(up), %rbp
+ and cnd, %r11
+ add R32(%rax), R32(%rax) C restore carry
+ mov 24(up), %rax
+ lea 32(up), up
+ ADCSBB %rdi, %r12
+ mov %r12, (rp)
+ ADCSBB %r9, %r13
+ mov %r13, 8(rp)
+ ADCSBB %r10, %rbp
+ mov %rbp, 16(rp)
+ ADCSBB %r11, %rax
+ mov %rax, 24(rp)
+ lea 32(rp), rp
+ sbb R32(%rax), R32(%rax) C save carry
+ sub $4, n
+ jnz L(top)
+
+L(end): neg R32(%rax)
+ pop %r13
+ pop %r12
+ pop %rbp
+ pop %rbx
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/gcd_11.asm
new file mode 100644
index 00000000000..4723093bb46
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/gcd_11.asm
@@ -0,0 +1,37 @@
+dnl AMD64 mpn_gcd_11.
+
+dnl Copyright 2012 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_gcd_11)
+include_mpn(`x86_64/core2/gcd_11.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/gmp-mparam.h
index db9b2deb9b5..36f45120d67 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/gmp-mparam.h
@@ -1,6 +1,6 @@
/* Sandy Bridge gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2015 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,85 +31,86 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-/* 3300 MHz Core i5 Sandy Bridge */
-/* FFT tuning limit = 200 M */
-/* Generated by tuneup.c, 2015-10-07, gcc 4.8 */
+/* 3400-3800 MHz Intel Xeon E3-1270 Sandy Bridge */
+/* FFT tuning limit = 468,152,320 */
+/* Generated by tuneup.c, 2019-10-20, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 2
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 9
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 22
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 24
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 8
#define USE_PREINV_DIVREM_1 1 /* native */
#define DIV_QR_1_NORM_THRESHOLD 1
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 29
+#define BMOD_1_TO_MOD_1_THRESHOLD 30
+
+#define DIV_1_VS_MUL_1_PERCENT 298
#define MUL_TOOM22_THRESHOLD 20
#define MUL_TOOM33_THRESHOLD 65
-#define MUL_TOOM44_THRESHOLD 166
-#define MUL_TOOM6H_THRESHOLD 256
+#define MUL_TOOM44_THRESHOLD 154
+#define MUL_TOOM6H_THRESHOLD 254
#define MUL_TOOM8H_THRESHOLD 333
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 108
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 105
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 122
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 114
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 151
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 148
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 28
#define SQR_TOOM3_THRESHOLD 93
-#define SQR_TOOM4_THRESHOLD 250
-#define SQR_TOOM6_THRESHOLD 351
-#define SQR_TOOM8_THRESHOLD 454
+#define SQR_TOOM4_THRESHOLD 248
+#define SQR_TOOM6_THRESHOLD 342
+#define SQR_TOOM8_THRESHOLD 462
-#define MULMID_TOOM42_THRESHOLD 34
+#define MULMID_TOOM42_THRESHOLD 36
#define MULMOD_BNM1_THRESHOLD 13
-#define SQRMOD_BNM1_THRESHOLD 16
+#define SQRMOD_BNM1_THRESHOLD 15
#define MUL_FFT_MODF_THRESHOLD 396 /* k = 5 */
#define MUL_FFT_TABLE3 \
{ { 396, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
{ 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
{ 25, 7}, { 13, 6}, { 27, 7}, { 21, 8}, \
- { 11, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
+ { 11, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
{ 15, 7}, { 31, 8}, { 17, 7}, { 35, 8}, \
{ 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
- { 33, 9}, { 19, 8}, { 39, 9}, { 23, 8}, \
- { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 35, 9}, { 19, 8}, { 39, 9}, { 23, 8}, \
+ { 49, 9}, { 27,10}, { 15, 9}, { 39,10}, \
{ 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 79,10}, { 47, 9}, \
- { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
- { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
- { 135,11}, { 79,10}, { 159,11}, { 95,10}, \
- { 191, 9}, { 383,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
- { 575,10}, { 303,11}, { 159,10}, { 319,12}, \
- { 95,11}, { 191,10}, { 383,11}, { 207,13}, \
- { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
- { 271,10}, { 543,11}, { 287,10}, { 575,11}, \
- { 303,12}, { 159,11}, { 319,10}, { 639,11}, \
- { 351,10}, { 703,11}, { 367,10}, { 735,11}, \
- { 383,10}, { 767,11}, { 415,10}, { 831,12}, \
- { 223,11}, { 479,13}, { 127,12}, { 255,11}, \
- { 511,10}, { 1023,11}, { 543,12}, { 287,11}, \
- { 575,10}, { 1151,11}, { 607,12}, { 319,11}, \
- { 671,12}, { 351,11}, { 735,12}, { 383,11}, \
- { 767,12}, { 415,11}, { 831,12}, { 447,11}, \
- { 895,12}, { 479,14}, { 127,13}, { 255,12}, \
- { 511,11}, { 1023,12}, { 543,11}, { 1087,12}, \
- { 575,11}, { 1151,12}, { 607,13}, { 319,12}, \
- { 735,13}, { 383,12}, { 831,13}, { 447,12}, \
- { 959,14}, { 255,13}, { 511,12}, { 1087,13}, \
- { 575,12}, { 1215,13}, { 639,12}, { 1279,13}, \
- { 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
- { 1535,13}, { 831,12}, { 1663,13}, { 959,14}, \
+ { 67,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 79,11}, { 47,10}, \
+ { 95,12}, { 31,11}, { 63,10}, { 135,11}, \
+ { 79,10}, { 159, 9}, { 319,10}, { 167,11}, \
+ { 95, 7}, { 1535, 8}, { 831,10}, { 223, 9}, \
+ { 447,11}, { 127,10}, { 255, 9}, { 511,11}, \
+ { 143,10}, { 287, 9}, { 575,10}, { 303,11}, \
+ { 159,10}, { 319,12}, { 95,11}, { 191,10}, \
+ { 383,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 303,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 351,10}, { 703,11}, { 367,12}, \
+ { 191,11}, { 383,10}, { 767,11}, { 415,10}, \
+ { 831,12}, { 223,11}, { 447,10}, { 895,11}, \
+ { 479,13}, { 127,12}, { 255,11}, { 543,12}, \
+ { 287,11}, { 607,12}, { 319,11}, { 639,12}, \
+ { 351,11}, { 703,12}, { 383,11}, { 767,12}, \
+ { 415,11}, { 831,12}, { 447,11}, { 895,12}, \
+ { 479,14}, { 127,13}, { 255,12}, { 543,11}, \
+ { 1087,12}, { 607,13}, { 319,12}, { 735,13}, \
+ { 383,12}, { 831,13}, { 447,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1087,13}, { 575,12}, \
+ { 1215,13}, { 639,12}, { 1279,13}, { 703,12}, \
+ { 1407,14}, { 383,13}, { 767,12}, { 1535,13}, \
+ { 831,12}, { 1663,13}, { 959,15}, { 255,14}, \
{ 511,13}, { 1087,12}, { 2175,13}, { 1215,14}, \
{ 639,13}, { 1343,12}, { 2687,13}, { 1407,12}, \
{ 2815,13}, { 1471,14}, { 767,13}, { 1663,14}, \
@@ -117,115 +118,124 @@ see https://www.gnu.org/licenses/. */
{ 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
{ 1279,13}, { 2687,14}, { 1407,13}, { 2815,15}, \
{ 767,14}, { 1535,13}, { 3071,14}, { 1663,13}, \
- { 3455,14}, { 1919,16}, { 511,15}, { 1023,14}, \
- { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
- { 5887,15}, { 1535,14}, { 3455,15}, { 1791,14}, \
- { 3839,13}, { 7679,16}, { 1023,15}, { 2047,14}, \
- { 4223,15}, { 2303,14}, { 4863,15}, { 2815,14}, \
- { 5887,16}, { 1535,15}, { 3327,14}, { 6911,15}, \
- { 3839,14}, { 7679,17}, { 1023,16}, { 2047,15}, \
- { 4863,16}, { 2559,15}, { 5887,14}, { 11775,16}, \
- { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
- {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 208
+ { 3455,12}, { 6911,14}, { 1919,16}, { 511,15}, \
+ { 1023,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
+ { 2943,13}, { 5887,15}, { 1535,14}, { 3455,13}, \
+ { 6911,15}, { 1791,14}, { 3839,13}, { 7679,16}, \
+ { 1023,15}, { 2047,14}, { 4223,15}, { 2303,14}, \
+ { 4863,15}, { 2815,14}, { 5887,16}, { 1535,15}, \
+ { 3327,14}, { 6911,15}, { 3839,14}, { 7679,17}, \
+ { 1023,16}, { 2047,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
+ { 3583,15}, { 7679,14}, { 15359,17}, { 2047,16}, \
+ { 4095,15}, { 8191,16}, { 4607,15}, { 9983,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 219
#define MUL_FFT_THRESHOLD 4736
-#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 336 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 340, 5}, { 11, 4}, { 23, 5}, { 21, 6}, \
+ { { 336, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
{ 11, 5}, { 23, 6}, { 25, 7}, { 13, 6}, \
{ 27, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
{ 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
{ 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
{ 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
{ 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 63,10}, { 39, 9}, \
- { 79,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 47,11}, { 31,10}, { 79,11}, \
{ 47,10}, { 95,12}, { 31,11}, { 63,10}, \
{ 127, 9}, { 255,10}, { 135,11}, { 79,10}, \
{ 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
- { 383,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 271, 9}, { 543,11}, { 143,10}, \
- { 287, 9}, { 575,10}, { 303, 9}, { 607,11}, \
- { 159,10}, { 319, 9}, { 639,12}, { 95,11}, \
- { 191,10}, { 383,11}, { 207,13}, { 63,12}, \
- { 127,11}, { 255,10}, { 511,11}, { 271,10}, \
- { 543,11}, { 287,10}, { 575,11}, { 303,10}, \
- { 607,11}, { 319,10}, { 639,11}, { 335,10}, \
- { 671,11}, { 351,10}, { 703,11}, { 367,12}, \
- { 191,11}, { 383,10}, { 767,11}, { 415,10}, \
- { 831,12}, { 223,11}, { 479,13}, { 127,12}, \
- { 255,11}, { 543,12}, { 287,11}, { 607,12}, \
- { 319,11}, { 671,12}, { 351,11}, { 703,13}, \
- { 191,12}, { 383,11}, { 767,12}, { 415,11}, \
- { 831,12}, { 447,11}, { 895,12}, { 479,14}, \
- { 127,13}, { 255,12}, { 543,11}, { 1087,12}, \
- { 607,13}, { 319,12}, { 735,13}, { 383,12}, \
- { 831,13}, { 447,12}, { 959,13}, { 511,12}, \
+ { 383,12}, { 63,11}, { 127,10}, { 255, 6}, \
+ { 4351, 7}, { 2303, 8}, { 1215,12}, { 95,11}, \
+ { 191,10}, { 383,13}, { 63,12}, { 127,11}, \
+ { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
+ { 287,10}, { 575,11}, { 303,10}, { 607,12}, \
+ { 159,11}, { 319,10}, { 639,11}, { 335,10}, \
+ { 671,11}, { 351,10}, { 703,12}, { 191,11}, \
+ { 383,10}, { 767,11}, { 415,10}, { 831,12}, \
+ { 223,11}, { 447,10}, { 895,11}, { 479,13}, \
+ { 127,12}, { 255,11}, { 543,12}, { 287,11}, \
+ { 607,12}, { 319,11}, { 671,12}, { 351,11}, \
+ { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 415,11}, { 831,12}, { 447,11}, { 895,12}, \
+ { 479,14}, { 127,13}, { 255,12}, { 511,11}, \
+ { 1023,12}, { 543,11}, { 1087,12}, { 607,13}, \
+ { 319,12}, { 703,13}, { 383,12}, { 831,13}, \
+ { 447,12}, { 959,14}, { 255,13}, { 511,12}, \
{ 1087,13}, { 575,12}, { 1215,13}, { 639,12}, \
- { 1343,13}, { 703,12}, { 1407,14}, { 383,13}, \
- { 767,12}, { 1535,13}, { 831,12}, { 1663,13}, \
- { 959,14}, { 511,13}, { 1087,12}, { 2175,13}, \
- { 1215,14}, { 639,13}, { 1343,12}, { 2687,13}, \
- { 1407,12}, { 2815,13}, { 1471,14}, { 767,13}, \
- { 1599,12}, { 3199,13}, { 1663,14}, { 895,13}, \
- { 1791,15}, { 511,14}, { 1023,13}, { 2175,14}, \
- { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
- { 2687,14}, { 1407,13}, { 2815,15}, { 767,14}, \
- { 1535,13}, { 3199,14}, { 1663,13}, { 3455,12}, \
- { 6911,14}, { 1791,16}, { 511,15}, { 1023,14}, \
- { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
- { 5887,15}, { 1535,14}, { 3455,13}, { 6911,15}, \
- { 1791,14}, { 3839,16}, { 1023,15}, { 2047,14}, \
- { 4223,15}, { 2303,14}, { 4863,15}, { 2815,14}, \
- { 5887,16}, { 1535,15}, { 3327,14}, { 6911,15}, \
- { 3839,17}, { 1023,16}, { 2047,15}, { 4863,16}, \
- { 2559,15}, { 5887,14}, { 11775,16}, { 65536,17}, \
- { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
- {2097152,22}, {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 203
+ { 1279,13}, { 703,14}, { 383,13}, { 767,12}, \
+ { 1535,13}, { 831,12}, { 1663,13}, { 959,14}, \
+ { 511,13}, { 1087,12}, { 2175,13}, { 1215,14}, \
+ { 639,13}, { 1343,12}, { 2687,13}, { 1407,12}, \
+ { 2815,13}, { 1471,14}, { 767,13}, { 1599,12}, \
+ { 3199,13}, { 1663,14}, { 895,13}, { 1791,15}, \
+ { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
+ { 2431,12}, { 4863,14}, { 1279,13}, { 2687,14}, \
+ { 1407,13}, { 2815,15}, { 767,14}, { 1535,13}, \
+ { 3199,14}, { 1663,13}, { 3455,12}, { 6911,14}, \
+ { 1791,16}, { 511,15}, { 1023,14}, { 2431,13}, \
+ { 4863,15}, { 1279,14}, { 2943,13}, { 5887,15}, \
+ { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
+ { 3839,16}, { 1023,15}, { 2047,14}, { 4223,15}, \
+ { 2303,14}, { 4863,15}, { 2815,14}, { 5887,16}, \
+ { 1535,15}, { 3327,14}, { 6911,15}, { 3839,17}, \
+ { 1023,16}, { 2047,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
+ { 3583,15}, { 7679,14}, { 15359,17}, { 2047,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 SQR_FFT_TABLE3_SIZE 210
#define SQR_FFT_THRESHOLD 3264
#define MULLO_BASECASE_THRESHOLD 0 /* always */
#define MULLO_DC_THRESHOLD 62
#define MULLO_MUL_N_THRESHOLD 8907
-#define SQRLO_BASECASE_THRESHOLD 8
-#define SQRLO_DC_THRESHOLD 0 /* never mpn_sqrlo_basecase */
+#define SQRLO_BASECASE_THRESHOLD 9
+#define SQRLO_DC_THRESHOLD 66
#define SQRLO_SQR_THRESHOLD 6440
-#define DC_DIV_QR_THRESHOLD 51
-#define DC_DIVAPPR_Q_THRESHOLD 171
-#define DC_BDIV_QR_THRESHOLD 44
-#define DC_BDIV_Q_THRESHOLD 104
+#define DC_DIV_QR_THRESHOLD 52
+#define DC_DIVAPPR_Q_THRESHOLD 172
+#define DC_BDIV_QR_THRESHOLD 46
+#define DC_BDIV_Q_THRESHOLD 92
-#define INV_MULMOD_BNM1_THRESHOLD 38
+#define INV_MULMOD_BNM1_THRESHOLD 46
#define INV_NEWTON_THRESHOLD 170
-#define INV_APPR_THRESHOLD 165
+#define INV_APPR_THRESHOLD 167
-#define BINV_NEWTON_THRESHOLD 224
-#define REDC_1_TO_REDC_2_THRESHOLD 32
+#define BINV_NEWTON_THRESHOLD 228
+#define REDC_1_TO_REDC_2_THRESHOLD 36
#define REDC_2_TO_REDC_N_THRESHOLD 55
-#define MU_DIV_QR_THRESHOLD 1442
+#define MU_DIV_QR_THRESHOLD 1387
#define MU_DIVAPPR_Q_THRESHOLD 1387
-#define MUPI_DIV_QR_THRESHOLD 74
+#define MUPI_DIV_QR_THRESHOLD 77
#define MU_BDIV_QR_THRESHOLD 1187
#define MU_BDIV_Q_THRESHOLD 1442
-#define POWM_SEC_TABLE 3,19,177,452,1297
+#define POWM_SEC_TABLE 1,16,191,452,1297
-#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_DC_THRESHOLD 14
#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 874
-#define SET_STR_PRECOMPUTE_THRESHOLD 2015
+#define SET_STR_DC_THRESHOLD 1160
+#define SET_STR_PRECOMPUTE_THRESHOLD 2043
-#define FAC_DSC_THRESHOLD 620
-#define FAC_ODD_THRESHOLD 28
+#define FAC_DSC_THRESHOLD 426
+#define FAC_ODD_THRESHOLD 24
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 100
-#define HGCD_APPR_THRESHOLD 50
+#define MATRIX22_STRASSEN_THRESHOLD 14
+#define HGCD2_DIV1_METHOD 5 /* 0.74% faster than 3 */
+#define HGCD_THRESHOLD 96
+#define HGCD_APPR_THRESHOLD 60
#define HGCD_REDUCE_THRESHOLD 2681
-#define GCD_DC_THRESHOLD 483
-#define GCDEXT_DC_THRESHOLD 386
-#define JACOBI_BASE_METHOD 1
+#define GCD_DC_THRESHOLD 465
+#define GCDEXT_DC_THRESHOLD 345
+#define JACOBI_BASE_METHOD 1 /* 32.22% faster than 4 */
+
+/* Tuneup completed successfully, took 276198 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_1.asm
index ded7d899c23..a43a1174b7c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_1.asm
@@ -2,7 +2,8 @@ dnl X86-64 mpn_mul_1 optimised for Intel Sandy Bridge.
dnl Contributed to the GNU project by Torbjörn Granlund.
-dnl Copyright 2003-2005, 2007, 2008, 2011-2013 Free Software Foundation, Inc.
+dnl Copyright 2003-2005, 2007, 2008, 2011-2013, 2017 Free Software Foundation,
+dnl Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -35,127 +36,164 @@ include(`../config.m4')
C cycles/limb
C AMD K8,K9
C AMD K10
-C AMD bd1
+C AMD bull
+C AMD pile
+C AMD steam
+C AMD excavator
C AMD bobcat
+C AMD jaguar
C Intel P4
C Intel core2
C Intel NHM
-C Intel SBR 2.5
-C Intel IBR 2.4
+C Intel SBR 2.49
+C Intel IBR 2.32
+C Intel HWL 2.44
+C Intel BWL 2.43
+C Intel SKL 2.47
C Intel atom
+C Intel SLM
C VIA nano
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjorn Granlund.
-C TODO
-C * The loop is great, but the prologue code was quickly written. Tune it!
-C * Add mul_1c entry point.
-C * We could preserve one less register under DOS64 calling conventions, using
-C r10 instead of rsi.
-
define(`rp', `%rdi') C rcx
-define(`up', `%rsi') C rdx
+define(`up_param',`%rsi') C rdx
define(`n_param', `%rdx') C r8
define(`v0', `%rcx') C r9
+define(`cin', `%r8') C stack
-define(`n', `%r11')
+define(`up', `%rsi') C same as rp_param
+define(`n', `%r9')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-IFDOS(` define(`up', ``%rsi'')') dnl
-IFDOS(` define(`rp', ``%rcx'')') dnl
-IFDOS(` define(`v0', ``%r9'')') dnl
-IFDOS(` define(`r9', ``rdi'')') dnl
-IFDOS(` define(`n_param',``%r8'')') dnl
-IFDOS(` define(`n', ``%r8'')') dnl
-IFDOS(` define(`r8', ``r11'')') dnl
+IFDOS(` define(`rp', `%rcx')')
+IFDOS(` define(`up_param',`%rdx')')
+IFDOS(` define(`n_param', `%r8')')
+IFDOS(` define(`v0', `%r9')')
+IFDOS(` define(`cin', `48(%rsp)')')
+
+IFDOS(` define(`up', `%rsi')')
+IFDOS(` define(`n', `%r8')')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_mul_1)
-
-IFDOS(``push %rsi '')
-IFDOS(``push %rdi '')
-IFDOS(``mov %rdx, %rsi '')
-
- mov (up), %rax
- mov R32(`n_param'), R32(%r10)
-IFSTD(` mov n_param, n ')
-
- lea (up,n_param,8), up
+IFDOS(` push %rsi ')
+ mov (up_param), %rax
+IFSTD(` mov n_param, n ')
+ lea (up_param,n_param,8), up
lea -8(rp,n_param,8), rp
neg n
mul v0
- and $3, R32(%r10)
- jz L(b0)
- cmp $2, R32(%r10)
- jb L(b1)
- jz L(b2)
-
-L(b3): add $-1, n
- mov %rax, %r9
- mov %rdx, %r8
- mov 16(up,n,8), %rax
+
+ test $1, R8(n)
+ jz L(x0)
+L(x1): mov %rax, %r11
+ mov %rdx, %r10
+ test $2, R8(n)
+ jnz L(01)
+
+L(11): mov 8(up,n,8), %rax
+ dec n
jmp L(L3)
-L(b1): mov %rax, %r9
- mov %rdx, %r8
- add $1, n
- jnc L(L1)
+L(01): inc n
+ jnz L(L1)
mov %rax, (rp)
mov %rdx, %rax
-IFDOS(``pop %rdi '')
-IFDOS(``pop %rsi '')
+IFDOS(` pop %rsi ')
ret
-L(b2): add $-2, n
- mov %rax, %r8
- mov %rdx, %r9
- mov 24(up,n,8), %rax
- jmp L(L2)
-
-L(b0): mov %rax, %r8
- mov %rdx, %r9
+L(x0): mov %rax, %r10
+ mov %rdx, %r11
mov 8(up,n,8), %rax
- jmp L(L0)
+ test $2, R8(n)
+ jz L(L0)
+
+L(10): add $-2, n
+ jmp L(L2)
ALIGN(8)
-L(top): mov %rdx, %r8
- add %rax, %r9
+L(top): mov %rdx, %r10
+ add %rax, %r11
L(L1): mov 0(up,n,8), %rax
- adc $0, %r8
+ adc $0, %r10
mul v0
- add %rax, %r8
- mov %r9, 0(rp,n,8)
+ add %rax, %r10
+ mov %r11, 0(rp,n,8)
mov 8(up,n,8), %rax
- mov %rdx, %r9
- adc $0, %r9
+ mov %rdx, %r11
+L(L0c): adc $0, %r11
L(L0): mul v0
- mov %r8, 8(rp,n,8)
- add %rax, %r9
- mov %rdx, %r8
- mov 16(up,n,8), %rax
- adc $0, %r8
+ mov %r10, 8(rp,n,8)
+ add %rax, %r11
+ mov %rdx, %r10
+L(L3c): mov 16(up,n,8), %rax
+ adc $0, %r10
L(L3): mul v0
- mov %r9, 16(rp,n,8)
- mov %rdx, %r9
- add %rax, %r8
- mov 24(up,n,8), %rax
- adc $0, %r9
+ mov %r11, 16(rp,n,8)
+ mov %rdx, %r11
+ add %rax, %r10
+L(L2c): mov 24(up,n,8), %rax
+ adc $0, %r11
L(L2): mul v0
- mov %r8, 24(rp,n,8)
+ mov %r10, 24(rp,n,8)
add $4, n
jnc L(top)
-L(end): add %rax, %r9
+L(end): add %rax, %r11
mov %rdx, %rax
adc $0, %rax
- mov %r9, (rp)
+ mov %r11, (rp)
-IFDOS(``pop %rdi '')
-IFDOS(``pop %rsi '')
+IFDOS(` pop %rsi ')
ret
EPILOGUE()
+
+ ALIGN(16)
+PROLOGUE(mpn_mul_1c)
+IFDOS(` push %rsi ')
+ mov (up_param), %rax
+IFSTD(` mov n_param, n ')
+ lea (up_param,n_param,8), up
+ lea -8(rp,n_param,8), rp
+ neg n
+ mul v0
+
+ test $1, R8(n)
+ jz L(x0c)
+L(x1c): mov %rax, %r11
+ mov %rdx, %r10
+ test $2, R8(n)
+ jnz L(01c)
+
+L(11c): add cin, %r11
+ dec n
+ jmp L(L3c)
+
+L(01c): add cin, %r11
+ inc n
+ jnz L(L1)
+ mov %r11, (rp)
+ mov %rdx, %rax
+ adc $0, %rax
+IFDOS(` pop %rsi ')
+ ret
+
+L(x0c): mov %rax, %r10
+ mov %rdx, %r11
+ test $2, R8(n)
+ jz L(00c)
+
+L(10c): add $-2, n
+ add cin, %r10
+ jmp L(L2c)
+
+L(00c): add cin, %r10
+ mov 8(up,n,8), %rax
+ jmp L(L0c)
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_2.asm
index ffee78a385b..781534dbafc 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/mul_2.asm
@@ -33,20 +33,24 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb best
-C AMD K8,K9
-C AMD K10
-C AMD bull
-C AMD pile
-C AMD bobcat
-C AMD jaguar
-C Intel P4
-C Intel core
-C Intel NHM
-C Intel SBR 2.57 2.52 using 4-way code
-C Intel IBR 2.35 2.32 using 4-way code
-C Intel HWL 2.02 1.86
-C Intel BWL
-C Intel atom
+C AMD K8,K9 8.03
+C AMD K10 8.03
+C AMD bull 9.19
+C AMD pile 9.16
+C AMD steam
+C AMD excavator
+C AMD bobcat 10.6
+C AMD jaguar 11.0
+C Intel P4 26.0
+C Intel core2 8.73
+C Intel NHM 8.55
+C Intel SBR 5.15
+C Intel IBR 4.57
+C Intel HWL 4.08
+C Intel BWL 4.10
+C Intel SKL 4.14
+C Intel atom 39.5
+C Intel SLM 26.3
C VIA nano
C This code is the result of running a code generation and optimisation tool
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/popcount.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/popcount.asm
deleted file mode 100644
index a5be33e6a79..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/coreisbr/popcount.asm
+++ /dev/null
@@ -1,118 +0,0 @@
-dnl AMD64 mpn_popcount -- population count.
-
-dnl Copyright 2008, 2010-2013 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/.
-
-include(`../config.m4')
-
-C cycles/limb
-C AMD K8,K9 n/a
-C AMD K10 1.5 slower than 8-way non-pipelined code
-C AMD bd1 4.2
-C AMD bobcat 6.28 slower than 8-way non-pipelined code
-C Intel P4 n/a
-C Intel core2 n/a
-C Intel NHM 1.32
-C Intel SBR 1.05 fluctuating
-C Intel IBR 1.05 fluctuating
-C Intel HSW 1
-C Intel atom n/a
-C VIA nano n/a
-
-define(`up', `%rdi')
-define(`n_param', `%rsi')
-
-define(`n', `%rcx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_popcount)
- FUNC_ENTRY(2)
-
- lea (up,n_param,8), up
- xor R32(%rax), R32(%rax)
-
- test $1, R8(n_param)
- jnz L(bx1)
-
-L(bx0): test $2, R8(n_param)
- jnz L(b10)
-
-L(b00): mov $0, R32(n)
- sub n_param, n
- .byte 0xf3,0x4c,0x0f,0xb8,0x04,0xcf C popcnt (up,n,8), %r8
- .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xcf,0x08 C popcnt 8(up,n,8), %r9
- jmp L(lo0)
-
-L(b10): mov $2, R32(n)
- sub n_param, n
- .byte 0xf3,0x4c,0x0f,0xb8,0x54,0xcf,0xf0 C popcnt -16(up,n,8), %r10
- .byte 0xf3,0x4c,0x0f,0xb8,0x5c,0xcf,0xf8 C popcnt -8(up,n,8), %r11
- test n, n
- jz L(cj2)
- jmp L(lo2)
-
-L(bx1): test $2, R8(n_param)
- jnz L(b11)
-
-L(b01): mov $1, R32(n)
- sub n_param, n
- .byte 0xf3,0x4c,0x0f,0xb8,0x5c,0xcf,0xf8 C popcnt -8(up,n,8), %r11
- test n, n
- jz L(cj1)
- .byte 0xf3,0x4c,0x0f,0xb8,0x04,0xcf C popcnt 0(up,n,8), %r8
- jmp L(lo1)
-
-L(b11): mov $-1, n
- sub n_param, n
- .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xcf,0x08 C popcnt 8(up,n,8), %r9
- .byte 0xf3,0x4c,0x0f,0xb8,0x54,0xcf,0x10 C popcnt 16(up,n,8), %r10
- jmp L(lo3)
-
- ALIGN(32)
-L(top): add %r9, %rax
-L(lo2): .byte 0xf3,0x4c,0x0f,0xb8,0x04,0xcf C popcnt 0(up,n,8), %r8
- add %r10, %rax
-L(lo1): .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xcf,0x08 C popcnt 8(up,n,8), %r9
- add %r11, %rax
-L(lo0): .byte 0xf3,0x4c,0x0f,0xb8,0x54,0xcf,0x10 C popcnt 16(up,n,8), %r10
- add %r8, %rax
-L(lo3): .byte 0xf3,0x4c,0x0f,0xb8,0x5c,0xcf,0x18 C popcnt 24(up,n,8), %r11
- add $4, n
- js L(top)
-
-L(end): add %r9, %rax
-L(cj2): add %r10, %rax
-L(cj1): add %r11, %rax
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/darwin.m4 b/Build/source/libs/gmp/gmp-src/mpn/x86_64/darwin.m4
index 6f8ec7893d9..77714762530 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/darwin.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/darwin.m4
@@ -41,13 +41,14 @@ dnl
dnl Simply override the definition in x86_64-defs.m4.
define(`CALL',`call GSYM_PREFIX`'$1')
+define(`TCALL',`jmp GSYM_PREFIX`'$1')
dnl Usage: JUMPTABSECT
dnl
dnl CAUTION: Do not put anything sensible here, like RODATA. That works with
dnl some Darwin tool chains, but silently breaks with other. (Note that
-dnl putting jump tables in the text segment is a really poor idea for PC many
+dnl putting jump tables in the text segment is a really poor idea for many PC
dnl processors, since they cannot cache the same thing in both L1D and L2I.)
define(`JUMPTABSECT', `.text')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/div_qr_1n_pi1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/div_qr_1n_pi1.asm
index cb072e979dc..b3d45e2c71a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/div_qr_1n_pi1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/div_qr_1n_pi1.asm
@@ -81,7 +81,7 @@ ABI_SUPPORT(STD64)
TEXT
ALIGN(16)
PROLOGUE(mpn_div_qr_1n_pi1)
- FUNC_ENTRY(6)
+ FUNC_ENTRY(4)
IFDOS(` mov 56(%rsp), %r8 ')
IFDOS(` mov 64(%rsp), %r9 ')
dec UN_INPUT
@@ -108,7 +108,7 @@ IFDOS(` mov 64(%rsp), %r9 ')
add $1, T
L(single_div_done):
mov T, (QP)
- FUNC_EXIT
+ FUNC_EXIT()
ret
L(first):
C FIXME: Could delay some of these until we enter the loop.
@@ -233,7 +233,7 @@ L(done):
pop %r13
pop %r14
pop %r15
- FUNC_EXIT
+ FUNC_EXIT()
ret
L(q_incr):
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/divrem_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/divrem_2.asm
index 296c9b673c3..20811ccbc9f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/divrem_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/divrem_2.asm
@@ -100,8 +100,10 @@ L(2):
push %r11
IFSTD(` mov %r11, %rdi ')
IFDOS(` mov %r11, %rcx ')
+IFDOS(` sub $32, %rsp ')
ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
+IFDOS(` add $32, %rsp ')
pop %r11
pop %r10
pop %r8
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/dos64.m4 b/Build/source/libs/gmp/gmp-src/mpn/x86_64/dos64.m4
index 9414623b56c..0da1b365894 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/dos64.m4
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/dos64.m4
@@ -46,6 +46,7 @@ dnl
dnl Simply override the definition in x86_64-defs.m4.
define(`CALL',`call GSYM_PREFIX`'$1')
+define(`TCALL',`jmp GSYM_PREFIX`'$1')
dnl Usage: JUMPTABSECT
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com-palignr.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com-palignr.asm
index c7155d115b6..69027bc28aa 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com-palignr.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com-palignr.asm
@@ -36,19 +36,20 @@ C cycles/limb cycles/limb cycles/limb good
C aligned unaligned best seen for cpu?
C AMD K8,K9 2.0 illop 1.0/1.0 N
C AMD K10 0.85 illop Y/N
-C AMD bull 1.39 ? 1.45 Y/N
-C AMD pile 0.8-1.4 0.7-1.4 Y
-C AMD steam
-C AMD excavator
+C AMD bd1 1.39 ? 1.45 Y/N
+C AMD bd2 0.8-1.4 0.7-1.4 Y
+C AMD bd3
+C AMD bd4
C AMD bobcat 1.97 ? 8.17 1.5/1.5 N
C AMD jaguar 1.02 1.02 0.91/0.91 N
C Intel P4 2.26 illop Y/N
-C Intel core 0.52 0.95 opt/0.74 Y
-C Intel NHM 0.52 0.65 opt/opt Y
+C Intel core 0.58 0.87 opt/0.74 Y
+C Intel NHM 0.64 1.14 opt/bad Y
C Intel SBR 0.51 0.65 opt/opt Y
C Intel IBR 0.50 0.64 opt/0.57 Y
C Intel HWL 0.51 0.58 opt/opt Y
-C Intel BWL 0.57 0.69 opt/0.65 Y
+C Intel BWL 0.52 0.64 opt/opt Y
+C Intel SKL 0.51 0.63 opt/opt Y
C Intel atom 1.16 1.70 opt/opt Y
C Intel SLM 1.02 1.52 N
C VIA nano 1.09 1.10 opt/opt Y
@@ -81,7 +82,7 @@ PROLOGUE(mpn_com)
cmp $COM_SSE_THRESHOLD, n
jbe L(bc)
- pcmpeqb %xmm7, %xmm7 C set to 111...111
+ pcmpeqb %xmm5, %xmm5 C set to 111...111
test $8, R8(rp) C is rp 16-byte aligned?
jz L(rp_aligned) C jump if rp aligned
@@ -107,10 +108,10 @@ L(atop):movdqa 0(up), %xmm0
movdqa 32(up), %xmm2
movdqa 48(up), %xmm3
lea 64(up), up
- pxor %xmm7, %xmm0
- pxor %xmm7, %xmm1
- pxor %xmm7, %xmm2
- pxor %xmm7, %xmm3
+ pxor %xmm5, %xmm0
+ pxor %xmm5, %xmm1
+ pxor %xmm5, %xmm2
+ pxor %xmm5, %xmm3
movdqa %xmm0, (rp)
movdqa %xmm1, 16(rp)
movdqa %xmm2, 32(rp)
@@ -124,8 +125,8 @@ L(am): sub $8, n
movdqa (up), %xmm0
movdqa 16(up), %xmm1
lea 32(up), up
- pxor %xmm7, %xmm0
- pxor %xmm7, %xmm1
+ pxor %xmm5, %xmm0
+ pxor %xmm5, %xmm1
movdqa %xmm0, (rp)
movdqa %xmm1, 16(rp)
lea 32(rp), rp
@@ -134,7 +135,7 @@ L(am): sub $8, n
jz 1f
movdqa (up), %xmm0
lea 16(up), up
- pxor %xmm7, %xmm0
+ pxor %xmm5, %xmm0
movdqa %xmm0, (rp)
lea 16(rp), rp
@@ -167,44 +168,44 @@ C quite separate: up-rp < 5 or up-up > 15 limbs
ALIGN(16)
L(utop):movdqa 120(up), %xmm3
- pxor %xmm7, %xmm0
+ pxor %xmm5, %xmm0
movdqa %xmm0, -128(rp)
sub $16, n
L(um): movdqa 104(up), %xmm2
palignr($8, %xmm2, %xmm3)
movdqa 88(up), %xmm1
- pxor %xmm7, %xmm3
+ pxor %xmm5, %xmm3
movdqa %xmm3, 112(rp)
palignr($8, %xmm1, %xmm2)
movdqa 72(up), %xmm0
- pxor %xmm7, %xmm2
+ pxor %xmm5, %xmm2
movdqa %xmm2, 96(rp)
palignr($8, %xmm0, %xmm1)
movdqa 56(up), %xmm3
- pxor %xmm7, %xmm1
+ pxor %xmm5, %xmm1
movdqa %xmm1, 80(rp)
palignr($8, %xmm3, %xmm0)
movdqa 40(up), %xmm2
- pxor %xmm7, %xmm0
+ pxor %xmm5, %xmm0
movdqa %xmm0, 64(rp)
palignr($8, %xmm2, %xmm3)
movdqa 24(up), %xmm1
- pxor %xmm7, %xmm3
+ pxor %xmm5, %xmm3
movdqa %xmm3, 48(rp)
palignr($8, %xmm1, %xmm2)
movdqa 8(up), %xmm0
- pxor %xmm7, %xmm2
+ pxor %xmm5, %xmm2
movdqa %xmm2, 32(rp)
palignr($8, %xmm0, %xmm1)
movdqa -8(up), %xmm3
- pxor %xmm7, %xmm1
+ pxor %xmm5, %xmm1
movdqa %xmm1, 16(rp)
palignr($8, %xmm3, %xmm0)
lea 128(up), up
lea 128(rp), rp
jnc L(utop)
- pxor %xmm7, %xmm0
+ pxor %xmm5, %xmm0
movdqa %xmm0, -128(rp)
L(uend):test $8, R8(n)
@@ -213,19 +214,19 @@ L(uend):test $8, R8(n)
movdqa 40(up), %xmm2
palignr($8, %xmm2, %xmm3)
movdqa 24(up), %xmm1
- pxor %xmm7, %xmm3
+ pxor %xmm5, %xmm3
movdqa %xmm3, 48(rp)
palignr($8, %xmm1, %xmm2)
movdqa 8(up), %xmm0
- pxor %xmm7, %xmm2
+ pxor %xmm5, %xmm2
movdqa %xmm2, 32(rp)
palignr($8, %xmm0, %xmm1)
movdqa -8(up), %xmm3
- pxor %xmm7, %xmm1
+ pxor %xmm5, %xmm1
movdqa %xmm1, 16(rp)
palignr($8, %xmm3, %xmm0)
lea 64(up), up
- pxor %xmm7, %xmm0
+ pxor %xmm5, %xmm0
movdqa %xmm0, (rp)
lea 64(rp), rp
@@ -235,11 +236,11 @@ L(uend):test $8, R8(n)
movdqa 8(up), %xmm0
palignr($8, %xmm0, %xmm1)
movdqa -8(up), %xmm3
- pxor %xmm7, %xmm1
+ pxor %xmm5, %xmm1
movdqa %xmm1, 16(rp)
palignr($8, %xmm3, %xmm0)
lea 32(up), up
- pxor %xmm7, %xmm0
+ pxor %xmm5, %xmm0
movdqa %xmm0, (rp)
lea 32(rp), rp
@@ -249,7 +250,7 @@ L(uend):test $8, R8(n)
movdqa -8(up), %xmm3
palignr($8, %xmm3, %xmm0)
lea 16(up), up
- pxor %xmm7, %xmm0
+ pxor %xmm5, %xmm0
movdqa %xmm0, (rp)
lea 16(rp), rp
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com.asm
index 307fb75373d..c867222897c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/com.asm
@@ -78,6 +78,10 @@ ASM_START()
PROLOGUE(mpn_com)
FUNC_ENTRY(3)
+IFDOS(` add $-56, %rsp ')
+IFDOS(` movdqa %xmm6, (%rsp) ')
+IFDOS(` movdqa %xmm7, 16(%rsp) ')
+
pcmpeqb %xmm7, %xmm7 C set to 111...111
test $8, R8(rp) C is rp 16-byte aligned?
@@ -162,6 +166,10 @@ L(sma): add $14, n
not %rax
mov %rax, (rp)
1:
-L(don): FUNC_EXIT()
+L(don):
+IFDOS(` movdqa (%rsp), %xmm6 ')
+IFDOS(` movdqa 16(%rsp), %xmm7 ')
+IFDOS(` add $56, %rsp ')
+ FUNC_EXIT()
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyd.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyd.asm
index 5b8b8bf5c66..b3c47064d7f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyd.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyd.asm
@@ -94,9 +94,13 @@ PROLOGUE(mpn_copyd)
lea -8(rp), rp
dec n
- sub $16, n
+L(ali): sub $16, n
jc L(sma)
+IFDOS(` add $-56, %rsp ')
+IFDOS(` movdqa %xmm6, (%rsp) ')
+IFDOS(` movdqa %xmm7, 16(%rsp) ')
+
ALIGN(16)
L(top): movdqu (up), %xmm0
movdqu -16(up), %xmm1
@@ -116,9 +120,13 @@ L(top): movdqu (up), %xmm0
movdqa %xmm6, -96(rp)
movdqa %xmm7, -112(rp)
lea -128(rp), rp
-L(ali): sub $16, n
+ sub $16, n
jnc L(top)
+IFDOS(` movdqa (%rsp), %xmm6 ')
+IFDOS(` movdqa 16(%rsp), %xmm7 ')
+IFDOS(` add $56, %rsp ')
+
L(sma): test $8, R8(n)
jz 1f
movdqu (up), %xmm0
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi-palignr.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi-palignr.asm
index 22f13f1d862..9876a473359 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi-palignr.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi-palignr.asm
@@ -36,15 +36,17 @@ C cycles/limb cycles/limb cycles/limb good
C aligned unaligned best seen for cpu?
C AMD K8,K9 2.0 illop 1.0/1.0 N
C AMD K10 0.85 illop Y/N
-C AMD bull 0.70 0.66 Y
-C AMD pile 0.68 0.66 Y
-C AMD steam ? ?
-C AMD excavator ? ?
-C AMD bobcat 1.97 8.16 1.5/1.5 N
-C AMD jaguar 0.77 0.93 0.65/opt N/Y
+C AMD bd1 0.70 0.66 Y
+C AMD bd2 0.68 0.66 Y
+C AMD bd3 ? ?
+C AMD bd4 ? ?
+C AMD bt1 1.97 8.16 1.5/1.5 N
+C AMD bt2 0.77 0.93 0.65/opt N/Y
+C AMD zn1 ? ?
+C AMD zn2 ? ?
C Intel P4 2.26 illop Y/N
-C Intel core 0.52 0.64 opt/opt Y
-C Intel NHM 0.52 0.71 opt/opt Y
+C Intel CNR 0.52 0.64 opt/opt Y
+C Intel NHM 0.52 0.71 0.50/0.67 N
C Intel SBR 0.51 0.54 opt/0.51 Y
C Intel IBR 0.50 0.54 opt/opt Y
C Intel HWL 0.50 0.51 opt/opt Y
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi.asm
index b2f3b9ddb89..97f7865e6b5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/copyi.asm
@@ -88,9 +88,13 @@ PROLOGUE(mpn_copyi)
movsq C copy single limb
dec n
- sub $16, n
+L(ali): sub $16, n
jc L(sma)
+IFDOS(` add $-56, %rsp ')
+IFDOS(` movdqa %xmm6, (%rsp) ')
+IFDOS(` movdqa %xmm7, 16(%rsp) ')
+
ALIGN(16)
L(top): movdqu (up), %xmm0
movdqu 16(up), %xmm1
@@ -110,9 +114,13 @@ L(top): movdqu (up), %xmm0
movdqa %xmm6, 96(rp)
movdqa %xmm7, 112(rp)
lea 128(rp), rp
-L(ali): sub $16, n
+ sub $16, n
jnc L(top)
+IFDOS(` movdqa (%rsp), %xmm6 ')
+IFDOS(` movdqa 16(%rsp), %xmm7 ')
+IFDOS(` add $56, %rsp ')
+
L(sma): test $8, R8(n)
jz 1f
movdqu (up), %xmm0
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshift.asm
index f76972a22f6..6a17b935108 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshift.asm
@@ -2,7 +2,7 @@ dnl AMD64 mpn_lshift optimised for CPUs with fast SSE.
dnl Contributed to the GNU project by David Harvey and Torbjorn Granlund.
-dnl Copyright 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2010-2012, 2018 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -69,6 +69,7 @@ ASM_START()
TEXT
ALIGN(64)
PROLOGUE(mpn_lshift)
+ FUNC_ENTRY(4)
movd R32(%rcx), %xmm4
mov $64, R32(%rax)
sub R32(%rcx), R32(%rax)
@@ -124,6 +125,7 @@ L(uent):sub $2, n
psrlq %xmm5, %xmm0
por %xmm1, %xmm0
movdqa %xmm0, (rp)
+ FUNC_EXIT()
ret
C *****************************************************************************
@@ -149,6 +151,7 @@ L(aent):
psrlq %xmm5, %xmm0
por %xmm1, %xmm0
movdqa %xmm0, (rp)
+ FUNC_EXIT()
ret
C *****************************************************************************
@@ -165,5 +168,6 @@ L(le2): jne L(end8)
L(end8):movq (ap), %xmm0
psllq %xmm4, %xmm0
movq %xmm0, (rp)
+ FUNC_EXIT()
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshiftc.asm
index d2520690e22..a616075f13b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshiftc.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/lshiftc.asm
@@ -2,7 +2,7 @@ dnl AMD64 mpn_lshiftc optimised for CPUs with fast SSE.
dnl Contributed to the GNU project by David Harvey and Torbjorn Granlund.
-dnl Copyright 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2010-2012, 2018 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -70,6 +70,7 @@ ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_lshiftc)
+ FUNC_ENTRY(4)
movd R32(%rcx), %xmm4
mov $64, R32(%rax)
sub R32(%rcx), R32(%rax)
@@ -79,7 +80,7 @@ PROLOGUE(mpn_lshiftc)
mov -8(ap,n,8), %rax
shr R8(%rcx), %rax
- pcmpeqb %xmm7, %xmm7 C set to 111...111
+ pcmpeqb %xmm2, %xmm2 C set to 111...111
cmp $2, n
jle L(le2)
@@ -94,7 +95,7 @@ C Do one initial limb in order to make rp aligned
psllq %xmm4, %xmm0
psrlq %xmm5, %xmm1
por %xmm1, %xmm0
- pxor %xmm7, %xmm0
+ pxor %xmm2, %xmm0
movq %xmm0, -8(rp,n,8)
dec n
@@ -114,7 +115,7 @@ L(utop):movq (ap,n,8), %xmm1
psllq %xmm4, %xmm1
psrlq %xmm5, %xmm0
por %xmm1, %xmm0
- pxor %xmm7, %xmm0
+ pxor %xmm2, %xmm0
movdqa %xmm0, (rp,n,8)
L(uent):sub $2, n
ja L(utop)
@@ -128,8 +129,9 @@ L(uent):sub $2, n
psllq %xmm4, %xmm1
psrlq %xmm5, %xmm0
por %xmm1, %xmm0
- pxor %xmm7, %xmm0
+ pxor %xmm2, %xmm0
movdqa %xmm0, (rp)
+ FUNC_EXIT()
ret
C *****************************************************************************
@@ -142,7 +144,7 @@ L(atop):movdqa (ap,n,8), %xmm0 C xmm0 = B*ap[n-1] + ap[n-2]
psllq %xmm4, %xmm0
psrlq %xmm5, %xmm1
por %xmm1, %xmm0
- pxor %xmm7, %xmm0
+ pxor %xmm2, %xmm0
movdqa %xmm0, (rp,n,8)
L(aent):sub $2, n
ja L(atop)
@@ -155,8 +157,9 @@ L(aent):sub $2, n
psllq %xmm4, %xmm0
psrlq %xmm5, %xmm1
por %xmm1, %xmm0
- pxor %xmm7, %xmm0
+ pxor %xmm2, %xmm0
movdqa %xmm0, (rp)
+ FUNC_EXIT()
ret
C *****************************************************************************
@@ -168,12 +171,13 @@ L(le2): jne L(end8)
psllq %xmm4, %xmm0
psrlq %xmm5, %xmm1
por %xmm1, %xmm0
- pxor %xmm7, %xmm0
+ pxor %xmm2, %xmm0
movq %xmm0, 8(rp)
L(end8):movq (ap), %xmm0
psllq %xmm4, %xmm0
- pxor %xmm7, %xmm0
+ pxor %xmm2, %xmm0
movq %xmm0, (rp)
+ FUNC_EXIT()
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/sec_tabselect.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/sec_tabselect.asm
index e3df110be4e..e7b7febbefa 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/sec_tabselect.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fastsse/sec_tabselect.asm
@@ -75,6 +75,12 @@ PROLOGUE(mpn_sec_tabselect)
FUNC_ENTRY(4)
IFDOS(` mov 56(%rsp), %r8d ')
+IFDOS(` add $-88, %rsp ')
+IFDOS(` movdqu %xmm6, (%rsp) ')
+IFDOS(` movdqu %xmm7, 16(%rsp) ')
+IFDOS(` movdqu %xmm8, 32(%rsp) ')
+IFDOS(` movdqu %xmm9, 48(%rsp) ')
+
movd which, %xmm8
pshufd $0, %xmm8, %xmm8 C 4 `which' copies
mov $1, R32(%rax)
@@ -88,15 +94,15 @@ IFDOS(` mov 56(%rsp), %r8d ')
L(outer_top):
mov nents, i
mov tp, %r11
- pxor %xmm13, %xmm13
+ pxor %xmm1, %xmm1
pxor %xmm4, %xmm4
pxor %xmm5, %xmm5
pxor %xmm6, %xmm6
pxor %xmm7, %xmm7
ALIGN(16)
L(top): movdqa %xmm8, %xmm0
- pcmpeqd %xmm13, %xmm0
- paddd %xmm9, %xmm13
+ pcmpeqd %xmm1, %xmm0
+ paddd %xmm9, %xmm1
movdqu 0(tp), %xmm2
movdqu 16(tp), %xmm3
pand %xmm0, %xmm2
@@ -128,13 +134,13 @@ L(outer_end):
je L(b0xx)
L(b1xx):mov nents, i
mov tp, %r11
- pxor %xmm13, %xmm13
+ pxor %xmm1, %xmm1
pxor %xmm4, %xmm4
pxor %xmm5, %xmm5
ALIGN(16)
L(tp4): movdqa %xmm8, %xmm0
- pcmpeqd %xmm13, %xmm0
- paddd %xmm9, %xmm13
+ pcmpeqd %xmm1, %xmm0
+ paddd %xmm9, %xmm1
movdqu 0(tp), %xmm2
movdqu 16(tp), %xmm3
pand %xmm0, %xmm2
@@ -153,12 +159,12 @@ L(b0xx):test $2, R8(n)
je L(b00x)
L(b01x):mov nents, i
mov tp, %r11
- pxor %xmm13, %xmm13
+ pxor %xmm1, %xmm1
pxor %xmm4, %xmm4
ALIGN(16)
L(tp2): movdqa %xmm8, %xmm0
- pcmpeqd %xmm13, %xmm0
- paddd %xmm9, %xmm13
+ pcmpeqd %xmm1, %xmm0
+ paddd %xmm9, %xmm1
movdqu 0(tp), %xmm2
pand %xmm0, %xmm2
por %xmm2, %xmm4
@@ -173,12 +179,12 @@ L(b00x):test $1, R8(n)
je L(b000)
L(b001):mov nents, i
mov tp, %r11
- pxor %xmm13, %xmm13
+ pxor %xmm1, %xmm1
pxor %xmm4, %xmm4
ALIGN(16)
L(tp1): movdqa %xmm8, %xmm0
- pcmpeqd %xmm13, %xmm0
- paddd %xmm9, %xmm13
+ pcmpeqd %xmm1, %xmm0
+ paddd %xmm9, %xmm1
movq 0(tp), %xmm2
pand %xmm0, %xmm2
por %xmm2, %xmm4
@@ -187,6 +193,12 @@ L(tp1): movdqa %xmm8, %xmm0
jne L(tp1)
movq %xmm4, 0(rp)
-L(b000):FUNC_EXIT()
+L(b000):
+IFDOS(` movdqu (%rsp), %xmm6 ')
+IFDOS(` movdqu 16(%rsp), %xmm7 ')
+IFDOS(` movdqu 32(%rsp), %xmm8 ')
+IFDOS(` movdqu 48(%rsp), %xmm9 ')
+IFDOS(` add $88, %rsp ')
+ FUNC_EXIT()
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86/fat/gcd_1.c b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/addmul_2.c
index f809bd80928..e0d7358407b 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86/fat/gcd_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/addmul_2.c
@@ -1,6 +1,6 @@
-/* Fat binary fallback mpn_gcd_1.
+/* Fat binary fallback mpn_addmul_2.
-Copyright 2003 Free Software Foundation, Inc.
+Copyright 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,5 +28,11 @@ 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 "gmp-impl.h"
-#include "mpn/generic/gcd_1.c"
+mp_limb_t
+mpn_addmul_2 (mp_ptr rp, mp_srcptr up, mp_size_t n, const mp_limb_t vp[2])
+{
+ rp[n] = mpn_addmul_1 (rp, up, n, vp[0]);
+ return mpn_addmul_1 (rp + 1, up, n, vp[1]);
+}
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 b8482fec743..b7446a395f3 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
@@ -7,7 +7,7 @@
THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
COMPLETELY IN FUTURE GNU MP RELEASES.
-Copyright 2003, 2004, 2009, 2011-2015 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2009, 2011-2015, 2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -39,7 +39,6 @@ see https://www.gnu.org/licenses/. */
#include <stdlib.h> /* for getenv */
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
/* Change this to "#define TRACE(x) x" for some traces. */
@@ -92,6 +91,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) },
{ "nano", "CentaurHauls", MAKE_FMS (6, 15) },
};
@@ -160,7 +160,7 @@ struct cpuvec_t __gmpn_cpuvec = {
__MPN(copyi_init),
__MPN(divexact_1_init),
__MPN(divrem_1_init),
- __MPN(gcd_1_init),
+ __MPN(gcd_11_init),
__MPN(lshift_init),
__MPN(lshiftc_init),
__MPN(mod_1_init),
@@ -325,15 +325,25 @@ __gmpn_cpuvec_init (void)
case 0x2c: /* WSM Gulftown */
case 0x2e: /* NHM Beckton */
case 0x2f: /* WSM Eagleton */
+ CPUVEC_SETUP_core2;
+ CPUVEC_SETUP_coreinhm;
+ break;
+
case 0x37: /* Silvermont */
case 0x4a: /* Silvermont */
case 0x4c: /* Airmont */
case 0x4d: /* Silvermont/Avoton */
case 0x5a: /* Silvermont */
+ CPUVEC_SETUP_atom;
+ CPUVEC_SETUP_silvermont;
+ break;
+
case 0x5c: /* Goldmont */
case 0x5f: /* Goldmont */
- CPUVEC_SETUP_core2;
- CPUVEC_SETUP_coreinhm;
+ case 0x7a: /* Goldmont Plus */
+ CPUVEC_SETUP_atom;
+ CPUVEC_SETUP_silvermont;
+ CPUVEC_SETUP_goldmont;
break;
case 0x2a: /* SB */
@@ -401,7 +411,6 @@ __gmpn_cpuvec_init (void)
case 0x0f: /* k8 */
case 0x11: /* "fam 11h", mix of k8 and k10 */
case 0x13:
- case 0x17:
CPUVEC_SETUP_k8;
break;
@@ -412,16 +421,27 @@ __gmpn_cpuvec_init (void)
break;
case 0x14: /* bobcat */
+ CPUVEC_SETUP_k8;
+ CPUVEC_SETUP_k10;
+ CPUVEC_SETUP_bt1;
+ break;
+
case 0x16: /* jaguar */
CPUVEC_SETUP_k8;
CPUVEC_SETUP_k10;
- CPUVEC_SETUP_bobcat;
+ CPUVEC_SETUP_bt1;
+ CPUVEC_SETUP_bt2;
break;
case 0x15: /* bulldozer, piledriver, steamroller, excavator */
CPUVEC_SETUP_k8;
CPUVEC_SETUP_k10;
CPUVEC_SETUP_bd1;
+ break;
+
+ case 0x17: /* zen */
+ CPUVEC_SETUP_zen;
+ break;
}
}
else if (strcmp (vendor_string, "CentaurHauls") == 0)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat_entry.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat_entry.asm
index 8f7599dd587..5f244ac2b65 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat_entry.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat_entry.asm
@@ -167,7 +167,9 @@ IFSTD(` push %rsi ')
push %r8
push %r9
push %rax
+IFDOS(` sub $32, %rsp ')
CALL( __gmpn_cpuvec_init)
+IFDOS(` add $32, %rsp ')
pop %rax
pop %r9
pop %r8
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_1.asm
deleted file mode 100644
index ac4aceddca2..00000000000
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_1.asm
+++ /dev/null
@@ -1,165 +0,0 @@
-dnl AMD64 mpn_gcd_1 -- mpn by 1 gcd.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011, 2012 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/.
-
-include(`../config.m4')
-
-
-C cycles/bit (approx)
-C AMD K8,K9 5.21 (4.95)
-C AMD K10 5.15 (5.00)
-C AMD bd1 5.42 (5.14)
-C AMD bobcat 6.71 (6.56)
-C Intel P4 13.5 (12.75)
-C Intel core2 6.20 (6.16)
-C Intel NHM 6.49 (6.25)
-C Intel SBR 7.75 (7.57)
-C Intel atom 8.77 (8.54)
-C VIA nano 6.60 (6.20)
-C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
-
-C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
-
-deflit(MAXSHIFT, 7)
-deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
-
-DEF_OBJECT(ctz_table,64)
- .byte MAXSHIFT
-forloop(i,1,MASK,
-` .byte m4_count_trailing_zeros(i)
-')
-END_OBJECT(ctz_table)
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 8)
-
-C INPUT PARAMETERS
-define(`up', `%rdi')
-define(`n', `%rsi')
-define(`v0', `%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-IFDOS(`define(`STACK_ALLOC', 40)')
-IFSTD(`define(`STACK_ALLOC', 8)')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- FUNC_ENTRY(3)
- mov (up), %rax C U low limb
- mov $-1, R32(%rcx)
- or v0, %rax C x | y
-
-L(twos):
- inc R32(%rcx)
- shr %rax
- jnc L(twos)
-
- shr R8(%rcx), v0
- push %rcx C common twos
-
-L(divide_strip_y):
- shr v0
- jnc L(divide_strip_y)
- adc v0, v0
-
- cmp $1, n
- jnz L(reduce_nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- mov (up), %r8
- mov %r8, %rax
- shr $BMOD_THRES_LOG2, %r8
- cmp %r8, v0
- ja L(noreduce)
- push v0
- sub $STACK_ALLOC, %rsp C maintain ABI required rsp alignment
-
-L(bmod):
-IFDOS(` mov %rdx, %r8 ')
-IFDOS(` mov %rsi, %rdx ')
-IFDOS(` mov %rdi, %rcx ')
- ASSERT(nz, `test $15, %rsp')
- CALL( mpn_modexact_1_odd)
-
-L(reduced):
- add $STACK_ALLOC, %rsp
- pop %rdx
-
-L(noreduce):
- LEA( ctz_table, %rsi)
- test %rax, %rax
- mov %rax, %rcx
- jnz L(mid)
- jmp L(end)
-
-L(reduce_nby1):
- push v0
- sub $STACK_ALLOC, %rsp C maintain ABI required rsp alignment
-
- cmp $BMOD_1_TO_MOD_1_THRESHOLD, n
- jl L(bmod)
-IFDOS(` mov %rdx, %r8 ')
-IFDOS(` mov %rsi, %rdx ')
-IFDOS(` mov %rdi, %rcx ')
- ASSERT(nz, `test $15, %rsp')
- CALL( mpn_mod_1)
- jmp L(reduced)
-
- ALIGN(16) C K8 BC P4 NHM SBR
-L(top): cmovc %rcx, %rax C if x-y < 0 0
- cmovc %rdi, %rdx C use x,y-x 0
-L(mid): and $MASK, R32(%rcx) C 0
- movzbl (%rsi,%rcx), R32(%rcx) C 1
- jz L(shift_alot) C 1
- shr R8(%rcx), %rax C 3
- mov %rax, %rdi C 4
- mov %rdx, %rcx C 3
- sub %rax, %rcx C 4
- sub %rdx, %rax C 4
- jnz L(top) C 5
-
-L(end): pop %rcx
- mov %rdx, %rax
- shl R8(%rcx), %rax
- FUNC_EXIT()
- ret
-
-L(shift_alot):
- shr $MAXSHIFT, %rax
- mov %rax, %rcx
- jmp L(mid)
-EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_11.asm
new file mode 100644
index 00000000000..f9b3bcc9689
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_11.asm
@@ -0,0 +1,114 @@
+dnl AMD64 mpn_gcd_11 -- 1 x 1 gcd.
+
+dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
+dnl Granlund.
+
+dnl Copyright 2000-2002, 2005, 2009, 2011, 2012, 2017 Free Software
+dnl 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit
+C AMD K8,K9 5.5
+C AMD K10 ?
+C AMD bd1 ?
+C AMD bd2 ?
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD bt1 7.1
+C AMD bt2 ?
+C AMD zn1 ?
+C AMD zn2 ?
+C Intel P4 ?
+C Intel CNR ?
+C Intel PNR ?
+C Intel NHM ?
+C Intel WSM ?
+C Intel SBR ?
+C Intel IBR ?
+C Intel HWL ?
+C Intel BWL ?
+C Intel SKL ?
+C Intel atom 9.1
+C Intel SLM 6.9
+C Intel GLM 6.0
+C Intel GLM+ 5.8
+C VIA nano ?
+
+
+C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
+
+deflit(MAXSHIFT, 7)
+deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
+
+DEF_OBJECT(ctz_table,64)
+ .byte MAXSHIFT
+forloop(i,1,MASK,
+` .byte m4_count_trailing_zeros(i)
+')
+END_OBJECT(ctz_table)
+
+define(`u0', `%rdi')
+define(`v0', `%rsi')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_11)
+ FUNC_ENTRY(2)
+ LEA( ctz_table, %r8)
+ jmp L(ent)
+
+ ALIGN(16)
+L(top): cmovc %rdx, u0 C u = |u - v|
+ cmovc %rax, v0 C v = min(u,v)
+L(mid): and $MASK, R32(%rdx)
+ movzbl (%r8,%rdx), R32(%rcx)
+ jz L(shift_alot)
+ shr R8(%rcx), u0
+L(ent): mov u0, %rax
+ mov v0, %rdx
+ sub u0, %rdx
+ sub v0, u0
+ jnz L(top)
+
+L(end): C rax = result
+ C rdx = 0 for the benefit of internal gcd_22 call
+ FUNC_EXIT()
+ ret
+
+L(shift_alot):
+ shr $MAXSHIFT, u0
+ mov u0, %rdx
+ jmp L(mid)
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_22.asm
new file mode 100644
index 00000000000..78f985f896c
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/gcd_22.asm
@@ -0,0 +1,163 @@
+dnl AMD64 mpn_gcd_22. Assumes useless bsf, useless shrd, no tzcnt, no shlx.
+dnl We actually use tzcnt here, when table cannot count bits, as tzcnt always
+dnl works for our use, and helps a lot for certain CPUs.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit
+C AMD K8,K9 8.9
+C AMD K10 8.8
+C AMD bd1 9.7
+C AMD bd2 7.8
+C AMD bd3 ?
+C AMD bd4 7.4
+C AMD bt1 9.2
+C AMD bt2 9.1
+C AMD zn1 7.5
+C AMD zn2 7.5
+C Intel P4 ?
+C Intel CNR 10.5
+C Intel PNR 10.5
+C Intel NHM 9.7
+C Intel WSM 9.7
+C Intel SBR 10.7
+C Intel IBR ?
+C Intel HWL 9.5
+C Intel BWL 8.7
+C Intel SKL 8.6
+C Intel atom 18.9
+C Intel SLM 14.0
+C Intel GLM 9.8
+C Intel GLM+ 8.8
+C VIA nano ?
+
+
+C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
+
+deflit(MAXSHIFT, 8)
+deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
+
+DEF_OBJECT(ctz_table,64)
+ .byte MAXSHIFT
+forloop(i,1,MASK,
+` .byte m4_count_trailing_zeros(i)
+')
+END_OBJECT(ctz_table)
+
+define(`u1', `%rdi')
+define(`u0', `%rsi')
+define(`v1', `%rdx')
+define(`v0_param', `%rcx')
+
+define(`v0', `%rax')
+define(`cnt', `%rcx')
+
+define(`s0', `%r8')
+define(`s1', `%r9')
+define(`t0', `%rcx')
+define(`t1', `%r11')
+
+dnl ABI_SUPPORT(DOS64) C returns mp_double_limb_t in memory
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_22)
+ FUNC_ENTRY(4)
+ mov v0_param, v0
+
+ LEA( ctz_table, %r10)
+
+ ALIGN(16)
+L(top): mov v0, t0
+ sub u0, t0
+ jz L(lowz) C jump when low limb result = 0
+ mov v1, t1
+ sbb u1, t1
+
+ mov u0, s0
+ mov u1, s1
+
+ sub v0, u0
+ sbb v1, u1
+
+L(bck): cmovc t0, u0 C u = |u - v|
+ cmovc t1, u1 C u = |u - v|
+ cmovc s0, v0 C v = min(u,v)
+ cmovc s1, v1 C v = min(u,v)
+
+ and $MASK, R32(t0)
+ movzbl (%r10,t0), R32(cnt)
+ jz L(count_better)
+C Rightshift (u1,,u0) into (u1,,u0)
+L(shr): shr R8(cnt), u0
+ mov u1, t1
+ shr R8(cnt), u1
+ neg cnt
+ shl R8(cnt), t1
+ or t1, u0
+
+ test v1, v1
+ jnz L(top)
+ test u1, u1
+ jnz L(top)
+
+L(gcd_11):
+ mov v0, %rdi
+C mov u0, %rsi
+ TCALL( mpn_gcd_11)
+
+L(count_better):
+ rep;bsf u0, cnt C tzcnt!
+ jmp L(shr)
+
+L(lowz):C We come here when v0 - u0 = 0
+ C 1. If v1 - u1 = 0, then gcd is u = v.
+ C 2. Else compute gcd_21({v1,v0}, |u1-v1|)
+ mov v1, t0
+ sub u1, t0
+ je L(end)
+
+ xor t1, t1
+ mov u0, s0
+ mov u1, s1
+ mov u1, u0
+ xor u1, u1
+ sub v1, u0
+ jmp L(bck)
+
+L(end): C mov v0, %rax
+ C mov v1, %rdx
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aorrlsh_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aorrlsh_n.asm
new file mode 100644
index 00000000000..06c5d5d7ed0
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aorrlsh_n.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_addlsh_n, mpn_rsblsh_n, optimised for Intel Goldmont.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addlsh_n mpn_rsblsh_n)
+include_mpn(`x86_64/k8/aorrlsh_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aors_n.asm
new file mode 100644
index 00000000000..1818f9f931e
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aors_n.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_add_n, mpn_sub_n, optimised for Intel Goldmont.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+include_mpn(`x86_64/coreihwl/aors_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aorsmul_1.asm
new file mode 100644
index 00000000000..9c5f631c72d
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/aorsmul_1.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_addmul_1 and mpn_submul_1 optimised for Intel Goldmont.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+include_mpn(`x86_64/bd1/aorsmul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/gmp-mparam.h
new file mode 100644
index 00000000000..531521d59d2
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/gmp-mparam.h
@@ -0,0 +1,264 @@
+/* Intel Goldmont gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* 2200 MHz Intel Atom C3758 Goldmont/Denverton */
+/* FFT tuning limit = 468,030,122 */
+/* Generated by tuneup.c, 2019-10-12, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 5
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 13
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 38
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1_NORM_THRESHOLD 3
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 17
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 19
+
+#define DIV_1_VS_MUL_1_PERCENT 301
+
+#define MUL_TOOM22_THRESHOLD 23
+#define MUL_TOOM33_THRESHOLD 65
+#define MUL_TOOM44_THRESHOLD 178
+#define MUL_TOOM6H_THRESHOLD 258
+#define MUL_TOOM8H_THRESHOLD 357
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 121
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 131
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 121
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 129
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 178
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 30
+#define SQR_TOOM3_THRESHOLD 113
+#define SQR_TOOM4_THRESHOLD 290
+#define SQR_TOOM6_THRESHOLD 351
+#define SQR_TOOM8_THRESHOLD 0 /* always */
+
+#define MULMID_TOOM42_THRESHOLD 36
+
+#define MULMOD_BNM1_THRESHOLD 14
+#define SQRMOD_BNM1_THRESHOLD 16
+
+#define MUL_FFT_MODF_THRESHOLD 440 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 440, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
+ { 24, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
+ { 31, 7}, { 21, 8}, { 11, 7}, { 24, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 31, 8}, \
+ { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 41, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 71,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 103,12}, { 31,11}, { 63,10}, \
+ { 135,11}, { 79,10}, { 159,11}, { 95,10}, \
+ { 191,11}, { 111,12}, { 63,11}, { 127,10}, \
+ { 255,11}, { 143,10}, { 287, 9}, { 575,11}, \
+ { 159,10}, { 319,12}, { 95,11}, { 191,10}, \
+ { 383, 9}, { 767,11}, { 207,10}, { 415,13}, \
+ { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 271,10}, { 543,11}, { 287,10}, { 575,11}, \
+ { 303,12}, { 159,11}, { 319,10}, { 639,11}, \
+ { 367,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 415,12}, { 223,11}, { 479,13}, { 127,12}, \
+ { 255,11}, { 543,12}, { 287,11}, { 607,12}, \
+ { 319,11}, { 639,12}, { 351,11}, { 703,13}, \
+ { 191,12}, { 383,11}, { 767,12}, { 415,11}, \
+ { 831,12}, { 479,14}, { 127,13}, { 255,12}, \
+ { 543,11}, { 1087,12}, { 607,13}, { 319,12}, \
+ { 671,11}, { 1343,12}, { 703,11}, { 1407,12}, \
+ { 735,13}, { 383,12}, { 767,11}, { 1535,12}, \
+ { 831,13}, { 447,12}, { 959,14}, { 255,13}, \
+ { 511,12}, { 1023,11}, { 2047,12}, { 1087,13}, \
+ { 575,12}, { 1215,11}, { 2431,10}, { 4863,13}, \
+ { 639,12}, { 1279,11}, { 2559,12}, { 1343,13}, \
+ { 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
+ { 1535,13}, { 831,12}, { 1727,13}, { 959,15}, \
+ { 255,14}, { 511,13}, { 1023,12}, { 2047,13}, \
+ { 1087,12}, { 2175,13}, { 1151,12}, { 2303,13}, \
+ { 1215,12}, { 2431,11}, { 4863,14}, { 639,13}, \
+ { 1279,12}, { 2559,13}, { 1343,12}, { 2687,13}, \
+ { 1407,12}, { 2815,13}, { 1471,12}, { 2943,11}, \
+ { 5887,14}, { 767,13}, { 1535,12}, { 3071,13}, \
+ { 1727,14}, { 895,13}, { 1791,12}, { 3583,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2303,12}, { 4607,13}, { 2431,12}, \
+ { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
+ { 2943,12}, { 5887,15}, { 767,14}, { 1535,13}, \
+ { 3071,14}, { 1663,13}, { 3455,12}, { 6911,14}, \
+ { 1791,13}, { 3583,14}, { 1919,13}, { 3839,16}, \
+ { 511,15}, { 1023,14}, { 2431,13}, { 4863,15}, \
+ { 1279,14}, { 2943,13}, { 5887,12}, { 11775,15}, \
+ { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
+ { 3839,13}, { 7679,12}, { 15359,14}, { 3967,16}, \
+ { 1023,15}, { 2047,14}, { 4351,15}, { 2303,14}, \
+ { 4863,15}, { 2815,14}, { 5887,13}, { 11775,16}, \
+ { 1535,15}, { 3071,14}, { 6143,15}, { 3327,14}, \
+ { 6911,15}, { 3839,14}, { 7679,13}, { 15359,17}, \
+ { 1023,16}, { 2047,15}, { 4351,14}, { 8703,15}, \
+ { 4863,16}, { 2559,15}, { 5887,14}, { 11775,16}, \
+ { 3071,15}, { 6911,16}, { 3583,15}, { 7679,14}, \
+ { 15359,15}, { 7935,17}, { 2047,16}, { 4095,15}, \
+ { 8703,16}, { 4607,15}, { 9983,14}, { 19967,16}, \
+ { 5119,15}, { 10239,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 261
+#define MUL_FFT_THRESHOLD 4544
+
+#define SQR_FFT_MODF_THRESHOLD 380 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 380, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
+ { 11, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
+ { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
+ { 31, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
+ { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 127, 9}, { 255,10}, { 135,11}, { 79,10}, \
+ { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
+ { 383,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 271, 9}, { 543,10}, { 287, 9}, \
+ { 575,10}, { 303, 9}, { 607,10}, { 319, 9}, \
+ { 639,12}, { 95,11}, { 191,10}, { 383,11}, \
+ { 207,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 303,10}, { 607,11}, { 319,10}, \
+ { 639,11}, { 351,10}, { 703,11}, { 367,12}, \
+ { 191,11}, { 415,12}, { 223,11}, { 479,13}, \
+ { 127,12}, { 255,11}, { 543,12}, { 287,11}, \
+ { 607,12}, { 319,11}, { 639,12}, { 351,11}, \
+ { 703,10}, { 1407,13}, { 191,12}, { 383,11}, \
+ { 767,12}, { 479,14}, { 127,13}, { 255,12}, \
+ { 607,13}, { 319,12}, { 703,11}, { 1407,12}, \
+ { 735,13}, { 383,12}, { 767,11}, { 1535,12}, \
+ { 799,13}, { 447,12}, { 895,11}, { 1791,14}, \
+ { 255,13}, { 511,12}, { 1023,13}, { 575,12}, \
+ { 1151,11}, { 2303,12}, { 1215,13}, { 639,12}, \
+ { 1279,13}, { 703,12}, { 1407,14}, { 383,13}, \
+ { 767,12}, { 1535,13}, { 831,12}, { 1663,13}, \
+ { 895,12}, { 1791,13}, { 959,15}, { 255,14}, \
+ { 511,13}, { 1023,12}, { 2047,13}, { 1087,12}, \
+ { 2175,13}, { 1151,12}, { 2303,13}, { 1215,12}, \
+ { 2431,14}, { 639,13}, { 1279,12}, { 2559,13}, \
+ { 1343,12}, { 2687,13}, { 1407,12}, { 2815,13}, \
+ { 1471,12}, { 2943,11}, { 5887,14}, { 767,13}, \
+ { 1535,12}, { 3071,13}, { 1599,12}, { 3199,13}, \
+ { 1663,14}, { 895,13}, { 1791,12}, { 3583,15}, \
+ { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
+ { 2303,12}, { 4607,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,13}, { 2943,12}, \
+ { 5887,15}, { 767,14}, { 1535,13}, { 3199,14}, \
+ { 1663,13}, { 3455,12}, { 6911,14}, { 1791,13}, \
+ { 3583,14}, { 1919,16}, { 511,15}, { 1023,14}, \
+ { 2303,13}, { 4607,14}, { 2431,13}, { 4863,15}, \
+ { 1279,14}, { 2943,13}, { 5887,12}, { 11775,15}, \
+ { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
+ { 3583,13}, { 7167,14}, { 3839,13}, { 7679,12}, \
+ { 15359,16}, { 1023,15}, { 2047,14}, { 4223,15}, \
+ { 2303,14}, { 4863,15}, { 2559,14}, { 5119,15}, \
+ { 2815,14}, { 5887,13}, { 11775,16}, { 1535,15}, \
+ { 3071,14}, { 6143,15}, { 3327,14}, { 6911,15}, \
+ { 3583,14}, { 7167,15}, { 3839,14}, { 7679,13}, \
+ { 15359,17}, { 1023,16}, { 2047,15}, { 4095,14}, \
+ { 8191,15}, { 4863,16}, { 2559,15}, { 5887,14}, \
+ { 11775,16}, { 3071,15}, { 6911,16}, { 3583,15}, \
+ { 7679,14}, { 15359,15}, { 7935,14}, { 15871,17}, \
+ { 2047,16}, { 4095,15}, { 8447,16}, { 4607,15}, \
+ { 9983,14}, { 19967,16}, { 5119,15}, { 10239,16}, \
+ { 5631,15}, { 11775,17}, { 3071,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 259
+#define SQR_FFT_THRESHOLD 3520
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 62
+#define MULLO_MUL_N_THRESHOLD 8907
+#define SQRLO_BASECASE_THRESHOLD 10
+#define SQRLO_DC_THRESHOLD 13
+#define SQRLO_SQR_THRESHOLD 7035
+
+#define DC_DIV_QR_THRESHOLD 51
+#define DC_DIVAPPR_Q_THRESHOLD 183
+#define DC_BDIV_QR_THRESHOLD 47
+#define DC_BDIV_Q_THRESHOLD 88
+
+#define INV_MULMOD_BNM1_THRESHOLD 46
+#define INV_NEWTON_THRESHOLD 226
+#define INV_APPR_THRESHOLD 204
+
+#define BINV_NEWTON_THRESHOLD 264
+#define REDC_1_TO_REDC_2_THRESHOLD 28
+#define REDC_2_TO_REDC_N_THRESHOLD 54
+
+#define MU_DIV_QR_THRESHOLD 1589
+#define MU_DIVAPPR_Q_THRESHOLD 1620
+#define MUPI_DIV_QR_THRESHOLD 83
+#define MU_BDIV_QR_THRESHOLD 1334
+#define MU_BDIV_Q_THRESHOLD 1470
+
+#define POWM_SEC_TABLE 1,16,194,642
+
+#define GET_STR_DC_THRESHOLD 10
+#define GET_STR_PRECOMPUTE_THRESHOLD 17
+#define SET_STR_DC_THRESHOLD 381
+#define SET_STR_PRECOMPUTE_THRESHOLD 1042
+
+#define FAC_DSC_THRESHOLD 218
+#define FAC_ODD_THRESHOLD 25
+
+#define MATRIX22_STRASSEN_THRESHOLD 21
+#define HGCD2_DIV1_METHOD 1 /* 6.58% faster than 3 */
+#define HGCD_THRESHOLD 136
+#define HGCD_APPR_THRESHOLD 168
+#define HGCD_REDUCE_THRESHOLD 3014
+#define GCD_DC_THRESHOLD 416
+#define GCDEXT_DC_THRESHOLD 393
+#define JACOBI_BASE_METHOD 4 /* 1.17% faster than 3 */
+
+/* Tuneup completed successfully, took 800192 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/mul_1.asm
new file mode 100644
index 00000000000..ed1ec5497cf
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/mul_1.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_mul_1 optimised for Intel Goldmont.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_mul_1 mpn_mul_1c)
+include_mpn(`x86_64/coreisbr/mul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/redc_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/redc_1.asm
new file mode 100644
index 00000000000..1192635abef
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/goldmont/redc_1.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_redc_1 optimised for Intel Goldmont.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_redc_1)
+include_mpn(`x86_64/k8/redc_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/invert_limb.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/invert_limb.asm
index cc79b89a2b3..b375ad37021 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/invert_limb.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/invert_limb.asm
@@ -56,14 +56,11 @@ PROLOGUE(mpn_invert_limb) C Kn C2 Ci
FUNC_ENTRY(1)
mov %rdi, %rax C 0 0 0
shr $55, %rax C 1 1 1
-ifdef(`PIC',`
ifdef(`DARWIN',`
- mov mpn_invert_limb_table@GOTPCREL(%rip), %r8
+ lea mpn_invert_limb_table(%rip), %r8
add $-512, %r8
',`
lea -512+mpn_invert_limb_table(%rip), %r8
-')',`
- movabs $-512+mpn_invert_limb_table, %r8
')
movzwl (%r8,%rax,2), R32(%rcx) C %rcx = v0
@@ -88,7 +85,7 @@ ifdef(`DARWIN',`
shr $47, %rcx
add %rax, %rcx C %rcx = v2
- C v3 = (v2 << 31) + (v2 * (2^96 - v2 * d63 + ((v2 >> 1) & mask)) >> 65
+ C v3 = (v2 << 31) + (v2 * (2^96 - v2 * d63 + ((v2 >> 1) & mask)) >> 65)
mov %rdi, %rsi C 0 0 0
shr %rsi C d/2
sbb %rax, %rax C -d0 = -(d mod 2)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_11.asm
new file mode 100644
index 00000000000..4723093bb46
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_11.asm
@@ -0,0 +1,37 @@
+dnl AMD64 mpn_gcd_11.
+
+dnl Copyright 2012 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_gcd_11)
+include_mpn(`x86_64/core2/gcd_11.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_22.asm
new file mode 100644
index 00000000000..f58b4cccf61
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_22.asm
@@ -0,0 +1,142 @@
+dnl AMD64 mpn_gcd_22. Assumes useful bsf, useless shrd, no tzcnt, no shlx.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+
+C cycles/bit
+C AMD K8,K9 ?
+C AMD K10 7.4
+C AMD bd1 9.9
+C AMD bd2 ?
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD bt1 ?
+C AMD bt2 ?
+C AMD zn1 ?
+C AMD zn2 ?
+C Intel P4 ?
+C Intel CNR ?
+C Intel PNR ?
+C Intel NHM 9.2
+C Intel WSM 9.0
+C Intel SBR ?
+C Intel IBR ?
+C Intel HWL ?
+C Intel BWL ?
+C Intel SKL ?
+C Intel atom ?
+C Intel SLM ?
+C Intel GLM ?
+C Intel GLM+ ?
+C VIA nano ?
+
+
+define(`u1', `%rdi')
+define(`u0', `%rsi')
+define(`v1', `%rdx')
+define(`v0_param', `%rcx')
+
+define(`v0', `%rax')
+define(`cnt', `%rcx')
+
+define(`s0', `%r8')
+define(`s1', `%r9')
+define(`t0', `%r10')
+define(`t1', `%r11')
+
+dnl ABI_SUPPORT(DOS64) C returns mp_double_limb_t in memory
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(64)
+PROLOGUE(mpn_gcd_22)
+ FUNC_ENTRY(4)
+ mov v0_param, v0
+
+ ALIGN(16)
+L(top): mov v0, t0
+ sub u0, t0
+ jz L(lowz) C jump when low limb result = 0
+ mov v1, t1
+ sbb u1, t1
+
+ mov u0, s0
+ mov u1, s1
+
+ bsf t0, cnt
+
+ sub v0, u0
+ sbb v1, u1
+
+L(bck): cmovc t0, u0 C u = |u - v|
+ cmovnc u1, t1 C u = |u - v|
+ cmovc s0, v0 C v = min(u,v)
+ cmovc s1, v1 C v = min(u,v)
+
+ shr R8(cnt), u0
+ mov t1, u1
+ shr R8(cnt), u1
+ neg cnt
+ shl R8(cnt), t1
+ or t1, u0
+
+ test u1, u1
+ jnz L(top)
+ test v1, v1
+ jnz L(top)
+
+L(gcd_11):
+ mov v0, %rdi
+C mov u0, %rsi
+ TCALL( mpn_gcd_11)
+
+L(lowz):C We come here when v0 - u0 = 0
+ C 1. If v1 - u1 = 0, then gcd is u = v.
+ C 2. Else compute gcd_21({v1,v0}, |u1-v1|)
+ mov v1, t0
+ sub u1, t0
+ je L(end)
+
+ xor t1, t1
+ mov u0, s0
+ mov u1, s1
+ bsf t0, cnt
+ mov u1, u0
+ xor u1, u1
+ sub v1, u0
+ jmp L(bck)
+
+L(end): C mov v0, %rax
+ C mov v1, %rdx
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gmp-mparam.h
index c05f1508557..349bace4c36 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gmp-mparam.h
@@ -1,7 +1,6 @@
/* AMD K10 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2012, 2014, 2015 Free Software Foundation,
-Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -39,199 +38,211 @@ see https://www.gnu.org/licenses/. */
: MPN(mpn_sublsh_n)(rp,up,vp,n,c))
#endif
-/* 3200 MHz K10 Thuban */
-/* FFT tuning limit = 200 M */
-/* Generated by tuneup.c, 2015-10-07, gcc 4.8 */
+/* 3200-3600 MHz K10 Thuban */
+/* FFT tuning limit = 427,161,280 */
+/* Generated by tuneup.c, 2019-10-22, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 5
#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 17
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 28
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 8
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 11
#define USE_PREINV_DIVREM_1 1 /* native */
#define DIV_QR_1_NORM_THRESHOLD 1
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 14
+#define BMOD_1_TO_MOD_1_THRESHOLD 15
+
+#define DIV_1_VS_MUL_1_PERCENT 324
#define MUL_TOOM22_THRESHOLD 27
#define MUL_TOOM33_THRESHOLD 81
#define MUL_TOOM44_THRESHOLD 232
-#define MUL_TOOM6H_THRESHOLD 369
-#define MUL_TOOM8H_THRESHOLD 462
+#define MUL_TOOM6H_THRESHOLD 363
+#define MUL_TOOM8H_THRESHOLD 478
#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 154
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 155
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 145
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 163
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 203
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 160
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 142
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 34
+#define SQR_TOOM2_THRESHOLD 30
#define SQR_TOOM3_THRESHOLD 117
-#define SQR_TOOM4_THRESHOLD 348
-#define SQR_TOOM6_THRESHOLD 552
-#define SQR_TOOM8_THRESHOLD 0 /* always */
+#define SQR_TOOM4_THRESHOLD 280
+#define SQR_TOOM6_THRESHOLD 446
+#define SQR_TOOM8_THRESHOLD 547
#define MULMID_TOOM42_THRESHOLD 34
#define MULMOD_BNM1_THRESHOLD 15
#define SQRMOD_BNM1_THRESHOLD 17
-#define MUL_FFT_MODF_THRESHOLD 565 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 530 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 565, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
+ { { 530, 5}, { 24, 6}, { 13, 5}, { 27, 6}, \
{ 27, 7}, { 14, 6}, { 29, 7}, { 15, 6}, \
- { 31, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
- { 15, 7}, { 31, 8}, { 17, 7}, { 35, 8}, \
- { 19, 7}, { 39, 8}, { 21, 7}, { 43, 8}, \
- { 23, 7}, { 47, 8}, { 25, 7}, { 51, 8}, \
- { 29, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
- { 43, 9}, { 23, 8}, { 51, 9}, { 27, 8}, \
- { 55,10}, { 15, 9}, { 31, 8}, { 63, 9}, \
- { 43,10}, { 23, 9}, { 59,11}, { 15,10}, \
- { 31, 9}, { 67,10}, { 39, 9}, { 83,10}, \
- { 47, 9}, { 95,10}, { 55,11}, { 31,10}, \
- { 79,11}, { 47,10}, { 103,12}, { 31,11}, \
- { 63,10}, { 135,11}, { 79,10}, { 167,11}, \
- { 95,10}, { 191,11}, { 111,12}, { 63,11}, \
- { 143,10}, { 287,11}, { 159,12}, { 95,11}, \
- { 191,10}, { 383,11}, { 207,13}, { 63,12}, \
+ { 31, 7}, { 29, 8}, { 15, 7}, { 32, 8}, \
+ { 17, 7}, { 36, 8}, { 19, 7}, { 39, 8}, \
+ { 21, 7}, { 43, 8}, { 23, 7}, { 47, 8}, \
+ { 25, 7}, { 51, 8}, { 29, 9}, { 15, 8}, \
+ { 35, 9}, { 19, 8}, { 43, 9}, { 23, 8}, \
+ { 51, 9}, { 27, 8}, { 55,10}, { 15, 9}, \
+ { 31, 8}, { 63, 9}, { 35, 8}, { 71, 9}, \
+ { 39, 8}, { 81, 9}, { 43,10}, { 23, 9}, \
+ { 55,11}, { 15,10}, { 31, 9}, { 71,10}, \
+ { 39, 9}, { 87,10}, { 47, 9}, { 99,10}, \
+ { 55,11}, { 31,10}, { 87,11}, { 47,10}, \
+ { 111,12}, { 31,11}, { 63,10}, { 143,11}, \
+ { 79,10}, { 167,11}, { 95,10}, { 191,11}, \
+ { 111,12}, { 63,11}, { 143,10}, { 287,11}, \
+ { 159,12}, { 95,11}, { 207,13}, { 63,12}, \
{ 127,11}, { 255,10}, { 511,11}, { 271,10}, \
{ 543,11}, { 287,12}, { 159,11}, { 319,10}, \
{ 639,11}, { 335,10}, { 671,11}, { 351,10}, \
{ 703,12}, { 191,11}, { 383,10}, { 767,11}, \
{ 415,12}, { 223,11}, { 447,13}, { 127,12}, \
- { 255,11}, { 543,12}, { 287,11}, { 607,12}, \
- { 319,11}, { 671,12}, { 351,11}, { 703,13}, \
- { 191,12}, { 383,11}, { 767,12}, { 415,11}, \
- { 831,12}, { 447,14}, { 127,13}, { 255,12}, \
- { 543,11}, { 1087,12}, { 607,11}, { 1215,13}, \
- { 319,12}, { 671,11}, { 1343,12}, { 735,13}, \
- { 383,12}, { 799,11}, { 1599,12}, { 831,13}, \
- { 447,12}, { 959,13}, { 511,12}, { 1087,13}, \
- { 575,12}, { 1215,13}, { 639,12}, { 1343,13}, \
- { 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
- { 1599,13}, { 831,12}, { 1663,13}, { 895,12}, \
- { 1791,13}, { 959,14}, { 511,13}, { 1087,12}, \
+ { 255,11}, { 543,12}, { 287,11}, { 575,10}, \
+ { 1151,11}, { 607,12}, { 319,11}, { 671,12}, \
+ { 351,11}, { 703,13}, { 191,12}, { 383,11}, \
+ { 767,12}, { 415,11}, { 831,12}, { 447,14}, \
+ { 127,13}, { 255,12}, { 543,11}, { 1087,12}, \
+ { 575,11}, { 1151,12}, { 607,13}, { 319,12}, \
+ { 703,11}, { 1407,12}, { 735,13}, { 383,12}, \
+ { 831,13}, { 447,12}, { 959,14}, { 255,13}, \
+ { 511,12}, { 1087,13}, { 575,12}, { 1215,13}, \
+ { 639,12}, { 1343,13}, { 703,12}, { 1471,14}, \
+ { 383,13}, { 767,12}, { 1535,13}, { 831,12}, \
+ { 1663,13}, { 959,14}, { 511,13}, { 1087,12}, \
{ 2175,13}, { 1215,14}, { 639,13}, { 1471,14}, \
- { 767,13}, { 1663,14}, { 895,13}, { 1791,15}, \
+ { 767,13}, { 1663,14}, { 895,13}, { 1855,15}, \
{ 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
{ 2431,14}, { 1279,13}, { 2559,14}, { 1407,15}, \
{ 767,14}, { 1791,16}, { 511,15}, { 1023,14}, \
- { 2175,13}, { 4351,14}, { 2431,15}, { 1279,14}, \
- { 2687,13}, { 5375,14}, { 2815,15}, { 1535,14}, \
+ { 2431,15}, { 1279,14}, { 2943,15}, { 1535,14}, \
{ 3199,15}, { 1791,14}, { 3583,16}, { 1023,15}, \
- { 2047,14}, { 4351,15}, { 2303,14}, { 4991,15}, \
- { 2559,14}, { 5247,16}, { 1535,15}, { 3071,14}, \
- { 6399,15}, { 3327,14}, { 6911,15}, { 3583,17}, \
- { 1023,16}, { 2047,15}, { 4351,14}, { 8959,15}, \
- { 4863,16}, { 2559,15}, { 5375,14}, { 10751,15}, \
- { 5887,14}, { 11775,16}, { 65536,17}, { 131072,18}, \
- { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
- {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 198
+ { 2047,14}, { 4223,15}, { 2303,14}, { 4863,15}, \
+ { 2559,14}, { 5247,15}, { 2815,16}, { 1535,15}, \
+ { 3071,14}, { 6271,15}, { 3327,14}, { 6911,15}, \
+ { 3583,17}, { 1023,16}, { 2047,15}, { 4351,14}, \
+ { 8959,15}, { 4863,16}, { 2559,15}, { 5887,14}, \
+ { 11775,16}, { 3071,15}, { 6911,16}, { 3583,15}, \
+ { 7167,17}, { 2047,16}, { 4095,15}, { 8959,16}, \
+ { 4607,15}, { 9983,16}, { 5631,15}, { 11775,17}, \
+ { 3071,16}, { 6143,15}, { 12543,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 207
#define MUL_FFT_THRESHOLD 7552
-#define SQR_FFT_MODF_THRESHOLD 440 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 476 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 440, 5}, { 23, 6}, { 12, 5}, { 25, 6}, \
- { 27, 7}, { 14, 6}, { 29, 7}, { 15, 6}, \
- { 31, 7}, { 29, 8}, { 15, 7}, { 32, 8}, \
- { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
- { 21, 7}, { 43, 8}, { 29, 9}, { 15, 8}, \
+ { { 476, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { 12, 5}, { 25, 6}, { 29, 7}, { 28, 8}, \
+ { 15, 7}, { 32, 8}, { 17, 7}, { 35, 8}, \
+ { 19, 7}, { 39, 8}, { 21, 7}, { 43, 8}, \
+ { 23, 7}, { 47, 8}, { 29, 9}, { 15, 8}, \
{ 35, 9}, { 19, 8}, { 43, 9}, { 23, 8}, \
- { 51, 9}, { 27, 8}, { 55,10}, { 15, 9}, \
+ { 49, 9}, { 27, 8}, { 55,10}, { 15, 9}, \
{ 31, 8}, { 63, 9}, { 43,10}, { 23, 9}, \
{ 55,11}, { 15,10}, { 31, 9}, { 67,10}, \
{ 39, 9}, { 83,10}, { 47, 9}, { 95,10}, \
{ 55,11}, { 31,10}, { 79,11}, { 47,10}, \
{ 103,12}, { 31,11}, { 63,10}, { 135,11}, \
- { 79,10}, { 159,11}, { 111,12}, { 63,11}, \
- { 127,10}, { 255,11}, { 143,10}, { 287,11}, \
- { 159,12}, { 95,11}, { 191,10}, { 383, 9}, \
- { 767,10}, { 399,11}, { 207,13}, { 63,12}, \
- { 127,11}, { 255,10}, { 511,11}, { 271,10}, \
- { 543,11}, { 287,10}, { 575,12}, { 159,11}, \
- { 319,10}, { 639,11}, { 335,10}, { 671,11}, \
- { 351,10}, { 703,11}, { 367,12}, { 191,11}, \
- { 383,10}, { 767,11}, { 399,10}, { 799,11}, \
- { 415,12}, { 223,11}, { 447,13}, { 127,12}, \
- { 255,11}, { 543,12}, { 287,11}, { 607,12}, \
+ { 79,10}, { 167,11}, { 111,12}, { 63,11}, \
+ { 127,10}, { 255,11}, { 143,10}, { 287, 9}, \
+ { 575,11}, { 159,10}, { 319,12}, { 95,11}, \
+ { 191,10}, { 383, 9}, { 767,10}, { 399,13}, \
+ { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 271,10}, { 543,11}, { 287,10}, { 575,12}, \
+ { 159,11}, { 319,10}, { 639,11}, { 335,10}, \
+ { 671,11}, { 351,10}, { 703,11}, { 367,12}, \
+ { 191,11}, { 383,10}, { 767,11}, { 415,10}, \
+ { 831,12}, { 223,11}, { 447,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,11}, { 543,12}, \
+ { 287,11}, { 575,10}, { 1151,11}, { 607,12}, \
{ 319,11}, { 639,10}, { 1279,11}, { 671,12}, \
- { 351,11}, { 703,13}, { 191,12}, { 383,11}, \
- { 767,10}, { 1535,11}, { 799,12}, { 415,11}, \
- { 831,12}, { 447,14}, { 127,13}, { 255,12}, \
- { 511,11}, { 1023,12}, { 543,11}, { 1087,12}, \
- { 575,11}, { 1151,12}, { 607,13}, { 319,12}, \
- { 639,11}, { 1279,12}, { 671,11}, { 1343,12}, \
- { 735,13}, { 383,12}, { 831,13}, { 447,12}, \
+ { 351,11}, { 703,10}, { 1407,13}, { 191,12}, \
+ { 383,11}, { 799,12}, { 415,11}, { 831,12}, \
+ { 447,14}, { 127,13}, { 255,12}, { 511,11}, \
+ { 1023,12}, { 543,11}, { 1087,12}, { 575,11}, \
+ { 1151,12}, { 607,13}, { 319,12}, { 639,11}, \
+ { 1279,12}, { 671,11}, { 1343,12}, { 703,11}, \
+ { 1407,12}, { 735,13}, { 383,12}, { 767,11}, \
+ { 1535,12}, { 831,11}, { 1663,13}, { 447,12}, \
{ 959,14}, { 255,13}, { 511,12}, { 1087,13}, \
{ 575,12}, { 1215,13}, { 639,12}, { 1343,13}, \
{ 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
- { 1599,13}, { 831,12}, { 1663,13}, { 895,12}, \
+ { 1535,13}, { 831,12}, { 1727,13}, { 895,12}, \
{ 1791,13}, { 959,15}, { 255,14}, { 511,13}, \
{ 1087,12}, { 2175,13}, { 1215,14}, { 639,13}, \
- { 1407,14}, { 767,13}, { 1663,14}, { 895,13}, \
+ { 1471,14}, { 767,13}, { 1727,14}, { 895,13}, \
{ 1791,15}, { 511,14}, { 1023,13}, { 2175,14}, \
{ 1151,13}, { 2303,14}, { 1279,13}, { 2559,14}, \
{ 1407,15}, { 767,14}, { 1791,16}, { 511,15}, \
- { 1023,14}, { 2303,15}, { 1279,14}, { 2687,15}, \
+ { 1023,14}, { 2303,15}, { 1279,14}, { 2815,15}, \
{ 1535,14}, { 3199,15}, { 1791,16}, { 1023,15}, \
- { 2047,14}, { 4351,15}, { 2303,14}, { 4863,15}, \
- { 2559,14}, { 5247,16}, { 1535,15}, { 3071,14}, \
- { 6399,15}, { 3327,14}, { 6911,17}, { 1023,16}, \
- { 2047,15}, { 4351,14}, { 8959,15}, { 4863,16}, \
- { 2559,15}, { 5375,14}, { 10751,15}, { 5887,14}, \
- { 11775,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 201
+ { 2047,14}, { 4223,15}, { 2303,14}, { 4863,15}, \
+ { 2559,14}, { 5247,15}, { 2815,16}, { 1535,15}, \
+ { 3071,14}, { 6271,15}, { 3327,14}, { 6911,17}, \
+ { 1023,16}, { 2047,15}, { 4351,14}, { 8959,15}, \
+ { 4863,16}, { 2559,15}, { 5887,14}, { 11775,16}, \
+ { 3071,15}, { 6911,16}, { 3583,15}, { 7679,17}, \
+ { 2047,16}, { 4095,15}, { 8959,16}, { 4607,15}, \
+ { 9983,16}, { 5119,15}, { 10495,16}, { 5631,15}, \
+ { 11775,17}, { 3071,16}, { 6143,15}, { 12287,16}, \
+ { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+ {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 224
#define SQR_FFT_THRESHOLD 5568
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 60
+#define MULLO_DC_THRESHOLD 61
#define MULLO_MUL_N_THRESHOLD 14281
-#define SQRLO_BASECASE_THRESHOLD 8
+#define SQRLO_BASECASE_THRESHOLD 9
#define SQRLO_DC_THRESHOLD 0 /* never mpn_sqrlo_basecase */
#define SQRLO_SQR_THRESHOLD 10950
-#define DC_DIV_QR_THRESHOLD 56
-#define DC_DIVAPPR_Q_THRESHOLD 240
+#define DC_DIV_QR_THRESHOLD 54
+#define DC_DIVAPPR_Q_THRESHOLD 238
#define DC_BDIV_QR_THRESHOLD 54
-#define DC_BDIV_Q_THRESHOLD 44
+#define DC_BDIV_Q_THRESHOLD 42
#define INV_MULMOD_BNM1_THRESHOLD 54
-#define INV_NEWTON_THRESHOLD 226
-#define INV_APPR_THRESHOLD 218
+#define INV_NEWTON_THRESHOLD 252
+#define INV_APPR_THRESHOLD 230
-#define BINV_NEWTON_THRESHOLD 324
+#define BINV_NEWTON_THRESHOLD 327
#define REDC_1_TO_REDC_2_THRESHOLD 25
-#define REDC_2_TO_REDC_N_THRESHOLD 71
+#define REDC_2_TO_REDC_N_THRESHOLD 67
-#define MU_DIV_QR_THRESHOLD 1718
-#define MU_DIVAPPR_Q_THRESHOLD 1652
-#define MUPI_DIV_QR_THRESHOLD 102
+#define MU_DIV_QR_THRESHOLD 1620
+#define MU_DIVAPPR_Q_THRESHOLD 1620
+#define MUPI_DIV_QR_THRESHOLD 104
#define MU_BDIV_QR_THRESHOLD 1528
-#define MU_BDIV_Q_THRESHOLD 1589
+#define MU_BDIV_Q_THRESHOLD 1652
-#define POWM_SEC_TABLE 1,22,194,579,1297
+#define POWM_SEC_TABLE 1,22,321,473,2144
-#define GET_STR_DC_THRESHOLD 19
-#define GET_STR_PRECOMPUTE_THRESHOLD 27
+#define GET_STR_DC_THRESHOLD 15
+#define GET_STR_PRECOMPUTE_THRESHOLD 24
#define SET_STR_DC_THRESHOLD 248
-#define SET_STR_PRECOMPUTE_THRESHOLD 1616
-
-#define FAC_DSC_THRESHOLD 739
-#define FAC_ODD_THRESHOLD 0 /* always */
-
-#define MATRIX22_STRASSEN_THRESHOLD 18
-#define HGCD_THRESHOLD 135
-#define HGCD_APPR_THRESHOLD 50
-#define HGCD_REDUCE_THRESHOLD 3014
-#define GCD_DC_THRESHOLD 555
-#define GCDEXT_DC_THRESHOLD 469
-#define JACOBI_BASE_METHOD 4
+#define SET_STR_PRECOMPUTE_THRESHOLD 1304
+
+#define FAC_DSC_THRESHOLD 470
+#define FAC_ODD_THRESHOLD 25
+
+#define MATRIX22_STRASSEN_THRESHOLD 17
+#define HGCD2_DIV1_METHOD 5 /* 8.38% faster than 4 */
+#define HGCD_THRESHOLD 115
+#define HGCD_APPR_THRESHOLD 146
+#define HGCD_REDUCE_THRESHOLD 3524
+#define GCD_DC_THRESHOLD 535
+#define GCDEXT_DC_THRESHOLD 460
+#define JACOBI_BASE_METHOD 1 /* 0.90% faster than 4 */
+
+/* Tuneup completed successfully, took 448763 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/hamdist.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/hamdist.asm
index 44b67b5e4e6..f70494a33a2 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/hamdist.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/hamdist.asm
@@ -1,6 +1,6 @@
dnl AMD64 mpn_hamdist -- hamming distance.
-dnl Copyright 2008, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2008, 2010-2012, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -30,20 +30,26 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C AMD K8,K9 n/a
-C AMD K10 2
-C Intel P4 n/a
-C Intel core2 n/a
-C Intel corei 2.05
-C Intel atom n/a
-C VIA nano n/a
-
-C This is very straightforward 2-way unrolled code.
-
-C TODO
-C * Write something less basic. It should not be hard to reach 1.5 c/l with
-C 4-way unrolling.
+C cycles/limb
+C AMD K8,K9 -
+C AMD K10 2.0 =
+C AMD bd1 ~4.4 =
+C AMD bd2 ~4.4 =
+C AMD bd3
+C AMD bd4
+C AMD bobcat 7.55 =
+C AMD jaguar 2.52 -
+C Intel P4 -
+C Intel core2 -
+C Intel NHM 2.03 +
+C Intel SBR 2.01 +
+C Intel IBR 1.96 +
+C Intel HWL 1.64 =
+C Intel BWL 1.56 -
+C Intel SKL 1.52 =
+C Intel atom
+C Intel SLM 3.0 -
+C VIA nano
define(`ap', `%rdi')
define(`bp', `%rsi')
@@ -64,12 +70,12 @@ PROLOGUE(mpn_hamdist)
lea (bp,n,8), bp C point at B operand end
neg n
- bt $0, R32(n)
- jnc L(2)
+ test $1, R8(n)
+ jz L(2)
L(1): .byte 0xf3,0x49,0x0f,0xb8,0xc0 C popcnt %r8, %rax
xor R32(%r10), R32(%r10)
- add $1, n
+ inc n
js L(top)
FUNC_EXIT()
ret
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshift.asm
index a1cbc31f61b..cadf9b9d3b8 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshift.asm
@@ -1,4 +1,4 @@
-dnl X86-64 mpn_lshift optimised for Intel Sandy Bridge.
+dnl X86-64 mpn_lshift optimised for AMD K10.
dnl Copyright 2012 Free Software Foundation, Inc.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshiftc.asm
index ac90edb76b0..48a92e56f67 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshiftc.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/lshiftc.asm
@@ -1,4 +1,4 @@
-dnl X86-64 mpn_lshiftc optimised for Intel Sandy Bridge.
+dnl X86-64 mpn_lshiftc optimised for AMD K10.
dnl Copyright 2012 Free Software Foundation, Inc.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/rshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/rshift.asm
index 4c1c0d4cde0..249051a273e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/rshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/rshift.asm
@@ -1,4 +1,4 @@
-dnl X86-64 mpn_rshift optimised for Intel Sandy Bridge.
+dnl X86-64 mpn_rshift optimised for AMD K10.
dnl Copyright 2012 Free Software Foundation, Inc.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/addmul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/addmul_2.asm
index 18307d719fc..78bcba16a65 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/addmul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/addmul_2.asm
@@ -1,7 +1,7 @@
dnl AMD64 mpn_addmul_2 -- Multiply an n-limb vector with a 2-limb vector and
dnl add the result to a third limb vector.
-dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2008, 2011, 2012, 2016 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,14 +31,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
+C cycles/limb cycles/limb cfg cycles/limb am1+am1
C AMD K8,K9 2.375
C AMD K10 2.375
+C AMD bull 5.2 <- 4.6-4.75 bad
+C AMD pile 4.96 <- 4.6-4.75 bad
+C AMD steam ?
+C AMD excavator ?
+C AMD bobcat 5.75 5.0 bad
+C AMD jaguar 5.9 5.2-5.4 bad
C Intel P4 15-16
-C Intel core2 4.45
-C Intel NHM 4.32
-C Intel SBR 3.4
-C Intel atom ?
+C Intel core2 4.5 4.25-4.5 bad
+C Intel NHM 4.33 4.55 bad
+C Intel SBR 3.4 2.93 3.24 bad
+C Intel IBR 3.35 2.6 2.95 bad
+C Intel HWL 3.3 2.15 2.3 bad
+C Intel BWL 2.33 2.33 1.65 bad
+C Intel SKL 2.37 2.21 1.64 bad
+C Intel atom 20 18.7
+C Intel SLM 8 8.5
C VIA nano 4.4
C This code is the result of running a code generation and optimization tool
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/bdiv_q_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/bdiv_q_1.asm
new file mode 100644
index 00000000000..1172b0d116f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/bdiv_q_1.asm
@@ -0,0 +1,179 @@
+dnl AMD64 mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- Hensel division by 1-limb divisor,
+dnl returning quotient only.
+
+dnl Copyright 2001, 2002, 2004-2006, 2009, 2011, 2012, 2017 Free Software
+dnl 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C norm/unorm
+C AMD K8,K9 10 +
+C AMD K10 10 +
+C AMD bull 13.7 -
+C AMD pile 13.7 +
+C AMD steam
+C AMD excavator
+C AMD bobcat 15 -
+C AMD jaguar 16 -
+C Intel P4 33 =
+C Intel core2 13.25 =
+C Intel NHM 14 =
+C Intel SBR 8.5 -
+C Intel IBR 8.5 -
+C Intel HWL 8 =
+C Intel BWL 8 =
+C Intel SKL 8 =
+C Intel atom 42 --
+C Intel SLM 20.4 --
+C VIA nano
+
+C INPUT PARAMETERS
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`n', `%rdx')
+define(`d', `%rcx')
+define(`di', `%r8') C just mpn_pi1_bdiv_q_1
+define(`ncnt', `%r9') C just mpn_pi1_bdiv_q_1
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(mpn_bdiv_q_1)
+ FUNC_ENTRY(4)
+ push %rbx
+
+ mov %rcx, %rax
+ xor R32(%rcx), R32(%rcx) C ncnt count
+ mov %rdx, %r10
+
+ bt $0, R32(%rax)
+ jnc L(evn) C skip bsf unless divisor is even
+
+L(odd): mov %rax, %rbx
+ shr R32(%rax)
+ and $127, R32(%rax) C d/2, 7 bits
+
+ LEA( binvert_limb_table, %rdx)
+
+ movzbl (%rdx,%rax), R32(%rax) C inv 8 bits
+
+ mov %rbx, %r11 C d without twos
+
+ lea (%rax,%rax), R32(%rdx) C 2*inv
+ imul R32(%rax), R32(%rax) C inv*inv
+ imul R32(%rbx), R32(%rax) C inv*inv*d
+ sub R32(%rax), R32(%rdx) C inv = 2*inv - inv*inv*d, 16 bits
+
+ lea (%rdx,%rdx), R32(%rax) C 2*inv
+ imul R32(%rdx), R32(%rdx) C inv*inv
+ imul R32(%rbx), R32(%rdx) C inv*inv*d
+ sub R32(%rdx), R32(%rax) C inv = 2*inv - inv*inv*d, 32 bits
+
+ lea (%rax,%rax), %r8 C 2*inv
+ imul %rax, %rax C inv*inv
+ imul %rbx, %rax C inv*inv*d
+ sub %rax, %r8 C inv = 2*inv - inv*inv*d, 64 bits
+
+ jmp L(pi1)
+
+L(evn): bsf %rax, %rcx
+ shr R8(%rcx), %rax
+ jmp L(odd)
+EPILOGUE()
+
+PROLOGUE(mpn_pi1_bdiv_q_1)
+ FUNC_ENTRY(4)
+IFDOS(` mov 56(%rsp), %r8 ')
+IFDOS(` mov 64(%rsp), %r9 ')
+ push %rbx
+
+ mov %rcx, %r11 C d
+ mov %rdx, %r10 C n
+ mov %r9, %rcx C ncnt
+
+L(pi1): mov (up), %rax C up[0]
+
+ dec %r10
+ jz L(one)
+
+ mov 8(up), %rdx C up[1]
+ lea (up,%r10,8), up C up end
+ lea (rp,%r10,8), rp C rp end
+ neg %r10 C -n
+
+ shrd R8(%rcx), %rdx, %rax
+
+ xor R32(%rbx), R32(%rbx)
+ jmp L(ent)
+
+ ALIGN(8)
+L(top):
+ C rax q
+ C rbx carry bit, 0 or 1
+ C rcx ncnt
+ C rdx
+ C r10 counter, limbs, negative
+ C r11 d
+
+ mul %r11 C carry limb in rdx
+ mov (up,%r10,8), %rax
+ mov 8(up,%r10,8), %r9
+ shrd R8(%rcx), %r9, %rax
+ nop
+ sub %rbx, %rax C apply carry bit
+ setc R8(%rbx)
+ sub %rdx, %rax C apply carry limb
+ adc $0, R32(%rbx)
+L(ent): imul %r8, %rax
+ mov %rax, (rp,%r10,8)
+ inc %r10
+ jnz L(top)
+
+ mul %r11 C carry limb in rdx
+ mov (up), %rax C up high limb
+ shr R8(%rcx), %rax
+ sub %rbx, %rax C apply carry bit
+ sub %rdx, %rax C apply carry limb
+ imul %r8, %rax
+ mov %rax, (rp)
+ pop %rbx
+ FUNC_EXIT()
+ ret
+
+L(one): shr R8(%rcx), %rax
+ imul %r8, %rax
+ mov %rax, (rp)
+ pop %rbx
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/div_qr_1n_pi1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/div_qr_1n_pi1.asm
index 861402b2229..86de08cc8c5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/div_qr_1n_pi1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/div_qr_1n_pi1.asm
@@ -81,7 +81,7 @@ ABI_SUPPORT(STD64)
TEXT
ALIGN(16)
PROLOGUE(mpn_div_qr_1n_pi1)
- FUNC_ENTRY(6)
+ FUNC_ENTRY(4)
IFDOS(` mov 56(%rsp), %r8 ')
IFDOS(` mov 64(%rsp), %r9 ')
dec UN_INPUT
@@ -108,7 +108,7 @@ IFDOS(` mov 64(%rsp), %r9 ')
add $1, T
L(single_div_done):
mov T, (QP)
- FUNC_EXIT
+ FUNC_EXIT()
ret
L(first):
C FIXME: Could delay some of these until we enter the loop.
@@ -235,7 +235,7 @@ L(done):
pop %r13
pop %r14
pop %r15
- FUNC_EXIT
+ FUNC_EXIT()
ret
L(q_incr):
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/gmp-mparam.h
index df78c389234..d87cc3bf19e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/k8/gmp-mparam.h
@@ -1,6 +1,6 @@
/* AMD K8 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2012, 2014 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,20 +31,22 @@ see https://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 64
#define GMP_LIMB_BYTES 8
-// #undef mpn_sublsh_n
-// #define mpn_sublsh_n(rp,up,vp,n,c) \
-// (((rp) == (up)) ? mpn_submul_1 (rp, vp, n, CNST_LIMB(1) << (c)) \
-// : MPN(mpn_sublsh_n)(rp,up,vp,n,c))
+#if 0
+#undef mpn_sublsh_n
+#define mpn_sublsh_n(rp,up,vp,n,c) \
+ (((rp) == (up)) ? mpn_submul_1 (rp, vp, n, CNST_LIMB(1) << (c)) \
+ : MPN(mpn_sublsh_n)(rp,up,vp,n,c))
+#endif
/* 2500 MHz K8 Brisbane */
-/* FFT tuning limit = 25000000 */
-/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
+/* FFT tuning limit = 115,768,433 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 13
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 5
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 2
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 14
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 35
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
#define USE_PREINV_DIVREM_1 1 /* native */
@@ -54,183 +56,182 @@ see https://www.gnu.org/licenses/. */
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD 16
+#define DIV_1_VS_MUL_1_PERCENT 309
+
#define MUL_TOOM22_THRESHOLD 28
#define MUL_TOOM33_THRESHOLD 81
-#define MUL_TOOM44_THRESHOLD 242
-#define MUL_TOOM6H_THRESHOLD 345
-#define MUL_TOOM8H_THRESHOLD 482
+#define MUL_TOOM44_THRESHOLD 232
+#define MUL_TOOM6H_THRESHOLD 324
+#define MUL_TOOM8H_THRESHOLD 478
#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 153
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 161
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 175
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 166
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 154
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 160
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 226
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
#define SQR_TOOM2_THRESHOLD 34
-#define SQR_TOOM3_THRESHOLD 129
-#define SQR_TOOM4_THRESHOLD 527
-#define SQR_TOOM6_THRESHOLD 562
+#define SQR_TOOM3_THRESHOLD 114
+#define SQR_TOOM4_THRESHOLD 336
+#define SQR_TOOM6_THRESHOLD 430
#define SQR_TOOM8_THRESHOLD 0 /* always */
#define MULMID_TOOM42_THRESHOLD 36
-#define MULMOD_BNM1_THRESHOLD 18
-#define SQRMOD_BNM1_THRESHOLD 22
+#define MULMOD_BNM1_THRESHOLD 17
+#define SQRMOD_BNM1_THRESHOLD 19
#define MUL_FFT_MODF_THRESHOLD 654 /* k = 5 */
#define MUL_FFT_TABLE3 \
{ { 654, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
{ 12, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 15, 5}, { 31, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 19, 6}, { 39, 7}, { 29, 8}, \
- { 15, 7}, { 33, 8}, { 17, 7}, { 37, 8}, \
- { 19, 7}, { 39, 8}, { 23, 7}, { 47, 8}, \
- { 25, 7}, { 51, 8}, { 43, 9}, { 23, 8}, \
- { 51, 9}, { 27, 8}, { 57, 9}, { 31, 8}, \
- { 65, 9}, { 35, 8}, { 71, 9}, { 39, 8}, \
- { 79, 9}, { 43,10}, { 23, 9}, { 59, 8}, \
- { 119,10}, { 31, 8}, { 125, 9}, { 71,10}, \
- { 39, 9}, { 87,10}, { 47, 9}, { 99,10}, \
- { 55, 9}, { 123,11}, { 31,10}, { 63, 9}, \
- { 131,10}, { 71, 9}, { 143,10}, { 79, 9}, \
- { 159,10}, { 87,11}, { 47,10}, { 119,11}, \
- { 63,10}, { 143,11}, { 79,10}, { 175,11}, \
- { 95,10}, { 199,11}, { 111,10}, { 223,12}, \
- { 63,11}, { 143,10}, { 287, 9}, { 575,10}, \
- { 295,11}, { 159,10}, { 319,11}, { 175,12}, \
+ { 27, 7}, { 14, 6}, { 29, 7}, { 15, 6}, \
+ { 31, 7}, { 29, 8}, { 15, 7}, { 32, 8}, \
+ { 17, 7}, { 37, 8}, { 19, 7}, { 39, 8}, \
+ { 21, 7}, { 44, 8}, { 23, 7}, { 47, 8}, \
+ { 25, 7}, { 51, 8}, { 31, 7}, { 63, 8}, \
+ { 37, 9}, { 19, 8}, { 43, 9}, { 23, 8}, \
+ { 53, 9}, { 27, 8}, { 57, 9}, { 31, 8}, \
+ { 67, 9}, { 35, 8}, { 71, 9}, { 39, 8}, \
+ { 81, 9}, { 43,10}, { 23, 9}, { 55, 8}, \
+ { 111,10}, { 31, 9}, { 71,10}, { 39, 9}, \
+ { 87,10}, { 47, 9}, { 99,10}, { 55, 9}, \
+ { 111,11}, { 31,10}, { 63, 9}, { 131,10}, \
+ { 71, 9}, { 147,10}, { 87,11}, { 47,10}, \
+ { 111,11}, { 63,10}, { 143,11}, { 79,10}, \
+ { 167,11}, { 95,10}, { 199,11}, { 111,12}, \
+ { 63,11}, { 143,10}, { 287,11}, { 159,12}, \
{ 95,11}, { 191,10}, { 383,11}, { 207,10}, \
- { 415, 9}, { 831,11}, { 223,10}, { 447,13}, \
- { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
- { 271,10}, { 543, 9}, { 1087,11}, { 287,10}, \
- { 575, 9}, { 1151,12}, { 159,11}, { 319,10}, \
- { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
- { 703,11}, { 367,12}, { 191,11}, { 383,10}, \
- { 767,11}, { 399,10}, { 799,11}, { 415,10}, \
- { 831,12}, { 223,11}, { 447,10}, { 895,11}, \
- { 479,13}, { 127,12}, { 255,11}, { 511,10}, \
- { 1023,11}, { 543,10}, { 1087,12}, { 287,11}, \
- { 575,10}, { 1151,11}, { 607,12}, { 319,11}, \
- { 639,10}, { 1279,11}, { 671,12}, { 351,11}, \
- { 703,10}, { 1407,13}, { 191,12}, { 383,11}, \
- { 767,12}, { 415,11}, { 831,12}, { 447,11}, \
- { 895,12}, { 479,11}, { 959,14}, { 127,13}, \
- { 255,12}, { 511,11}, { 1023,12}, { 543,11}, \
- { 1087,12}, { 575,11}, { 1151,12}, { 607,11}, \
- { 1215,13}, { 319,12}, { 671,11}, { 1343,12}, \
- { 735,13}, { 383,12}, { 799,11}, { 1599,12}, \
- { 863,13}, { 447,12}, { 895,11}, { 1791,12}, \
- { 991,13}, { 511,12}, { 1087,13}, { 575,12}, \
- { 1215,13}, { 639,12}, { 1343,13}, { 703,12}, \
- { 1471,14}, { 383,13}, { 767,12}, { 1599,13}, \
- { 831,12}, { 1663,13}, { 895,12}, { 1791,13}, \
- { 959,12}, { 1919,14}, { 511,13}, { 1087,12}, \
- { 2175,13}, { 1215,14}, { 639,13}, { 1471,14}, \
- { 767,13}, { 1663,14}, { 895,13}, { 1919,15}, \
- { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
- { 2367,14}, { 1279,13}, { 2559,14}, { 1407,15}, \
- { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 205
+ { 415,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,12}, \
+ { 159,11}, { 319,10}, { 639,11}, { 335,10}, \
+ { 671,11}, { 351,12}, { 191,11}, { 415,12}, \
+ { 223,11}, { 447,13}, { 127,12}, { 255,11}, \
+ { 543,12}, { 287,11}, { 575,10}, { 1151,11}, \
+ { 607,12}, { 319,11}, { 671,12}, { 351,11}, \
+ { 703,13}, { 191,12}, { 383,11}, { 767,12}, \
+ { 415,11}, { 831,12}, { 447,11}, { 895,12}, \
+ { 479,14}, { 127,13}, { 255,12}, { 543,11}, \
+ { 1087,12}, { 575,11}, { 1151,12}, { 607,13}, \
+ { 319,12}, { 735,13}, { 383,12}, { 831,13}, \
+ { 447,12}, { 959,14}, { 255,13}, { 511,12}, \
+ { 1087,13}, { 575,12}, { 1215,13}, { 639,12}, \
+ { 1279,13}, { 703,12}, { 1407,14}, { 383,13}, \
+ { 767,12}, { 1535,13}, { 831,12}, { 1663,13}, \
+ { 959,15}, { 255,14}, { 511,13}, { 1215,14}, \
+ { 639,13}, { 1471,14}, { 767,13}, { 1663,14}, \
+ { 895,13}, { 1855,15}, { 511,14}, { 1023,13}, \
+ { 2047,14}, { 1151,13}, { 2367,14}, { 1407,15}, \
+ { 767,14}, { 1791,16}, { 511,15}, { 1023,14}, \
+ { 2303,15}, { 1279,14}, { 2687,15}, { 1535,14}, \
+ { 3199,15}, { 1791,16}, { 1023,15}, { 2047,14}, \
+ { 4223,15}, { 2303,14}, { 4735,15}, { 2559,16}, \
+ { 1535,15}, { 3071,14}, { 6271,15}, { 3327,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 183
#define MUL_FFT_THRESHOLD 11520
-#define SQR_FFT_MODF_THRESHOLD 570 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 540 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 570, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
+ { { 540, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
{ 12, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 14, 5}, { 29, 6}, { 16, 5}, { 33, 6}, \
- { 29, 7}, { 15, 6}, { 31, 7}, { 16, 6}, \
- { 33, 7}, { 17, 6}, { 35, 7}, { 33, 8}, \
- { 17, 7}, { 37, 8}, { 19, 7}, { 40, 8}, \
+ { 16, 5}, { 33, 6}, { 29, 7}, { 15, 6}, \
+ { 31, 7}, { 16, 6}, { 33, 7}, { 33, 8}, \
+ { 17, 7}, { 37, 8}, { 19, 7}, { 39, 8}, \
{ 21, 7}, { 43, 8}, { 23, 7}, { 47, 8}, \
{ 25, 7}, { 51, 8}, { 29, 9}, { 15, 8}, \
{ 37, 9}, { 19, 8}, { 43, 9}, { 23, 8}, \
{ 51, 9}, { 27, 8}, { 55, 9}, { 31, 8}, \
- { 63, 9}, { 35, 8}, { 71, 9}, { 39, 8}, \
- { 79, 9}, { 43,10}, { 23, 9}, { 55,10}, \
- { 31, 9}, { 71,10}, { 39, 9}, { 83,10}, \
- { 47, 9}, { 99,10}, { 55, 9}, { 123,11}, \
- { 31,10}, { 63, 9}, { 127,10}, { 71, 9}, \
- { 143,10}, { 87,11}, { 47,10}, { 111,12}, \
+ { 65, 9}, { 35, 8}, { 71, 9}, { 43,10}, \
+ { 23, 9}, { 55,10}, { 31, 9}, { 71,10}, \
+ { 39, 9}, { 83,10}, { 47, 9}, { 99,10}, \
+ { 55, 9}, { 111,11}, { 31,10}, { 63, 9}, \
+ { 127,10}, { 87,11}, { 47,10}, { 111,12}, \
{ 31,11}, { 63,10}, { 143,11}, { 79,10}, \
- { 167,11}, { 95,10}, { 199,11}, { 111,12}, \
+ { 167,11}, { 95,10}, { 191,11}, { 111,12}, \
{ 63,11}, { 127, 9}, { 511,11}, { 143,10}, \
- { 287, 9}, { 575, 8}, { 1151,11}, { 159,10}, \
- { 319, 9}, { 639,11}, { 175,12}, { 95,11}, \
+ { 287, 9}, { 575,11}, { 159,12}, { 95,11}, \
{ 191,10}, { 383, 9}, { 767,11}, { 207,10}, \
- { 415, 9}, { 831,10}, { 431,11}, { 223,10}, \
- { 447,13}, { 63,12}, { 127,10}, { 511, 9}, \
- { 1023,10}, { 543, 9}, { 1087,11}, { 287,10}, \
- { 575, 9}, { 1151,12}, { 159,11}, { 319,10}, \
- { 639, 9}, { 1279,11}, { 335,10}, { 671,11}, \
- { 351,10}, { 703,11}, { 367,12}, { 191,11}, \
- { 383,10}, { 767,11}, { 399,10}, { 799,11}, \
- { 415,10}, { 831,11}, { 431,12}, { 223,11}, \
- { 447,10}, { 895,11}, { 463,13}, { 127,11}, \
- { 511,10}, { 1023,11}, { 543,10}, { 1087,12}, \
- { 287,11}, { 575,10}, { 1151,11}, { 607,10}, \
- { 1215,12}, { 319,11}, { 639,10}, { 1279,11}, \
- { 671,12}, { 351,11}, { 703,10}, { 1407,13}, \
- { 191,12}, { 383,11}, { 767,10}, { 1535,11}, \
- { 799,12}, { 415,11}, { 831,12}, { 447,11}, \
- { 895,12}, { 479,14}, { 127,12}, { 511,11}, \
+ { 415,13}, { 63,12}, { 127,10}, { 511, 9}, \
+ { 1023,11}, { 271,10}, { 543, 9}, { 1087,11}, \
+ { 287,10}, { 575,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
+ { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 415,10}, { 831,12}, { 223,11}, { 447,13}, \
+ { 127,11}, { 511,10}, { 1023,11}, { 543,10}, \
+ { 1087,12}, { 287,11}, { 575,10}, { 1151,11}, \
+ { 607,12}, { 319,11}, { 639,10}, { 1279,11}, \
+ { 671,12}, { 351,11}, { 703,13}, { 191,12}, \
+ { 383,11}, { 767,12}, { 415,11}, { 831,12}, \
+ { 447,11}, { 895,14}, { 127,12}, { 511,11}, \
{ 1023,12}, { 543,11}, { 1087,12}, { 575,11}, \
{ 1151,12}, { 607,11}, { 1215,13}, { 319,12}, \
{ 639,11}, { 1279,12}, { 671,11}, { 1343,12}, \
{ 703,11}, { 1407,12}, { 735,13}, { 383,12}, \
- { 799,11}, { 1599,12}, { 863,13}, { 447,12}, \
+ { 767,11}, { 1535,12}, { 831,13}, { 447,12}, \
{ 959,13}, { 511,12}, { 1087,13}, { 575,12}, \
{ 1215,13}, { 639,12}, { 1343,13}, { 703,12}, \
- { 1471,14}, { 383,13}, { 767,12}, { 1599,13}, \
+ { 1407,14}, { 383,13}, { 767,12}, { 1535,13}, \
{ 831,12}, { 1663,13}, { 895,12}, { 1791,13}, \
- { 959,14}, { 511,13}, { 1023,12}, { 2047,13}, \
- { 1215,14}, { 639,13}, { 1471,14}, { 767,13}, \
- { 1663,14}, { 895,13}, { 1855,15}, { 511,14}, \
- { 1023,13}, { 2111,14}, { 1151,13}, { 2303,14}, \
- { 1407,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
+ { 959,14}, { 511,13}, { 1215,14}, { 639,13}, \
+ { 1471,14}, { 767,13}, { 1663,14}, { 895,13}, \
+ { 1791,15}, { 511,14}, { 1023,13}, { 2111,14}, \
+ { 1151,13}, { 2303,14}, { 1407,15}, { 767,14}, \
+ { 1791,16}, { 511,15}, { 1023,14}, { 2303,15}, \
+ { 1279,14}, { 2687,15}, { 1535,14}, { 3199,15}, \
+ { 1791,16}, { 1023,15}, { 2047,14}, { 4223,15}, \
+ { 2303,14}, { 4863,15}, { 2559,16}, { 1535,15}, \
+ { 3071,14}, { 6271,15}, { 3327,17}, { 131072,18}, \
{ 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
{4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 214
-#define SQR_FFT_THRESHOLD 5760
+#define SQR_FFT_TABLE3_SIZE 202
+#define SQR_FFT_THRESHOLD 7296
#define MULLO_BASECASE_THRESHOLD 0 /* always */
#define MULLO_DC_THRESHOLD 61
-#define MULLO_MUL_N_THRESHOLD 22906
+#define MULLO_MUL_N_THRESHOLD 22239
+#define SQRLO_BASECASE_THRESHOLD 8
+#define SQRLO_DC_THRESHOLD 0 /* never mpn_sqrlo_basecase */
+#define SQRLO_SQR_THRESHOLD 14281
-#define DC_DIV_QR_THRESHOLD 51
-#define DC_DIVAPPR_Q_THRESHOLD 264
+#define DC_DIV_QR_THRESHOLD 47
+#define DC_DIVAPPR_Q_THRESHOLD 266
#define DC_BDIV_QR_THRESHOLD 38
-#define DC_BDIV_Q_THRESHOLD 170
+#define DC_BDIV_Q_THRESHOLD 104
-#define INV_MULMOD_BNM1_THRESHOLD 67
-#define INV_NEWTON_THRESHOLD 246
-#define INV_APPR_THRESHOLD 244
+#define INV_MULMOD_BNM1_THRESHOLD 54
+#define INV_NEWTON_THRESHOLD 252
+#define INV_APPR_THRESHOLD 250
-#define BINV_NEWTON_THRESHOLD 252
+#define BINV_NEWTON_THRESHOLD 258
#define REDC_1_TO_REDC_2_THRESHOLD 35
-#define REDC_2_TO_REDC_N_THRESHOLD 84
+#define REDC_2_TO_REDC_N_THRESHOLD 79
#define MU_DIV_QR_THRESHOLD 2089
-#define MU_DIVAPPR_Q_THRESHOLD 1752
-#define MUPI_DIV_QR_THRESHOLD 93
-#define MU_BDIV_QR_THRESHOLD 1718
+#define MU_DIVAPPR_Q_THRESHOLD 1895
+#define MUPI_DIV_QR_THRESHOLD 99
+#define MU_BDIV_QR_THRESHOLD 1787
#define MU_BDIV_Q_THRESHOLD 1895
-#define POWM_SEC_TABLE 2,16,194,904,2177
+#define POWM_SEC_TABLE 1,16,194,960,2825
-#define MATRIX22_STRASSEN_THRESHOLD 21
-#define HGCD_THRESHOLD 148
-#define HGCD_APPR_THRESHOLD 185
-#define HGCD_REDUCE_THRESHOLD 4120
-#define GCD_DC_THRESHOLD 562
-#define GCDEXT_DC_THRESHOLD 501
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 17
-#define GET_STR_PRECOMPUTE_THRESHOLD 29
-#define SET_STR_DC_THRESHOLD 268
-#define SET_STR_PRECOMPUTE_THRESHOLD 1787
+#define GET_STR_DC_THRESHOLD 16
+#define GET_STR_PRECOMPUTE_THRESHOLD 26
+#define SET_STR_DC_THRESHOLD 248
+#define SET_STR_PRECOMPUTE_THRESHOLD 1747
#define FAC_DSC_THRESHOLD 1240
-#define FAC_ODD_THRESHOLD 0 /* always */
+#define FAC_ODD_THRESHOLD 27
+
+#define MATRIX22_STRASSEN_THRESHOLD 21
+#define HGCD2_DIV1_METHOD 3 /* 4.10% faster than 5 */
+#define HGCD_THRESHOLD 141
+#define HGCD_APPR_THRESHOLD 181
+#define HGCD_REDUCE_THRESHOLD 4633
+#define GCD_DC_THRESHOLD 622
+#define GCDEXT_DC_THRESHOLD 496
+#define JACOBI_BASE_METHOD 1 /* 0.97% faster than 3 */
+
+/* Tuneup completed successfully, took 131832 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/logops_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/logops_n.asm
index b277f589624..e25854d260e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/logops_n.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/logops_n.asm
@@ -1,6 +1,6 @@
dnl AMD64 logops.
-dnl Copyright 2004-2006, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2004-2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,48 +31,61 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-C cycles/limb
-C AMD K8,K9 1.5 with fluctuations for variant 2 and 3
-C AMD K10 1.5 with fluctuations for all variants
-C Intel P4 2.8/3.35/3.60 (variant1/variant2/variant3)
-C Intel core2 2
-C Intel NHM 2
-C Intel SBR 1.5/1.75/1.75
-C Intel atom 3.75
+C c/l c/l c/l good
+C var-1 var-2 var-3 for cpu?
+C AMD K8,K9 1.5 1.5 1.5 y
+C AMD K10 1.5 1.5 1.5 y
+C AMD bd1
+C AMD bd2
+C AMD bd3
+C AMD bd4
+C AMD bt1 2.67 ~2.79 ~2.67
+C AMD bt2 2.0 2.28 2.28 y
+C AMD zen 1.5 1.5 1.5 =
+C Intel P4 2.8 3.35 3.6
+C Intel PNR 2.0 2.0 2.0 =
+C Intel NHM 2.0 2.0 2.0 =
+C Intel SBR 1.5 1.75 1.75 n
+C Intel IBR 1.48 1.71 1.72 n
+C Intel HWL 1.5 1.5 1.5 n
+C Intel BWL 1.5 1.5 1.5 n
+C Intel SKL 1.5 1.5 1.5 n
+C Intel atom 3.82 3.82 3.82 n
+C Intel SLM 3.0 3.0 3.0 =
C VIA nano 3.25
ifdef(`OPERATION_and_n',`
define(`func',`mpn_and_n')
define(`VARIANT_1')
- define(`LOGOP',`andq')')
+ define(`LOGOP',`and')')
ifdef(`OPERATION_andn_n',`
define(`func',`mpn_andn_n')
define(`VARIANT_2')
- define(`LOGOP',`andq')')
+ define(`LOGOP',`and')')
ifdef(`OPERATION_nand_n',`
define(`func',`mpn_nand_n')
define(`VARIANT_3')
- define(`LOGOP',`andq')')
+ define(`LOGOP',`and')')
ifdef(`OPERATION_ior_n',`
define(`func',`mpn_ior_n')
define(`VARIANT_1')
- define(`LOGOP',`orq')')
+ define(`LOGOP',`or')')
ifdef(`OPERATION_iorn_n',`
define(`func',`mpn_iorn_n')
define(`VARIANT_2')
- define(`LOGOP',`orq')')
+ define(`LOGOP',`or')')
ifdef(`OPERATION_nior_n',`
define(`func',`mpn_nior_n')
define(`VARIANT_3')
- define(`LOGOP',`orq')')
+ define(`LOGOP',`or')')
ifdef(`OPERATION_xor_n',`
define(`func',`mpn_xor_n')
define(`VARIANT_1')
- define(`LOGOP',`xorq')')
+ define(`LOGOP',`xor')')
ifdef(`OPERATION_xnor_n',`
define(`func',`mpn_xnor_n')
define(`VARIANT_2')
- define(`LOGOP',`xorq')')
+ define(`LOGOP',`xor')')
MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n)
@@ -93,44 +106,45 @@ ifdef(`VARIANT_1',`
ALIGN(32)
PROLOGUE(func)
FUNC_ENTRY(4)
- movq (vp), %r8
- movl R32(%rcx), R32(%rax)
- leaq (vp,n,8), vp
- leaq (up,n,8), up
- leaq (rp,n,8), rp
- negq n
- andl $3, R32(%rax)
+ mov (vp), %r8
+ mov R32(%rcx), R32(%rax)
+ lea (vp,n,8), vp
+ lea (up,n,8), up
+ lea (rp,n,8), rp
+ neg n
+ and $3, R32(%rax)
je L(b00)
- cmpl $2, R32(%rax)
+ cmp $2, R32(%rax)
jc L(b01)
je L(b10)
L(b11): LOGOP (up,n,8), %r8
- movq %r8, (rp,n,8)
- decq n
+ mov %r8, (rp,n,8)
+ dec n
jmp L(e11)
-L(b10): addq $-2, n
+L(b10): add $-2, n
jmp L(e10)
L(b01): LOGOP (up,n,8), %r8
- movq %r8, (rp,n,8)
- incq n
+ mov %r8, (rp,n,8)
+ inc n
jz L(ret)
-L(oop): movq (vp,n,8), %r8
-L(b00): movq 8(vp,n,8), %r9
+L(top): mov (vp,n,8), %r8
+L(b00): mov 8(vp,n,8), %r9
LOGOP (up,n,8), %r8
LOGOP 8(up,n,8), %r9
- nop
- movq %r8, (rp,n,8)
- movq %r9, 8(rp,n,8)
-L(e11): movq 16(vp,n,8), %r8
-L(e10): movq 24(vp,n,8), %r9
+ nop C K8/K9/K10 concession
+ mov %r8, (rp,n,8)
+ mov %r9, 8(rp,n,8)
+L(e11): mov 16(vp,n,8), %r8
+L(e10): mov 24(vp,n,8), %r9
LOGOP 16(up,n,8), %r8
LOGOP 24(up,n,8), %r9
- movq %r8, 16(rp,n,8)
- movq %r9, 24(rp,n,8)
- addq $4, n
- jnc L(oop)
+ mov %r8, 16(rp,n,8)
+ mov %r9, 24(rp,n,8)
+ add $4, n
+ jnc L(top)
+
L(ret): FUNC_EXIT()
ret
EPILOGUE()
@@ -141,49 +155,50 @@ ifdef(`VARIANT_2',`
ALIGN(32)
PROLOGUE(func)
FUNC_ENTRY(4)
- movq (vp), %r8
- notq %r8
- movl R32(%rcx), R32(%rax)
- leaq (vp,n,8), vp
- leaq (up,n,8), up
- leaq (rp,n,8), rp
- negq n
- andl $3, R32(%rax)
+ mov (vp), %r8
+ not %r8
+ mov R32(%rcx), R32(%rax)
+ lea (vp,n,8), vp
+ lea (up,n,8), up
+ lea (rp,n,8), rp
+ neg n
+ and $3, R32(%rax)
je L(b00)
- cmpl $2, R32(%rax)
+ cmp $2, R32(%rax)
jc L(b01)
je L(b10)
L(b11): LOGOP (up,n,8), %r8
- movq %r8, (rp,n,8)
- decq n
+ mov %r8, (rp,n,8)
+ dec n
jmp L(e11)
-L(b10): addq $-2, n
+L(b10): add $-2, n
jmp L(e10)
.byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90
L(b01): LOGOP (up,n,8), %r8
- movq %r8, (rp,n,8)
- incq n
+ mov %r8, (rp,n,8)
+ inc n
jz L(ret)
-L(oop): movq (vp,n,8), %r8
- notq %r8
-L(b00): movq 8(vp,n,8), %r9
- notq %r9
+L(top): mov (vp,n,8), %r8
+ not %r8
+L(b00): mov 8(vp,n,8), %r9
+ not %r9
LOGOP (up,n,8), %r8
LOGOP 8(up,n,8), %r9
- movq %r8, (rp,n,8)
- movq %r9, 8(rp,n,8)
-L(e11): movq 16(vp,n,8), %r8
- notq %r8
-L(e10): movq 24(vp,n,8), %r9
- notq %r9
+ mov %r8, (rp,n,8)
+ mov %r9, 8(rp,n,8)
+L(e11): mov 16(vp,n,8), %r8
+ not %r8
+L(e10): mov 24(vp,n,8), %r9
+ not %r9
LOGOP 16(up,n,8), %r8
LOGOP 24(up,n,8), %r9
- movq %r8, 16(rp,n,8)
- movq %r9, 24(rp,n,8)
- addq $4, n
- jnc L(oop)
+ mov %r8, 16(rp,n,8)
+ mov %r9, 24(rp,n,8)
+ add $4, n
+ jnc L(top)
+
L(ret): FUNC_EXIT()
ret
EPILOGUE()
@@ -194,50 +209,51 @@ ifdef(`VARIANT_3',`
ALIGN(32)
PROLOGUE(func)
FUNC_ENTRY(4)
- movq (vp), %r8
- movl R32(%rcx), R32(%rax)
- leaq (vp,n,8), vp
- leaq (up,n,8), up
- leaq (rp,n,8), rp
- negq n
- andl $3, R32(%rax)
+ mov (vp), %r8
+ mov R32(%rcx), R32(%rax)
+ lea (vp,n,8), vp
+ lea (up,n,8), up
+ lea (rp,n,8), rp
+ neg n
+ and $3, R32(%rax)
je L(b00)
- cmpl $2, R32(%rax)
+ cmp $2, R32(%rax)
jc L(b01)
je L(b10)
L(b11): LOGOP (up,n,8), %r8
- notq %r8
- movq %r8, (rp,n,8)
- decq n
+ not %r8
+ mov %r8, (rp,n,8)
+ dec n
jmp L(e11)
-L(b10): addq $-2, n
+L(b10): add $-2, n
jmp L(e10)
.byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90
L(b01): LOGOP (up,n,8), %r8
- notq %r8
- movq %r8, (rp,n,8)
- incq n
+ not %r8
+ mov %r8, (rp,n,8)
+ inc n
jz L(ret)
-L(oop): movq (vp,n,8), %r8
-L(b00): movq 8(vp,n,8), %r9
+L(top): mov (vp,n,8), %r8
+L(b00): mov 8(vp,n,8), %r9
LOGOP (up,n,8), %r8
- notq %r8
+ not %r8
LOGOP 8(up,n,8), %r9
- notq %r9
- movq %r8, (rp,n,8)
- movq %r9, 8(rp,n,8)
-L(e11): movq 16(vp,n,8), %r8
-L(e10): movq 24(vp,n,8), %r9
+ not %r9
+ mov %r8, (rp,n,8)
+ mov %r9, 8(rp,n,8)
+L(e11): mov 16(vp,n,8), %r8
+L(e10): mov 24(vp,n,8), %r9
LOGOP 16(up,n,8), %r8
- notq %r8
+ not %r8
LOGOP 24(up,n,8), %r9
- notq %r9
- movq %r8, 16(rp,n,8)
- movq %r9, 24(rp,n,8)
- addq $4, n
- jnc L(oop)
+ not %r9
+ mov %r8, 16(rp,n,8)
+ mov %r9, 24(rp,n,8)
+ add $4, n
+ jnc L(top)
+
L(ret): FUNC_EXIT()
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/lshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/lshift.asm
index f368944b85d..fff31520d9e 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/lshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/lshift.asm
@@ -1,7 +1,7 @@
dnl AMD64 mpn_lshift -- mpn left shift.
-dnl Copyright 2003, 2005, 2007, 2009, 2011, 2012 Free Software Foundation,
-dnl Inc.
+dnl Copyright 2003, 2005, 2007, 2009, 2011, 2012, 2018 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -56,82 +56,7 @@ ASM_START()
ALIGN(32)
PROLOGUE(mpn_lshift)
FUNC_ENTRY(4)
- cmp $1, R8(%rcx)
- jne L(gen)
-
-C For cnt=1 we want to work from lowest limb towards higher limbs.
-C Check for bad overlap (up=rp is OK!) up=rp+1..rp+n-1 is bad.
-C FIXME: this could surely be done more cleverly.
-
- mov rp, %rax
- sub up, %rax
- je L(fwd) C rp = up
- shr $3, %rax
- cmp n, %rax
- jb L(gen)
-
-L(fwd): mov R32(n), R32(%rax)
- shr $2, n
- je L(e1)
- and $3, R32(%rax)
-
- ALIGN(8)
- nop
- nop
-L(t1): mov (up), %r8
- mov 8(up), %r9
- mov 16(up), %r10
- mov 24(up), %r11
- lea 32(up), up
- adc %r8, %r8
- mov %r8, (rp)
- adc %r9, %r9
- mov %r9, 8(rp)
- adc %r10, %r10
- mov %r10, 16(rp)
- adc %r11, %r11
- mov %r11, 24(rp)
- lea 32(rp), rp
- dec n
- jne L(t1)
-
- inc R32(%rax)
- dec R32(%rax)
- jne L(n00)
- adc R32(%rax), R32(%rax)
- FUNC_EXIT()
- ret
-L(e1): test R32(%rax), R32(%rax) C clear cy
-L(n00): mov (up), %r8
- dec R32(%rax)
- jne L(n01)
- adc %r8, %r8
- mov %r8, (rp)
-L(ret): adc R32(%rax), R32(%rax)
- FUNC_EXIT()
- ret
-L(n01): dec R32(%rax)
- mov 8(up), %r9
- jne L(n10)
- adc %r8, %r8
- adc %r9, %r9
- mov %r8, (rp)
- mov %r9, 8(rp)
- adc R32(%rax), R32(%rax)
- FUNC_EXIT()
- ret
-L(n10): mov 16(up), %r10
- adc %r8, %r8
- adc %r9, %r9
- adc %r10, %r10
- mov %r8, (rp)
- mov %r9, 8(rp)
- mov %r10, 16(rp)
- adc $-1, R32(%rax)
- FUNC_EXIT()
- ret
-
-L(gen): neg R32(%rcx) C put rsh count in cl
+ neg R32(%rcx) C put rsh count in cl
mov -8(up,n,8), %rax
shr R8(%rcx), %rax C function return value
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_1.asm
index 09b5dd1e1a1..255305f3fcb 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_1.asm
@@ -198,8 +198,10 @@ PROLOGUE(mpn_mod_1_1p_cps)
sal R8(%rcx), %r12
IFSTD(` mov %r12, %rdi ') C pass parameter
IFDOS(` mov %r12, %rcx ') C pass parameter
+IFDOS(` sub $32, %rsp ')
ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
+IFDOS(` add $32, %rsp ')
neg %r12
mov %r12, %r8
mov %rax, (%rbx) C store bi
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_2.asm
index 09d856e6e6b..40fcaebf40f 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_2.asm
@@ -183,8 +183,10 @@ PROLOGUE(mpn_mod_1s_2p_cps)
sal R8(%rcx), %r12 C b << cnt
IFSTD(` mov %r12, %rdi ') C pass parameter
IFDOS(` mov %r12, %rcx ') C pass parameter
+IFDOS(` sub $32, %rsp ')
ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
+IFDOS(` add $32, %rsp ')
mov %r12, %r8
mov %rax, %r11
mov %rax, (%rbx) C store bi
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_4.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_4.asm
index ae34617c7f2..6cf304cf2f1 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_4.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_1_4.asm
@@ -190,8 +190,10 @@ PROLOGUE(mpn_mod_1s_4p_cps)
sal R8(%rcx), %r12 C b << cnt
IFSTD(` mov %r12, %rdi ') C pass parameter
IFDOS(` mov %r12, %rcx ') C pass parameter
+IFDOS(` sub $32, %rsp ')
ASSERT(nz, `test $15, %rsp')
CALL( mpn_invert_limb)
+IFDOS(` add $32, %rsp ')
mov %r12, %r8
mov %rax, %r11
mov %rax, (%rbx) C store bi
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_34lsub1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_34lsub1.asm
index 62bdcfac690..75421a6ec24 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_34lsub1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mod_34lsub1.asm
@@ -36,12 +36,22 @@ C cycles/limb
C AMD K8,K9 0.67 0.583 is possible with zero-reg instead of $0, 4-way
C AMD K10 0.67 this seems hard to beat
C AMD bd1 1
+C AMD bd2 1
+C AMD bd3 ?
+C AMD bd4 ?
+C AMD zen 0.62
C AMD bobcat 1.07
+C AMD jaguar 1
C Intel P4 7.35 terrible, use old code
C Intel core2 1.25 1+epsilon with huge unrolling
C Intel NHM 1.15 this seems hard to beat
C Intel SBR 0.93
+C Intel IBR 0.93
+C Intel HWL 0.82
+C Intel BWL 0.64
+C Intel SKY 0.60
C Intel atom 2.5
+C Intel SLM 1.59
C VIA nano 1.25 this seems hard to beat
C INPUT PARAMETERS
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_1.asm
index b032afc9ddb..e1ba89b0481 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_1.asm
@@ -31,16 +31,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9 2.5
-C AMD K10 2.5
-C AMD bd1 5.0
-C AMD bobcat 5.5
-C Intel P4 12.3
-C Intel core2 4.0
-C Intel NHM 3.75
-C Intel SBR 2.95
-C Intel atom 19.8
-C VIA nano 4.25
+C AMD K8,K9 2.54
+C AMD K10 2.54
+C AMD bull 4.98
+C AMD pile 4.80
+C AMD steam
+C AMD excavator
+C AMD bobcat 5.37
+C AMD jaguar 6.16
+C Intel P4 12.6
+C Intel core2 4.05
+C Intel NHM 4.0
+C Intel SBR 2.91
+C Intel IBR 2.73
+C Intel HWL 2.44
+C Intel BWL 2.39
+C Intel SKL 2.44
+C Intel atom 19.8
+C Intel SLM 9.0
+C VIA nano 4.25
C The loop of this code is the result of running a code generation and
C optimization tool suite written by David Harvey and Torbjorn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_2.asm
index f408c52250e..d64313b32a7 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_2.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mul_2.asm
@@ -1,7 +1,7 @@
dnl AMD64 mpn_mul_2 -- Multiply an n-limb vector with a 2-limb vector and
dnl store the result in a third limb vector.
-dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2008, 2011, 2012, 2016 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -32,13 +32,25 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
-C AMD K8,K9 2.275
-C AMD K10 2.275
-C Intel P4 13.5
-C Intel core2 4.0
-C Intel corei 3.8
-C Intel atom ?
-C VIA nano ?
+C AMD K8,K9 4.53
+C AMD K10 4.53
+C AMD bull 9.76 10.37
+C AMD pile 9.22
+C AMD steam
+C AMD excavator
+C AMD bobcat 11.3
+C AMD jaguar 11.9
+C Intel P4 25.0
+C Intel core2 8.05
+C Intel NHM 7.72
+C Intel SBR 6.33
+C Intel IBR 6.15
+C Intel HWL 6.00
+C Intel BWL 4.44
+C Intel SKL 4.54
+C Intel atom 39.0
+C Intel SLM 24.0
+C VIA nano
C This code is the result of running a code generation and optimization tool
C suite written by David Harvey and Torbjorn Granlund.
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/adx/addmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/adx/addmul_1.asm
index ea607899a4c..9ceb611cb9d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/adx/addmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/adx/addmul_1.asm
@@ -36,14 +36,22 @@ C cycles/limb
C AMD K8,K9 -
C AMD K10 -
C AMD bd1 -
-C AMD bobcat -
+C AMD bd2 -
+C AMD bd3 -
+C AMD bd4 -
+C AMD zen ?
+C AMD bt1 -
+C AMD bt2 -
C Intel P4 -
C Intel PNR -
C Intel NHM -
C Intel SBR -
+C Intel IBR -
C Intel HWL -
C Intel BWL ?
+C Intel SKL ?
C Intel atom -
+C Intel SLM -
C VIA nano -
define(`rp', `%rdi') dnl rcx
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/nano/gcd_11.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/nano/gcd_11.asm
new file mode 100644
index 00000000000..4723093bb46
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/nano/gcd_11.asm
@@ -0,0 +1,37 @@
+dnl AMD64 mpn_gcd_11.
+
+dnl Copyright 2012 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_gcd_11)
+include_mpn(`x86_64/core2/gcd_11.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/addmul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/addmul_2.asm
new file mode 100644
index 00000000000..7ae6a1a3cdf
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/addmul_2.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_addmul_2 optimised for Intel Nocona.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addmul_2)
+include_mpn(`x86_64/bd1/addmul_2.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/aorsmul_1.asm
new file mode 100644
index 00000000000..e5dbb34a299
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/aorsmul_1.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_addmul_1 and mpn_submul_1 optimised for Intel Nocona.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+include_mpn(`x86_64/bd1/aorsmul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/gmp-mparam.h
index 2171e230a5c..9c79310e551 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/gmp-mparam.h
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/gmp-mparam.h
@@ -1,6 +1,6 @@
/* Pentium 4-64 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2010, 2014 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -38,194 +38,220 @@ see https://www.gnu.org/licenses/. */
#undef HAVE_NATIVE_mpn_addlsh_n
#undef HAVE_NATIVE_mpn_rsblsh_n
-/* 3400 MHz Pentium4 Nocona / 1024 Kibyte cache */
-/* FFT tuning limit = 25000000 */
-/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
+/* 3400 MHz Pentium4 Nocona / 1024 Kibyte L2 cache */
+/* FFT tuning limit = 107,095,964 */
+/* Generated by tuneup.c, 2019-11-09, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 5
#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 16
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 14
#define MOD_1_2_TO_MOD_1_4_THRESHOLD 32
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 11
#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_NORM_THRESHOLD 2
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 12
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
#define BMOD_1_TO_MOD_1_THRESHOLD 20
+#define DIV_1_VS_MUL_1_PERCENT 228
+
#define MUL_TOOM22_THRESHOLD 12
-#define MUL_TOOM33_THRESHOLD 41
-#define MUL_TOOM44_THRESHOLD 112
-#define MUL_TOOM6H_THRESHOLD 157
-#define MUL_TOOM8H_THRESHOLD 236
+#define MUL_TOOM33_THRESHOLD 81
+#define MUL_TOOM44_THRESHOLD 130
+#define MUL_TOOM6H_THRESHOLD 173
+#define MUL_TOOM8H_THRESHOLD 430
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
#define MUL_TOOM32_TO_TOOM53_THRESHOLD 91
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 81
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 78
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 106
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 89
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 88
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 112
-#define SQR_BASECASE_THRESHOLD 5
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 53
-#define SQR_TOOM4_THRESHOLD 154
-#define SQR_TOOM6_THRESHOLD 197
-#define SQR_TOOM8_THRESHOLD 296
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 18
+#define SQR_TOOM3_THRESHOLD 113
+#define SQR_TOOM4_THRESHOLD 202
+#define SQR_TOOM6_THRESHOLD 238
+#define SQR_TOOM8_THRESHOLD 430
-#define MULMID_TOOM42_THRESHOLD 22
+#define MULMID_TOOM42_THRESHOLD 20
#define MULMOD_BNM1_THRESHOLD 9
-#define SQRMOD_BNM1_THRESHOLD 9
+#define SQRMOD_BNM1_THRESHOLD 11
-#define MUL_FFT_MODF_THRESHOLD 252 /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD 236 /* k = 5 */
#define MUL_FFT_TABLE3 \
- { { 252, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
- { 13, 7}, { 7, 6}, { 15, 7}, { 8, 6}, \
- { 17, 7}, { 9, 6}, { 19, 7}, { 13, 8}, \
- { 7, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
- { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
- { 21, 9}, { 11, 8}, { 25,10}, { 7, 9}, \
+ { { 236, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
+ { 9, 5}, { 19, 6}, { 17, 7}, { 9, 6}, \
+ { 19, 7}, { 10, 6}, { 21, 7}, { 11, 6}, \
+ { 23, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
+ { 9, 7}, { 21, 8}, { 11, 7}, { 23, 8}, \
+ { 13, 9}, { 7, 8}, { 15, 7}, { 31, 8}, \
+ { 21, 9}, { 11, 8}, { 27,10}, { 7, 9}, \
{ 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
- { 23, 8}, { 47,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 79,10}, { 47, 9}, \
- { 95,10}, { 55,11}, { 31,10}, { 63, 9}, \
- { 127, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
- { 287,10}, { 79,11}, { 47,10}, { 95, 9}, \
- { 191,10}, { 103,12}, { 31,11}, { 63,10}, \
+ { 23, 8}, { 47, 9}, { 27,10}, { 15, 9}, \
+ { 39,10}, { 23, 9}, { 51,11}, { 15,10}, \
+ { 31, 9}, { 67,10}, { 39, 9}, { 83,10}, \
+ { 47, 9}, { 95,10}, { 55,11}, { 31,10}, \
+ { 63, 9}, { 127, 8}, { 255,10}, { 71, 9}, \
+ { 143, 8}, { 287,10}, { 79,11}, { 47,10}, \
+ { 95, 9}, { 191,12}, { 31,11}, { 63,10}, \
{ 127, 9}, { 255,10}, { 143, 9}, { 287,11}, \
- { 79,10}, { 159, 9}, { 319,10}, { 175, 9}, \
- { 351,11}, { 95,10}, { 191, 9}, { 383,10}, \
- { 223,12}, { 63,11}, { 127,10}, { 255,11}, \
- { 143,10}, { 287, 9}, { 575, 8}, { 1151,11}, \
- { 159,10}, { 319,11}, { 175,10}, { 351,12}, \
- { 95,11}, { 191,10}, { 383,11}, { 207,10}, \
- { 415,11}, { 223,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 287,10}, { 575, 9}, \
- { 1151,12}, { 159,11}, { 319,10}, { 639,11}, \
- { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
- { 767,11}, { 415,12}, { 223,11}, { 447,13}, \
- { 127,12}, { 255,11}, { 511,12}, { 287,11}, \
- { 575,10}, { 1151,12}, { 319,11}, { 639,12}, \
- { 351,11}, { 703,13}, { 191,12}, { 383,11}, \
- { 767,12}, { 415,11}, { 831,12}, { 447,11}, \
- { 895,14}, { 127,13}, { 255,12}, { 511,11}, \
- { 1023,12}, { 543,11}, { 1087,10}, { 2175,12}, \
- { 575,11}, { 1151,13}, { 319,12}, { 639,11}, \
- { 1279,12}, { 703,11}, { 1407,10}, { 2815,13}, \
- { 383,12}, { 767,11}, { 1535,12}, { 831,11}, \
- { 1663,13}, { 447,12}, { 895,14}, { 255,13}, \
- { 511,12}, { 1023,11}, { 2047,12}, { 1087,11}, \
- { 2175,13}, { 575,12}, { 1151,11}, { 2303,12}, \
- { 1215,11}, { 2431,10}, { 4863,13}, { 639,12}, \
- { 1279,11}, { 2559,13}, { 703,12}, { 1407,11}, \
- { 2815,14}, { 383,13}, { 767,12}, { 1535,13}, \
- { 831,12}, { 1663,13}, { 895,15}, { 255,14}, \
- { 511,13}, { 1023,12}, { 2047,13}, { 1087,12}, \
- { 2175,13}, { 1151,12}, { 2303,13}, { 1215,12}, \
- { 2431,11}, { 4863,14}, { 639,13}, { 1279,12}, \
- { 2559,13}, { 1407,12}, { 2815,14}, { 767,13}, \
- { 1663,14}, { 895,13}, { 1791,12}, { 3583,13}, \
- { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
- { 2175,14}, { 1151,13}, { 2303,12}, { 4607,13}, \
- { 2431,12}, { 4863,14}, { 1279,13}, { 2559,14}, \
- { 1407,13}, { 2815,15}, { 32768,16}, { 65536,17}, \
- { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
- {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 211
-#define MUL_FFT_THRESHOLD 2240
-
-#define SQR_FFT_MODF_THRESHOLD 212 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 212, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
- { 13, 7}, { 7, 6}, { 15, 7}, { 9, 6}, \
- { 19, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 20, 8}, { 11, 7}, { 24, 8}, \
- { 13, 9}, { 7, 8}, { 21, 9}, { 11, 8}, \
- { 25,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
- { 19, 8}, { 39, 9}, { 23, 8}, { 47,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 47,11}, \
- { 15,10}, { 31, 9}, { 63, 8}, { 127, 9}, \
- { 67,10}, { 39, 9}, { 79,10}, { 55,11}, \
- { 31,10}, { 63, 9}, { 127, 8}, { 255,10}, \
- { 71, 9}, { 143, 8}, { 287,10}, { 79, 9}, \
- { 159,11}, { 47, 9}, { 191,12}, { 31,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
- { 287,11}, { 79,10}, { 159, 9}, { 319,10}, \
- { 175, 9}, { 351,10}, { 191, 9}, { 383,10}, \
- { 207,11}, { 111,10}, { 223,12}, { 63,11}, \
- { 127,10}, { 255,11}, { 143,10}, { 287, 9}, \
- { 575,11}, { 159,10}, { 319,11}, { 175,10}, \
- { 351,11}, { 191,10}, { 383,11}, { 223,13}, \
+ { 79,10}, { 159, 9}, { 319,10}, { 175,11}, \
+ { 95,10}, { 191, 9}, { 383,10}, { 223,12}, \
+ { 63,11}, { 127,10}, { 255,11}, { 143,10}, \
+ { 287,11}, { 159,10}, { 319,11}, { 175,12}, \
+ { 95,11}, { 191,10}, { 383,11}, { 223,13}, \
{ 63,12}, { 127,11}, { 255,10}, { 511,11}, \
{ 287,10}, { 575,12}, { 159,11}, { 351,12}, \
{ 191,11}, { 383,12}, { 223,11}, { 447,13}, \
{ 127,12}, { 255,11}, { 511,12}, { 287,11}, \
- { 575,10}, { 1151,12}, { 319,11}, { 639,12}, \
- { 351,13}, { 191,12}, { 383,11}, { 767,12}, \
- { 415,11}, { 831,12}, { 447,14}, { 127,13}, \
- { 255,12}, { 511,11}, { 1023,10}, { 2047,11}, \
- { 1087,12}, { 575,11}, { 1151,13}, { 319,12}, \
- { 639,11}, { 1279,12}, { 703,11}, { 1407,13}, \
- { 383,12}, { 767,11}, { 1535,12}, { 831,13}, \
+ { 575,10}, { 1151,12}, { 351,13}, { 191,12}, \
+ { 415,11}, { 831,10}, { 1663,12}, { 447,14}, \
+ { 127,13}, { 255,12}, { 511,11}, { 1023,12}, \
+ { 543,11}, { 1087,10}, { 2175,12}, { 575,11}, \
+ { 1151,13}, { 319,12}, { 639,11}, { 1279,12}, \
+ { 671,11}, { 1343,12}, { 703,13}, { 383,12}, \
+ { 767,11}, { 1535,12}, { 831,11}, { 1663,13}, \
{ 447,14}, { 255,13}, { 511,12}, { 1023,11}, \
- { 2047,13}, { 575,12}, { 1151,11}, { 2303,12}, \
- { 1215,13}, { 639,12}, { 1279,11}, { 2559,13}, \
- { 703,14}, { 383,13}, { 767,12}, { 1535,13}, \
- { 831,12}, { 1663,13}, { 895,15}, { 255,14}, \
+ { 2047,12}, { 1087,11}, { 2175,13}, { 575,12}, \
+ { 1151,11}, { 2303,12}, { 1215,11}, { 2431,10}, \
+ { 4863,13}, { 639,12}, { 1279,11}, { 2559,12}, \
+ { 1343,13}, { 703,14}, { 383,13}, { 767,12}, \
+ { 1535,13}, { 831,12}, { 1663,15}, { 255,14}, \
{ 511,13}, { 1023,12}, { 2047,13}, { 1087,12}, \
{ 2175,13}, { 1151,12}, { 2303,13}, { 1215,12}, \
- { 2431,14}, { 639,13}, { 1279,12}, { 2687,13}, \
- { 1407,12}, { 2815,14}, { 767,13}, { 1663,14}, \
- { 895,13}, { 1791,12}, { 3583,15}, { 511,14}, \
+ { 2431,11}, { 4863,14}, { 639,13}, { 1279,12}, \
+ { 2559,13}, { 1343,12}, { 2687,13}, { 1407,12}, \
+ { 2815,13}, { 1471,14}, { 767,13}, { 1663,14}, \
+ { 895,13}, { 1791,12}, { 3583,13}, { 1919,12}, \
+ { 3839,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2303,12}, { 4607,13}, { 2431,12}, \
+ { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
+ { 2815,15}, { 767,14}, { 1791,13}, { 3583,14}, \
+ { 1919,13}, { 3839,16}, { 511,15}, { 1023,14}, \
+ { 2175,13}, { 4351,14}, { 2303,13}, { 4607,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
+ { 5887,15}, { 1535,14}, { 3199,15}, { 1791,14}, \
+ { 3839,13}, { 7679,16}, { 1023,15}, { 2047,14}, \
+ { 4351,15}, { 2303,14}, { 4863,15}, { 2815,14}, \
+ { 5887,16}, { 1535,15}, { 3071,14}, { 6143,15}, \
+ { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 229
+#define MUL_FFT_THRESHOLD 2752
+
+#define SQR_FFT_MODF_THRESHOLD 240 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 240, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
+ { 9, 5}, { 19, 6}, { 17, 7}, { 9, 6}, \
+ { 23, 7}, { 12, 6}, { 25, 7}, { 13, 8}, \
+ { 7, 7}, { 17, 8}, { 9, 7}, { 21, 8}, \
+ { 11, 7}, { 24, 8}, { 13, 9}, { 7, 8}, \
+ { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
+ { 27,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
+ { 19, 8}, { 39, 9}, { 27,10}, { 15, 9}, \
+ { 39,10}, { 23, 9}, { 47,11}, { 15,10}, \
+ { 31, 9}, { 63,10}, { 39, 9}, { 79,10}, \
+ { 55,11}, { 31,10}, { 63, 9}, { 127, 8}, \
+ { 255,10}, { 71, 9}, { 143, 8}, { 287,10}, \
+ { 79,11}, { 47,10}, { 95, 9}, { 191,12}, \
+ { 31,11}, { 63,10}, { 127, 9}, { 255,10}, \
+ { 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
+ { 319,10}, { 175, 9}, { 351,11}, { 95,10}, \
+ { 191, 9}, { 383,10}, { 207, 9}, { 415,10}, \
+ { 223,12}, { 63,11}, { 127,10}, { 255,11}, \
+ { 143,10}, { 287,11}, { 159,10}, { 319,11}, \
+ { 175,10}, { 351,12}, { 95,11}, { 191,10}, \
+ { 383,11}, { 207,10}, { 415,11}, { 223,13}, \
+ { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 287,10}, { 575,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 351,12}, { 191,11}, { 383,10}, \
+ { 767,12}, { 223,11}, { 447,13}, { 127,12}, \
+ { 255,11}, { 511,12}, { 287,11}, { 575,10}, \
+ { 1151,12}, { 319,11}, { 639,12}, { 351,13}, \
+ { 191,12}, { 383,11}, { 767,12}, { 415,11}, \
+ { 831,12}, { 447,14}, { 127,13}, { 255,12}, \
+ { 511,11}, { 1023,12}, { 543,11}, { 1087,12}, \
+ { 575,11}, { 1151,13}, { 319,12}, { 639,11}, \
+ { 1279,12}, { 671,11}, { 1343,13}, { 383,12}, \
+ { 767,11}, { 1535,12}, { 831,13}, { 447,14}, \
+ { 255,13}, { 511,12}, { 1023,11}, { 2047,12}, \
+ { 1087,13}, { 575,12}, { 1151,11}, { 2303,12}, \
+ { 1215,11}, { 2431,10}, { 4863,13}, { 639,12}, \
+ { 1279,11}, { 2559,12}, { 1343,11}, { 2687,14}, \
+ { 383,13}, { 767,12}, { 1535,13}, { 831,12}, \
+ { 1663,15}, { 255,14}, { 511,13}, { 1023,12}, \
+ { 2047,13}, { 1087,12}, { 2175,13}, { 1151,12}, \
+ { 2303,13}, { 1215,12}, { 2431,11}, { 4863,14}, \
+ { 639,13}, { 1279,12}, { 2559,13}, { 1343,12}, \
+ { 2687,13}, { 1407,12}, { 2815,13}, { 1471,14}, \
+ { 767,13}, { 1663,14}, { 895,13}, { 1791,12}, \
+ { 3583,13}, { 1919,12}, { 3839,15}, { 511,14}, \
{ 1023,13}, { 2175,14}, { 1151,13}, { 2303,12}, \
{ 4607,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
- { 2559,14}, { 1407,13}, { 2815,15}, { 32768,16}, \
- { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
- {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 184
-#define SQR_FFT_THRESHOLD 1984
+ { 2687,14}, { 1407,13}, { 2943,15}, { 767,14}, \
+ { 1663,13}, { 3327,14}, { 1791,13}, { 3583,14}, \
+ { 1919,13}, { 3839,16}, { 511,15}, { 1023,14}, \
+ { 2175,13}, { 4351,14}, { 2303,13}, { 4607,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2815,13}, \
+ { 5631,14}, { 2943,13}, { 5887,15}, { 1535,14}, \
+ { 3327,15}, { 1791,14}, { 3839,13}, { 7679,16}, \
+ { 1023,15}, { 2047,14}, { 4351,15}, { 2303,14}, \
+ { 4863,15}, { 2815,14}, { 5887,16}, { 1535,15}, \
+ { 3071,14}, { 6143,15}, { 32768,16}, { 65536,17}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 235
+#define SQR_FFT_THRESHOLD 2368
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 33
-#define MULLO_MUL_N_THRESHOLD 4392
+#define MULLO_DC_THRESHOLD 45
+#define MULLO_MUL_N_THRESHOLD 5397
+#define SQRLO_BASECASE_THRESHOLD 6
+#define SQRLO_DC_THRESHOLD 46
+#define SQRLO_SQR_THRESHOLD 4658
-#define DC_DIV_QR_THRESHOLD 35
-#define DC_DIVAPPR_Q_THRESHOLD 68
-#define DC_BDIV_QR_THRESHOLD 32
-#define DC_BDIV_Q_THRESHOLD 56
+#define DC_DIV_QR_THRESHOLD 36
+#define DC_DIVAPPR_Q_THRESHOLD 95
+#define DC_BDIV_QR_THRESHOLD 35
+#define DC_BDIV_Q_THRESHOLD 47
#define INV_MULMOD_BNM1_THRESHOLD 22
-#define INV_NEWTON_THRESHOLD 195
+#define INV_NEWTON_THRESHOLD 178
#define INV_APPR_THRESHOLD 116
-#define BINV_NEWTON_THRESHOLD 199
-#define REDC_1_TO_REDC_2_THRESHOLD 4
-#define REDC_2_TO_REDC_N_THRESHOLD 42
+#define BINV_NEWTON_THRESHOLD 206
+#define REDC_1_TO_REDC_2_THRESHOLD 24
+#define REDC_2_TO_REDC_N_THRESHOLD 50
#define MU_DIV_QR_THRESHOLD 979
#define MU_DIVAPPR_Q_THRESHOLD 979
-#define MUPI_DIV_QR_THRESHOLD 91
-#define MU_BDIV_QR_THRESHOLD 855
+#define MUPI_DIV_QR_THRESHOLD 97
+#define MU_BDIV_QR_THRESHOLD 762
#define MU_BDIV_Q_THRESHOLD 942
-#define POWM_SEC_TABLE 1,16,175,692,1603
+#define POWM_SEC_TABLE 7,34,114,523,1486
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 109
-#define HGCD_APPR_THRESHOLD 119
-#define HGCD_REDUCE_THRESHOLD 1679
-#define GCD_DC_THRESHOLD 222
-#define GCDEXT_DC_THRESHOLD 238
-#define JACOBI_BASE_METHOD 4
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 25
+#define SET_STR_DC_THRESHOLD 381
+#define SET_STR_PRECOMPUTE_THRESHOLD 1659
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 24
-#define SET_STR_DC_THRESHOLD 537
-#define SET_STR_PRECOMPUTE_THRESHOLD 1430
-
-#define FAC_DSC_THRESHOLD 1127
+#define FAC_DSC_THRESHOLD 969
#define FAC_ODD_THRESHOLD 0 /* always */
+
+#define MATRIX22_STRASSEN_THRESHOLD 29
+#define HGCD2_DIV1_METHOD 3 /* 2.03% faster than 5 */
+#define HGCD_THRESHOLD 92
+#define HGCD_APPR_THRESHOLD 95
+#define HGCD_REDUCE_THRESHOLD 1815
+#define GCD_DC_THRESHOLD 195
+#define GCDEXT_DC_THRESHOLD 233
+#define JACOBI_BASE_METHOD 4 /* 17.06% faster than 1 */
+
+/* Tuneup completed successfully, took 297016 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshift.asm
index d3b521364ff..4037be4874a 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshift.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshift.asm
@@ -1,6 +1,6 @@
-dnl x86-64 mpn_lshift optimized for Pentium 4.
+dnl X86-64 mpn_lshift optimised for Pentium 4.
-dnl Copyright 2003, 2005, 2007, 2008, 2012 Free Software Foundation, Inc.
+dnl Copyright 2018 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -30,137 +30,8 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-
-C cycles/limb
-C AMD K8,K9 2.5
-C AMD K10 ?
-C Intel P4 3.29
-C Intel core2 2.1 (fluctuates, presumably cache related)
-C Intel corei ?
-C Intel atom 14.3
-C VIA nano ?
-
-C INPUT PARAMETERS
-define(`rp',`%rdi')
-define(`up',`%rsi')
-define(`n',`%rdx')
-define(`cnt',`%cl')
-
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_lshift)
- FUNC_ENTRY(4)
- mov -8(up,n,8), %rax
- movd R32(%rcx), %mm4
- neg R32(%rcx) C put rsh count in cl
- and $63, R32(%rcx)
- movd R32(%rcx), %mm5
-
- lea 1(n), R32(%r8)
-
- shr R8(%rcx), %rax C function return value
-
- and $3, R32(%r8)
- je L(rol) C jump for n = 3, 7, 11, ...
-
- dec R32(%r8)
- jne L(1)
-C n = 4, 8, 12, ...
- movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm0
- psrlq %mm5, %mm0
- por %mm0, %mm2
- movq %mm2, -8(rp,n,8)
- dec n
- jmp L(rol)
-
-L(1): dec R32(%r8)
- je L(1x) C jump for n = 1, 5, 9, 13, ...
-C n = 2, 6, 10, 16, ...
- movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm0
- psrlq %mm5, %mm0
- por %mm0, %mm2
- movq %mm2, -8(rp,n,8)
- dec n
-L(1x):
- cmp $1, n
- je L(ast)
- movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm3
- psllq %mm4, %mm3
- movq -16(up,n,8), %mm0
- movq -24(up,n,8), %mm1
- psrlq %mm5, %mm0
- por %mm0, %mm2
- psrlq %mm5, %mm1
- por %mm1, %mm3
- movq %mm2, -8(rp,n,8)
- movq %mm3, -16(rp,n,8)
- sub $2, n
-
-L(rol): movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm3
- psllq %mm4, %mm3
-
- sub $4, n C 4
- jb L(end) C 2
- ALIGN(32)
-L(top):
- C finish stuff from lsh block
- movq 16(up,n,8), %mm0
- movq 8(up,n,8), %mm1
- psrlq %mm5, %mm0
- por %mm0, %mm2
- psrlq %mm5, %mm1
- movq (up,n,8), %mm0
- por %mm1, %mm3
- movq -8(up,n,8), %mm1
- movq %mm2, 24(rp,n,8)
- movq %mm3, 16(rp,n,8)
- C start two new rsh
- psrlq %mm5, %mm0
- psrlq %mm5, %mm1
-
- C finish stuff from rsh block
- movq 8(up,n,8), %mm2
- movq (up,n,8), %mm3
- psllq %mm4, %mm2
- por %mm2, %mm0
- psllq %mm4, %mm3
- movq -8(up,n,8), %mm2
- por %mm3, %mm1
- movq -16(up,n,8), %mm3
- movq %mm0, 8(rp,n,8)
- movq %mm1, (rp,n,8)
- C start two new lsh
- sub $4, n
- psllq %mm4, %mm2
- psllq %mm4, %mm3
-
- jae L(top) C 2
-L(end):
- movq 8(up), %mm0
- psrlq %mm5, %mm0
- por %mm0, %mm2
- movq (up), %mm1
- psrlq %mm5, %mm1
- por %mm1, %mm3
- movq %mm2, 16(rp)
- movq %mm3, 8(rp)
-
-L(ast): movq (up), %mm2
- psllq %mm4, %mm2
- movq %mm2, (rp)
- emms
- FUNC_EXIT()
- ret
-EPILOGUE()
+MULFUNC_PROLOGUE(mpn_lshift)
+include_mpn(`x86_64/fastsse/lshift.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshiftc.asm
index fc64676574e..52856c1bd9c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshiftc.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/lshiftc.asm
@@ -1,7 +1,6 @@
-dnl x86-64 mpn_lshiftc optimized for Pentium 4.
+dnl X86-64 mpn_lshiftc optimised for Pentium 4.
-dnl Copyright 2003, 2005, 2007, 2008, 2010, 2012 Free Software Foundation,
-dnl Inc.
+dnl Copyright 2018 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -31,149 +30,8 @@ dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
-
-C cycles/limb
-C AMD K8,K9 ?
-C AMD K10 ?
-C Intel P4 4.15
-C Intel core2 ?
-C Intel corei ?
-C Intel atom ?
-C VIA nano ?
-
-C INPUT PARAMETERS
-define(`rp',`%rdi')
-define(`up',`%rsi')
-define(`n',`%rdx')
-define(`cnt',`%cl')
-
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_lshiftc)
- FUNC_ENTRY(4)
- mov -8(up,n,8), %rax
- pcmpeqd %mm6, %mm6 C 0xffff...fff
- movd R32(%rcx), %mm4
- neg R32(%rcx) C put rsh count in cl
- and $63, R32(%rcx)
- movd R32(%rcx), %mm5
-
- lea 1(n), R32(%r8)
-
- shr R8(%rcx), %rax C function return value
-
- and $3, R32(%r8)
- je L(rol) C jump for n = 3, 7, 11, ...
-
- dec R32(%r8)
- jne L(1)
-C n = 4, 8, 12, ...
- movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm0
- pxor %mm6, %mm2
- psrlq %mm5, %mm0
- pandn %mm2, %mm0
- movq %mm0, -8(rp,n,8)
- dec n
- jmp L(rol)
-
-L(1): dec R32(%r8)
- je L(1x) C jump for n = 1, 5, 9, 13, ...
-C n = 2, 6, 10, 16, ...
- movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm0
- pxor %mm6, %mm2
- psrlq %mm5, %mm0
- pandn %mm2, %mm0
- movq %mm0, -8(rp,n,8)
- dec n
-L(1x):
- cmp $1, n
- je L(ast)
- movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm3
- psllq %mm4, %mm3
- movq -16(up,n,8), %mm0
- movq -24(up,n,8), %mm1
- pxor %mm6, %mm2
- psrlq %mm5, %mm0
- pandn %mm2, %mm0
- pxor %mm6, %mm3
- psrlq %mm5, %mm1
- pandn %mm3, %mm1
- movq %mm0, -8(rp,n,8)
- movq %mm1, -16(rp,n,8)
- sub $2, n
-
-L(rol): movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm3
- psllq %mm4, %mm3
-
- sub $4, n
- jb L(end)
- ALIGN(32)
-L(top):
- C finish stuff from lsh block
- movq 16(up,n,8), %mm0
- pxor %mm6, %mm2
- movq 8(up,n,8), %mm1
- psrlq %mm5, %mm0
- psrlq %mm5, %mm1
- pandn %mm2, %mm0
- pxor %mm6, %mm3
- movq %mm0, 24(rp,n,8)
- movq (up,n,8), %mm0
- pandn %mm3, %mm1
- movq %mm1, 16(rp,n,8)
- movq -8(up,n,8), %mm1
- C start two new rsh
- psrlq %mm5, %mm0
- psrlq %mm5, %mm1
-
- C finish stuff from rsh block
- movq 8(up,n,8), %mm2
- pxor %mm6, %mm0
- movq (up,n,8), %mm3
- psllq %mm4, %mm2
- psllq %mm4, %mm3
- pandn %mm0, %mm2
- pxor %mm6, %mm1
- movq %mm2, 8(rp,n,8)
- movq -8(up,n,8), %mm2
- pandn %mm1, %mm3
- movq %mm3, (rp,n,8)
- movq -16(up,n,8), %mm3
- C start two new lsh
- sub $4, n
- psllq %mm4, %mm2
- psllq %mm4, %mm3
-
- jae L(top)
-
-L(end): pxor %mm6, %mm2
- movq 8(up), %mm0
- psrlq %mm5, %mm0
- pandn %mm2, %mm0
- pxor %mm6, %mm3
- movq (up), %mm1
- psrlq %mm5, %mm1
- pandn %mm3, %mm1
- movq %mm0, 16(rp)
- movq %mm1, 8(rp)
-
-L(ast): movq (up), %mm2
- psllq %mm4, %mm2
- pxor %mm6, %mm2
- movq %mm2, (rp)
- emms
- FUNC_EXIT()
- ret
-EPILOGUE()
+MULFUNC_PROLOGUE(mpn_lshiftc)
+include_mpn(`x86_64/fastsse/lshiftc.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_1.asm
new file mode 100644
index 00000000000..70de67057ab
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_1.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_mul_1 optimised for Intel Nocona.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_mul_1 mpn_mul_1c)
+include_mpn(`x86_64/bd1/mul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_2.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_2.asm
new file mode 100644
index 00000000000..a0f730210ea
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_2.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_mul_2 optimised for Intel Nocona.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_mul_2)
+include_mpn(`x86_64/bd1/mul_2.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_basecase.asm
new file mode 100644
index 00000000000..fb16029d3a0
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mul_basecase.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_mul_basecase optimised for Intel Nocona.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_mul_basecase)
+include_mpn(`x86_64/core2/mul_basecase.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mullo_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mullo_basecase.asm
new file mode 100644
index 00000000000..b9e08a823e4
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/mullo_basecase.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_mullo_basecase optimised for Intel Nocona.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_mullo_basecase)
+include_mpn(`x86_64/core2/mullo_basecase.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/redc_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/redc_1.asm
new file mode 100644
index 00000000000..00e380dcd45
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/redc_1.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_redc_1 optimised for Intel Nocona.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_redc_1)
+include_mpn(`x86_64/bt1/redc_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/sqr_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/sqr_basecase.asm
new file mode 100644
index 00000000000..9725287da74
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/pentium4/sqr_basecase.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_sqr_basecase optimised for Intel Nocona.
+
+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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_sqr_basecase)
+include_mpn(`x86_64/core2/sqr_basecase.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/popham.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/popham.asm
index 9005f817762..3a29b2e661d 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/popham.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/popham.asm
@@ -1,6 +1,6 @@
dnl AMD64 mpn_popcount, mpn_hamdist -- population count and hamming distance.
-dnl Copyright 2004, 2005, 2007, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2004, 2005, 2007, 2010-2012, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -66,7 +66,7 @@ ifdef(`OPERATION_hamdist',`
define(`h55555555', `%r10')
define(`h33333333', `%r11')
define(`h0f0f0f0f', `%rcx')
- define(`h01010101', `%r14')
+ define(`h01010101', `%r12')
define(`POP', `dnl')
define(`HAM', `$1')
')
@@ -83,23 +83,19 @@ ASM_START()
PROLOGUE(func)
POP(` FUNC_ENTRY(2) ')
HAM(` FUNC_ENTRY(3) ')
- push %r12
- push %r13
- HAM(` push %r14 ')
-
+ push %rbx
mov $0x5555555555555555, h55555555
+ push %rbp
mov $0x3333333333333333, h33333333
- mov $0x0f0f0f0f0f0f0f0f, h0f0f0f0f
- mov $0x0101010101010101, h01010101
-
+ HAM(` push %r12 ')
lea (up,n,8), up
+ mov $0x0f0f0f0f0f0f0f0f, h0f0f0f0f
HAM(` lea (vp,n,8), vp ')
neg n
-
+ mov $0x0101010101010101, h01010101
xor R32(%rax), R32(%rax)
-
- bt $0, R32(n)
- jnc L(top)
+ test $1, R8(n)
+ jz L(top)
mov (up,n,8), %r8
HAM(` xor (vp,n,8), %r8 ')
@@ -115,47 +111,37 @@ PROLOGUE(func)
and h33333333, %r9
add %r8, %r9 C 16 4-bit fields (0..4)
- mov %r9, %r8
- shr $4, %r9
- and h0f0f0f0f, %r8
- and h0f0f0f0f, %r9
- add %r8, %r9 C 8 8-bit fields (0..16)
-
- imul h01010101, %r9 C sum the 8 fields in high 8 bits
- shr $56, %r9
-
- mov %r9, %rax C add to total
- add $1, n
- jz L(end)
+ dec n
+ jmp L(mid)
ALIGN(16)
L(top): mov (up,n,8), %r8
- mov 8(up,n,8), %r12
+ mov 8(up,n,8), %rbx
HAM(` xor (vp,n,8), %r8 ')
- HAM(` xor 8(vp,n,8), %r12 ')
+ HAM(` xor 8(vp,n,8), %rbx ')
mov %r8, %r9
- mov %r12, %r13
+ mov %rbx, %rbp
shr %r8
- shr %r12
+ shr %rbx
and h55555555, %r8
- and h55555555, %r12
+ and h55555555, %rbx
sub %r8, %r9
- sub %r12, %r13
+ sub %rbx, %rbp
mov %r9, %r8
- mov %r13, %r12
+ mov %rbp, %rbx
shr $2, %r9
- shr $2, %r13
+ shr $2, %rbp
and h33333333, %r8
and h33333333, %r9
- and h33333333, %r12
- and h33333333, %r13
+ and h33333333, %rbx
+ and h33333333, %rbp
add %r8, %r9 C 16 4-bit fields (0..4)
- add %r12, %r13 C 16 4-bit fields (0..4)
+ add %rbx, %rbp C 16 4-bit fields (0..4)
- add %r13, %r9 C 16 4-bit fields (0..8)
- mov %r9, %r8
+ add %rbp, %r9 C 16 4-bit fields (0..8)
+L(mid): mov %r9, %r8
shr $4, %r9
and h0f0f0f0f, %r8
and h0f0f0f0f, %r9
@@ -169,9 +155,9 @@ L(top): mov (up,n,8), %r8
jnc L(top)
L(end):
- HAM(` pop %r14 ')
- pop %r13
- pop %r12
+ HAM(` pop %r12 ')
+ pop %rbp
+ pop %rbx
FUNC_EXIT()
ret
EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorrlsh1_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorrlsh1_n.asm
new file mode 100644
index 00000000000..98c26cfdd57
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorrlsh1_n.asm
@@ -0,0 +1,50 @@
+dnl X86-64 mpn_addlsh1_n/mpn_rsblsh1_n optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+define(LSH, 1)
+define(RSH, 63)
+
+ifdef(`OPERATION_addlsh1_n', `
+ define(ADDSUB, add)
+ define(ADCSBB, adc)
+ define(func, mpn_addlsh1_n)')
+ifdef(`OPERATION_rsblsh1_n', `
+ define(ADDSUB, sub)
+ define(ADCSBB, sbb)
+ define(func, mpn_rsblsh1_n)')
+
+MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_rsblsh1_n)
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+include_mpn(`x86_64/aorrlshC_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorrlsh2_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorrlsh2_n.asm
new file mode 100644
index 00000000000..2a832171ebb
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorrlsh2_n.asm
@@ -0,0 +1,50 @@
+dnl X86-64 mpn_addlsh2_n/mpn_rsblsh2_n optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+define(LSH, 2)
+define(RSH, 62)
+
+ifdef(`OPERATION_addlsh2_n', `
+ define(ADDSUB, add)
+ define(ADCSBB, adc)
+ define(func, mpn_addlsh2_n)')
+ifdef(`OPERATION_rsblsh2_n', `
+ define(ADDSUB, sub)
+ define(ADCSBB, sbb)
+ define(func, mpn_rsblsh2_n)')
+
+MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_rsblsh2_n)
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+include_mpn(`x86_64/aorrlshC_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aors_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aors_n.asm
new file mode 100644
index 00000000000..dce3d7558cf
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aors_n.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_add_n, mpn_sub_n, optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+include_mpn(`x86_64/coreisbr/aors_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorsmul_1.asm
new file mode 100644
index 00000000000..ead0d76a0a6
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/aorsmul_1.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_addmul_1/mpn_submul_1 optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_addmul_1c mpn_submul_1 mpn_submul_1c)
+include_mpn(`x86_64/core2/aorsmul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/gmp-mparam.h
new file mode 100644
index 00000000000..f8cb0f4c763
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/gmp-mparam.h
@@ -0,0 +1,252 @@
+/* Intel Silvermont gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* Disable use of slow functions. FIXME: We should disable lib inclusion. */
+#undef HAVE_NATIVE_mpn_mul_2
+#undef HAVE_NATIVE_mpn_addmul_2
+
+/* 2400 MHz Intel Atom C2758 Silvermont/Rangeley */
+/* FFT tuning limit = 468153400 */
+/* Generated by tuneup.c, 2019-10-19, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 55
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
+
+#define DIV_1_VS_MUL_1_PERCENT 168
+
+#define MUL_TOOM22_THRESHOLD 19
+#define MUL_TOOM33_THRESHOLD 66
+#define MUL_TOOM44_THRESHOLD 152
+#define MUL_TOOM6H_THRESHOLD 222
+#define MUL_TOOM8H_THRESHOLD 333
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 105
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 114
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 88
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 24
+#define SQR_TOOM3_THRESHOLD 97
+#define SQR_TOOM4_THRESHOLD 232
+#define SQR_TOOM6_THRESHOLD 286
+#define SQR_TOOM8_THRESHOLD 0 /* always */
+
+#define MULMID_TOOM42_THRESHOLD 24
+
+#define MULMOD_BNM1_THRESHOLD 13
+#define SQRMOD_BNM1_THRESHOLD 15
+
+#define MUL_FFT_MODF_THRESHOLD 340 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 340, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
+ { 17, 7}, { 9, 6}, { 20, 7}, { 11, 6}, \
+ { 23, 7}, { 17, 8}, { 9, 7}, { 21, 8}, \
+ { 11, 7}, { 23, 8}, { 13, 7}, { 27, 8}, \
+ { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
+ { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
+ { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
+ { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
+ { 31,11}, { 63,10}, { 127, 9}, { 255,10}, \
+ { 135,11}, { 79, 9}, { 319,11}, { 95,10}, \
+ { 191, 9}, { 383,10}, { 207, 9}, { 415,11}, \
+ { 111,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,10}, { 271,11}, { 143,10}, { 287, 9}, \
+ { 575,10}, { 303,11}, { 159,10}, { 319,12}, \
+ { 95,11}, { 191,10}, { 383,11}, { 207,10}, \
+ { 415,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 319,10}, { 639,11}, { 351,10}, \
+ { 703, 9}, { 1407,12}, { 191,11}, { 415,10}, \
+ { 831,12}, { 223,11}, { 479,13}, { 127,12}, \
+ { 255,11}, { 543,12}, { 287,11}, { 575,10}, \
+ { 1151,12}, { 319,11}, { 639,12}, { 351,11}, \
+ { 703,10}, { 1407,13}, { 191,12}, { 415,11}, \
+ { 831,10}, { 1663,12}, { 479,14}, { 127,13}, \
+ { 255,12}, { 543,11}, { 1087,10}, { 2175,12}, \
+ { 575,11}, { 1151,13}, { 319,12}, { 639,11}, \
+ { 1279,12}, { 703,11}, { 1407,13}, { 383,12}, \
+ { 831,11}, { 1663,13}, { 447,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1087,11}, { 2175,13}, \
+ { 575,12}, { 1215,11}, { 2431,10}, { 4863,13}, \
+ { 639,12}, { 1279,13}, { 703,12}, { 1407,14}, \
+ { 383,13}, { 831,12}, { 1663,13}, { 959,15}, \
+ { 255,14}, { 511,13}, { 1087,12}, { 2175,13}, \
+ { 1215,12}, { 2431,11}, { 4863,14}, { 639,13}, \
+ { 1407,12}, { 2815,13}, { 1471,12}, { 2943,11}, \
+ { 5887,14}, { 767,13}, { 1663,14}, { 895,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
+ { 2559,14}, { 1407,13}, { 2943,12}, { 5887,15}, \
+ { 767,14}, { 1663,13}, { 3455,12}, { 6911,14}, \
+ { 1919,16}, { 511,15}, { 1023,14}, { 2431,13}, \
+ { 4863,15}, { 1279,14}, { 2943,13}, { 5887,12}, \
+ { 11775,15}, { 1535,14}, { 3455,13}, { 6911,15}, \
+ { 1791,14}, { 3839,13}, { 7679,16}, { 1023,15}, \
+ { 2047,14}, { 4223,15}, { 2303,14}, { 4863,15}, \
+ { 2815,14}, { 5887,13}, { 11775,16}, { 1535,15}, \
+ { 3327,14}, { 6911,15}, { 3839,14}, { 7679,17}, \
+ { 1023,16}, { 2047,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
+ { 3583,15}, { 7679,14}, { 15359,17}, { 2047,16}, \
+ { 4607,15}, { 9215,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 225
+#define MUL_FFT_THRESHOLD 3712
+
+#define SQR_FFT_MODF_THRESHOLD 308 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 308, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
+ { 21, 7}, { 11, 6}, { 23, 7}, { 17, 8}, \
+ { 9, 7}, { 21, 8}, { 11, 7}, { 23, 8}, \
+ { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
+ { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
+ { 33, 9}, { 19, 8}, { 39, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 47,11}, { 15,10}, { 31, 9}, \
+ { 63,10}, { 39, 9}, { 79,10}, { 47, 9}, \
+ { 95,11}, { 31,10}, { 79,11}, { 47,10}, \
+ { 95,12}, { 31,11}, { 63,10}, { 127, 9}, \
+ { 255, 8}, { 511, 9}, { 271, 8}, { 543,11}, \
+ { 79,10}, { 159, 9}, { 319, 8}, { 639,10}, \
+ { 175,11}, { 95,10}, { 191, 9}, { 383,10}, \
+ { 207, 9}, { 415,12}, { 63,11}, { 127,10}, \
+ { 255, 9}, { 511,10}, { 271, 9}, { 543,10}, \
+ { 287, 9}, { 575,10}, { 303,11}, { 159,10}, \
+ { 319, 9}, { 639,11}, { 175,10}, { 351,12}, \
+ { 95,11}, { 191,10}, { 383,11}, { 207,10}, \
+ { 415,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 303,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 351,10}, { 703,12}, { 191,11}, \
+ { 383,10}, { 767,11}, { 415,10}, { 831,12}, \
+ { 223,11}, { 479,12}, { 255,11}, { 543,12}, \
+ { 287,11}, { 575,12}, { 319,11}, { 639,12}, \
+ { 351,11}, { 703,10}, { 1407,13}, { 191,12}, \
+ { 383,11}, { 767,12}, { 415,11}, { 831,12}, \
+ { 479,13}, { 255,12}, { 543,11}, { 1087,10}, \
+ { 2175,12}, { 575,11}, { 1151,12}, { 607,13}, \
+ { 319,12}, { 639,11}, { 1279,12}, { 703,11}, \
+ { 1407,13}, { 383,12}, { 831,11}, { 1663,13}, \
+ { 447,12}, { 895,14}, { 255,13}, { 511,12}, \
+ { 1087,11}, { 2175,13}, { 575,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1279,13}, { 703,12}, \
+ { 1407,14}, { 383,13}, { 831,12}, { 1663,13}, \
+ { 959,15}, { 255,14}, { 511,13}, { 1087,12}, \
+ { 2175,13}, { 1215,12}, { 2431,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1407,12}, { 2815,13}, \
+ { 1471,12}, { 2943,14}, { 767,13}, { 1663,14}, \
+ { 895,13}, { 1791,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,13}, { 2943,15}, \
+ { 767,14}, { 1663,13}, { 3455,12}, { 6911,14}, \
+ { 1791,13}, { 3583,16}, { 511,15}, { 1023,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2943,13}, \
+ { 5887,12}, { 11775,15}, { 1535,14}, { 3455,13}, \
+ { 6911,15}, { 1791,14}, { 3839,13}, { 7679,16}, \
+ { 1023,15}, { 2047,14}, { 4223,15}, { 2303,14}, \
+ { 4863,15}, { 2815,14}, { 5887,13}, { 11775,16}, \
+ { 1535,15}, { 3071,14}, { 6143,15}, { 3327,14}, \
+ { 6911,15}, { 3839,14}, { 7679,17}, { 1023,16}, \
+ { 2047,15}, { 4863,16}, { 2559,15}, { 5887,14}, \
+ { 11775,16}, { 3071,15}, { 6911,16}, { 3583,15}, \
+ { 7679,14}, { 15359,17}, { 2047,16}, { 4607,15}, \
+ { 9983,16}, { 5631,15}, { 11775,17}, { 3071,16}, \
+ { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+ {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 232
+#define SQR_FFT_THRESHOLD 2752
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 55
+#define MULLO_MUL_N_THRESHOLD 6633
+#define SQRLO_BASECASE_THRESHOLD 9
+#define SQRLO_DC_THRESHOLD 0 /* never mpn_sqrlo_basecase */
+#define SQRLO_SQR_THRESHOLD 5397
+
+#define DC_DIV_QR_THRESHOLD 33
+#define DC_DIVAPPR_Q_THRESHOLD 222
+#define DC_BDIV_QR_THRESHOLD 31
+#define DC_BDIV_Q_THRESHOLD 147
+
+#define INV_MULMOD_BNM1_THRESHOLD 37
+#define INV_NEWTON_THRESHOLD 222
+#define INV_APPR_THRESHOLD 222
+
+#define BINV_NEWTON_THRESHOLD 212
+#define REDC_1_TO_REDC_2_THRESHOLD 55
+#define REDC_2_TO_REDC_N_THRESHOLD 0 /* always */
+
+#define MU_DIV_QR_THRESHOLD 1142
+#define MU_DIVAPPR_Q_THRESHOLD 1142
+#define MUPI_DIV_QR_THRESHOLD 81
+#define MU_BDIV_QR_THRESHOLD 942
+#define MU_BDIV_Q_THRESHOLD 1043
+
+#define POWM_SEC_TABLE 1,34,102,588,1730
+
+#define GET_STR_DC_THRESHOLD 17
+#define GET_STR_PRECOMPUTE_THRESHOLD 30
+#define SET_STR_DC_THRESHOLD 381
+#define SET_STR_PRECOMPUTE_THRESHOLD 1659
+
+#define FAC_DSC_THRESHOLD 351
+#define FAC_ODD_THRESHOLD 27
+
+#define MATRIX22_STRASSEN_THRESHOLD 16
+#define HGCD2_DIV1_METHOD 3 /* 3.06% faster than 1 */
+#define HGCD_THRESHOLD 120
+#define HGCD_APPR_THRESHOLD 153
+#define HGCD_REDUCE_THRESHOLD 2121
+#define GCD_DC_THRESHOLD 416
+#define GCDEXT_DC_THRESHOLD 309
+#define JACOBI_BASE_METHOD 1 /* 2.28% faster than 3 */
+
+/* Tuneup completed successfully, took 938046 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/hamdist.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/hamdist.asm
new file mode 100644
index 00000000000..848ed016149
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/hamdist.asm
@@ -0,0 +1,38 @@
+dnl x86-64 mpn_hamdist.
+
+dnl Copyright 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 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/.
+
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_hamdist)
+include_mpn(`x86_64/coreinhm/hamdist.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/lshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/lshift.asm
new file mode 100644
index 00000000000..acd31809132
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/lshift.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_lshift optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_lshift)
+include_mpn(`x86_64/fastsse/lshift-movdqu2.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/lshiftc.asm
new file mode 100644
index 00000000000..3a68bb55853
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/lshiftc.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_lshiftc optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_lshiftc)
+include_mpn(`x86_64/fastsse/lshiftc-movdqu2.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mul_1.asm
new file mode 100644
index 00000000000..c1e1c942b47
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mul_1.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_mul_1 optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_mul_1 mpn_mul_1c)
+include_mpn(`x86_64/bd1/mul_1.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mul_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mul_basecase.asm
new file mode 100644
index 00000000000..6228c48fc25
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mul_basecase.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_mul_basecase optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_mul_basecase)
+include_mpn(`x86_64/k8/mul_basecase.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mullo_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mullo_basecase.asm
new file mode 100644
index 00000000000..0244f8a03bd
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/mullo_basecase.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_mullo_basecase optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_mullo_basecase)
+include_mpn(`x86_64/k8/mullo_basecase.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/popcount.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/popcount.asm
new file mode 100644
index 00000000000..73eb7b5a265
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/popcount.asm
@@ -0,0 +1,38 @@
+dnl x86-64 mpn_popcount.
+
+dnl Copyright 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 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/.
+
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_popcount)
+include_mpn(`x86_64/coreinhm/popcount.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/rshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/rshift.asm
new file mode 100644
index 00000000000..b84371cd2a5
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/rshift.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_rshift optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_rshift)
+include_mpn(`x86_64/fastsse/rshift-movdqu2.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/sqr_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/sqr_basecase.asm
new file mode 100644
index 00000000000..afccf935fbf
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/silvermont/sqr_basecase.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_sqr_basecase optimised for Intel Silvermont.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_sqr_basecase)
+include_mpn(`x86_64/k8/sqr_basecase.asm')
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 6995cf25cf7..a899ea167e4 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
@@ -1,6 +1,6 @@
/* Skylake gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2015 Free Software Foundation, Inc.
+Copyright 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,42 +35,44 @@ see https://www.gnu.org/licenses/. */
#undef HAVE_NATIVE_mpn_mul_2
#undef HAVE_NATIVE_mpn_addmul_2
-/* 3500 MHz i5-6600K Skylake */
-/* FFT tuning limit = 300 M */
-/* Generated by tuneup.c, 2015-10-10, gcc 5.2 */
+/* 3600-4000 MHz Intel Xeon E3-1270v5 Skylake */
+/* FFT tuning limit = 465,990,371 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
#define MOD_1_1_TO_MOD_1_2_THRESHOLD 13
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 34
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 32
#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
#define USE_PREINV_DIVREM_1 1 /* native */
#define DIV_QR_1_NORM_THRESHOLD 1
#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 41
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 21
+#define BMOD_1_TO_MOD_1_THRESHOLD 20
+
+#define DIV_1_VS_MUL_1_PERCENT 473
#define MUL_TOOM22_THRESHOLD 26
#define MUL_TOOM33_THRESHOLD 73
#define MUL_TOOM44_THRESHOLD 208
-#define MUL_TOOM6H_THRESHOLD 366
-#define MUL_TOOM8H_THRESHOLD 430
+#define MUL_TOOM6H_THRESHOLD 300
+#define MUL_TOOM8H_THRESHOLD 406
#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 162
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 153
#define MUL_TOOM42_TO_TOOM53_THRESHOLD 137
#define MUL_TOOM42_TO_TOOM63_THRESHOLD 151
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 203
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 106
#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 34
-#define SQR_TOOM3_THRESHOLD 109
-#define SQR_TOOM4_THRESHOLD 450
-#define SQR_TOOM6_THRESHOLD 562
-#define SQR_TOOM8_THRESHOLD 0 /* always */
+#define SQR_TOOM2_THRESHOLD 32
+#define SQR_TOOM3_THRESHOLD 117
+#define SQR_TOOM4_THRESHOLD 336
+#define SQR_TOOM6_THRESHOLD 426
+#define SQR_TOOM8_THRESHOLD 547
#define MULMID_TOOM42_THRESHOLD 46
@@ -80,151 +82,165 @@ see https://www.gnu.org/licenses/. */
#define MUL_FFT_MODF_THRESHOLD 404 /* k = 5 */
#define MUL_FFT_TABLE3 \
{ { 404, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 25, 7}, { 13, 6}, { 28, 7}, { 25, 8}, \
+ { 12, 5}, { 25, 6}, { 28, 7}, { 15, 6}, \
+ { 31, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
{ 13, 7}, { 28, 8}, { 15, 7}, { 32, 8}, \
{ 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
{ 21, 9}, { 11, 8}, { 23, 7}, { 47, 8}, \
{ 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
{ 41, 9}, { 23, 8}, { 49, 9}, { 27,10}, \
- { 15, 9}, { 43,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 83,10}, { 47, 9}, { 99,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31,11}, { 63,10}, { 127, 6}, { 2047, 5}, \
- { 4223, 6}, { 2175, 5}, { 4351, 7}, { 1215, 8}, \
- { 639, 9}, { 335, 7}, { 1343, 8}, { 703,11}, \
- { 95,10}, { 191, 9}, { 383, 8}, { 799,11}, \
- { 111,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 543,11}, { 143, 9}, { 607,11}, { 159, 9}, \
- { 639,12}, { 95,10}, { 383, 9}, { 767,10}, \
- { 415,13}, { 63,11}, { 255,10}, { 543,11}, \
- { 287,10}, { 575,11}, { 303,12}, { 159,11}, \
- { 319,10}, { 639,11}, { 335,10}, { 671,11}, \
- { 351,10}, { 703,11}, { 415,10}, { 831,12}, \
- { 223,11}, { 447,13}, { 127,11}, { 543,10}, \
- { 1087,11}, { 607,12}, { 319,11}, { 671,12}, \
- { 351,11}, { 703,12}, { 383,11}, { 767,12}, \
- { 415,11}, { 831,12}, { 479,14}, { 127,12}, \
- { 607,13}, { 319,12}, { 703,13}, { 383,12}, \
+ { 15, 9}, { 39, 8}, { 79, 9}, { 43,10}, \
+ { 23, 9}, { 55,11}, { 15,10}, { 31, 9}, \
+ { 71,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 99,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 103,12}, { 31,11}, { 63,10}, \
+ { 135,11}, { 79,10}, { 167,11}, { 95,10}, \
+ { 191, 9}, { 383,10}, { 199,11}, { 111,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
+ { 271, 9}, { 543,11}, { 143,10}, { 287, 9}, \
+ { 575,11}, { 159,12}, { 95,11}, { 191,10}, \
+ { 383,13}, { 63,12}, { 127,11}, { 255,10}, \
+ { 511,11}, { 271,10}, { 543,11}, { 287,10}, \
+ { 575,11}, { 303,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
+ { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 415,12}, { 223,11}, { 447,13}, { 127,12}, \
+ { 255,11}, { 543,12}, { 287,11}, { 607,12}, \
+ { 319,11}, { 671,12}, { 351,11}, { 703,13}, \
+ { 191,12}, { 383,11}, { 767,12}, { 415,11}, \
+ { 831,12}, { 479,14}, { 127,13}, { 255,12}, \
+ { 543,11}, { 1087,12}, { 607,13}, { 319,12}, \
+ { 671,11}, { 1343,12}, { 703,13}, { 383,12}, \
{ 831,13}, { 447,12}, { 959,13}, { 511,12}, \
{ 1087,13}, { 575,12}, { 1151,13}, { 639,12}, \
- { 1279,13}, { 703,14}, { 383,13}, { 767,12}, \
+ { 1343,13}, { 703,14}, { 383,13}, { 767,12}, \
{ 1535,13}, { 831,12}, { 1727,13}, { 959,14}, \
{ 511,13}, { 1087,12}, { 2175,13}, { 1151,14}, \
- { 639,13}, { 1343,12}, { 2687,13}, { 1407,12}, \
- { 2815,14}, { 767,13}, { 1599,12}, { 3199,13}, \
- { 1727,14}, { 895,15}, { 511,14}, { 1023,13}, \
+ { 639,13}, { 1343,12}, { 2687,13}, { 1407,14}, \
+ { 767,13}, { 1599,12}, { 3199,13}, { 1663,14}, \
+ { 895,13}, { 1791,15}, { 511,14}, { 1023,13}, \
{ 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
{ 1279,13}, { 2687,14}, { 1407,13}, { 2815,15}, \
{ 767,14}, { 1535,13}, { 3199,14}, { 1663,13}, \
{ 3455,12}, { 6911,14}, { 1791,16}, { 511,15}, \
{ 1023,14}, { 2175,13}, { 4351,14}, { 2431,13}, \
{ 4863,15}, { 1279,14}, { 2943,13}, { 5887,15}, \
- { 1535,14}, { 3455,15}, { 1791,14}, { 3839,16}, \
- { 1023,15}, { 2047,14}, { 4351,15}, { 2303,14}, \
- { 4863,15}, { 2559,14}, { 5247,15}, { 2815,14}, \
- { 5887,16}, { 1535,15}, { 3327,14}, { 6911,15}, \
- { 3839,17}, { 1023,16}, { 2047,15}, { 4863,16}, \
- { 2559,15}, { 5887,14}, { 11775,16}, { 3071,15}, \
- { 6911,16}, { 3583,15}, { 7679,14}, { 15359,17}, \
- { 2047,16}, { 4095,15}, { 8191,16}, { 65536,17}, \
+ { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
+ { 3839,13}, { 7679,16}, { 1023,15}, { 2047,14}, \
+ { 4223,15}, { 2303,14}, { 4863,15}, { 2559,14}, \
+ { 5247,15}, { 2815,14}, { 5887,16}, { 1535,15}, \
+ { 3327,14}, { 6911,15}, { 3839,14}, { 7679,17}, \
+ { 1023,16}, { 2047,15}, { 4351,14}, { 8703,15}, \
+ { 4863,16}, { 2559,15}, { 5887,14}, { 11775,16}, \
+ { 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 203
-#define MUL_FFT_THRESHOLD 4736
+#define MUL_FFT_TABLE3_SIZE 227
+#define MUL_FFT_THRESHOLD 6272
-#define SQR_FFT_MODF_THRESHOLD 368 /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD 400 /* k = 5 */
#define SQR_FFT_TABLE3 \
- { { 368, 5}, { 23, 6}, { 25, 7}, { 13, 6}, \
- { 27, 7}, { 25, 8}, { 13, 7}, { 28, 8}, \
- { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
- { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
- { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 47, 9}, \
- { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
- { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 135,11}, { 79,10}, \
- { 159, 9}, { 319,11}, { 95,10}, { 191, 6}, \
- { 3199, 7}, { 1727, 8}, { 895, 9}, { 479,10}, \
- { 255, 8}, { 1023, 9}, { 543,10}, { 287, 9}, \
- { 575, 8}, { 1151, 9}, { 607,11}, { 159, 9}, \
- { 671,12}, { 95,11}, { 191, 9}, { 767,11}, \
- { 207,13}, { 63,11}, { 255,10}, { 511, 9}, \
- { 1023,10}, { 543, 9}, { 1087,10}, { 671,11}, \
- { 351,10}, { 735,11}, { 383,10}, { 767,11}, \
- { 415,10}, { 831,12}, { 223,11}, { 447,10}, \
- { 895,11}, { 479,13}, { 127,12}, { 255,11}, \
- { 607,12}, { 319,11}, { 735,12}, { 383,11}, \
- { 767,12}, { 415,11}, { 831,12}, { 479,14}, \
- { 127,12}, { 735,13}, { 383,12}, { 831,13}, \
+ { { 400, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 29, 7}, { 15, 6}, { 31, 7}, { 28, 8}, \
+ { 15, 7}, { 32, 8}, { 17, 7}, { 35, 8}, \
+ { 19, 7}, { 39, 8}, { 27, 9}, { 15, 8}, \
+ { 33, 9}, { 19, 8}, { 39, 9}, { 23, 8}, \
+ { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 67,10}, { 39, 9}, { 79,10}, { 55,11}, \
+ { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
+ { 31,11}, { 63,10}, { 135,11}, { 79,10}, \
+ { 159, 9}, { 319,11}, { 95,12}, { 63,11}, \
+ { 127,10}, { 255, 9}, { 511,10}, { 271,11}, \
+ { 143,10}, { 287, 9}, { 575,10}, { 303,11}, \
+ { 159,10}, { 319,12}, { 95,10}, { 383,13}, \
+ { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 271,10}, { 543,11}, { 287,10}, { 575,11}, \
+ { 303,10}, { 607,12}, { 159,11}, { 319,10}, \
+ { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
+ { 703,11}, { 367,10}, { 735,11}, { 383,10}, \
+ { 767,11}, { 415,10}, { 831,12}, { 223,11}, \
+ { 479,13}, { 127,12}, { 255,11}, { 543,12}, \
+ { 287,11}, { 607,12}, { 319,11}, { 671,12}, \
+ { 351,11}, { 735,12}, { 383,11}, { 799,12}, \
+ { 415,11}, { 831,12}, { 479,14}, { 127,13}, \
+ { 255,12}, { 511,11}, { 1023,12}, { 607,13}, \
+ { 319,12}, { 735,13}, { 383,12}, { 831,13}, \
{ 447,12}, { 959,13}, { 511,12}, { 1023,13}, \
{ 575,12}, { 1151,13}, { 639,12}, { 1279,13}, \
- { 703,14}, { 383,13}, { 767,12}, { 1535,13}, \
- { 831,12}, { 1663,13}, { 959,14}, { 511,13}, \
- { 1087,12}, { 2175,13}, { 1151,14}, { 639,13}, \
- { 1343,12}, { 2687,13}, { 1471,14}, { 767,13}, \
- { 1599,12}, { 3199,13}, { 1663,14}, { 895,15}, \
+ { 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
+ { 1535,13}, { 831,12}, { 1727,13}, { 895,12}, \
+ { 1791,13}, { 959,14}, { 511,13}, { 1087,12}, \
+ { 2175,13}, { 1151,14}, { 639,13}, { 1343,12}, \
+ { 2687,13}, { 1407,14}, { 767,13}, { 1599,12}, \
+ { 3199,13}, { 1663,14}, { 895,13}, { 1791,15}, \
{ 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
{ 2431,12}, { 4863,14}, { 1279,13}, { 2687,14}, \
{ 1407,15}, { 767,14}, { 1535,13}, { 3199,14}, \
- { 1663,13}, { 3455,12}, { 6911,16}, { 511,15}, \
- { 1023,14}, { 2303,13}, { 4607,14}, { 2431,13}, \
- { 4863,15}, { 1279,14}, { 2943,13}, { 5887,15}, \
- { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
- { 3839,16}, { 1023,15}, { 2047,14}, { 4351,15}, \
- { 2303,14}, { 4863,15}, { 2559,14}, { 5119,15}, \
- { 2815,14}, { 5887,16}, { 1535,15}, { 3071,14}, \
- { 6143,15}, { 3327,14}, { 6911,15}, { 3839,17}, \
- { 1023,16}, { 2047,15}, { 4863,16}, { 2559,15}, \
- { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
- { 3583,15}, { 7679,14}, { 15359,17}, { 2047,16}, \
- { 4095,15}, { 8191,16}, { 65536,17}, { 131072,18}, \
- { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
- {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 186
-#define SQR_FFT_THRESHOLD 3712
+ { 1663,13}, { 3455,14}, { 1791,16}, { 511,15}, \
+ { 1023,14}, { 2431,13}, { 4863,15}, { 1279,14}, \
+ { 2943,13}, { 5887,15}, { 1535,14}, { 3455,15}, \
+ { 1791,14}, { 3839,16}, { 1023,15}, { 2047,14}, \
+ { 4223,15}, { 2303,14}, { 4863,15}, { 2559,14}, \
+ { 5119,15}, { 2815,14}, { 5887,16}, { 1535,15}, \
+ { 3071,14}, { 6143,15}, { 3327,14}, { 6911,15}, \
+ { 3839,17}, { 1023,16}, { 2047,15}, { 4863,16}, \
+ { 2559,15}, { 5887,14}, { 11775,16}, { 3071,15}, \
+ { 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}, \
+ { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+ {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 205
+#define SQR_FFT_THRESHOLD 4224
#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 27
-#define MULLO_MUL_N_THRESHOLD 9174
-#define SQRLO_BASECASE_THRESHOLD 8
-#define SQRLO_DC_THRESHOLD 132
-#define SQRLO_SQR_THRESHOLD 7269
+#define MULLO_DC_THRESHOLD 79
+#define MULLO_MUL_N_THRESHOLD 11278
+#define SQRLO_BASECASE_THRESHOLD 10
+#define SQRLO_DC_THRESHOLD 109
+#define SQRLO_SQR_THRESHOLD 8207
-#define DC_DIV_QR_THRESHOLD 52
-#define DC_DIVAPPR_Q_THRESHOLD 173
-#define DC_BDIV_QR_THRESHOLD 87
-#define DC_BDIV_Q_THRESHOLD 156
+#define DC_DIV_QR_THRESHOLD 55
+#define DC_DIVAPPR_Q_THRESHOLD 179
+#define DC_BDIV_QR_THRESHOLD 82
+#define DC_BDIV_Q_THRESHOLD 166
#define INV_MULMOD_BNM1_THRESHOLD 50
-#define INV_NEWTON_THRESHOLD 165
-#define INV_APPR_THRESHOLD 165
+#define INV_NEWTON_THRESHOLD 170
+#define INV_APPR_THRESHOLD 171
#define BINV_NEWTON_THRESHOLD 294
-#define REDC_1_TO_REDC_2_THRESHOLD 30
-#define REDC_2_TO_REDC_N_THRESHOLD 75
+#define REDC_1_TO_REDC_2_THRESHOLD 33
+#define REDC_2_TO_REDC_N_THRESHOLD 59
-#define MU_DIV_QR_THRESHOLD 1620
-#define MU_DIVAPPR_Q_THRESHOLD 1620
+#define MU_DIV_QR_THRESHOLD 1528
+#define MU_DIVAPPR_Q_THRESHOLD 1589
#define MUPI_DIV_QR_THRESHOLD 62
-#define MU_BDIV_QR_THRESHOLD 1589
-#define MU_BDIV_Q_THRESHOLD 1718
+#define MU_BDIV_QR_THRESHOLD 1470
+#define MU_BDIV_Q_THRESHOLD 1597
-#define POWM_SEC_TABLE 1,9,194,960,1133,1730
+#define POWM_SEC_TABLE 2,8,191,452,904
-#define GET_STR_DC_THRESHOLD 10
-#define GET_STR_PRECOMPUTE_THRESHOLD 17
-#define SET_STR_DC_THRESHOLD 1065
-#define SET_STR_PRECOMPUTE_THRESHOLD 2024
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 19
+#define SET_STR_DC_THRESHOLD 898
+#define SET_STR_PRECOMPUTE_THRESHOLD 1670
-#define FAC_DSC_THRESHOLD 767
+#define FAC_DSC_THRESHOLD 474
#define FAC_ODD_THRESHOLD 0 /* always */
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 71
-#define HGCD_APPR_THRESHOLD 55
-#define HGCD_REDUCE_THRESHOLD 3014
-#define GCD_DC_THRESHOLD 706
-#define GCDEXT_DC_THRESHOLD 393
-#define JACOBI_BASE_METHOD 3
+#define MATRIX22_STRASSEN_THRESHOLD 16
+#define HGCD2_DIV1_METHOD 5 /* 3.85% faster than 3 */
+#define HGCD_THRESHOLD 64
+#define HGCD_APPR_THRESHOLD 60
+#define HGCD_REDUCE_THRESHOLD 2681
+#define GCD_DC_THRESHOLD 618
+#define GCDEXT_DC_THRESHOLD 321
+#define JACOBI_BASE_METHOD 1 /* 12.01% faster than 4 */
+
+/* Tuneup completed successfully, took 213784 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/sqr_diag_addlsh1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/sqr_diag_addlsh1.asm
index 4ad034c855d..f48612507d5 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/sqr_diag_addlsh1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/sqr_diag_addlsh1.asm
@@ -40,11 +40,11 @@ C AMD pile 3.6
C AMD steam ?
C AMD bobcat 4
C AMD jaguar ?
-C Intel P4 ?
+C Intel P4 11.5
C Intel core 4
C Intel NHM 3.6
C Intel SBR 3.15
-C Intel IBR 3.2
+C Intel IBR 3.0
C Intel HWL 2.6
C Intel BWL ?
C Intel atom 14
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 a626419bb81..64e3729801f 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
@@ -2,7 +2,8 @@ divert(-1)
dnl m4 macros for amd64 assembler.
-dnl Copyright 1999-2005, 2008, 2009, 2011-2013 Free Software Foundation, Inc.
+dnl Copyright 1999-2005, 2008, 2009, 2011-2013, 2017 Free Software Foundation,
+dnl Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -50,7 +51,7 @@ define(CPUVEC_FUNCS_LIST,
`copyi',
`divexact_1',
`divrem_1',
-`gcd_1',
+`gcd_11',
`lshift',
`lshiftc',
`mod_1',
@@ -135,18 +136,24 @@ define(`ASSERT_counter',incr(ASSERT_counter))')')')
define(ASSERT_counter,1)
+dnl LEA - load effective address
+dnl
+dnl FIXME: We should never create a GOT entry and therefore use the simpler 2nd
+dnl variant always. We need to understand what happens for not-yet-hidden
+dnl symbols first.
+dnl
define(`LEA',`dnl
ifdef(`PIC',
`mov $1@GOTPCREL(%rip), $2'
,
- `movabs `$'$1, $2')
+ `lea $1(%rip), $2')
')
define(`DEF_OBJECT',
-m4_assert_numargs_range(1,2)
-` RODATA
- ALIGN(ifelse($#,1,2,$2))
+m4_assert_numargs_range(2,3)
+` ifelse($#,3,`$3',`RODATA')
+ ALIGN($2)
$1:
')
@@ -199,8 +206,15 @@ ifdef(`PIC',
`call GSYM_PREFIX`'$1'
)')
+define(`TCALL',`dnl
+ifdef(`PIC',
+ `jmp GSYM_PREFIX`'$1@PLT'
+,
+ `jmp GSYM_PREFIX`'$1'
+)')
+
-define(`JUMPTABSECT', `.section .data.rel.ro.local,"aw",@progbits')
+define(`JUMPTABSECT', `.section .data.rel.ro.local,"a",@progbits')
dnl Usage: JMPENT(targlabel,tablabel)
@@ -313,18 +327,19 @@ define(`oplist',
`(%r8)', 24, `(%r9)', 25, `(%r10)',26, `(%r11)',27,
`(%r12)',28, `(%r13)',29, `(%r14)',30, `(%r15)',31')
-
-dnl Usage
+dnl Usage (by mulx, shlx, shrx)
dnl
-dnl mulx(reg1,reg2,reg3)
+dnl reg1,reg2,reg3,opc1,opc2
dnl
dnl or
dnl
-dnl mulx((reg1),reg2,reg3)
+dnl (reg1),reg2,reg3,opc1,opc2
dnl
dnl where reg1 is any register but rsp,rbp,r12,r13, or
dnl
-dnl mulx(off,(reg1),reg2,reg3)
+dnl or
+dnl
+dnl off,(reg1),reg2,reg3,opc1,opc2
dnl
dnl where reg1 is any register but rsp,r12.
dnl
@@ -335,21 +350,79 @@ dnl
dnl Other addressing forms are not handled. Invalid forms are not properly
dnl detected. Offsets that don't fit one byte are not handled correctly.
-define(`mulx',`dnl
+define(`c4_helper',`dnl
.byte 0xc4`'dnl
-ifelse(`$#',3,`dnl
+ifelse(`$#',5,`dnl
,eval(0xe2^32*regnumh($1)^128*regnumh($3))`'dnl
-,eval(0xfb-8*regnum($2))`'dnl
-,0xf6`'dnl
+,eval(0x$4-8*regnum($2))`'dnl
+,0x$5`'dnl
,eval(0xc0+(7 & regnum($1))+8*(7 & regnum($3))-0xc0*ix($1))`'dnl
-',`$#',4,`dnl
+',`$#',6,`dnl
,eval(0xe2^32*regnumh($2)^128*regnumh($4))`'dnl
-,eval(0xfb-8*regnum($3))`'dnl
-,0xf6`'dnl
+,eval(0x$5-8*regnum($3))`'dnl
+,0x$6`'dnl
,eval(0x40+(7 & regnum($2))+8*(7 & regnum($4)))`'dnl
,eval(($1 + 256) % 256)`'dnl
')')
+
+dnl Usage
+dnl
+dnl mulx(reg1,reg2,reg3)
+dnl
+dnl or
+dnl
+dnl mulx((reg1),reg2,reg3)
+dnl
+dnl where reg1 is any register but rsp,rbp,r12,r13, or
+dnl
+dnl mulx(off,(reg1),reg2,reg3)
+dnl
+dnl where reg1 is any register but rsp,r12.
+
+define(`mulx',`dnl
+ifelse(`$#',3,`dnl
+c4_helper($1,$2,$3,fb,f6)',`dnl format 1,2
+c4_helper($1,$2,$3,$4,fb,f6)'dnl format 3
+)')
+
+
+dnl Usage
+dnl
+dnl shlx(reg1,reg2,reg3)
+dnl shrx(reg1,reg2,reg3)
+dnl
+dnl or
+dnl
+dnl shlx(reg1,(reg2),reg3)
+dnl shrx(reg1,(reg2),reg3)
+dnl
+dnl where reg2 is any register but rsp,rbp,r12,r13, or
+dnl
+dnl shlx(reg1,off,(reg2),reg3)
+dnl shrx(reg1,off,(reg2),reg3)
+dnl
+dnl where reg2 is any register but rsp,r12.
+
+define(`shlx',`dnl
+ifelse(`$#',3,`dnl
+c4_helper($2,$1,$3,f9,f7)',`dnl format 1,2
+c4_helper($1,$3,$2,$4,f9,f7)'dnl format 3
+)')
+
+define(`shrx',`dnl
+ifelse(`$#',3,`dnl
+c4_helper($2,$1,$3,fb,f7)',`dnl format 1,2
+c4_helper($1,$3,$2,$4,fb,f7)'dnl format 3
+)')
+
+define(`sarx',`dnl
+ifelse(`$#',3,`dnl
+c4_helper($2,$1,$3,fa,f7)',`dnl format 1,2
+c4_helper($1,$3,$2,$4,fa,f7)'dnl format 3
+)')
+
+
dnl Usage
dnl
dnl adcx(reg1,reg2)
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorrlsh1_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorrlsh1_n.asm
new file mode 100644
index 00000000000..803fa30b109
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorrlsh1_n.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_addlsh1_n, mpn_addlsh1_nc, mpn_rsblsh1_n, mpn_rsblsh1_nc.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_addlsh1_nc mpn_rsblsh1_n mpn_rsblsh1_nc)
+include_mpn(`x86_64/atom/aorrlsh1_n.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorrlsh_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorrlsh_n.asm
new file mode 100644
index 00000000000..e049b2f5324
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorrlsh_n.asm
@@ -0,0 +1,226 @@
+dnl AMD64 mpn_addlsh_n, mpn_rsblsh_n.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+C cycles/limb
+C AMD K8,K9 n/a
+C AMD K10 n/a
+C AMD bd1 n/a
+C AMD bd2 n/a
+C AMD bd3 n/a
+C AMD bd4 2.31
+C AMD zen 1.69
+C AMD bt1 n/a
+C AMD bt2 n/a
+C Intel P4 n/a
+C Intel PNR n/a
+C Intel NHM n/a
+C Intel SBR n/a
+C Intel IBR n/a
+C Intel HWL 2.08
+C Intel BWL 1.78
+C Intel SKL 1.78
+C Intel atom n/a
+C Intel SLM n/a
+C VIA nano n/a
+
+C TODO
+C * The loop sustains 4 insns/cycle on zen.
+C * Perhaps avoid using jrcxz by using dec n + jnz.
+
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`vp', `%rdx')
+define(`n', `%rcx')
+define(`cnt', `%r8')
+
+define(`tnc', `%r9')
+
+ifdef(`OPERATION_addlsh_n',`
+ define(ADCSBB, `adc')
+ define(func, mpn_addlsh_n)
+')
+ifdef(`OPERATION_rsblsh_n',`
+ define(ADCSBB, `sbb')
+ define(func, mpn_rsblsh_n)
+')
+
+MULFUNC_PROLOGUE(mpn_addlsh_n mpn_rsblsh_n)
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(func)
+ FUNC_ENTRY(4)
+IFDOS(` mov 56(%rsp), %r8d ')
+
+ mov (vp), %r10
+
+ mov R32(n), R32(%rax)
+ shr $3, n
+ xor R32(tnc), R32(tnc)
+ sub cnt, tnc
+ and $7, R32(%rax)
+
+ lea L(tab)(%rip), %r11
+ifdef(`PIC',`
+ movslq (%r11,%rax,4), %rax
+ add %r11, %rax
+ jmp *%rax
+',`
+ jmp *(%r11,%rax,8)
+')
+
+L(0): lea 32(up), up
+ lea 32(vp), vp
+ lea 32(rp), rp
+ xor R32(%r11), R32(%r11)
+ jmp L(e0)
+
+L(7): mov %r10, %r11
+ lea 24(up), up
+ lea 24(vp), vp
+ lea 24(rp), rp
+ xor R32(%r10), R32(%r10)
+ jmp L(e7)
+
+L(6): lea 16(up), up
+ lea 16(vp), vp
+ lea 16(rp), rp
+ xor R32(%r11), R32(%r11)
+ jmp L(e6)
+
+L(5): mov %r10, %r11
+ lea 8(up), up
+ lea 8(vp), vp
+ lea 8(rp), rp
+ xor R32(%r10), R32(%r10)
+ jmp L(e5)
+
+L(end): ADCSBB 24(up), %rax
+ mov %rax, -40(rp)
+ shrx( tnc, %r11, %rax)
+ ADCSBB n, %rax
+ FUNC_EXIT()
+ ret
+
+ ALIGN(32)
+L(top): jrcxz L(end)
+ mov -32(vp), %r10
+ ADCSBB 24(up), %rax
+ lea 64(up), up
+ shrx( tnc, %r11, %r11)
+ mov %rax, -40(rp)
+L(e0): dec n
+ shlx( cnt, %r10, %rax)
+ lea (%r11,%rax), %rax
+ mov -24(vp), %r11
+ ADCSBB -32(up), %rax
+ shrx( tnc, %r10, %r10)
+ mov %rax, -32(rp)
+L(e7): shlx( cnt, %r11, %rax)
+ lea (%r10,%rax), %rax
+ mov -16(vp), %r10
+ ADCSBB -24(up), %rax
+ shrx( tnc, %r11, %r11)
+ mov %rax, -24(rp)
+L(e6): shlx( cnt, %r10, %rax)
+ lea (%r11,%rax), %rax
+ mov -8(vp), %r11
+ ADCSBB -16(up), %rax
+ shrx( tnc, %r10, %r10)
+ mov %rax, -16(rp)
+L(e5): shlx( cnt, %r11, %rax)
+ lea (%r10,%rax), %rax
+ mov (vp), %r10
+ ADCSBB -8(up), %rax
+ shrx( tnc, %r11, %r11)
+ mov %rax, -8(rp)
+L(e4): shlx( cnt, %r10, %rax)
+ lea (%r11,%rax), %rax
+ mov 8(vp), %r11
+ ADCSBB (up), %rax
+ shrx( tnc, %r10, %r10)
+ mov %rax, (rp)
+L(e3): shlx( cnt, %r11, %rax)
+ lea (%r10,%rax), %rax
+ mov 16(vp), %r10
+ ADCSBB 8(up), %rax
+ shrx( tnc, %r11, %r11)
+ mov %rax, 8(rp)
+L(e2): shlx( cnt, %r10, %rax)
+ lea (%r11,%rax), %rax
+ mov 24(vp), %r11
+ ADCSBB 16(up), %rax
+ lea 64(vp), vp
+ shrx( tnc, %r10, %r10)
+ mov %rax, 16(rp)
+ lea 64(rp), rp
+L(e1): shlx( cnt, %r11, %rax)
+ lea (%r10,%rax), %rax
+ jmp L(top)
+
+L(4): xor R32(%r11), R32(%r11)
+ jmp L(e4)
+
+L(3): mov %r10, %r11
+ lea -8(up), up
+ lea -8(vp), vp
+ lea -8(rp), rp
+ xor R32(%r10), R32(%r10)
+ jmp L(e3)
+
+L(2): lea -16(up), up
+ lea -16(vp), vp
+ lea -16(rp), rp
+ xor R32(%r11), R32(%r11)
+ jmp L(e2)
+
+L(1): mov %r10, %r11
+ lea -24(up), up
+ lea 40(vp), vp
+ lea 40(rp), rp
+ xor R32(%r10), R32(%r10)
+ jmp L(e1)
+EPILOGUE()
+ JUMPTABSECT
+ ALIGN(8)
+L(tab): JMPENT( L(0), L(tab))
+ JMPENT( L(1), L(tab))
+ JMPENT( L(2), L(tab))
+ JMPENT( L(3), L(tab))
+ JMPENT( L(4), L(tab))
+ JMPENT( L(5), L(tab))
+ JMPENT( L(6), L(tab))
+ JMPENT( L(7), L(tab))
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/aorsmul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorsmul_1.asm
index 285c07335e8..89795e31472 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/aorsmul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/aorsmul_1.asm
@@ -1,6 +1,6 @@
dnl AMD64 mpn_addmul_1 and mpn_submul_1 for CPUs with mulx.
-dnl Copyright 2012, 2013 Free Software Foundation, Inc.
+dnl Copyright 2012, 2013, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -34,16 +34,22 @@ C cycles/limb
C AMD K8,K9 -
C AMD K10 -
C AMD bd1 -
-C AMD bd2 ?
-C AMD bobcat -
-C AMD jaguar ?
+C AMD bd2 -
+C AMD bd3 -
+C AMD bd4 4.3
+C AMD zen 2
+C AMD bt1 -
+C AMD bt2 -
C Intel P4 -
C Intel PNR -
C Intel NHM -
C Intel SBR -
+C Intel IBR -
C Intel HWL ?
C Intel BWL ?
+C Intel SKL ?
C Intel atom -
+C Intel SLM -
C VIA nano -
define(`rp', `%rdi') C rcx
@@ -65,19 +71,16 @@ ifdef(`OPERATION_submul_1',`
define(`func', `mpn_submul_1')
')
-MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
-IFDOS(` define(`up', ``%rsi'') ') dnl
-IFDOS(` define(`rp', ``%rcx'') ') dnl
-IFDOS(` define(`vl', ``%r9'') ') dnl
-IFDOS(` define(`r9', ``rdi'') ') dnl
-IFDOS(` define(`n', ``%r8'') ') dnl
-IFDOS(` define(`r8', ``r11'') ') dnl
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(func)
+ FUNC_ENTRY(4)
mov (up), %r8
push %rbx
@@ -97,23 +100,23 @@ PROLOGUE(func)
jz L(b2)
jg L(b3)
-L(b1): mulx %r8, %rbx, %rax
+L(b1): mulx( %r8, %rbx, %rax)
sub $-1, n
jz L(wd1)
- mulx (up,n,8), %r9, %r8
- mulx 8(up,n,8), %r11, %r10
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
test R32(%rax), R32(%rax) C clear cy
jmp L(lo1)
-L(b0): mulx %r8, %r9, %r8
- mulx 8(up,n,8), %r11, %r10
- mulx 16(up,n,8), %r13, %r12
+L(b0): mulx( %r8, %r9, %r8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
xor R32(%rax), R32(%rax)
jmp L(lo0)
-L(b3): mulx %r8, %r11, %r10
- mulx 8(up,n,8), %r13, %r12
- mulx 16(up,n,8), %rbx, %rax
+L(b3): mulx( %r8, %r11, %r10)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x08 C mulx 8(up,n,8), %r13, %r12
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x10 C mulx 16(up,n,8), %rbx, %rax
add %r10, %r13
adc %r12, %rbx
adc $0, %rax
@@ -122,25 +125,25 @@ L(b3): mulx %r8, %r11, %r10
test R32(%rax), R32(%rax) C clear cy
jmp L(lo3)
-L(b2): mulx %r8, %r13, %r12
- mulx 8(up,n,8), %rbx, %rax
+L(b2): mulx( %r8, %r13, %r12)
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x08 C mulx 8(up,n,8), %rbx, %rax
add %r12, %rbx
adc $0, %rax
sub $-2, n
jz L(wd2)
- mulx (up,n,8), %r9, %r8
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
test R32(%rax), R32(%rax) C clear cy
jmp L(lo2)
L(top): ADDSUB %r9, (rp,n,8)
-L(lo3): mulx (up,n,8), %r9, %r8
+L(lo3): .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
ADCSBB %r11, 8(rp,n,8)
-L(lo2): mulx 8(up,n,8), %r11, %r10
+L(lo2): .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
ADCSBB %r13, 16(rp,n,8)
-L(lo1): mulx 16(up,n,8), %r13, %r12
+L(lo1): .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
ADCSBB %rbx, 24(rp,n,8)
adc %rax, %r9
-L(lo0): mulx 24(up,n,8), %rbx, %rax
+L(lo0): .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
adc %r8, %r11
adc %r10, %r13
adc %r12, %rbx
@@ -156,6 +159,7 @@ L(wd1): ADCSBB %rbx, 24(rp)
pop %r13
pop %r12
pop %rbx
+ FUNC_EXIT()
ret
EPILOGUE()
ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/com.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/com.asm
new file mode 100644
index 00000000000..b34f84169ed
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/com.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_com optimised for AMD Zen.
+
+dnl Copyright 2012 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_com)
+include_mpn(`x86_64/fastsse/com.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/copyd.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/copyd.asm
new file mode 100644
index 00000000000..63ed2371a52
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/copyd.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_copyd optimised for AMD Zen.
+
+dnl Copyright 2012 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_copyd)
+include_mpn(`x86_64/fastsse/copyd.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/copyi.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/copyi.asm
new file mode 100644
index 00000000000..1aafaaafcd5
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/copyi.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_copyi optimised for AMD Zen.
+
+dnl Copyright 2012 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_copyi)
+include_mpn(`x86_64/fastsse/copyi.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gcd_11.asm
index 3d8e5c7ab12..0ffb6caa03c 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/k10/gcd_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gcd_11.asm
@@ -1,4 +1,4 @@
-dnl AMD64 mpn_gcd_1.
+dnl AMD64 mpn_gcd_11.
dnl Copyright 2012 Free Software Foundation, Inc.
@@ -33,5 +33,5 @@ include(`../config.m4')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
-MULFUNC_PROLOGUE(mpn_gcd_1)
-include_mpn(`x86_64/core2/gcd_1.asm')
+MULFUNC_PROLOGUE(mpn_gcd_11)
+include_mpn(`x86_64/bd2/gcd_11.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gcd_22.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gcd_22.asm
new file mode 100644
index 00000000000..5dfd9e3c0b7
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gcd_22.asm
@@ -0,0 +1,37 @@
+dnl AMD64 mpn_gcd_22.
+
+dnl Copyright 2019 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/.
+
+include(`../config.m4')
+
+dnl ABI_SUPPORT(DOS64) C returns mp_double_limb_t in memory
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_gcd_22)
+include_mpn(`x86_64/coreihwl/gcd_22.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gmp-mparam.h b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gmp-mparam.h
new file mode 100644
index 00000000000..05a12b32d41
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/gmp-mparam.h
@@ -0,0 +1,280 @@
+/* AMD Zen gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* Disable use of slow functions. FIXME: We should disable lib inclusion. */
+#undef HAVE_NATIVE_mpn_mul_2
+#undef HAVE_NATIVE_mpn_addmul_2
+
+/* 3700-4300 MHz Pinnacle Ridge */
+/* FFT tuning limit = 468,514,360 */
+/* Generated by tuneup.c, 2019-10-18, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 13
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 18
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 9
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 32
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 22
+
+#define DIV_1_VS_MUL_1_PERCENT 338
+
+#define MUL_TOOM22_THRESHOLD 16
+#define MUL_TOOM33_THRESHOLD 107
+#define MUL_TOOM44_THRESHOLD 190
+#define MUL_TOOM6H_THRESHOLD 230
+#define MUL_TOOM8H_THRESHOLD 272
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 110
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 106
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 117
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 136
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 32
+#define SQR_TOOM3_THRESHOLD 114
+#define SQR_TOOM4_THRESHOLD 422
+#define SQR_TOOM6_THRESHOLD 0 /* always */
+#define SQR_TOOM8_THRESHOLD 0 /* always */
+
+#define MULMID_TOOM42_THRESHOLD 40
+
+#define MULMOD_BNM1_THRESHOLD 12
+#define SQRMOD_BNM1_THRESHOLD 17
+
+#define MUL_FFT_MODF_THRESHOLD 540 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 540, 5}, { 22, 6}, { 12, 5}, { 25, 6}, \
+ { 25, 7}, { 13, 6}, { 29, 7}, { 15, 6}, \
+ { 31, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
+ { 13, 7}, { 29, 8}, { 15, 7}, { 32, 8}, \
+ { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { 21, 7}, { 43, 9}, { 11, 8}, { 29, 9}, \
+ { 15, 8}, { 35, 9}, { 19, 8}, { 43, 9}, \
+ { 23, 8}, { 49, 9}, { 27,10}, { 15, 9}, \
+ { 31, 8}, { 63, 9}, { 43,10}, { 23, 9}, \
+ { 55,11}, { 15,10}, { 31, 9}, { 67,10}, \
+ { 39, 9}, { 83,10}, { 47, 9}, { 99,10}, \
+ { 55,11}, { 31,10}, { 79,11}, { 47,10}, \
+ { 103,12}, { 31,11}, { 63,10}, { 135,11}, \
+ { 79,10}, { 167,11}, { 95,10}, { 191,12}, \
+ { 63,11}, { 159,12}, { 95,11}, { 191,13}, \
+ { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
+ { 271,10}, { 543,11}, { 287,12}, { 159,11}, \
+ { 319,10}, { 639,11}, { 335,10}, { 671, 9}, \
+ { 1343,11}, { 351,12}, { 191,11}, { 383,10}, \
+ { 767,11}, { 415,10}, { 831,12}, { 223,11}, \
+ { 447,13}, { 127,12}, { 255,11}, { 543,10}, \
+ { 1087,12}, { 287,11}, { 575,10}, { 1151,11}, \
+ { 607,10}, { 1215,12}, { 319,11}, { 639,10}, \
+ { 1279,11}, { 671,10}, { 1343, 9}, { 2687,12}, \
+ { 351,11}, { 703,13}, { 191,12}, { 383,11}, \
+ { 767,12}, { 415,11}, { 831,10}, { 1663,12}, \
+ { 447,14}, { 127,13}, { 255,12}, { 511,11}, \
+ { 1023,12}, { 543,11}, { 1087,12}, { 575,11}, \
+ { 1151,12}, { 607,11}, { 1215,13}, { 319,12}, \
+ { 639,11}, { 1279,12}, { 671,11}, { 1343,10}, \
+ { 2687,12}, { 703,11}, { 1407,13}, { 383,12}, \
+ { 799,11}, { 1599,12}, { 831,11}, { 1663,13}, \
+ { 447,12}, { 895,11}, { 1791,12}, { 927,11}, \
+ { 1855,12}, { 959,11}, { 1919,10}, { 3839,13}, \
+ { 511,12}, { 1087,11}, { 2175,13}, { 575,12}, \
+ { 1215,11}, { 2431,13}, { 639,12}, { 1343,11}, \
+ { 2687,13}, { 703,12}, { 1407,14}, { 383,13}, \
+ { 767,12}, { 1599,13}, { 831,12}, { 1727,11}, \
+ { 3455,13}, { 895,12}, { 1855,13}, { 959,12}, \
+ { 1919,11}, { 3839,14}, { 511,13}, { 1087,12}, \
+ { 2175,13}, { 1215,12}, { 2431,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1471,12}, { 2943,14}, \
+ { 767,13}, { 1599,12}, { 3199,13}, { 1727,12}, \
+ { 3455,14}, { 895,13}, { 1855,12}, { 3711,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
+ { 2687,14}, { 1407,13}, { 2815,15}, { 767,14}, \
+ { 1535,13}, { 3199,14}, { 1663,13}, { 3455,12}, \
+ { 6911,14}, { 1791,13}, { 3583,14}, { 1919,16}, \
+ { 511,15}, { 1023,14}, { 2175,13}, { 4479,14}, \
+ { 2431,13}, { 4863,15}, { 1279,14}, { 2687,13}, \
+ { 5375,14}, { 2943,13}, { 5887,15}, { 1535,14}, \
+ { 3455,13}, { 6911,15}, { 1791,14}, { 3839,13}, \
+ { 7679,16}, { 1023,15}, { 2047,14}, { 4479,15}, \
+ { 2303,14}, { 4991,15}, { 2559,14}, { 5247,15}, \
+ { 2815,14}, { 5887,16}, { 1535,15}, { 3327,14}, \
+ { 6911,15}, { 3839,14}, { 7679,17}, { 1023,16}, \
+ { 2047,15}, { 4095,14}, { 8191,15}, { 4351,14}, \
+ { 8959,15}, { 4863,16}, { 2559,15}, { 5375,14}, \
+ { 11007,15}, { 5887,14}, { 11775,16}, { 3071,15}, \
+ { 6911,16}, { 3583,15}, { 7167,14}, { 14335,15}, \
+ { 7679,14}, { 15359,15}, { 7935,14}, { 15871,17}, \
+ { 2047,16}, { 4095,15}, { 8959,16}, { 4607,15}, \
+ { 9215,14}, { 18431,15}, { 9727,14}, { 19455,15}, \
+ { 9983,14}, { 19967,16}, { 5119,15}, { 11007,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 271
+#define MUL_FFT_THRESHOLD 6272
+
+#define SQR_FFT_MODF_THRESHOLD 404 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 404, 5}, { 13, 4}, { 27, 5}, { 21, 6}, \
+ { 11, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
+ { 14, 5}, { 29, 6}, { 29, 7}, { 15, 6}, \
+ { 31, 7}, { 17, 6}, { 35, 7}, { 25, 8}, \
+ { 13, 7}, { 29, 8}, { 15, 7}, { 33, 8}, \
+ { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { 29, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 49, 9}, { 27,10}, \
+ { 15, 9}, { 31, 8}, { 63, 9}, { 43,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 67,10}, { 39, 9}, { 79,10}, { 47, 9}, \
+ { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 135,11}, { 79,10}, { 159,11}, { 95,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,11}, \
+ { 143,10}, { 287, 9}, { 575,11}, { 159,12}, \
+ { 95,11}, { 191,13}, { 63,12}, { 127,11}, \
+ { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
+ { 287,10}, { 575,11}, { 303,12}, { 159,11}, \
+ { 319,10}, { 639,11}, { 335,10}, { 671, 9}, \
+ { 1343,11}, { 351,10}, { 703,11}, { 367,10}, \
+ { 735,12}, { 191,11}, { 383,10}, { 767,11}, \
+ { 399,10}, { 799,11}, { 415,10}, { 831,12}, \
+ { 223,11}, { 447,10}, { 895,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
+ { 1087,12}, { 287,11}, { 575,10}, { 1151,11}, \
+ { 607,10}, { 1215,12}, { 319,11}, { 639,10}, \
+ { 1279,11}, { 671,10}, { 1343,12}, { 351,11}, \
+ { 703,10}, { 1407,11}, { 735,10}, { 1471,13}, \
+ { 191,12}, { 383,11}, { 767,10}, { 1535,11}, \
+ { 799,12}, { 415,11}, { 831,10}, { 1663,12}, \
+ { 447,11}, { 895,14}, { 127,13}, { 255,12}, \
+ { 511,11}, { 1023,12}, { 543,11}, { 1087,12}, \
+ { 575,11}, { 1151,12}, { 607,11}, { 1215,13}, \
+ { 319,12}, { 639,11}, { 1279,12}, { 671,11}, \
+ { 1343,12}, { 703,11}, { 1407,12}, { 735,11}, \
+ { 1471,13}, { 383,12}, { 767,11}, { 1535,12}, \
+ { 799,11}, { 1599,12}, { 831,11}, { 1663,13}, \
+ { 447,12}, { 895,11}, { 1791,12}, { 959,14}, \
+ { 255,13}, { 511,12}, { 1023,11}, { 2047,12}, \
+ { 1087,11}, { 2175,13}, { 575,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1343,13}, { 703,12}, \
+ { 1471,11}, { 2943,14}, { 383,13}, { 767,12}, \
+ { 1599,13}, { 831,12}, { 1727,11}, { 3455,13}, \
+ { 895,12}, { 1855,13}, { 959,15}, { 255,14}, \
+ { 511,13}, { 1023,12}, { 2047,13}, { 1087,12}, \
+ { 2175,13}, { 1215,12}, { 2431,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1471,12}, { 2943,14}, \
+ { 767,13}, { 1599,12}, { 3199,13}, { 1727,12}, \
+ { 3455,14}, { 895,13}, { 1855,12}, { 3711,13}, \
+ { 1919,15}, { 511,14}, { 1023,13}, { 2175,14}, \
+ { 1151,13}, { 2431,12}, { 4863,14}, { 1279,13}, \
+ { 2687,14}, { 1407,13}, { 2943,15}, { 767,14}, \
+ { 1535,13}, { 3199,14}, { 1663,13}, { 3455,12}, \
+ { 6911,14}, { 1791,13}, { 3583,14}, { 1919,16}, \
+ { 511,15}, { 1023,14}, { 2047,13}, { 4095,14}, \
+ { 2175,13}, { 4479,12}, { 8959,14}, { 2431,13}, \
+ { 4863,15}, { 1279,14}, { 2943,13}, { 5887,12}, \
+ { 11775,15}, { 1535,14}, { 3455,13}, { 6911,15}, \
+ { 1791,14}, { 3839,13}, { 7679,14}, { 3967,16}, \
+ { 1023,15}, { 2047,14}, { 4479,15}, { 2303,14}, \
+ { 4991,15}, { 2559,14}, { 5247,15}, { 2815,14}, \
+ { 5887,13}, { 11775,16}, { 1535,15}, { 3071,14}, \
+ { 6143,15}, { 3327,14}, { 6911,15}, { 3839,14}, \
+ { 7679,17}, { 1023,16}, { 2047,15}, { 4095,14}, \
+ { 8191,15}, { 4351,14}, { 8959,15}, { 4863,14}, \
+ { 9727,16}, { 2559,15}, { 5887,14}, { 11775,16}, \
+ { 3071,15}, { 6911,16}, { 3583,15}, { 7167,14}, \
+ { 14335,15}, { 7679,14}, { 15359,15}, { 7935,14}, \
+ { 15871,17}, { 2047,16}, { 4095,15}, { 8959,16}, \
+ { 4607,15}, { 9215,14}, { 18431,15}, { 9727,14}, \
+ { 19455,15}, { 9983,14}, { 19967,16}, { 5119,15}, \
+ { 10239,16}, { 5631,15}, { 11775,17}, { 3071,16}, \
+ { 6655,15}, { 13311,16}, { 65536,17}, { 131072,18}, \
+ { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+ {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 302
+#define SQR_FFT_THRESHOLD 4224
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 69
+#define MULLO_MUL_N_THRESHOLD 11278
+#define SQRLO_BASECASE_THRESHOLD 12
+#define SQRLO_DC_THRESHOLD 82
+#define SQRLO_SQR_THRESHOLD 8207
+
+#define DC_DIV_QR_THRESHOLD 76
+#define DC_DIVAPPR_Q_THRESHOLD 232
+#define DC_BDIV_QR_THRESHOLD 76
+#define DC_BDIV_Q_THRESHOLD 104
+
+#define INV_MULMOD_BNM1_THRESHOLD 37
+#define INV_NEWTON_THRESHOLD 274
+#define INV_APPR_THRESHOLD 230
+
+#define BINV_NEWTON_THRESHOLD 372
+#define REDC_1_TO_REDC_N_THRESHOLD 68
+
+#define MU_DIV_QR_THRESHOLD 1499
+#define MU_DIVAPPR_Q_THRESHOLD 1718
+#define MUPI_DIV_QR_THRESHOLD 108
+#define MU_BDIV_QR_THRESHOLD 1470
+#define MU_BDIV_Q_THRESHOLD 1787
+
+#define POWM_SEC_TABLE 3,22,81,494
+
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 20
+#define SET_STR_DC_THRESHOLD 486
+#define SET_STR_PRECOMPUTE_THRESHOLD 1264
+
+#define FAC_DSC_THRESHOLD 187
+#define FAC_ODD_THRESHOLD 0 /* always */
+
+#define MATRIX22_STRASSEN_THRESHOLD 23
+#define HGCD2_DIV1_METHOD 1 /* 9.20% faster than 3 */
+#define HGCD_THRESHOLD 109
+#define HGCD_APPR_THRESHOLD 104
+#define HGCD_REDUCE_THRESHOLD 3014
+#define GCD_DC_THRESHOLD 566
+#define GCDEXT_DC_THRESHOLD 382
+#define JACOBI_BASE_METHOD 1 /* 15.55% faster than 3 */
+
+/* Tuneup completed successfully, took 281243 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/hamdist.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/hamdist.asm
new file mode 100644
index 00000000000..48dcf610113
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/hamdist.asm
@@ -0,0 +1,38 @@
+dnl AMD64 mpn_hamdist -- hamming distance.
+
+dnl Copyright 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 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/.
+
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_hamdist)
+include_mpn(`x86_64/coreinhm/hamdist.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/lshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/lshift.asm
new file mode 100644
index 00000000000..4dce3191b6f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/lshift.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_lshift optimised for AMD Zen.
+
+dnl Copyright 2012 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_lshift)
+include_mpn(`x86_64/fastsse/lshift-movdqu2.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/lshiftc.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/lshiftc.asm
new file mode 100644
index 00000000000..d52b194929c
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/lshiftc.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_lshiftc optimised for AMD Zen.
+
+dnl Copyright 2012 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_lshiftc)
+include_mpn(`x86_64/fastsse/lshiftc-movdqu2.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/mul_1.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mul_1.asm
index 34a044dcdcc..6a083ac5bc0 100644
--- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/mulx/mul_1.asm
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mul_1.asm
@@ -1,6 +1,6 @@
dnl AMD64 mpn_mul_1 for CPUs with mulx.
-dnl Copyright 2012, 2013 Free Software Foundation, Inc.
+dnl Copyright 2012, 2013, 2017 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -34,16 +34,22 @@ C cycles/limb
C AMD K8,K9 -
C AMD K10 -
C AMD bd1 -
-C AMD bd2 ?
+C AMD bd2 -
+C AMD bd3 -
+C AMD bd4 4.4
+C AMD zen 2
C AMD bobcat -
-C AMD jaguar ?
+C AMD jaguar -
C Intel P4 -
C Intel PNR -
C Intel NHM -
C Intel SBR -
+C Intel IBR -
C Intel HWL ?
C Intel BWL ?
+C Intel SKL ?
C Intel atom -
+C Intel SLM -
C VIA nano -
define(`rp', `%rdi') C rcx
@@ -54,20 +60,20 @@ define(`v0_param',`%rcx') C r9
define(`n', `%rcx')
define(`v0', `%rdx')
-IFDOS(` define(`up', ``%rsi'') ') dnl
-IFDOS(` define(`rp', ``%rcx'') ') dnl
-IFDOS(` define(`v0', ``%r9'') ') dnl
-IFDOS(` define(`r9', ``rdi'') ') dnl
-IFDOS(` define(`n', ``%r8'') ') dnl
-IFDOS(` define(`r8', ``r11'') ') dnl
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_mul_1c)
+ FUNC_ENTRY(4)
+IFDOS(` mov 56(%rsp), %r8 ')
jmp L(ent)
EPILOGUE()
+ ALIGN(16)
PROLOGUE(mpn_mul_1)
+ FUNC_ENTRY(4)
xor R32(%r8), R32(%r8) C carry-in limb
L(ent): mov (up), %r9
@@ -89,51 +95,51 @@ L(ent): mov (up), %r9
jg L(b3)
L(b1): mov %r8, %r12
- mulx %r9, %rbx, %rax
+ mulx( %r9, %rbx, %rax)
sub $-1, n
jz L(wd1)
- mulx (up,n,8), %r9, %r8
- mulx 8(up,n,8), %r11, %r10
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
add %r12, %rbx
jmp L(lo1)
-L(b3): mulx %r9, %r11, %r10
- mulx 8(up,n,8), %r13, %r12
- mulx 16(up,n,8), %rbx, %rax
+L(b3): mulx( %r9, %r11, %r10)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x08 C mulx 8(up,n,8), %r13, %r12
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x10 C mulx 16(up,n,8), %rbx, %rax
sub $-3, n
jz L(wd3)
add %r8, %r11
jmp L(lo3)
L(b2): mov %r8, %r10 C carry-in limb
- mulx %r9, %r13, %r12
- mulx 8(up,n,8), %rbx, %rax
+ mulx( %r9, %r13, %r12)
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x08 C mulx 8(up,n,8), %rbx, %rax
sub $-2, n
jz L(wd2)
- mulx (up,n,8), %r9, %r8
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
add %r10, %r13
jmp L(lo2)
L(b0): mov %r8, %rax C carry-in limb
- mulx %r9, %r9, %r8
- mulx 8(up,n,8), %r11, %r10
- mulx 16(up,n,8), %r13, %r12
+ mulx( %r9, %r9, %r8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
add %rax, %r9
jmp L(lo0)
L(top): jrcxz L(end)
adc %r8, %r11
mov %r9, (rp,n,8)
-L(lo3): mulx (up,n,8), %r9, %r8
+L(lo3): .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
adc %r10, %r13
mov %r11, 8(rp,n,8)
-L(lo2): mulx 8(up,n,8), %r11, %r10
+L(lo2): .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
adc %r12, %rbx
mov %r13, 16(rp,n,8)
-L(lo1): mulx 16(up,n,8), %r13, %r12
+L(lo1): .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
adc %rax, %r9
mov %rbx, 24(rp,n,8)
-L(lo0): mulx 24(up,n,8), %rbx, %rax
+L(lo0): .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
lea 4(n), n
jmp L(top)
@@ -143,12 +149,13 @@ L(wd3): adc %r8, %r11
L(wd2): adc %r10, %r13
mov %r13, 16(rp)
L(wd1): adc %r12, %rbx
- adc n, %rax
+ adc $0, %rax
mov %rbx, 24(rp)
pop %r13
pop %r12
pop %rbx
+ FUNC_EXIT()
ret
EPILOGUE()
ASM_END()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mul_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mul_basecase.asm
new file mode 100644
index 00000000000..affa3b69c60
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mul_basecase.asm
@@ -0,0 +1,455 @@
+dnl AMD64 mpn_mul_basecase optimised for AMD Zen.
+
+dnl Copyright 2012, 2013, 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 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/.
+
+include(`../config.m4')
+
+C TODO
+C * Try 2x unrolling instead of current 4x, at least for mul_1. Else consider
+C shallower sw pipelining of mul_1/addmul_1 loops, allowing 4 or 6 instead
+C of 8 product registers.
+C * Split up mul_1 into 4 loops in order to fall into the addmul_1 loops
+C without branch tree.
+C * Improve the overlapped software pipelining. The mulx in the osp block now
+C suffers from write/read conflicts, in particular the 1 mod 4 case. Also,
+C mul_1 could osp into addmul_1.
+C * Let vn_param be vn to save a copy.
+C * Re-allocate to benefit more from 32-bit encoding.
+C * Poor performance for e.g. n = 12,16.
+
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`un_param', `%rdx')
+define(`vp_param', `%rcx')
+define(`vn_param', `%r8')
+
+define(`un', `%r14')
+define(`vp', `%rbp')
+define(`v0', `%rdx')
+define(`n', `%rcx')
+define(`vn', `%r15')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_mul_basecase)
+ FUNC_ENTRY(4)
+IFDOS(` mov 56(%rsp), %r8d ')
+
+ cmp $2, un_param
+ ja L(gen)
+ mov (vp_param), %rdx
+ mulx( (up), %rax, %r9) C 0 1
+ je L(s2x)
+
+L(s11): mov %rax, (rp)
+ mov %r9, 8(rp)
+ FUNC_EXIT()
+ ret
+
+L(s2x): cmp $2, vn_param
+ mulx( 8,(up), %r8, %r10) C 1 2
+ je L(s22)
+
+L(s21): add %r8, %r9
+ adc $0, %r10
+ mov %rax, (rp)
+ mov %r9, 8(rp)
+ mov %r10, 16(rp)
+ FUNC_EXIT()
+ ret
+
+L(s22): add %r8, %r9 C 1
+ adc $0, %r10 C 2
+ mov 8(vp_param), %rdx
+ mov %rax, (rp)
+ mulx( (up), %r8, %r11) C 1 2
+ mulx( 8,(up), %rax, %rdx) C 2 3
+ add %r11, %rax C 2
+ adc $0, %rdx C 3
+ add %r8, %r9 C 1
+ adc %rax, %r10 C 2
+ adc $0, %rdx C 3
+ mov %r9, 8(rp)
+ mov %r10, 16(rp)
+ mov %rdx, 24(rp)
+ FUNC_EXIT()
+ ret
+
+
+L(gen): push %r15
+ push %r14
+ push %r13
+ push %r12
+ push %rbp
+ push %rbx
+
+ mov un_param, un
+ mov vp_param, vp
+ mov vn_param, vn
+
+ mov (up), %r9
+ mov (vp), v0
+
+ lea (up,un,8), up
+ lea -32(rp,un,8), rp
+
+ neg un
+ mov un, n
+ test $1, R8(un)
+ jz L(mx0)
+L(mx1): test $2, R8(un)
+ jz L(mb3)
+
+L(mb1): mulx( %r9, %rbx, %rax)
+ inc n
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0x08 C mulx 8(up,un,8), %r9, %r8
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0x10 C mulx 16(up,un,8), %r11, %r10
+ jmp L(mlo1)
+
+L(mb3): mulx( %r9, %r11, %r10)
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x08 C mulx 8(up,un,8), %r13, %r12
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x10 C mulx 16(up,un,8), %rbx, %rax
+ sub $-3, n
+ jz L(mwd3)
+ test R32(%rdx), R32(%rdx)
+ jmp L(mlo3)
+
+L(mx0): test $2, R8(un)
+ jz L(mb0)
+
+L(mb2): mulx( %r9, %r13, %r12)
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x08 C mulx 8(up,un,8), %rbx, %rax
+ lea 2(n), n
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0x10 C mulx 16(up,un,8), %r9, %r8
+ jmp L(mlo2)
+
+L(mb0): mulx( %r9, %r9, %r8)
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0x08 C mulx 8(up,un,8), %r11, %r10
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x10 C mulx 16(up,un,8), %r13, %r12
+ jmp L(mlo0)
+
+L(mtop):jrcxz L(mend)
+ adc %r8, %r11
+ mov %r9, (rp,n,8)
+L(mlo3):.byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r10, %r13
+ mov %r11, 8(rp,n,8)
+L(mlo2):.byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r12, %rbx
+ mov %r13, 16(rp,n,8)
+L(mlo1):.byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rax, %r9
+ mov %rbx, 24(rp,n,8)
+L(mlo0):.byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ lea 4(n), n
+ jmp L(mtop)
+
+L(mend):mov %r9, (rp)
+ adc %r8, %r11
+L(mwd3):mov %r11, 8(rp)
+ adc %r10, %r13
+ mov %r13, 16(rp)
+ adc %r12, %rbx
+ adc $0, %rax
+ mov %rbx, 24(rp)
+ mov %rax, 32(rp)
+ add $8, vp
+ dec vn
+ jz L(end)
+
+C The rest of the file are 4 osp loops around addmul_1
+
+ test $1, R8(un)
+ jnz L(0x1)
+
+L(0x0): test $2, R8(un)
+ jnz L(oloop2_entry)
+
+L(oloop0_entry):
+ C initial feed-in block
+ mov (vp), %rdx
+ add $8, vp
+ mov un, n
+ add $8, rp
+ .byte 0xc4,0x22,0xb3,0xf6,0x04,0xf6 C mulx (up,un,8), %r9, %r8
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0x08 C mulx 8(up,un,8), %r11, %r10
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x10 C mulx 16(up,un,8), %r13, %r12
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x18 C mulx 24(up,un,8), %rbx, %rax
+ add %r8, %r11
+ jmp L(lo0)
+
+L(oloop0):
+ C overlapped software pipelining block
+ mov (vp), %rdx C new
+ add $8, vp
+ add %r9, (rp) C prev
+ .byte 0xc4,0x22,0xb3,0xf6,0x04,0xf6 C mulx (%rsi,%r14,8),%r9,%r8
+ adc %r11, 8(rp) C prev
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0x08 C mulx 0x8(%rsi,%r14,8),%r11,%r10
+ adc %r13, 16(rp) C prev
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x10 C mulx 0x10(%rsi,%r14,8),%r13,%r12
+ adc %rbx, 24(rp) C prev
+ mov un, n
+ adc $0, %rax C prev
+ mov %rax, 32(rp) C prev
+ add $8, rp
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x18 C mulx 0x18(%rsi,%r14,8),%rbx,%rax
+ add %r8, %r11 C new
+ jmp L(lo0)
+
+ ALIGN(16)
+L(tp0): add %r9, (rp,n,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r11, 8(rp,n,8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r13, 16(rp,n,8)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rbx, 24(rp,n,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ adc %r8, %r11
+L(lo0): adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, n
+ jnz L(tp0)
+
+ dec vn
+ jne L(oloop0)
+
+ jmp L(final_wind_down)
+
+L(oloop2_entry):
+ mov (vp), %rdx
+ add $8, vp
+ lea 2(un), n
+ add $8, rp
+ .byte 0xc4,0x22,0x93,0xf6,0x24,0xf6 C mulx (up,un,8), %r13, %r12
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x08 C mulx 8(up,un,8), %rbx, %rax
+ add %r12, %rbx
+ adc $0, %rax
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0x10 C mulx 16(up,un,8), %r9, %r8
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ add %r13, 16(rp,n,8)
+ jmp L(lo2)
+
+L(oloop2):
+ mov (vp), %rdx
+ add $8, vp
+ add %r9, (rp)
+ adc %r11, 8(rp)
+ adc %r13, 16(rp)
+ .byte 0xc4,0x22,0x93,0xf6,0x24,0xf6 C mulx (up,un,8), %r13, %r12
+ adc %rbx, 24(rp)
+ adc $0, %rax
+ mov %rax, 32(rp)
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x08 C mulx 8(up,un,8), %rbx, %rax
+ lea 2(un), n
+ add $8, rp
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0x10 C mulx 16(up,un,8), %r9, %r8
+ add %r12, %rbx
+ adc $0, %rax
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0x18 C mulx 0x18(%rsi,%r14,8),%r11,%r10
+ add %r13, 16(rp,n,8)
+ jmp L(lo2)
+
+ ALIGN(16)
+L(tp2): add %r9, (rp,n,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r11, 8(rp,n,8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r13, 16(rp,n,8)
+L(lo2): .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rbx, 24(rp,n,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, n
+ jnz L(tp2)
+
+ dec vn
+ jne L(oloop2)
+
+ jmp L(final_wind_down)
+
+L(0x1): test $2, R8(un)
+ jz L(oloop3_entry)
+
+L(oloop1_entry):
+ mov (vp), %rdx
+ add $8, vp
+ lea 1(un), n
+ add $8, rp
+ .byte 0xc4,0xa2,0xe3,0xf6,0x04,0xf6 C mulx (up,un,8), %rbx, %rax
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0x08 C mulx 8(up,un,8), %r9, %r8
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0x10 C mulx 16(up,un,8), %r11, %r10
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ add %rbx, 24(rp,n,8)
+ jmp L(lo1)
+
+L(oloop1):
+ mov (vp), %rdx
+ add $8, vp
+ add %r9, (rp)
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0x08 C mulx 8(up,un,8), %r9, %r8
+ adc %r11, 8(rp)
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0x10 C mulx 16(up,un,8), %r11, %r10
+ adc %r13, 16(rp)
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x18 C mulx 0x18(%rsi,%r14,8),%r13,%r12
+ adc %rbx, 24(rp)
+ adc $0, %rax
+ mov %rax, 32(rp)
+ .byte 0xc4,0xa2,0xe3,0xf6,0x04,0xf6 C mulx (up,un,8), %rbx, %rax
+ lea 1(un), n
+ add $8, rp
+ add %rbx, 24(rp,n,8)
+ jmp L(lo1)
+
+ ALIGN(16)
+L(tp1): add %r9, (rp,n,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r11, 8(rp,n,8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r13, 16(rp,n,8)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rbx, 24(rp,n,8)
+L(lo1): adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, n
+ jnz L(tp1)
+
+ dec vn
+ jne L(oloop1)
+
+ jmp L(final_wind_down)
+
+L(oloop3_entry):
+ mov (vp), %rdx
+ add $8, vp
+ lea 3(un), n
+ add $8, rp
+ .byte 0xc4,0x22,0xa3,0xf6,0x14,0xf6 C mulx (up,un,8), %r11, %r10
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x08 C mulx 8(up,un,8), %r13, %r12
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x10 C mulx 16(up,un,8), %rbx, %rax
+ add %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ test n, n
+ jz L(wd3)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ add %r11, 8(rp,n,8)
+ jmp L(lo3)
+
+L(oloop3):
+ mov (vp), %rdx
+ add $8, vp
+ add %r9, (rp)
+ adc %r11, 8(rp)
+ .byte 0xc4,0x22,0xa3,0xf6,0x14,0xf6 C mulx (up,un,8), %r11, %r10
+ adc %r13, 16(rp)
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x08 C mulx 8(up,un,8), %r13, %r12
+ adc %rbx, 24(rp)
+ adc $0, %rax
+ mov %rax, 32(rp)
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x10 C mulx 16(up,un,8), %rbx, %rax
+ lea 3(un), n
+ add $8, rp
+ add %r10, %r13
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r12, %rbx
+ adc $0, %rax
+ add %r11, 8(rp,n,8)
+ jmp L(lo3)
+
+ ALIGN(16)
+L(tp3): add %r9, (rp,n,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r11, 8(rp,n,8)
+L(lo3): .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r13, 16(rp,n,8)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rbx, 24(rp,n,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, n
+ jnz L(tp3)
+
+ dec vn
+ jne L(oloop3)
+
+L(final_wind_down):
+ add %r9, (rp)
+ adc %r11, 8(rp)
+ adc %r13, 16(rp)
+ adc %rbx, 24(rp)
+ adc $0, %rax
+ mov %rax, 32(rp)
+
+L(end): pop %rbx
+ pop %rbp
+ pop %r12
+ pop %r13
+ pop %r14
+ pop %r15
+ FUNC_EXIT()
+ ret
+
+L(3): mov (vp), %rdx
+ add $8, vp
+ add $8, rp
+ .byte 0xc4,0x22,0xa3,0xf6,0x14,0xf6 C mulx (up,un,8), %r11, %r10
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x08 C mulx 8(up,un,8), %r13, %r12
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x10 C mulx 16(up,un,8), %rbx, %rax
+ add %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+L(wd3): adc %r11, 8(rp)
+ adc %r13, 16(rp)
+ adc %rbx, 24(rp)
+ adc $0, %rax
+ mov %rax, 32(rp)
+ dec vn
+ jne L(3)
+ jmp L(end)
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mullo_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mullo_basecase.asm
new file mode 100644
index 00000000000..2ae729a4bce
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/mullo_basecase.asm
@@ -0,0 +1,299 @@
+dnl X64-64 mpn_mullo_basecase optimised for AMD Zen.
+
+dnl Contributed to the GNU project by Torbjorn Granlund.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+C The inner loops of this code are the result of running a code generation and
+C optimisation tool suite written by David Harvey and Torbjorn Granlund.
+
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`vp_param', `%rdx')
+define(`n', `%rcx')
+
+define(`vp', `%r11')
+define(`nn', `%rbp')
+
+C TODO
+C * Rearrange feed-in jumps for short branch forms.
+C * Roll out the heavy artillery and 4-way unroll outer loop. Since feed-in
+C code implodes, the blow-up will not be more than perhaps 2.5x.
+C * Micro-optimise critical lead-in code blocks.
+C * Clean up register use, e.g. r15 vs vp, disuse of nn, etc.
+C * Write n < 4 code specifically for Zen (current code is for Haswell).
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_mullo_basecase)
+ FUNC_ENTRY(4)
+ cmp $4, R32(n)
+ jae L(big)
+
+ mov vp_param, vp
+ mov (up), %rdx
+
+ cmp $2, R32(n)
+ jae L(gt1)
+L(n1): imul (vp), %rdx
+ mov %rdx, (rp)
+ FUNC_EXIT()
+ ret
+L(gt1): ja L(gt2)
+L(n2): mov (vp), %r9
+ mulx( %r9, %rax, %rdx)
+ mov %rax, (rp)
+ mov 8(up), %rax
+ imul %r9, %rax
+ add %rax, %rdx
+ mov 8(vp), %r9
+ mov (up), %rcx
+ imul %r9, %rcx
+ add %rcx, %rdx
+ mov %rdx, 8(rp)
+ FUNC_EXIT()
+ ret
+L(gt2):
+L(n3): mov (vp), %r9
+ mulx( %r9, %rax, %r10) C u0 x v0
+ mov %rax, (rp)
+ mov 8(up), %rdx
+ mulx( %r9, %rax, %rdx) C u1 x v0
+ imul 16(up), %r9 C u2 x v0
+ add %rax, %r10
+ adc %rdx, %r9
+ mov 8(vp), %r8
+ mov (up), %rdx
+ mulx( %r8, %rax, %rdx) C u0 x v1
+ add %rax, %r10
+ adc %rdx, %r9
+ imul 8(up), %r8 C u1 x v1
+ add %r8, %r9
+ mov %r10, 8(rp)
+ mov 16(vp), %r10
+ mov (up), %rax
+ imul %rax, %r10 C u0 x v2
+ add %r10, %r9
+ mov %r9, 16(rp)
+ FUNC_EXIT()
+ ret
+
+ ALIGN(16)
+L(big): push %r15
+ push %r14
+ push %r13
+ push %r12
+ push %rbp
+ push %rbx
+
+ mov (up), %r9
+ lea -8(up,n,8), up
+ lea -40(rp,n,8), rp
+
+ mov $4, R32(%r14)
+ sub n, %r14
+ mov -8(vp_param,n,8), %rbp
+ imul %r9, %rbp
+ lea 8(vp_param), %r15
+ mov (vp_param), %rdx
+
+ test $1, R8(%r14)
+ jnz L(mx0)
+L(mx1): test $2, R8(%r14)
+ jz L(mb3)
+
+L(mb1): mulx( %r9, %rbx, %rax)
+ lea -2(%r14), n
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0xf0 C mulx -0x10(%rsi,%r14,8),%r9,%r8
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0xf8 C mulx -0x8(%rsi,%r14,8),%r11,%r10
+ jmp L(mlo1)
+
+L(mb3): mulx( %r9, %r11, %r10)
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0xf0 C mulx -0x10(%rsi,%r14,8),%r13,%r12
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0xf8 C mulx -0x8(%rsi,%r14,8),%rbx,%rax
+ lea (%r14), n
+ jrcxz L(x)
+ jmp L(mlo3)
+L(x): jmp L(mcor)
+
+L(mb2): mulx( %r9, %r13, %r12)
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0xf0 C mulx -0x10(%rsi,%r14,8),%rbx,%rax
+ lea -1(%r14), n
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0xf8 C mulx -0x8(%rsi,%r14,8),%r9,%r8
+ jmp L(mlo2)
+
+L(mx0): test $2, R8(%r14)
+ jz L(mb2)
+
+L(mb0): mulx( %r9, %r9, %r8)
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0xf0 C mulx -0x10(%rsi,%r14,8),%r11,%r10
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0xf8 C mulx -0x8(%rsi,%r14,8),%r13,%r12
+ lea -3(%r14), n
+ jmp L(mlo0)
+
+ ALIGN(16)
+L(mtop):jrcxz L(mend)
+ adc %r8, %r11
+ mov %r9, (rp,n,8)
+L(mlo3):.byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r10, %r13
+ mov %r11, 8(rp,n,8)
+L(mlo2):.byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r12, %rbx
+ mov %r13, 16(rp,n,8)
+L(mlo1):.byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rax, %r9
+ mov %rbx, 24(rp,n,8)
+L(mlo0):.byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ lea 4(n), n
+ jmp L(mtop)
+
+L(mend):mov %r9, (rp)
+ adc %r8, %r11
+ mov %r11, 8(rp)
+ adc %r10, %r13
+ mov %r13, 16(rp)
+ adc %r12, %rbx
+ mov %rbx, 24(rp)
+
+L(outer):
+ mulx( (up), %r10, %r8) C FIXME r8 unused (use imul?)
+ adc %rax, %rbp
+ add %r10, %rbp
+ mov (%r15), %rdx
+ add $8, %r15
+ mov -24(up,%r14,8), %r8
+ lea -8(up), up
+
+ test $1, R8(%r14)
+ jz L(x0)
+L(x1): test $2, R8(%r14)
+ jnz L(b3)
+
+L(b1): mulx( %r8, %rbx, %rax)
+ lea -1(%r14), n
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (%rsi,%rcx,8),%r9,%r8
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 0x8(%rsi,%rcx,8),%r11,%r10
+ jmp L(lo1)
+
+L(x0): test $2, R8(%r14)
+ jz L(b2)
+
+L(b0): mulx( %r8, %r9, %r8)
+ lea -2(%r14), n
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0xf8 C mulx -0x8(%rsi,%r14,8),%r11,%r10
+ .byte 0xc4,0x22,0x93,0xf6,0x24,0xf6 C mulx (%rsi,%r14,8),%r13,%r12
+ jmp L(lo0)
+
+L(b3): mulx( %r8, %r11, %r10)
+ lea 1(%r14), n
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0xf8 C mulx -0x8(%rsi,%r14,8),%r13,%r12
+ .byte 0xc4,0xa2,0xe3,0xf6,0x04,0xf6 C mulx (%rsi,%r14,8),%rbx,%rax
+ add %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ jrcxz L(cor)
+ jmp L(lo3)
+
+L(cor): add 8(rp), %r11
+ mov 16(rp), %r10
+ mov 24(rp), %r12
+L(mcor):mov %r11, 8(rp)
+ adc %r10, %r13
+ adc %r12, %rbx
+ mulx( (up), %r10, %r8) C FIXME r8 unused (use imul?)
+ adc %rax, %rbp
+ add %r10, %rbp
+ mov (%r15), %rdx
+ mov -24(up), %r8
+ mulx( %r8, %r9, %r12)
+ mulx( -16,(up), %r14, %rax)
+ add %r12, %r14
+ adc $0, %rax
+ adc %r9, %r13
+ mov %r13, 16(rp)
+ adc %r14, %rbx
+ mulx( -8,(up), %r10, %r8) C FIXME r8 unused (use imul?)
+ adc %rax, %rbp
+ add %r10, %rbp
+ mov 8(%r15), %rdx
+ mulx( -24,(up), %r14, %rax)
+ add %r14, %rbx
+ mov %rbx, 24(rp)
+ mulx( -16,(up), %r10, %r8) C FIXME r8 unused (use imul?)
+ adc %rax, %rbp
+ add %r10, %rbp
+ mov %rbp, 32(rp)
+ pop %rbx
+ pop %rbp
+ pop %r12
+ pop %r13
+ pop %r14
+ pop %r15
+ FUNC_EXIT()
+ ret
+
+L(b2): mulx( %r8, %r13, %r12)
+ lea (%r14), n
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0xf8 C mulx -0x8(%rsi,%r14,8),%rbx,%rax
+ add %r12, %rbx
+ adc $0, %rax
+ .byte 0xc4,0x22,0xb3,0xf6,0x04,0xf6 C mulx (%rsi,%r14,8),%r9,%r8
+ jmp L(lo2)
+
+ ALIGN(16)
+L(top): add %r9, (rp,n,8)
+L(lo3): .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r11, 8(rp,n,8)
+L(lo2): .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r13, 16(rp,n,8)
+L(lo1): .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rbx, 24(rp,n,8)
+ adc %rax, %r9
+L(lo0): .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, n
+ js L(top)
+
+ add %r9, (rp)
+ adc %r11, 8(rp)
+ adc %r13, 16(rp)
+ adc %rbx, 24(rp)
+ inc %r14
+ jmp L(outer)
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/popcount.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/popcount.asm
new file mode 100644
index 00000000000..be1613b4a17
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/popcount.asm
@@ -0,0 +1,38 @@
+dnl AMD64 mpn_popcount -- population count.
+
+dnl Copyright 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 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/.
+
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_popcount)
+include_mpn(`x86_64/coreinhm/popcount.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/rshift.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/rshift.asm
new file mode 100644
index 00000000000..01968702c68
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/rshift.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_rshift optimised for AMD Zen.
+
+dnl Copyright 2012 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_rshift)
+include_mpn(`x86_64/fastsse/rshift-movdqu2.asm')
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sbpi1_bdiv_r.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sbpi1_bdiv_r.asm
new file mode 100644
index 00000000000..f6e8f9ce13c
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sbpi1_bdiv_r.asm
@@ -0,0 +1,507 @@
+dnl AMD64 mpn_sbpi1_bdiv_r optimised for AMD Zen
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+
+define(`up', `%rdi')
+define(`un_param', `%rsi')
+define(`dp_param', `%rdx')
+define(`dn_param', `%rcx')
+define(`dinv', `%r8')
+
+define(`i', `%rcx')
+define(`dn', `%r14')
+
+define(`dp', `%rsi')
+define(`un', `%r15')
+
+C TODO
+C * The o1...o8 loops for special dn counts were naively hand-optimised by
+C folding the generic loops. They can probably be tuned. The speculative
+C quotient limb generation might not be in the optimal spot.
+C * Perhaps avoid late-in-loop jumps, e.g., lo0.
+C * Improve regalloc wrt dn_param/dn and un_param/un to save some moves.
+
+C ABI_SUPPORT(DOS64)
+C ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(mpn_sbpi1_bdiv_r)
+ FUNC_ENTRY(4)
+IFDOS(` mov 56(%rsp), dinv ')
+ push %r15
+ push %r14
+ push %r13
+ push %r12
+ push %rbp
+ push %rbx
+
+ sub dn_param, un_param C outer loop count
+ mov dn_param, dn C FIXME: Suppress by reg re-alloc
+ push dinv C keep dinv on stack
+ mov un_param, un C FIXME: Suppress by reg re-alloc
+ xor R32(%rbp), R32(%rbp)
+
+ lea (dp_param,dn_param,8), dp
+
+ mov (up), %rdx
+ imul dinv, %rdx C first quotient limb
+
+ neg dn
+ lea -32(up,dn_param,8), up
+
+ test $1, R8(dn_param)
+ jnz L(cx1)
+
+L(cx0): test $2, R8(dn_param)
+ jnz L(b2)
+
+
+C =============================================================================
+L(b0): cmp $-4, dn
+ jnz L(gt4)
+
+L(o4): mulx( -32,(dp), %r9, %r14)
+ mulx( -24,(dp), %r11, %r10)
+ mulx( -16,(dp), %r13, %r12)
+ mulx( -8,(dp), %rbx, %rax)
+ add %r14, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add (up), %r9
+ adc 8(up), %r11
+ mov %r8, %rdx C dinv
+ mov %r11, 8(up)
+ mulx( %r11, %rdx, %r12) C next quotient
+ adc %r13, 16(up)
+ adc %rbx, 24(up)
+ adc %rbp, %rax
+ setc R8(%rbp)
+ add %rax, 32(up)
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(o4)
+ jmp L(ret)
+
+L(gt4): cmp $-8, dn
+ jnz L(out0)
+
+L(o8): mulx( -64,(dp), %r9, %r14)
+ mulx( -56,(dp), %rcx, %r10)
+ mulx( -48,(dp), %r13, %r12)
+ mulx( -40,(dp), %rbx, %rax)
+ add %r14, %rcx
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add -32(up), %r9
+ mulx( -32,(dp), %r9, %r14)
+ adc -24(up), %rcx
+ mov %rcx, -24(up)
+ mulx( -24,(dp), %r11, %r10)
+ adc %r13, -16(up)
+ mulx( -16,(dp), %r13, %r12)
+ adc %rbx, -8(up)
+ adc %rax, %r9
+ mulx( -8,(dp), %rbx, %rax)
+ adc %r14, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ mov %r8, %rdx C dinv
+ mulx( %rcx, %rdx, %r12) C next quotient
+ add %r9, (up)
+ adc %r11, 8(up)
+ adc %r13, 16(up)
+ adc %rbx, 24(up)
+ adc %rbp, %rax
+ setc R8(%rbp)
+ add %rax, 32(up)
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(o8)
+ jmp L(ret)
+
+L(out0):mov dn, i
+ .byte 0xc4,0x22,0xb3,0xf6,0x04,0xf6 C mulx (dp,dn,8),%r9,%r8
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0x08 C mulx 8(dp,dn,8),%r11,%r10
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x10 C mulx 16(dp,dn,8),%r13,%r12
+ clc
+ jmp L(lo0)
+
+ ALIGN(16)
+L(top0):add %r9, (up,i,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (dp,i,8), %r9, %r8
+ adc %r11, 8(up,i,8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(dp,i,8), %r11, %r10
+ adc %r13, 16(up,i,8)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(dp,i,8), %r13, %r12
+ adc %rbx, 24(up,i,8)
+ adc %rax, %r9
+L(lo0): .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(dp,i,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, i
+ js L(top0)
+
+ mov (%rsp), %rdx C dinv
+ .byte 0xc4,0x22,0xeb,0xf6,0x64,0xf7,0x28 C mulx 40(%rdi,%r14,8),%rdx,%r12
+ add %r9, (up)
+ adc %r11, 8(up)
+ adc %r13, 16(up)
+ adc %rbx, 24(up)
+ adc %rbp, %rax
+ setc R8(%rbp)
+ add %rax, 32(up)
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(out0)
+ jmp L(ret)
+
+L(cx1): test $2, R8(dn_param)
+ jnz L(b3)
+
+C =============================================================================
+L(b1): cmp $-1, dn
+ jnz L(gt1)
+
+ mov 24(up), %r9
+L(o1): mulx( -8,(dp), %rbx, %rdx)
+ add %r9, %rbx
+ adc %rbp, %rdx
+ add 32(up), %rdx
+ setc R8(%rbp)
+ mov %rdx, %r9
+ mulx( %r8, %rdx, %r12) C next quotient
+ lea 8(up), up
+ dec un
+ jne L(o1)
+ mov %r9, 24(up)
+ jmp L(ret)
+
+L(gt1): cmp $-5, dn
+ jnz L(out1)
+
+L(o5): mulx( -40,(dp), %rbx, %rax)
+ mulx( -32,(dp), %r9, %r14)
+ mulx( -24,(dp), %r11, %r10)
+ mulx( -16,(dp), %r13, %r12)
+ add -8(up), %rbx
+ adc %rax, %r9
+ mulx( -8,(dp), %rbx, %rax)
+ adc %r14, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add (up), %r9
+ mov %r9, (up)
+ mov %r8, %rdx C dinv
+ mulx( %r9, %rdx, %r12) C next quotient
+ adc %r11, 8(up)
+ adc %r13, 16(up)
+ adc %rbx, 24(up)
+ adc %rbp, %rax
+ setc R8(%rbp)
+ add %rax, 32(up)
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(o5)
+ jmp L(ret)
+
+L(out1):lea 1(dn), i
+ .byte 0xc4,0xa2,0xe3,0xf6,0x04,0xf6 C mulx (dp,dn,8),%rbx,%rax
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0x08 C mulx 8(dp,dn,8),%r9,%r8
+ .byte 0xc4,0x22,0xa3,0xf6,0x54,0xf6,0x10 C mulx 16(dp,dn,8),%r11,%r10
+ clc
+ jmp L(lo1)
+
+ ALIGN(16)
+L(top1):add %r9, (up,i,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (dp,i,8), %r9, %r8
+ adc %r11, 8(up,i,8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(dp,i,8), %r11, %r10
+ adc %r13, 16(up,i,8)
+L(lo1): .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(dp,i,8), %r13, %r12
+ adc %rbx, 24(up,i,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(dp,i,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, i
+ js L(top1)
+
+ mov (%rsp), %rdx C dinv
+ .byte 0xc4,0x22,0xeb,0xf6,0x64,0xf7,0x28 C mulx 40(up,dn,8), %rdx, %r12
+ add %r9, (up)
+ adc %r11, 8(up)
+ adc %r13, 16(up)
+ adc %rbx, 24(up)
+ adc %rbp, %rax
+ setc R8(%rbp)
+ add %rax, 32(up)
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(out1)
+ jmp L(ret)
+
+C =============================================================================
+L(b2): cmp $-2, dn
+ jnz L(gt2)
+
+ mov 16(up), %r10
+ mov 24(up), %r9
+L(o2): mulx( -16,(dp), %r13, %r12)
+ mulx( -8,(dp), %rbx, %rax)
+ add %r12, %rbx
+ adc $0, %rax
+ add %r10, %r13 C add just to produce carry
+ mov %r9, %r10
+ adc %rbx, %r10
+ mov %r8, %rdx
+ mulx( %r10, %rdx, %r12) C next quotient
+ adc %rbp, %rax
+ setc R8(%rbp)
+ mov 32(up), %r9
+ add %rax, %r9
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(o2)
+ mov %r10, 16(up)
+ mov %r9, 24(up)
+ jmp L(ret)
+
+L(gt2): cmp $-6, dn
+ jnz L(out2)
+
+L(o6): mulx( -48,(dp), %r13, %r12)
+ mulx( -40,(dp), %rcx, %rax)
+ add %r12, %rcx
+ adc $0, %rax
+ mulx( -32,(dp), %r9, %r14)
+ mulx( -24,(dp), %r11, %r10)
+ add -16(up), %r13
+ mulx( -16,(dp), %r13, %r12)
+ adc -8(up), %rcx
+ mov %rcx, -8(up)
+ adc %rax, %r9
+ mulx( -8,(dp), %rbx, %rax)
+ adc %r14, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ mov %r8, %rdx C dinv
+ mulx( %rcx, %rdx, %r12) C next quotient
+ add %r9, (up)
+ adc %r11, 8(up)
+ adc %r13, 16(up)
+ adc %rbx, 24(up)
+ adc %rbp, %rax
+ setc R8(%rbp)
+ add %rax, 32(up)
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(o6)
+ jmp L(ret)
+
+L(out2):lea 2(dn), i
+ .byte 0xc4,0x22,0x93,0xf6,0x24,0xf6 C mulx (dp,dn,8),%r13,%r12
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x08 C mulx 8(dp,dn,8),%rbx,%rax
+ add %r12, %rbx
+ adc $0, %rax
+ .byte 0xc4,0x22,0xb3,0xf6,0x44,0xf6,0x10 C mulx 16(dp,dn,8),%r9,%r8
+ jmp L(lo2)
+
+ ALIGN(16)
+L(top2):add %r9, (up,i,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (dp,i,8), %r9, %r8
+ adc %r11, 8(up,i,8)
+L(lo2): .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(dp,i,8), %r11, %r10
+ adc %r13, 16(up,i,8)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(dp,i,8), %r13, %r12
+ adc %rbx, 24(up,i,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(dp,i,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, i
+ js L(top2)
+
+ mov (%rsp), %rdx C dinv
+ .byte 0xc4,0x22,0xeb,0xf6,0x64,0xf7,0x28 C mulx 40(up,dn,8), %rdx, %r12
+ add %r9, (up)
+ adc %r11, 8(up)
+ adc %r13, 16(up)
+ adc %rbx, 24(up)
+ adc %rbp, %rax
+ setc R8(%rbp)
+ add %rax, 32(up)
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(out2)
+ jmp L(ret)
+
+C =============================================================================
+L(b3): cmp $-3, dn
+ jnz L(gt3)
+
+ mov 8(up), %r14
+ mov 16(up), %r9
+ mov 24(up), %rcx
+L(o3): mulx( -24,(dp), %r11, %r10)
+ mulx( -16,(dp), %r13, %r12)
+ mulx( -8,(dp), %rbx, %rax)
+ add %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add %r14, %r11
+ mov %r9, %r14
+ adc %r13, %r14
+ mov %rcx, %r9
+ mov %r8, %rdx C dinv
+ mulx( %r14, %rdx, %r12) C next quotient
+ adc %rbx, %r9
+ adc %rbp, %rax
+ setc R8(%rbp)
+ mov 32(up), %rcx
+ add %rax, %rcx
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(o3)
+ mov %r14, 8(up)
+ mov %r9, 16(up)
+ mov %rcx, 24(up)
+ jmp L(ret)
+
+L(gt3): cmp $-7, dn
+ jnz L(out3)
+
+L(o7): mulx( -56,(dp), %r11, %r10)
+ mulx( -48,(dp), %rcx, %r12)
+ mulx( -40,(dp), %rbx, %rax)
+ add %r10, %rcx
+ adc %r12, %rbx
+ adc $0, %rax
+ mulx( -32,(dp), %r9, %r14)
+ add -24(up), %r11
+ mulx( -24,(dp), %r11, %r10)
+ adc -16(up), %rcx
+ mov %rcx, -16(up)
+ mulx( -16,(dp), %r13, %r12)
+ adc %rbx, -8(up)
+ adc %rax, %r9
+ mulx( -8,(dp), %rbx, %rax)
+ adc %r14, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ mov %r8, %rdx C dinv
+ mulx( %rcx, %rdx, %r12) C next quotient
+ add %r9, (up)
+ adc %r11, 8(up)
+ adc %r13, 16(up)
+ adc %rbx, 24(up)
+ adc %rbp, %rax
+ setc R8(%rbp)
+ add %rax, 32(up)
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(o7)
+ jmp L(ret)
+
+L(out3):lea 3(dn), i
+ .byte 0xc4,0x22,0xa3,0xf6,0x14,0xf6 C mulx (dp,dn,8),%r11,%r10
+ .byte 0xc4,0x22,0x93,0xf6,0x64,0xf6,0x08 C mulx 8(dp,dn,8),%r13,%r12
+ .byte 0xc4,0xa2,0xe3,0xf6,0x44,0xf6,0x10 C mulx 16(dp,dn,8),%rbx,%rax
+ add %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ jmp L(lo3)
+
+ ALIGN(16)
+L(top3):add %r9, (up,i,8)
+L(lo3): .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (dp,i,8), %r9, %r8
+ adc %r11, 8(up,i,8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(dp,i,8), %r11, %r10
+ adc %r13, 16(up,i,8)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(dp,i,8), %r13, %r12
+ adc %rbx, 24(up,i,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(dp,i,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, i
+ js L(top3)
+
+ mov (%rsp), %rdx C dinv
+ .byte 0xc4,0x22,0xeb,0xf6,0x64,0xf7,0x28 C mulx 40(up,dn,8), %rdx, %r12
+ add %r9, (up)
+ adc %r11, 8(up)
+ adc %r13, 16(up)
+ adc %rbx, 24(up)
+ adc %rbp, %rax
+ setc R8(%rbp)
+ add %rax, 32(up)
+ adc $0, R32(%rbp)
+ lea 8(up), up
+ dec un
+ jne L(out3)
+
+L(ret): mov %rbp, %rax
+ pop %rsi C dummy dealloc
+ pop %rbx
+ pop %rbp
+ pop %r12
+ pop %r13
+ pop %r14
+ pop %r15
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sqr_basecase.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sqr_basecase.asm
new file mode 100644
index 00000000000..a7c612763e9
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sqr_basecase.asm
@@ -0,0 +1,482 @@
+dnl AMD64 mpn_sqr_basecase optimised for AMD Zen.
+
+dnl Copyright 2012, 2013, 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 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/.
+
+include(`../config.m4')
+
+C TODO
+C * Do overlapped software pipelining. This should close the remaining gap to
+C mul_basecase.
+C
+C * Update un just once in the outer loop.
+C
+C * Perhaps keep un and n pre-multiplied by 8, thus suppressing ",8" from
+C loads and stores. At least in some cases, the non-scaled form is faster.
+C
+C * Optimise xit3 code, e.g., using shrx and sarx like in the main loop.
+C
+C * The mul_1 feed-in code has gotten little attention and could probably be
+C improved. Perhaps even expand it to 4 separate loops to allow straight
+C fall-through into the 4 addmul_1 loops.
+C
+C * Clean up ad-hoc scratch register usage in the addmul_1 feed-in code blocks.
+
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`un_param',`%rdx')
+
+define(`un', `%rbp')
+define(`n', `%rcx')
+
+C these are used just for the small op code
+define(`w0', `%r8')
+define(`w1', `%r9')
+define(`w2', `%r10')
+define(`w3', `%r11')
+
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(mpn_sqr_basecase)
+ FUNC_ENTRY(3)
+
+ cmp $2, R32(un_param)
+ jae L(gt1)
+
+ mov (up), %rdx
+ mulx( %rdx, %rax, %rdx)
+ mov %rax, (rp)
+ mov %rdx, 8(rp)
+ FUNC_EXIT()
+ ret
+
+L(gt1): jne L(gt2)
+
+ mov (up), %rdx
+ mov 8(up), %rcx
+ mulx( %rcx, %r9, %r10) C v0 * v1 W 1 2
+ mulx( %rdx, %rax, %r8) C v0 * v0 W 0 1
+ mov %rcx, %rdx
+ mulx( %rdx, %r11, %rdx) C v1 * v1 W 2 3
+ add %r9, %r9 C W 1
+ adc %r10, %r10 C W 2
+ adc $0, %rdx C W 3
+ add %r9, %r8 C W 1
+ adc %r11, %r10 C W 2
+ adc $0, %rdx C W 3
+ mov %rax, (rp)
+ mov %r8, 8(rp)
+ mov %r10, 16(rp)
+ mov %rdx, 24(rp)
+ FUNC_EXIT()
+ ret
+
+L(gt2): cmp $4, R32(un_param)
+ jae L(gt3)
+
+ push %rbx
+ mov (up), %rdx
+ mulx( 8,(up), w2, w3)
+ mulx( 16,(up), w0, w1)
+ add w3, w0
+ mov 8(up), %rdx
+ mulx( 16,(up), %rax, w3)
+ adc %rax, w1
+ adc $0, w3
+ test R32(%rbx), R32(%rbx)
+ mov (up), %rdx
+ mulx( %rdx, %rbx, %rcx)
+ mov %rbx, (rp)
+ mov 8(up), %rdx
+ mulx( %rdx, %rax, %rbx)
+ mov 16(up), %rdx
+ mulx( %rdx, %rsi, %rdx)
+ adcx( w2, w2)
+ adcx( w0, w0)
+ adcx( w1, w1)
+ adcx( w3, w3)
+ adox( w2, %rcx)
+ adox( w0, %rax)
+ adox( w1, %rbx)
+ adox( w3, %rsi)
+ mov $0, R32(%r8)
+ adox( %r8, %rdx)
+ adcx( %r8, %rdx)
+ mov %rcx, 8(rp)
+ mov %rax, 16(rp)
+ mov %rbx, 24(rp)
+ mov %rsi, 32(rp)
+ mov %rdx, 40(rp)
+ pop %rbx
+ FUNC_EXIT()
+ ret
+
+L(gt3): push %r15
+C push %r14
+ push %r13
+ push %r12
+ push %rbp
+ push %rbx
+ mov R32(un_param), R32(un)
+
+ mov (up), %rdx C up[0]
+ mov 8(up), %r9 C up[1]
+
+ mulx( %rdx, %rax, %r15) C up[0]^2
+ mov %rax, (rp)
+ shl %rdx
+
+ lea (up,un,8), up
+ lea -32(rp,un,8), rp
+
+ neg un
+ lea 4(un), n
+ and $-4, n
+
+ test $1, R8(un)
+ jnz L(mx0)
+L(mx1): test $2, R8(un)
+ jz L(mb3)
+
+L(mb1): mulx( %r9, %rbx, %rax)
+ .byte 0xc4,0x62,0xb3,0xf6,0x44,0xee,0x10 C mulx 16(up,un,8), %r9, %r8
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xee,0x18 C mulx 24(up,un,8), %r11, %r10
+ add %r15, %rbx
+ jmp L(mlo1)
+
+L(mb3): mulx( %r9, %r11, %r10)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xee,0x10 C mulx 16(up,un,8), %r13, %r12
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xee,0x18 C mulx 24(up,un,8), %rbx, %rax
+ add %r15, %r11
+ jrcxz L(n4)
+ jmp L(mlo3)
+L(n4): mov %r11, 8(rp)
+ adc %r10, %r13
+ adc %r12, %rbx
+ jmp L(m)
+
+L(mx0): test $2, R8(un)
+ jnz L(mb0)
+
+L(mb2): mulx( %r9, %r13, %r12)
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xee,0x10 C mulx 16(up,un,8), %rbx, %rax
+ .byte 0xc4,0x62,0xb3,0xf6,0x44,0xee,0x18 C mulx 24(up,un,8), %r9, %r8
+ add %r15, %r13
+ jmp L(mlo2)
+
+L(mb0): mulx( %r9, %r9, %r8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xee,0x10 C mulx 16(up,un,8), %r11, %r10
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xee,0x18 C mulx 24(up,un,8), %r13, %r12
+ add %r15, %r9
+ jmp L(mlo0)
+
+ ALIGN(16)
+L(mtop):jrcxz L(mend)
+ adc %r8, %r11
+ mov %r9, (rp,n,8)
+L(mlo3):.byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r10, %r13
+ mov %r11, 8(rp,n,8)
+L(mlo2):.byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r12, %rbx
+ mov %r13, 16(rp,n,8)
+L(mlo1):.byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rax, %r9
+ mov %rbx, 24(rp,n,8)
+L(mlo0):.byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ lea 4(n), n
+ jmp L(mtop)
+
+L(mend):mov %r9, (rp)
+ adc %r8, %r11
+ mov %r11, 8(rp)
+ adc %r10, %r13
+ mov %r13, 16(rp)
+ adc %r12, %rbx
+ adc $0, %rax
+ mov %rbx, 24(rp)
+ mov %rax, 32(rp)
+
+ lea 2(un), un
+
+ mov $63, R32(%r15) C keep at 63 for shrx/sarx.
+ test $1, R8(un)
+ jz L(x0)
+L(x1): test $2, R8(un)
+ jz L(f3)
+ jmp L(f1)
+L(x0): test $2, R8(un)
+ jz L(f0)
+C jmp L(f2)
+
+L(f2): mov -8(up,un,8), %rdx C up[0]
+ lea 2(un), n
+ lea 8(rp), rp
+ .byte 0xc4,0x62,0x82,0xf7,0x5c,0xee,0xf0 C sarx %r15, -16(up,un,8), %r11
+ .byte 0xc4,0x62,0x83,0xf7,0x6c,0xee,0xf0 C shrx %r15, -16(up,un,8), %r13
+ and %rdx, %r11 C "ci" in C code
+ mulx( %rdx, %rax, %r10) C up[0]^2
+ lea (%r13,%rdx,2), %rdx C "u0" arg in C code
+ add %rax, %r11
+
+ .byte 0xc4,0x62,0x93,0xf6,0x24,0xee C mulx (up,un,8), %r13, %r12
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xee,0x08 C mulx 8(up,un,8), %rbx, %rax
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ jmp L(b2)
+
+ ALIGN(16)
+L(top2):add %r9, (rp,n,8)
+L(b2): .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r11, 8(rp,n,8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r13, 16(rp,n,8)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rbx, 24(rp,n,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, n
+ jnz L(top2)
+
+ inc un
+ add %r9, (rp)
+ adc %r11, 8(rp)
+ adc %r13, 16(rp)
+ adc %rbx, 24(rp)
+ adc $0, %rax
+ mov %rax, 32(rp)
+
+L(f1): mov -8(up,un,8), %rdx C up[0]
+ lea 1(un), n
+ lea 8(rp), rp
+ .byte 0xc4,0x62,0x82,0xf7,0x6c,0xee,0xf0 C sarx %r15, -16(up,un,8), %r13
+ .byte 0xc4,0xe2,0x83,0xf7,0x5c,0xee,0xf0 C shrx %r15, -16(up,un,8), %rbx
+ and %rdx, %r13 C "ci" in C code
+ mulx( %rdx, %rax, %r12) C up[0]^2
+ lea (%rbx,%rdx,2), %rdx C "u0" arg in C code
+ add %rax, %r13
+
+ .byte 0xc4,0xe2,0xe3,0xf6,0x04,0xee C mulx (up,un,8), %rbx, %rax
+ adc %r12, %rbx
+ adc $0, %rax
+ .byte 0xc4,0x62,0xb3,0xf6,0x44,0xee,0x08 C mulx 8(up,un,8), %r9, %r8
+ jmp L(b1)
+
+ ALIGN(16)
+L(top1):add %r9, (rp,n,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r11, 8(rp,n,8)
+L(b1): .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r13, 16(rp,n,8)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rbx, 24(rp,n,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, n
+ jnz L(top1)
+
+ inc un
+ add %r9, (rp)
+ adc %r11, 8(rp)
+ adc %r13, 16(rp)
+ adc %rbx, 24(rp)
+ adc $0, %rax
+ mov %rax, 32(rp)
+
+L(f0): mov -8(up,un,8), %rdx C up[0]
+ lea (un), n
+ lea 8(rp), rp
+ .byte 0xc4,0xe2,0x82,0xf7,0x5c,0xee,0xf0 C sarx %r15, -16(up,un,8), %rbx
+ .byte 0xc4,0x62,0x83,0xf7,0x4c,0xee,0xf0 C shrx %r15, -16(up,un,8), %r9
+ and %rdx, %rbx C "ci" in C code
+ mulx( %rdx, %r10, %rax) C up[0]^2
+ lea (%r9,%rdx,2), %rdx C "u0" arg in C code
+ add %r10, %rbx
+ adc $0, %rax C "cin" in C code
+
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,un,8), %r9, %r8
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xee,0x08 C mulx 8(up,un,8), %r11, %r10
+ jmp L(b0)
+
+ ALIGN(16)
+L(top0):add %r9, (rp,n,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r11, 8(rp,n,8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r13, 16(rp,n,8)
+L(b0): .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rbx, 24(rp,n,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, n
+ jnz L(top0)
+
+ inc un
+ add %r9, (rp)
+ adc %r11, 8(rp)
+ adc %r13, 16(rp)
+ adc %rbx, 24(rp)
+ adc $0, %rax
+ mov %rax, 32(rp)
+
+L(f3): mov -8(up,un,8), %rdx C up[0]
+ lea 3(un), n
+ lea 8(rp), rp
+ .byte 0xc4,0x62,0x82,0xf7,0x4c,0xee,0xf0 C sarx %r15, -16(up,un,8), %r9
+ .byte 0xc4,0x62,0x83,0xf7,0x5c,0xee,0xf0 C shrx %r15, -16(up,un,8), %r11
+ and %rdx, %r9 C "ci" in C code
+ mulx( %rdx, %rax, %r8) C up[0]^2
+ lea (%r11,%rdx,2), %rdx C "u0" arg in C code
+ add %rax, %r9
+
+ .byte 0xc4,0x62,0xa3,0xf6,0x14,0xee C mulx (%rsi,%rbp,8),%r11,%r10
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xee,0x08 C mulx 0x8(%rsi,%rbp,8),%r13,%r12
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xee,0x10 C mulx 0x10(%rsi,%rbp,8),%rbx,%rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ jrcxz L(xit3)
+ jmp L(top3) C FIXME perhaps fall through
+
+ ALIGN(16)
+L(top3):add %r9, (rp,n,8)
+ .byte 0xc4,0x62,0xb3,0xf6,0x04,0xce C mulx (up,n,8), %r9, %r8
+ adc %r11, 8(rp,n,8)
+ .byte 0xc4,0x62,0xa3,0xf6,0x54,0xce,0x08 C mulx 8(up,n,8), %r11, %r10
+ adc %r13, 16(rp,n,8)
+ .byte 0xc4,0x62,0x93,0xf6,0x64,0xce,0x10 C mulx 16(up,n,8), %r13, %r12
+ adc %rbx, 24(rp,n,8)
+ adc %rax, %r9
+ .byte 0xc4,0xe2,0xe3,0xf6,0x44,0xce,0x18 C mulx 24(up,n,8), %rbx, %rax
+ adc %r8, %r11
+ adc %r10, %r13
+ adc %r12, %rbx
+ adc $0, %rax
+ add $4, n
+ jnz L(top3)
+
+ inc un
+ add %r9, (rp)
+ adc %r11, 8(rp)
+ adc %r13, 16(rp)
+ adc %rbx, 24(rp)
+ adc $0, %rax
+ mov %rax, 32(rp)
+ jmp L(f2)
+
+
+L(xit3):add %r9, (rp)
+ adc %r11, 8(rp)
+ adc 16(rp), %r13
+ adc 24(rp), %rbx
+L(m): adc $0, %rax
+ mov %rax, 32(rp)
+ mov -24(up), %rdx C FIXME: CSE
+ mov -32(up), %r9 C FIXME: CSE
+ sar $63, %r9
+ and %rdx, %r9
+ add %r13, %r9
+ mulx( %rdx, %rax, %r10)
+ mov -16(up), %r8 C FIXME: CSE
+ adc $0, %r10
+ add %rax, %r9
+ adc $0, %r10
+ mov %r9, 16(rp)
+ mov -32(up), %rax
+ shl %rax
+ adc %rdx, %rdx
+ mulx( %r8, %r13, %r12)
+ mulx( -8,(up), %r11, %rax) C FIXME: CSE
+ add %r10, %r13
+ adc %r12, %r11
+ adc $0, %rax
+ add %rbx, %r13
+ mov %r13, 24(rp)
+ adc 32(rp), %r11
+ adc $0, %rax
+ mov -16(up), %rdx C FIXME: CSE
+ mov -8(up), %r8 C FIXME: CSE
+ mov -24(up), %r9
+ sar $63, %r9
+ and %rdx, %r9
+ add %r11, %r9
+ mulx( %rdx, %rbp, %r10)
+ adc $0, %r10
+ add %rbp, %r9
+ adc $0, %r10
+ mov %r9, 32(rp)
+ mov -24(up), %rbp
+ shl %rbp
+ adc %rdx, %rdx
+ mulx( %r8, %rbx, %rbp)
+ add %r10, %rbx
+ adc $0, %rbp
+ adc %rbx, %rax
+ mov %rax, 40(rp)
+ adc $0, %rbp
+ mov -8(up), %rdx C FIXME: CSE
+ mov -16(up), %r9 C FIXME: CSE
+ sar $63, %r9
+ and %rdx, %r9
+ add %rbp, %r9
+ mulx( %rdx, %rbp, %r10)
+ adc $0, %r10
+ add %rbp, %r9
+ adc $0, %r10
+ mov %r9, 48(rp)
+ mov %r10, 56(rp)
+
+ pop %rbx
+ pop %rbp
+ pop %r12
+ pop %r13
+C pop %r14
+ pop %r15
+
+ FUNC_EXIT()
+ ret
+EPILOGUE()
diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sublsh1_n.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sublsh1_n.asm
new file mode 100644
index 00000000000..00f6dc9161d
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen/sublsh1_n.asm
@@ -0,0 +1,37 @@
+dnl X86-64 mpn_sublsh1_n, mpn_sublsh1_nc.
+
+dnl Copyright 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 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/.
+
+include(`../config.m4')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_sublsh1_n mpn_sublsh1_nc)
+include_mpn(`x86_64/atom/sublsh1_n.asm')
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
new file mode 100644
index 00000000000..3748c5f580a
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/zen2/gmp-mparam.h
@@ -0,0 +1,276 @@
+/* AMD Zen2 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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/. */
+
+#define GMP_LIMB_BITS 64
+#define GMP_LIMB_BYTES 8
+
+/* Disable use of slow functions. FIXME: We should disable lib inclusion. */
+#undef HAVE_NATIVE_mpn_mul_2
+#undef HAVE_NATIVE_mpn_addmul_2
+
+/* 3600-4400 MHz Matisse */
+/* FFT tuning limit = 703,392,483 */
+/* Generated by tuneup.c, 2019-10-19, gcc 8.3 */
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1N_TO_MOD_1_1_THRESHOLD 4
+#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD 27
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 1
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define DIV_QR_1_NORM_THRESHOLD 1
+#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_QR_2_PI2_THRESHOLD 13
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD 22
+
+#define DIV_1_VS_MUL_1_PERCENT 385
+
+#define MUL_TOOM22_THRESHOLD 19
+#define MUL_TOOM33_THRESHOLD 125
+#define MUL_TOOM44_THRESHOLD 196
+#define MUL_TOOM6H_THRESHOLD 276
+#define MUL_TOOM8H_THRESHOLD 369
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD 121
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD 138
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD 129
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD 132
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD 185
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_TOOM2_THRESHOLD 30
+#define SQR_TOOM3_THRESHOLD 117
+#define SQR_TOOM4_THRESHOLD 315
+#define SQR_TOOM6_THRESHOLD 446
+#define SQR_TOOM8_THRESHOLD 527
+
+#define MULMID_TOOM42_THRESHOLD 38
+
+#define MULMOD_BNM1_THRESHOLD 14
+#define SQRMOD_BNM1_THRESHOLD 20
+
+#define MUL_FFT_MODF_THRESHOLD 436 /* k = 5 */
+#define MUL_FFT_TABLE3 \
+ { { 436, 5}, { 25, 6}, { 25, 7}, { 13, 6}, \
+ { 27, 7}, { 15, 6}, { 31, 7}, { 25, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 32, 8}, \
+ { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 49, 9}, { 27,10}, \
+ { 15, 9}, { 31, 8}, { 63, 9}, { 39,10}, \
+ { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
+ { 71,10}, { 39, 9}, { 83,10}, { 47, 9}, \
+ { 95,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 135,11}, { 79,10}, { 159,11}, { 95,10}, \
+ { 191,12}, { 63,11}, { 127,10}, { 255, 9}, \
+ { 511,11}, { 143,10}, { 287, 9}, { 575,11}, \
+ { 159,12}, { 95,11}, { 191,13}, { 63,12}, \
+ { 127,11}, { 255,10}, { 511,11}, { 271,10}, \
+ { 543, 9}, { 1087,11}, { 287,10}, { 575,12}, \
+ { 159,11}, { 319,10}, { 639,11}, { 335,10}, \
+ { 671,11}, { 351,10}, { 703,11}, { 367,12}, \
+ { 191,11}, { 383,10}, { 767,11}, { 415,10}, \
+ { 831,12}, { 223,11}, { 447,13}, { 127,12}, \
+ { 255,11}, { 543,10}, { 1087,12}, { 287,11}, \
+ { 575,10}, { 1151,11}, { 607,10}, { 1215,12}, \
+ { 319,11}, { 639,10}, { 1279,11}, { 671,10}, \
+ { 1343,12}, { 351,11}, { 703,10}, { 1407,11}, \
+ { 735,13}, { 191,12}, { 383,11}, { 767,10}, \
+ { 1535,11}, { 799,12}, { 415,11}, { 831,10}, \
+ { 1663,12}, { 447,11}, { 895,12}, { 479,14}, \
+ { 127,13}, { 255,12}, { 543,11}, { 1087,10}, \
+ { 2175,12}, { 575,11}, { 1151,12}, { 607,11}, \
+ { 1215,10}, { 2431,13}, { 319,12}, { 639,11}, \
+ { 1279,12}, { 671,11}, { 1343,10}, { 2687,12}, \
+ { 703,11}, { 1471,10}, { 2943,13}, { 383,12}, \
+ { 767,11}, { 1535,12}, { 799,11}, { 1599,12}, \
+ { 831,11}, { 1663,13}, { 447,12}, { 959,11}, \
+ { 1919,10}, { 3839,14}, { 255,13}, { 511,12}, \
+ { 1087,11}, { 2175,13}, { 575,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1343,11}, { 2687,13}, \
+ { 703,12}, { 1471,11}, { 2943,14}, { 383,13}, \
+ { 767,12}, { 1599,11}, { 3199,13}, { 831,12}, \
+ { 1727,13}, { 895,12}, { 1791,13}, { 959,12}, \
+ { 1919,11}, { 3839,14}, { 511,13}, { 1087,12}, \
+ { 2175,13}, { 1215,12}, { 2431,14}, { 639,13}, \
+ { 1343,12}, { 2687,13}, { 1471,12}, { 2943,11}, \
+ { 5887,14}, { 767,13}, { 1599,12}, { 3199,13}, \
+ { 1727,12}, { 3455,14}, { 895,13}, { 1919,12}, \
+ { 3839,11}, { 7679,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,13}, { 2943,12}, \
+ { 5887,15}, { 767,14}, { 1535,13}, { 3199,14}, \
+ { 1663,13}, { 3455,12}, { 6911,14}, { 1919,13}, \
+ { 3839,16}, { 511,15}, { 1023,14}, { 2175,13}, \
+ { 4479,12}, { 8959,14}, { 2431,13}, { 4863,15}, \
+ { 1279,14}, { 2943,13}, { 5887,12}, { 11775,15}, \
+ { 1535,14}, { 3455,15}, { 1791,14}, { 3839,13}, \
+ { 7679,14}, { 3967,16}, { 1023,15}, { 2047,14}, \
+ { 4479,15}, { 2303,14}, { 4863,15}, { 2559,14}, \
+ { 5247,15}, { 2815,14}, { 5887,16}, { 1535,15}, \
+ { 3327,14}, { 6911,15}, { 3839,14}, { 7679,13}, \
+ { 15359,17}, { 1023,16}, { 2047,15}, { 4351,14}, \
+ { 8959,15}, { 4863,16}, { 2559,15}, { 5887,14}, \
+ { 11775,16}, { 3071,15}, { 6911,16}, { 3583,15}, \
+ { 7679,14}, { 15359,15}, { 7935,17}, { 2047,16}, \
+ { 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}, \
+ { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+ {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 275
+#define MUL_FFT_THRESHOLD 4736
+
+#define SQR_FFT_MODF_THRESHOLD 396 /* k = 5 */
+#define SQR_FFT_TABLE3 \
+ { { 396, 5}, { 25, 6}, { 25, 7}, { 13, 6}, \
+ { 27, 7}, { 15, 6}, { 31, 7}, { 25, 8}, \
+ { 13, 7}, { 28, 8}, { 15, 7}, { 32, 8}, \
+ { 17, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
+ { 27, 9}, { 15, 8}, { 35, 9}, { 19, 8}, \
+ { 41, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
+ { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
+ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
+ { 79,10}, { 55,11}, { 31,10}, { 79,11}, \
+ { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
+ { 135,11}, { 79,10}, { 159,11}, { 95,12}, \
+ { 63,11}, { 127,10}, { 255, 9}, { 511,11}, \
+ { 143,10}, { 287, 9}, { 575,10}, { 303,11}, \
+ { 159,12}, { 95,13}, { 63,12}, { 127,11}, \
+ { 255,10}, { 511,11}, { 271,10}, { 543,11}, \
+ { 287,10}, { 575,11}, { 303,12}, { 159,11}, \
+ { 319,10}, { 639,11}, { 335,10}, { 671, 9}, \
+ { 1343,11}, { 351,10}, { 703,11}, { 367,10}, \
+ { 735,11}, { 383,10}, { 767,11}, { 415,10}, \
+ { 831,12}, { 223,11}, { 447,13}, { 127,12}, \
+ { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
+ { 1087,12}, { 287,11}, { 575,10}, { 1151,11}, \
+ { 607,10}, { 1215,12}, { 319,11}, { 639,10}, \
+ { 1279,11}, { 671,10}, { 1343,12}, { 351,11}, \
+ { 703,10}, { 1407,11}, { 735,10}, { 1471,12}, \
+ { 383,11}, { 767,10}, { 1535,11}, { 799,12}, \
+ { 415,11}, { 831,10}, { 1663,12}, { 447,11}, \
+ { 895,12}, { 479,11}, { 959,14}, { 127,12}, \
+ { 511,11}, { 1023,12}, { 543,11}, { 1087,10}, \
+ { 2175,12}, { 575,11}, { 1151,12}, { 607,11}, \
+ { 1215,10}, { 2431,12}, { 639,11}, { 1279,12}, \
+ { 671,11}, { 1343,10}, { 2687,12}, { 703,11}, \
+ { 1407,12}, { 735,11}, { 1471,10}, { 2943,13}, \
+ { 383,12}, { 767,11}, { 1535,12}, { 799,11}, \
+ { 1599,12}, { 831,11}, { 1663,13}, { 447,12}, \
+ { 959,11}, { 1919,10}, { 3839,13}, { 511,12}, \
+ { 1087,11}, { 2175,13}, { 575,12}, { 1215,11}, \
+ { 2431,13}, { 639,12}, { 1343,11}, { 2687,13}, \
+ { 703,12}, { 1471,11}, { 2943,14}, { 383,13}, \
+ { 767,12}, { 1599,13}, { 831,12}, { 1727,11}, \
+ { 3455,13}, { 959,12}, { 1919,11}, { 3839,14}, \
+ { 511,13}, { 1023,12}, { 2047,13}, { 1087,12}, \
+ { 2175,13}, { 1215,12}, { 2431,11}, { 4863,14}, \
+ { 639,13}, { 1343,12}, { 2687,13}, { 1471,12}, \
+ { 2943,11}, { 5887,14}, { 767,13}, { 1599,12}, \
+ { 3199,13}, { 1727,12}, { 3455,14}, { 895,13}, \
+ { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
+ { 2175,14}, { 1151,13}, { 2431,12}, { 4863,14}, \
+ { 1279,13}, { 2687,14}, { 1407,13}, { 2943,12}, \
+ { 5887,15}, { 767,14}, { 1535,13}, { 3199,14}, \
+ { 1663,13}, { 3455,12}, { 6911,14}, { 1919,13}, \
+ { 3839,12}, { 7679,16}, { 511,15}, { 1023,14}, \
+ { 2175,13}, { 4479,14}, { 2431,13}, { 4863,15}, \
+ { 1279,14}, { 2943,13}, { 5887,12}, { 11775,15}, \
+ { 1535,14}, { 3455,13}, { 6911,15}, { 1791,14}, \
+ { 3839,13}, { 7679,14}, { 3967,16}, { 1023,15}, \
+ { 2047,14}, { 4479,15}, { 2303,14}, { 4863,15}, \
+ { 2559,14}, { 5247,15}, { 2815,14}, { 5887,13}, \
+ { 11775,16}, { 1535,15}, { 3071,14}, { 6143,15}, \
+ { 3327,14}, { 6911,15}, { 3839,14}, { 7679,17}, \
+ { 1023,16}, { 2047,15}, { 4095,14}, { 8191,15}, \
+ { 4351,14}, { 8959,15}, { 4863,16}, { 2559,15}, \
+ { 5887,14}, { 11775,16}, { 3071,15}, { 6911,16}, \
+ { 3583,15}, { 7679,14}, { 15359,15}, { 7935,17}, \
+ { 2047,16}, { 4095,15}, { 8959,16}, { 4607,15}, \
+ { 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
+#define SQR_FFT_THRESHOLD 3264
+
+#define MULLO_BASECASE_THRESHOLD 0 /* always */
+#define MULLO_DC_THRESHOLD 57
+#define MULLO_MUL_N_THRESHOLD 8907
+#define SQRLO_BASECASE_THRESHOLD 8
+#define SQRLO_DC_THRESHOLD 0 /* never mpn_sqrlo_basecase */
+#define SQRLO_SQR_THRESHOLD 6440
+
+#define DC_DIV_QR_THRESHOLD 43
+#define DC_DIVAPPR_Q_THRESHOLD 154
+#define DC_BDIV_QR_THRESHOLD 46
+#define DC_BDIV_Q_THRESHOLD 93
+
+#define INV_MULMOD_BNM1_THRESHOLD 36
+#define INV_NEWTON_THRESHOLD 141
+#define INV_APPR_THRESHOLD 149
+
+#define BINV_NEWTON_THRESHOLD 264
+#define REDC_1_TO_REDC_N_THRESHOLD 47
+
+#define MU_DIV_QR_THRESHOLD 1470
+#define MU_DIVAPPR_Q_THRESHOLD 1528
+#define MUPI_DIV_QR_THRESHOLD 47
+#define MU_BDIV_QR_THRESHOLD 1187
+#define MU_BDIV_Q_THRESHOLD 1589
+
+#define POWM_SEC_TABLE 3,22,194,579
+
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 19
+#define SET_STR_DC_THRESHOLD 195
+#define SET_STR_PRECOMPUTE_THRESHOLD 1752
+
+#define FAC_DSC_THRESHOLD 345
+#define FAC_ODD_THRESHOLD 0 /* always */
+
+#define MATRIX22_STRASSEN_THRESHOLD 24
+#define HGCD2_DIV1_METHOD 1 /* 11.29% faster than 3 */
+#define HGCD_THRESHOLD 89
+#define HGCD_APPR_THRESHOLD 96
+#define HGCD_REDUCE_THRESHOLD 2681
+#define GCD_DC_THRESHOLD 465
+#define GCDEXT_DC_THRESHOLD 233
+#define JACOBI_BASE_METHOD 1 /* 25.56% faster than 4 */
+
+/* Tuneup completed successfully, took 294200 seconds */
diff --git a/Build/source/libs/gmp/gmp-src/mpq/abs.c b/Build/source/libs/gmp/gmp-src/mpq/abs.c
index 7fe04a35bb6..1f0bf13fcce 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/abs.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/abs.c
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpq_abs 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpq/aors.c b/Build/source/libs/gmp/gmp-src/mpq/aors.c
index 81edc1fa398..e86af94a5e7 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/aors.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/aors.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpq/canonicalize.c b/Build/source/libs/gmp/gmp-src/mpq/canonicalize.c
index 7c8e01b85a1..cbc0a22c312 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/canonicalize.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/canonicalize.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpq/clear.c b/Build/source/libs/gmp/gmp-src/mpq/clear.c
index 9b08f239cdf..65e899f3cee 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/clear.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/clear.c
@@ -1,6 +1,7 @@
/* mpq_clear -- free the space occupied by an mpq_t.
-Copyright 1991, 1994, 1995, 2000, 2001, 2015 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2000, 2001, 2015, 2018 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,12 +29,13 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
mpq_clear (mpq_t x)
{
- __GMP_FREE_FUNC_LIMBS (PTR(NUM(x)), ALLOC(NUM(x)));
- __GMP_FREE_FUNC_LIMBS (PTR(DEN(x)), ALLOC(DEN(x)));
+ if (ALLOC (NUM(x)))
+ __GMP_FREE_FUNC_LIMBS (PTR(NUM(x)), ALLOC(NUM(x)));
+ if (ALLOC (DEN(x)))
+ __GMP_FREE_FUNC_LIMBS (PTR(DEN(x)), ALLOC(DEN(x)));
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/clears.c b/Build/source/libs/gmp/gmp-src/mpq/clears.c
index 73e5f66247b..68c6ad3a163 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/clears.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/clears.c
@@ -1,6 +1,6 @@
/* mpq_clears() -- Clear multiple mpq_t variables.
-Copyright 2009, 2014, 2015 Free Software Foundation, Inc.
+Copyright 2009, 2014, 2015, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdarg.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -39,12 +38,15 @@ mpq_clears (mpq_ptr x, ...)
va_start (ap, x);
- while (x != NULL)
+ do
{
- __GMP_FREE_FUNC_LIMBS (PTR(NUM(x)), ALLOC(NUM(x)));
- __GMP_FREE_FUNC_LIMBS (PTR(DEN(x)), ALLOC(DEN(x)));
+ if (ALLOC (NUM(x)))
+ __GMP_FREE_FUNC_LIMBS (PTR(NUM(x)), ALLOC(NUM(x)));
+ if (ALLOC (DEN(x)))
+ __GMP_FREE_FUNC_LIMBS (PTR(DEN(x)), ALLOC(DEN(x)));
x = va_arg (ap, mpq_ptr);
}
+ while (x != NULL);
va_end (ap);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/cmp.c b/Build/source/libs/gmp/gmp-src/mpq/cmp.c
index 1758b78a603..d3eefe20f87 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/cmp.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/cmp.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -66,7 +65,7 @@ mpq_cmp_numden (mpq_srcptr op1, mpz_srcptr num_op2, mpz_srcptr den_op2)
d1h = PTR(DEN(op1))[den1_size - 1];
d2h = PTR(den_op2)[den2_size - 1];
op2_is_int = (den2_size | d2h) == 1;
- if (op2_is_int == (den1_size | d1h)) /* Both ops are integers */
+ if ((unsigned) op2_is_int == (den1_size | d1h)) /* Both ops are integers */
/* return mpz_cmp (NUM (op1), num_op2); */
{
int cmp;
diff --git a/Build/source/libs/gmp/gmp-src/mpq/cmp_si.c b/Build/source/libs/gmp/gmp-src/mpq/cmp_si.c
index f21382e5b04..faf472c7f5c 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/cmp_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/cmp_si.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpq/cmp_ui.c b/Build/source/libs/gmp/gmp-src/mpq/cmp_ui.c
index 93b2265c04e..9d99a9a861c 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/cmp_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/cmp_ui.c
@@ -2,7 +2,8 @@
negative based on if U > V, U == V, or U < V. Vn and Vd may have
common factors.
-Copyright 1993, 1994, 1996, 2000-2003, 2005, 2014 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000-2003, 2005, 2014, 2018 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
@@ -69,11 +69,13 @@ _mpq_cmp_ui (mpq_srcptr op1, unsigned long int num2, unsigned long int den2)
return -1;
/* NUM1 x DEN2 is either TMP1_SIZE limbs or TMP1_SIZE-1 limbs.
- Same for NUM1 x DEN1 with respect to TMP2_SIZE. */
- if (num1_size > den1_size + 1)
+ Same for NUM2 x DEN1 with respect to TMP2_SIZE. */
+ /* If frac2 <= 1 (i.e. num2 <= den2), shortcut with a simpler
+ condition: num1 > den1. Here we only test sizes. */
+ if (num1_size > den1_size + (num2 > den2))
/* NUM1 x DEN2 is surely larger in magnitude than NUM2 x DEN1. */
return num1_size;
- if (den1_size > num1_size + 1)
+ if (den1_size > num1_size + (den2 > num2))
/* NUM1 x DEN2 is surely smaller in magnitude than NUM2 x DEN1. */
return -num1_size;
@@ -90,8 +92,8 @@ _mpq_cmp_ui (mpq_srcptr op1, unsigned long int num2, unsigned long int den2)
tmp2_ptr[den1_size] = cy_limb;
tmp2_size = den1_size + (cy_limb != 0);
- cc = tmp1_size - tmp2_size != 0
- ? tmp1_size - tmp2_size : mpn_cmp (tmp1_ptr, tmp2_ptr, tmp1_size);
+ cc = tmp1_size - tmp2_size;
+ cc = cc != 0 ? cc : mpn_cmp (tmp1_ptr, tmp2_ptr, tmp1_size);
TMP_FREE;
return cc;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/div.c b/Build/source/libs/gmp/gmp-src/mpq/div.c
index 3a6018a2268..3bd97264d19 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/div.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/div.c
@@ -1,6 +1,7 @@
/* mpq_div -- divide two rational numbers.
-Copyright 1991, 1994-1996, 2000, 2001, 2015 Free Software Foundation, Inc.
+Copyright 1991, 1994-1996, 2000, 2001, 2015, 2018 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -49,12 +49,9 @@ mpq_div (mpq_ptr quot, mpq_srcptr op1, mpq_srcptr op2)
if (UNLIKELY (quot == op2))
{
- if (op1 == op2)
+ if (UNLIKELY (op1 == op2))
{
- PTR(NUM(quot))[0] = 1;
- SIZ(NUM(quot)) = 1;
- PTR(DEN(quot))[0] = 1;
- SIZ(DEN(quot)) = 1;
+ mpq_set_ui (quot, 1, 1);
return;
}
@@ -83,7 +80,7 @@ mpq_div (mpq_ptr quot, mpq_srcptr op1, mpq_srcptr op2)
/* We special case this to simplify allocation logic; gcd(0,x) = x
is a singular case for the allocations. */
SIZ(NUM(quot)) = 0;
- PTR(DEN(quot))[0] = 1;
+ MPZ_NEWALLOC (DEN(quot), 1)[0] = 1;
SIZ(DEN(quot)) = 1;
return;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/equal.c b/Build/source/libs/gmp/gmp-src/mpq/equal.c
index 500c2d802ea..9835e044255 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/equal.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/equal.c
@@ -1,7 +1,7 @@
/* mpq_equal(u,v) -- Compare U, V. Return non-zero if they are equal, zero
if they are non-equal.
-Copyright 1996, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1996, 2001, 2002, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
@@ -47,6 +46,11 @@ mpq_equal (mpq_srcptr op1, mpq_srcptr op2) __GMP_NOTHROW
if (num1_size != num2_size)
return 0;
+ den1_size = SIZ(DEN(op1));
+ den2_size = SIZ(DEN(op2));
+ if (den1_size != den2_size)
+ return 0;
+
num1_ptr = PTR(NUM(op1));
num2_ptr = PTR(NUM(op2));
num1_size = ABS (num1_size);
@@ -54,11 +58,6 @@ mpq_equal (mpq_srcptr op1, mpq_srcptr op2) __GMP_NOTHROW
if (num1_ptr[i] != num2_ptr[i])
return 0;
- den1_size = SIZ(DEN(op1));
- den2_size = SIZ(DEN(op2));
- if (den1_size != den2_size)
- return 0;
-
den1_ptr = PTR(DEN(op1));
den2_ptr = PTR(DEN(op2));
for (i = 0; i < den1_size; i++)
diff --git a/Build/source/libs/gmp/gmp-src/mpq/get_d.c b/Build/source/libs/gmp/gmp-src/mpq/get_d.c
index f206cdbc004..4d9779d85f1 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/get_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/get_d.c
@@ -1,6 +1,6 @@
/* double mpq_get_d (mpq_t src) -- mpq to double, rounding towards zero.
-Copyright 1995, 1996, 2001-2005 Free Software Foundation, Inc.
+Copyright 1995, 1996, 2001-2005, 2018, 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -75,9 +74,6 @@ see https://www.gnu.org/licenses/. */
If/when mpn_tdiv_qr supports its qxn parameter we can use that instead of
padding n with zeros in temporary space.
- If/when a quotient-only division exists it can be used here immediately.
- remp is only to satisfy mpn_tdiv_qr, the remainder is not used.
-
Alternatives:
An alternative algorithm, that may be faster:
@@ -105,10 +101,10 @@ mpq_get_d (mpq_srcptr src)
{
double res;
mp_srcptr np, dp;
- mp_ptr remp, tp;
+ mp_ptr temp;
mp_size_t nsize = SIZ(NUM(src));
mp_size_t dsize = SIZ(DEN(src));
- mp_size_t qsize, prospective_qsize, zeros, chop, tsize;
+ mp_size_t qsize, prospective_qsize, zeros;
mp_size_t sign_quotient = nsize;
long exp;
#define N_QLIMBS (1 + (sizeof (double) + GMP_LIMB_BYTES-1) / GMP_LIMB_BYTES)
@@ -128,46 +124,37 @@ mpq_get_d (mpq_srcptr src)
np = PTR(NUM(src));
dp = PTR(DEN(src));
- prospective_qsize = nsize - dsize + 1; /* from using given n,d */
- qsize = N_QLIMBS + 1; /* desired qsize */
+ prospective_qsize = nsize - dsize; /* from using given n,d */
+ qsize = N_QLIMBS; /* desired qsize */
zeros = qsize - prospective_qsize; /* padding n to get qsize */
exp = (long) -zeros * GMP_NUMB_BITS; /* relative to low of qp */
- chop = MAX (-zeros, 0); /* negative zeros means shorten n */
- np += chop;
- nsize -= chop;
- zeros += chop; /* now zeros >= 0 */
-
- tsize = nsize + zeros; /* size for possible copy of n */
-
- if (WANT_TMP_DEBUG)
- {
- /* separate blocks, for malloc debugging */
- remp = TMP_ALLOC_LIMBS (dsize);
- tp = (zeros > 0 ? TMP_ALLOC_LIMBS (tsize) : NULL);
- }
- else
- {
- /* one block with conditionalized size, for efficiency */
- remp = TMP_ALLOC_LIMBS (dsize + (zeros > 0 ? tsize : 0));
- tp = remp + dsize;
- }
-
/* zero extend n into temporary space, if necessary */
if (zeros > 0)
{
- MPN_ZERO (tp, zeros);
- MPN_COPY (tp+zeros, np, nsize);
- np = tp;
+ mp_size_t tsize;
+ tsize = nsize + zeros; /* size for copy of n */
+
+ temp = TMP_ALLOC_LIMBS (tsize + 1);
+ MPN_FILL (temp, zeros, 0);
+ MPN_COPY (temp + zeros, np, nsize);
+ np = temp;
nsize = tsize;
}
+ else /* negative zeros means shorten n */
+ {
+ np -= zeros;
+ nsize += zeros;
+
+ temp = TMP_ALLOC_LIMBS (nsize + 1);
+ }
- ASSERT (qsize == nsize - dsize + 1);
- mpn_tdiv_qr (qp, remp, (mp_size_t) 0, np, nsize, dp, dsize);
+ ASSERT (qsize == nsize - dsize);
+ mpn_div_q (qp, np, nsize, dp, dsize, temp);
/* strip possible zero high limb */
- qsize -= (qp[qsize-1] == 0);
+ qsize += (qp[qsize] != 0);
res = mpn_get_d (qp, qsize, sign_quotient, exp);
TMP_FREE;
diff --git a/Build/source/libs/gmp/gmp-src/mpq/get_den.c b/Build/source/libs/gmp/gmp-src/mpq/get_den.c
index 48a385c817e..d4fd90b986c 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/get_den.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/get_den.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpq/get_num.c b/Build/source/libs/gmp/gmp-src/mpq/get_num.c
index cb464ccb94f..079211c3ab4 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/get_num.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/get_num.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpq/get_str.c b/Build/source/libs/gmp/gmp-src/mpq/get_str.c
index 8fa0de1cd74..d0cfb58dd1f 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/get_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/get_str.c
@@ -1,6 +1,6 @@
/* mpq_get_str -- mpq to string conversion.
-Copyright 2001, 2002, 2006, 2011 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2006, 2011, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -48,10 +47,12 @@ mpq_get_str (char *str, int base, mpq_srcptr q)
/* This is an overestimate since we don't bother checking how much of
the high limbs of num and den are used. +2 for rounding up the
chars per bit of num and den. +3 for sign, slash and '\0'. */
+ if (ABS(base) < 2)
+ base = 10;
DIGITS_IN_BASE_PER_LIMB (str_alloc, ABSIZ(NUM(q)) + SIZ(DEN(q)), ABS(base));
str_alloc += 6;
- str = (char *) (*__gmp_allocate_func) (str_alloc);
+ str = __GMP_ALLOCATE_FUNC_TYPE (str_alloc, char);
}
mpz_get_str (str, base, mpq_numref(q));
@@ -65,9 +66,12 @@ mpq_get_str (char *str, int base, mpq_srcptr q)
ASSERT (len == strlen(str));
ASSERT (str_alloc == 0 || len+1 <= str_alloc);
- ASSERT (len+1 <= /* size recommended to applications */
- mpz_sizeinbase (mpq_numref(q), ABS(base)) +
- mpz_sizeinbase (mpq_denref(q), ABS(base)) + 3);
+ ASSERT (len+1 <= 3 + /* size recommended to applications */
+ (ABS(base) < 2 ?
+ mpz_sizeinbase (mpq_numref(q), 10) +
+ mpz_sizeinbase (mpq_denref(q), 10)
+ : mpz_sizeinbase (mpq_numref(q), ABS(base)) +
+ mpz_sizeinbase (mpq_denref(q), ABS(base))));
if (str_alloc != 0)
__GMP_REALLOCATE_FUNC_MAYBE_TYPE (str, str_alloc, len+1, char);
diff --git a/Build/source/libs/gmp/gmp-src/mpq/init.c b/Build/source/libs/gmp/gmp-src/mpq/init.c
index 6ece98ab1c6..b006945785e 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/init.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/init.c
@@ -1,6 +1,7 @@
/* mpq_init -- Make a new rational number with value 0/1.
-Copyright 1991, 1994, 1995, 2000-2002 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2000-2002, 2015, 2018 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,22 +29,17 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
mpq_init (mpq_t x)
{
- ALLOC(NUM(x)) = 1;
- PTR(NUM(x)) = __GMP_ALLOCATE_FUNC_LIMBS (1);
+ static const mp_limb_t dummy_limb=0xc1a0;
+ ALLOC(NUM(x)) = 0;
+ PTR(NUM(x)) = (mp_ptr) &dummy_limb;
SIZ(NUM(x)) = 0;
ALLOC(DEN(x)) = 1;
PTR(DEN(x)) = __GMP_ALLOCATE_FUNC_LIMBS (1);
PTR(DEN(x))[0] = 1;
SIZ(DEN(x)) = 1;
-
-#ifdef __CHECKER__
- /* let the low limb look initialized, for the benefit of mpz_get_ui etc */
- PTR(NUM(x))[0] = 0;
-#endif
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/inits.c b/Build/source/libs/gmp/gmp-src/mpq/inits.c
index bb14f93e21d..fff4343823a 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/inits.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/inits.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdarg.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -39,11 +38,12 @@ mpq_inits (mpq_ptr x, ...)
va_start (ap, x);
- while (x != NULL)
+ do
{
mpq_init (x);
x = va_arg (ap, mpq_ptr);
}
+ while (x != NULL);
va_end (ap);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/inp_str.c b/Build/source/libs/gmp/gmp-src/mpq/inp_str.c
index 7ba95743f8f..b7662bc9131 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/inp_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/inp_str.c
@@ -1,6 +1,6 @@
/* mpq_inp_str -- read an mpq from a FILE.
-Copyright 2001 Free Software Foundation, Inc.
+Copyright 2001, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <ctype.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -44,7 +43,7 @@ mpq_inp_str (mpq_ptr q, FILE *fp, int base)
fp = stdin;
SIZ(DEN(q)) = 1;
- PTR(DEN(q))[0] = 1;
+ MPZ_NEWALLOC (DEN(q), 1)[0] = 1;
nread = mpz_inp_str (mpq_numref(q), fp, base);
if (nread == 0)
diff --git a/Build/source/libs/gmp/gmp-src/mpq/inv.c b/Build/source/libs/gmp/gmp-src/mpq/inv.c
index bd703d48602..c395984e6a0 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/inv.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/inv.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpq/md_2exp.c b/Build/source/libs/gmp/gmp-src/mpq/md_2exp.c
index a2a7e1e2fb7..b3378b3fcd1 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/md_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/md_2exp.c
@@ -1,7 +1,7 @@
/* mpq_mul_2exp, mpq_div_2exp - multiply or divide by 2^N */
/*
-Copyright 2000, 2002, 2012 Free Software Foundation, Inc.
+Copyright 2000, 2002, 2012, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -103,7 +102,7 @@ mpq_div_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n)
{
SIZ(NUM(dst)) = 0;
SIZ(DEN(dst)) = 1;
- PTR(DEN(dst))[0] = 1;
+ MPZ_NEWALLOC (DEN(dst), 1)[0] = 1;
return;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/mul.c b/Build/source/libs/gmp/gmp-src/mpq/mul.c
index 49d618f3bc1..270dafc9535 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/mul.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -62,7 +61,7 @@ mpq_mul (mpq_ptr prod, mpq_srcptr op1, mpq_srcptr op2)
/* We special case this to simplify allocation logic; gcd(0,x) = x
is a singular case for the allocations. */
SIZ(NUM(prod)) = 0;
- PTR(DEN(prod))[0] = 1;
+ MPZ_NEWALLOC (DEN(prod), 1)[0] = 1;
SIZ(DEN(prod)) = 1;
return;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/neg.c b/Build/source/libs/gmp/gmp-src/mpq/neg.c
index 054e21ebe33..8fda41c7bc4 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/neg.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/neg.c
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpq_neg 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpq/out_str.c b/Build/source/libs/gmp/gmp-src/mpq/out_str.c
index c2bc053b215..5d2dd4ebcee 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/out_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/out_str.c
@@ -30,7 +30,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpq/set.c b/Build/source/libs/gmp/gmp-src/mpq/set.c
index fb7bfad49c6..87c15e31f42 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/set.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/set.c
@@ -1,6 +1,7 @@
/* mpq_set(dest,src) -- Set DEST to SRC.
-Copyright 1991, 1994, 1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2001, 2012, 2015 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -28,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -39,13 +39,13 @@ mpq_set (mpq_ptr dest, mpq_srcptr src)
mp_ptr dp;
num_size = SIZ(NUM(src));
+ SIZ(NUM(dest)) = num_size;
abs_num_size = ABS (num_size);
dp = MPZ_NEWALLOC (NUM(dest), abs_num_size);
- SIZ(NUM(dest)) = num_size;
MPN_COPY (dp, PTR(NUM(src)), abs_num_size);
den_size = SIZ(DEN(src));
- dp = MPZ_NEWALLOC (DEN(dest), den_size);
SIZ(DEN(dest)) = den_size;
+ dp = MPZ_NEWALLOC (DEN(dest), den_size);
MPN_COPY (dp, PTR(DEN(src)), den_size);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/set_d.c b/Build/source/libs/gmp/gmp-src/mpq/set_d.c
index bc792187181..3f3fab0b73d 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/set_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/set_d.c
@@ -1,6 +1,7 @@
/* mpq_set_d(mpq_t q, double d) -- Set q to d without rounding.
-Copyright 2000, 2002, 2003, 2012, 2014 Free Software Foundation, Inc.
+Copyright 2000, 2002, 2003, 2012, 2014, 2018 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -34,7 +35,6 @@ see https://www.gnu.org/licenses/. */
#include <float.h> /* for DBL_MAX */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -77,7 +77,7 @@ mpq_set_d (mpq_ptr dest, double d)
{
SIZ(NUM(dest)) = 0;
SIZ(DEN(dest)) = 1;
- PTR(DEN(dest))[0] = 1;
+ MPZ_NEWALLOC (DEN(dest), 1)[0] = 1;
return;
}
@@ -158,7 +158,7 @@ mpq_set_d (mpq_ptr dest, double d)
break;
#endif
}
- *PTR(DEN(dest)) = 1;
+ MPZ_NEWALLOC (DEN(dest), 1)[0] = 1;
SIZ(DEN(dest)) = 1;
}
SIZ(NUM(dest)) = negative ? -nn : nn;
diff --git a/Build/source/libs/gmp/gmp-src/mpq/set_den.c b/Build/source/libs/gmp/gmp-src/mpq/set_den.c
index 4bcb86b0977..e249db7e410 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/set_den.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/set_den.c
@@ -1,6 +1,7 @@
/* mpq_set_den(dest,den) -- Set the denominator of DEST from DEN.
-Copyright 1991, 1994-1996, 2000, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1994-1996, 2000, 2001, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -38,8 +38,8 @@ mpq_set_den (mpq_ptr dest, mpz_srcptr den)
mp_size_t abs_size = ABS (size);
mp_ptr dp;
+ SIZ(DEN(dest)) = size;
dp = MPZ_NEWALLOC (DEN(dest), abs_size);
- SIZ(DEN(dest)) = size;
MPN_COPY (dp, PTR(den), abs_size);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/set_f.c b/Build/source/libs/gmp/gmp-src/mpq/set_f.c
index 7764a17f05e..581d4fc92e4 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/set_f.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/set_f.c
@@ -1,6 +1,6 @@
/* mpq_set_f -- set an mpq from an mpf.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 2000-2002, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -47,7 +46,7 @@ mpq_set_f (mpq_ptr q, mpf_srcptr f)
/* set q=0 */
SIZ(NUM(q)) = 0;
SIZ(DEN(q)) = 1;
- PTR(DEN(q))[0] = 1;
+ MPZ_NEWALLOC (DEN(q), 1)[0] = 1;
return;
}
@@ -66,7 +65,7 @@ mpq_set_f (mpq_ptr q, mpf_srcptr f)
SIZ(NUM(q)) = fsize >= 0 ? fexp : -fexp;
SIZ(DEN(q)) = 1;
- PTR(DEN(q))[0] = 1;
+ MPZ_NEWALLOC (DEN(q), 1)[0] = 1;
}
else
{
diff --git a/Build/source/libs/gmp/gmp-src/mpq/set_num.c b/Build/source/libs/gmp/gmp-src/mpq/set_num.c
index c6b52ccaa18..1a099a25f2e 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/set_num.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/set_num.c
@@ -1,6 +1,7 @@
/* mpq_set_num(dest,num) -- Set the numerator of DEST from NUM.
-Copyright 1991, 1994, 1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2001, 2012, 2015 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -28,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -38,8 +38,8 @@ mpq_set_num (mpq_ptr dest, mpz_srcptr num)
mp_size_t abs_size = ABS (size);
mp_ptr dp;
+ SIZ(NUM(dest)) = size;
dp = MPZ_NEWALLOC (NUM(dest), abs_size);
- SIZ(NUM(dest)) = size;
MPN_COPY (dp, PTR(num), abs_size);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/set_si.c b/Build/source/libs/gmp/gmp-src/mpq/set_si.c
index 0a10b3048d1..e51406bfdee 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/set_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/set_si.c
@@ -1,7 +1,7 @@
/* mpq_set_si(dest,ulong_num,ulong_den) -- Set DEST to the rational number
ULONG_NUM/ULONG_DEN.
-Copyright 1991, 1994, 1995, 2001, 2003 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2001, 2003, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,14 +29,11 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
mpq_set_si (mpq_t dest, signed long int num, unsigned long int den)
{
- unsigned long int abs_num;
-
if (GMP_NUMB_BITS < BITS_PER_ULONG)
{
if (num == 0) /* Canonicalize 0/d to 0/1. */
@@ -46,8 +43,6 @@ mpq_set_si (mpq_t dest, signed long int num, unsigned long int den)
return;
}
- abs_num = ABS_CAST (unsigned long, num);
-
if (num == 0)
{
/* Canonicalize 0/d to 0/1. */
@@ -56,10 +51,10 @@ mpq_set_si (mpq_t dest, signed long int num, unsigned long int den)
}
else
{
- PTR(NUM(dest))[0] = abs_num;
+ MPZ_NEWALLOC (NUM(dest), 1)[0] = ABS_CAST (unsigned long, num);
SIZ(NUM(dest)) = num > 0 ? 1 : -1;
}
- PTR(DEN(dest))[0] = den;
+ MPZ_NEWALLOC (DEN(dest), 1)[0] = den;
SIZ(DEN(dest)) = (den != 0);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/set_str.c b/Build/source/libs/gmp/gmp-src/mpq/set_str.c
index 930fe5576c0..664bb2d04dc 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/set_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/set_str.c
@@ -1,6 +1,6 @@
/* mpq_set_str -- string to mpq conversion.
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2015, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -50,7 +49,7 @@ mpq_set_str (mpq_ptr q, const char *str, int base)
if (slash == NULL)
{
SIZ(DEN(q)) = 1;
- PTR(DEN(q))[0] = 1;
+ MPZ_NEWALLOC (DEN(q), 1)[0] = 1;
return mpz_set_str (mpq_numref(q), str, base);
}
@@ -60,7 +59,7 @@ mpq_set_str (mpq_ptr q, const char *str, int base)
memcpy (num, str, numlen);
num[numlen] = '\0';
ret = mpz_set_str (mpq_numref(q), num, base);
- (*__gmp_free_func) (num, numlen+1);
+ __GMP_FREE_FUNC_TYPE (num, numlen+1, char);
if (ret != 0)
return ret;
diff --git a/Build/source/libs/gmp/gmp-src/mpq/set_ui.c b/Build/source/libs/gmp/gmp-src/mpq/set_ui.c
index 4473b30bb84..db85d976f9e 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/set_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/set_ui.c
@@ -1,7 +1,7 @@
/* mpq_set_ui(dest,ulong_num,ulong_den) -- Set DEST to the rational number
ULONG_NUM/ULONG_DEN.
-Copyright 1991, 1994, 1995, 2001-2003 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2001-2003, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -46,16 +45,16 @@ mpq_set_ui (mpq_t dest, unsigned long int num, unsigned long int den)
if (num == 0)
{
- /* Canonicalize 0/n to 0/1. */
+ /* Canonicalize 0/d to 0/1. */
den = 1;
SIZ(NUM(dest)) = 0;
}
else
{
- PTR(NUM(dest))[0] = num;
+ MPZ_NEWALLOC (NUM(dest), 1)[0] = num;
SIZ(NUM(dest)) = 1;
}
- PTR(DEN(dest))[0] = den;
+ MPZ_NEWALLOC (DEN(dest), 1)[0] = den;
SIZ(DEN(dest)) = (den != 0);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/set_z.c b/Build/source/libs/gmp/gmp-src/mpq/set_z.c
index 358d1ca899c..8309c9324d7 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/set_z.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/set_z.c
@@ -1,6 +1,6 @@
/* mpq_set_z (dest,src) -- Set DEST to SRC.
-Copyright 1996, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1996, 2001, 2012, 2015, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -39,11 +38,11 @@ mpq_set_z (mpq_ptr dest, mpz_srcptr src)
mp_ptr dp;
num_size = SIZ (src);
+ SIZ(NUM(dest)) = num_size;
abs_num_size = ABS (num_size);
dp = MPZ_NEWALLOC (NUM(dest), abs_num_size);
- SIZ(NUM(dest)) = num_size;
MPN_COPY (dp, PTR(src), abs_num_size);
- PTR(DEN(dest))[0] = 1;
+ MPZ_NEWALLOC (DEN(dest), 1)[0] = 1;
SIZ(DEN(dest)) = 1;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpq/swap.c b/Build/source/libs/gmp/gmp-src/mpq/swap.c
index 51fdcac7fd3..e5152d42728 100644
--- a/Build/source/libs/gmp/gmp-src/mpq/swap.c
+++ b/Build/source/libs/gmp/gmp-src/mpq/swap.c
@@ -1,6 +1,6 @@
/* mpq_swap (U, V) -- Swap U and V.
-Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1997, 1998, 2000, 2001, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,44 +28,15 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
mpq_swap (mpq_ptr u, mpq_ptr v) __GMP_NOTHROW
{
- mp_ptr up, vp;
- mp_size_t usize, vsize;
- mp_size_t ualloc, valloc;
-
- ualloc = ALLOC(NUM(u));
- valloc = ALLOC(NUM(v));
- ALLOC(NUM(v)) = ualloc;
- ALLOC(NUM(u)) = valloc;
-
- usize = SIZ(NUM(u));
- vsize = SIZ(NUM(v));
- SIZ(NUM(v)) = usize;
- SIZ(NUM(u)) = vsize;
-
- up = PTR(NUM(u));
- vp = PTR(NUM(v));
- PTR(NUM(v)) = up;
- PTR(NUM(u)) = vp;
-
-
- ualloc = ALLOC(DEN(u));
- valloc = ALLOC(DEN(v));
- ALLOC(DEN(v)) = ualloc;
- ALLOC(DEN(u)) = valloc;
-
- usize = SIZ(DEN(u));
- vsize = SIZ(DEN(v));
- SIZ(DEN(v)) = usize;
- SIZ(DEN(u)) = vsize;
-
- up = PTR(DEN(u));
- vp = PTR(DEN(v));
- PTR(DEN(v)) = up;
- PTR(DEN(u)) = vp;
+ MP_SIZE_T_SWAP (ALLOC(NUM(u)), ALLOC(NUM(v)));
+ MP_SIZE_T_SWAP (ALLOC(DEN(u)), ALLOC(DEN(v)));
+ MP_SIZE_T_SWAP (SIZ(NUM(u)), SIZ(NUM(v)));
+ MP_SIZE_T_SWAP (SIZ(DEN(u)), SIZ(DEN(v)));
+ MP_PTR_SWAP (PTR(NUM(u)), PTR(NUM(v)));
+ MP_PTR_SWAP (PTR(DEN(u)), PTR(DEN(v)));
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/2fac_ui.c b/Build/source/libs/gmp/gmp-src/mpz/2fac_ui.c
index 37e6c468bc8..141a0a7ebc8 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/2fac_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/2fac_ui.c
@@ -2,7 +2,7 @@
Contributed to the GNU project by Marco Bodrato.
-Copyright 2012 Free Software Foundation, Inc.
+Copyright 2012, 2015, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#define FACTOR_LIST_STORE(P, PR, MAX_PR, VEC, I) \
@@ -67,10 +66,11 @@ mpz_2fac_ui (mpz_ptr x, unsigned long n)
mpz_mul_2exp (x, x, count);
} else { /* n is odd */
if (n <= ODD_DOUBLEFACTORIAL_TABLE_LIMIT) {
- PTR (x)[0] = __gmp_odd2fac_table[n >> 1];
- SIZ (x) = 1;
+ MPZ_NEWALLOC (x, 1)[0] = __gmp_odd2fac_table[n >> 1];
+ SIZ (x) = 1;
} else if (BELOW_THRESHOLD (n, FAC_2DSC_THRESHOLD)) { /* odd basecase, */
- mp_limb_t *factors, prod, max_prod, j;
+ mp_limb_t *factors, prod, max_prod;
+ mp_size_t j;
TMP_SDECL;
/* FIXME: we might alloc a fixed amount 1+FAC_2DSC_THRESHOLD/FACTORS_PER_LIMB */
diff --git a/Build/source/libs/gmp/gmp-src/mpz/Makefile.am b/Build/source/libs/gmp/gmp-src/mpz/Makefile.am
index 3ff60ac2e9f..a5e1f57200b 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/Makefile.am
+++ b/Build/source/libs/gmp/gmp-src/mpz/Makefile.am
@@ -54,14 +54,15 @@ libmpz_la_SOURCES = aors.h aors_ui.h fits_s.h mul_i.h \
invert.c ior.c iset.c iset_d.c iset_si.c iset_str.c iset_ui.c \
jacobi.c kronsz.c kronuz.c kronzs.c kronzu.c \
lcm.c lcm_ui.c limbs_read.c limbs_write.c limbs_modify.c limbs_finish.c \
- lucnum_ui.c lucnum2_ui.c mfac_uiui.c millerrabin.c \
+ lucnum_ui.c lucnum2_ui.c lucmod.c mfac_uiui.c millerrabin.c \
mod.c mul.c mul_2exp.c mul_si.c mul_ui.c n_pow_ui.c neg.c nextprime.c \
oddfac_1.c \
out_raw.c out_str.c perfpow.c perfsqr.c popcount.c pow_ui.c powm.c \
powm_sec.c powm_ui.c pprime_p.c prodlimbs.c primorial_ui.c random.c random2.c \
realloc.c realloc2.c remove.c roinit_n.c root.c rootrem.c rrandomb.c \
scan0.c scan1.c set.c set_d.c set_f.c set_q.c set_si.c set_str.c \
- set_ui.c setbit.c size.c sizeinbase.c sqrt.c sqrtrem.c sub.c sub_ui.c \
+ set_ui.c setbit.c size.c sizeinbase.c sqrt.c sqrtrem.c stronglucas.c \
+ sub.c sub_ui.c \
swap.c tdiv_ui.c tdiv_q.c tdiv_q_2exp.c tdiv_q_ui.c tdiv_qr.c \
tdiv_qr_ui.c tdiv_r.c tdiv_r_2exp.c tdiv_r_ui.c tstbit.c ui_pow_ui.c \
ui_sub.c urandomb.c urandomm.c xor.c
diff --git a/Build/source/libs/gmp/gmp-src/mpz/abs.c b/Build/source/libs/gmp/gmp-src/mpz/abs.c
index 81c6b632668..0cfbc49ae4c 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/abs.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/abs.c
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_abs 1
-#include "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/and.c b/Build/source/libs/gmp/gmp-src/mpz/and.c
index 5aa01a71da1..5d345477589 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/and.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/and.c
@@ -1,7 +1,7 @@
/* mpz_and -- Logical and.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2003, 2005, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2003, 2005, 2012,
+2015-2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -40,49 +39,47 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
mp_ptr res_ptr;
mp_size_t res_size;
mp_size_t i;
- TMP_DECL;
- TMP_MARK;
op1_size = SIZ(op1);
op2_size = SIZ(op2);
+ if (op1_size < op2_size)
+ {
+ MPZ_SRCPTR_SWAP (op1, op2);
+ MP_SIZE_T_SWAP (op1_size, op2_size);
+ }
+
op1_ptr = PTR(op1);
op2_ptr = PTR(op2);
- if (op1_size >= 0)
+ if (op2_size >= 0)
{
- if (op2_size >= 0)
- {
- res_size = MIN (op1_size, op2_size);
- /* First loop finds the size of the result. */
- for (i = res_size - 1; i >= 0; i--)
- if ((op1_ptr[i] & op2_ptr[i]) != 0)
- break;
- res_size = i + 1;
-
- /* Handle allocation, now then we know exactly how much space is
- needed for the result. */
- res_ptr = MPZ_REALLOC (res, res_size);
- /* Don't re-read op1_ptr and op2_ptr. Since res_size <=
- MIN(op1_size, op2_size), res is not changed when op1
- is identical to res or op2 is identical to res. */
-
- SIZ(res) = res_size;
- if (LIKELY (res_size != 0))
- mpn_and_n (res_ptr, op1_ptr, op2_ptr, res_size);
- return;
- }
- else /* op2_size < 0 */
- {
- /* Fall through to the code at the end of the function. */
- }
+ /* First loop finds the size of the result. */
+ for (i = op2_size; --i >= 0;)
+ if ((op1_ptr[i] & op2_ptr[i]) != 0)
+ {
+ res_size = i + 1;
+ /* Handle allocation, now then we know exactly how much space is
+ needed for the result. */
+ /* Don't re-read op1_ptr and op2_ptr. Since res_size <=
+ MIN(op1_size, op2_size), res is not changed when op1
+ is identical to res or op2 is identical to res. */
+ SIZ (res) = res_size;
+ mpn_and_n (MPZ_NEWALLOC (res, res_size), op1_ptr, op2_ptr, res_size);
+ return;
+ }
+
+ SIZ (res) = 0;
}
else
{
- if (op2_size < 0)
+ TMP_DECL;
+
+ op2_size = -op2_size;
+ TMP_MARK;
+ if (op1_size < 0)
{
mp_ptr opx, opy;
- mp_limb_t cy;
/* Both operands are negative, so will be the result.
-((-OP1) & (-OP2)) = -(~(OP1 - 1) & ~(OP2 - 1)) =
@@ -95,10 +92,6 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
would get carry into the zero-limb in this situation... */
op1_size = -op1_size;
- op2_size = -op2_size;
-
- if (op1_size > op2_size)
- MPN_SRCPTR_SWAP (op1_ptr, op1_size, op2_ptr, op2_size);
TMP_ALLOC_LIMBS_2 (opx, op1_size, opy, op2_size);
mpn_sub_1 (opx, op1_ptr, op1_size, (mp_limb_t) 1);
@@ -107,7 +100,7 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
mpn_sub_1 (opy, op2_ptr, op2_size, (mp_limb_t) 1);
op2_ptr = opy;
- res_ptr = MPZ_REALLOC (res, 1 + op2_size);
+ res_ptr = MPZ_NEWALLOC (res, 1 + op2_size);
/* Don't re-read OP1_PTR and OP2_PTR. They point to temporary
space--never to the space PTR(res) used to point to before
reallocation. */
@@ -115,130 +108,115 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
op2_size - op1_size);
mpn_ior_n (res_ptr, op1_ptr, op2_ptr, op1_size);
+ TMP_FREE;
res_size = op2_size;
- cy = mpn_add_1 (res_ptr, res_ptr, res_size, (mp_limb_t) 1);
- res_ptr[res_size] = cy;
- res_size += (cy != 0);
+ res_ptr[res_size] = 0;
+ MPN_INCR_U (res_ptr, res_size + 1, (mp_limb_t) 1);
+ res_size += res_ptr[res_size];
SIZ(res) = -res_size;
- TMP_FREE;
- return;
}
else
{
- /* We should compute -OP1 & OP2. Swap OP1 and OP2 and fall
- through to the code that handles OP1 & -OP2. */
- MPN_SRCPTR_SWAP (op1_ptr, op1_size, op2_ptr, op2_size);
- }
-
- }
-
- {
#if ANDNEW
- mp_size_t op2_lim;
- mp_size_t count;
-
- /* OP2 must be negated as with infinite precision.
-
- Scan from the low end for a non-zero limb. The first non-zero
- limb is simply negated (two's complement). Any subsequent
- limbs are one's complemented. Of course, we don't need to
- handle more limbs than there are limbs in the other, positive
- operand as the result for those limbs is going to become zero
- anyway. */
-
- /* Scan for the least significant non-zero OP2 limb, and zero the
- result meanwhile for those limb positions. (We will surely
- find a non-zero limb, so we can write the loop with one
- termination condition only.) */
- for (i = 0; op2_ptr[i] == 0; i++)
- res_ptr[i] = 0;
- op2_lim = i;
-
- op2_size = -op2_size;
-
- if (op1_size <= op2_size)
- {
- /* The ones-extended OP2 is >= than the zero-extended OP1.
- RES_SIZE <= OP1_SIZE. Find the exact size. */
- for (i = op1_size - 1; i > op2_lim; i--)
- if ((op1_ptr[i] & ~op2_ptr[i]) != 0)
- break;
- res_size = i + 1;
- for (i = res_size - 1; i > op2_lim; i--)
- res_ptr[i] = op1_ptr[i] & ~op2_ptr[i];
- res_ptr[op2_lim] = op1_ptr[op2_lim] & -op2_ptr[op2_lim];
- /* Yes, this *can* happen! */
- MPN_NORMALIZE (res_ptr, res_size);
- }
- else
- {
- /* The ones-extended OP2 is < than the zero-extended OP1.
- RES_SIZE == OP1_SIZE, since OP1 is normalized. */
- res_size = op1_size;
- MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, op1_size - op2_size);
- for (i = op2_size - 1; i > op2_lim; i--)
- res_ptr[i] = op1_ptr[i] & ~op2_ptr[i];
- res_ptr[op2_lim] = op1_ptr[op2_lim] & -op2_ptr[op2_lim];
- }
-
- SIZ(res) = res_size;
+ mp_size_t op2_lim;
+ mp_size_t count;
+
+ /* OP2 must be negated as with infinite precision.
+
+ Scan from the low end for a non-zero limb. The first non-zero
+ limb is simply negated (two's complement). Any subsequent
+ limbs are one's complemented. Of course, we don't need to
+ handle more limbs than there are limbs in the other, positive
+ operand as the result for those limbs is going to become zero
+ anyway. */
+
+ /* Scan for the least significant non-zero OP2 limb, and zero the
+ result meanwhile for those limb positions. (We will surely
+ find a non-zero limb, so we can write the loop with one
+ termination condition only.) */
+ for (i = 0; op2_ptr[i] == 0; i++)
+ res_ptr[i] = 0;
+ op2_lim = i;
+
+ if (op1_size <= op2_size)
+ {
+ /* The ones-extended OP2 is >= than the zero-extended OP1.
+ RES_SIZE <= OP1_SIZE. Find the exact size. */
+ for (i = op1_size - 1; i > op2_lim; i--)
+ if ((op1_ptr[i] & ~op2_ptr[i]) != 0)
+ break;
+ res_size = i + 1;
+ for (i = res_size - 1; i > op2_lim; i--)
+ res_ptr[i] = op1_ptr[i] & ~op2_ptr[i];
+ res_ptr[op2_lim] = op1_ptr[op2_lim] & -op2_ptr[op2_lim];
+ /* Yes, this *can* happen! */
+ MPN_NORMALIZE (res_ptr, res_size);
+ }
+ else
+ {
+ /* The ones-extended OP2 is < than the zero-extended OP1.
+ RES_SIZE == OP1_SIZE, since OP1 is normalized. */
+ res_size = op1_size;
+ MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, op1_size - op2_size);
+ for (i = op2_size - 1; i > op2_lim; i--)
+ res_ptr[i] = op1_ptr[i] & ~op2_ptr[i];
+ res_ptr[op2_lim] = op1_ptr[op2_lim] & -op2_ptr[op2_lim];
+ }
#else
- /* OP1 is positive and zero-extended,
- OP2 is negative and ones-extended.
- The result will be positive.
- OP1 & -OP2 = OP1 & ~(OP2 - 1). */
-
- mp_ptr opx;
-
- op2_size = -op2_size;
- opx = TMP_ALLOC_LIMBS (op2_size);
- mpn_sub_1 (opx, op2_ptr, op2_size, (mp_limb_t) 1);
- op2_ptr = opx;
-
- if (op1_size > op2_size)
- {
- /* The result has the same size as OP1, since OP1 is normalized
- and longer than the ones-extended OP2. */
- res_size = op1_size;
-
- /* Handle allocation, now then we know exactly how much space is
- needed for the result. */
- res_ptr = MPZ_REALLOC (res, res_size);
- /* Don't re-read OP1_PTR or OP2_PTR. Since res_size = op1_size,
- op1 is not changed if it is identical to res.
- OP2_PTR points to temporary space. */
-
- MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, res_size - op2_size);
- mpn_andn_n (res_ptr, op1_ptr, op2_ptr, op2_size);
-
- SIZ(res) = res_size;
- }
- else
- {
- /* Find out the exact result size. Ignore the high limbs of OP2,
- OP1 is zero-extended and would make the result zero. */
- for (i = op1_size - 1; i >= 0; i--)
- if ((op1_ptr[i] & ~op2_ptr[i]) != 0)
- break;
- res_size = i + 1;
-
- /* Handle allocation, now then we know exactly how much space is
- needed for the result. */
- res_ptr = MPZ_REALLOC (res, res_size);
- /* Don't re-read OP1_PTR. Since res_size <= op1_size,
- op1 is not changed if it is identical to res.
- Don't re-read OP2_PTR. It points to temporary space--never
- to the space PTR(res) used to point to before reallocation. */
-
- if (LIKELY (res_size != 0))
- mpn_andn_n (res_ptr, op1_ptr, op2_ptr, res_size);
-
- SIZ(res) = res_size;
- }
+ /* OP1 is positive and zero-extended,
+ OP2 is negative and ones-extended.
+ The result will be positive.
+ OP1 & -OP2 = OP1 & ~(OP2 - 1). */
+
+ mp_ptr opx;
+
+ opx = TMP_ALLOC_LIMBS (op2_size);
+ mpn_sub_1 (opx, op2_ptr, op2_size, (mp_limb_t) 1);
+ op2_ptr = opx;
+
+ if (op1_size > op2_size)
+ {
+ /* The result has the same size as OP1, since OP1 is normalized
+ and longer than the ones-extended OP2. */
+ res_size = op1_size;
+
+ /* Handle allocation, now then we know exactly how much space is
+ needed for the result. */
+ res_ptr = MPZ_NEWALLOC (res, res_size);
+ /* Don't re-read OP1_PTR or OP2_PTR. Since res_size = op1_size,
+ op1 is not changed if it is identical to res.
+ OP2_PTR points to temporary space. */
+
+ mpn_andn_n (res_ptr, op1_ptr, op2_ptr, op2_size);
+ MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, res_size - op2_size);
+ }
+ else
+ {
+ /* Find out the exact result size. Ignore the high limbs of OP2,
+ OP1 is zero-extended and would make the result zero. */
+ res_size = 0;
+ for (i = op1_size; --i >= 0;)
+ if ((op1_ptr[i] & ~op2_ptr[i]) != 0)
+ {
+ res_size = i + 1;
+ /* Handle allocation, now then we know exactly how much
+ space is needed for the result. */
+ /* Don't re-read OP1_PTR. Since res_size <= op1_size,
+ op1 is not changed if it is identical to res. Don't
+ re-read OP2_PTR. It points to temporary space--never
+ to the space PTR(res) used to point to before
+ reallocation. */
+ mpn_andn_n (MPZ_NEWALLOC (res, res_size), op1_ptr, op2_ptr, res_size);
+
+ break;
+ }
+ }
#endif
- }
- TMP_FREE;
+ SIZ(res) = res_size;
+ TMP_FREE;
+ }
+ }
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/aors.h b/Build/source/libs/gmp/gmp-src/mpz/aors.h
index 4d22754b23b..722d480532e 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/aors.h
+++ b/Build/source/libs/gmp/gmp-src/mpz/aors.h
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/aors_ui.h b/Build/source/libs/gmp/gmp-src/mpz/aors_ui.h
index 2e3c481ab70..ba65af3bfde 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/aors_ui.h
+++ b/Build/source/libs/gmp/gmp-src/mpz/aors_ui.h
@@ -1,8 +1,8 @@
/* mpz_add_ui, mpz_sub_ui -- Add or subtract an mpz_t and an unsigned
one-word integer.
-Copyright 1991, 1993, 1994, 1996, 1999-2002, 2004, 2012, 2013 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1999-2002, 2004, 2012, 2013, 2015
+Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -80,7 +79,7 @@ FUNCTION (mpz_ptr w, mpz_srcptr u, unsigned long int vval)
usize = SIZ (u);
if (usize == 0)
{
- PTR (w)[0] = vval;
+ MPZ_NEWALLOC (w, 1)[0] = vval;
SIZ (w) = VARIATION_NEG (vval != 0);
return;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/aorsmul.c b/Build/source/libs/gmp/gmp-src/mpz/aorsmul.c
index bf012c965ce..57b06b3a559 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/aorsmul.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/aorsmul.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/aorsmul_i.c b/Build/source/libs/gmp/gmp-src/mpz/aorsmul_i.c
index 07af0a4efe1..73f986e8ad3 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/aorsmul_i.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/aorsmul_i.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/array_init.c b/Build/source/libs/gmp/gmp-src/mpz/array_init.c
index 0a6880ab0f9..df97f34bc44 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/array_init.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/array_init.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/bin_ui.c b/Build/source/libs/gmp/gmp-src/mpz/bin_ui.c
index c24b21724c1..bab3e076989 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/bin_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/bin_ui.c
@@ -1,6 +1,6 @@
-/* mpz_bin_ui - compute n over k.
+/* mpz_bin_ui(RESULT, N, K) -- Set RESULT to N over K.
-Copyright 1998-2002, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1998-2002, 2012, 2013, 2015, 2017-2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,10 +28,302 @@ 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 "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
+/* How many special cases? Minimum is 2: 0 and 1;
+ * also 3 {0,1,2} and 5 {0,1,2,3,4} are implemented.
+ */
+#define APARTAJ_KALKULOJ 2
+
+/* Whether to use (1) or not (0) the function mpz_bin_uiui whenever
+ * the operands fit.
+ */
+#define UZU_BIN_UIUI 0
+
+/* Whether to use a shortcut to precompute the product of four
+ * elements (1), or precompute only the product of a couple (0).
+ *
+ * In both cases the precomputed product is then updated with some
+ * linear operations to obtain the product of the next four (1)
+ * [or two (0)] operands.
+ */
+#define KVAROPE 1
+
+static void
+posmpz_init (mpz_ptr r)
+{
+ mp_ptr rp;
+ ASSERT (SIZ (r) > 0);
+ rp = SIZ (r) + MPZ_REALLOC (r, SIZ (r) + 2);
+ *rp = 0;
+ *++rp = 0;
+}
+
+/* Equivalent to mpz_add_ui (r, r, in), but faster when
+ 0 < SIZ (r) < ALLOC (r) and limbs above SIZ (r) contain 0. */
+static void
+posmpz_inc_ui (mpz_ptr r, unsigned long in)
+{
+#if BITS_PER_ULONG > GMP_NUMB_BITS
+ mpz_add_ui (r, r, in);
+#else
+ ASSERT (SIZ (r) > 0);
+ MPN_INCR_U (PTR (r), SIZ (r) + 1, in);
+ SIZ (r) += (PTR (r)[SIZ (r)] != 0);
+#endif
+}
+
+/* Equivalent to mpz_sub_ui (r, r, in), but faster when
+ 0 < SIZ (r) and we know in advance that the result is positive. */
+static void
+posmpz_dec_ui (mpz_ptr r, unsigned long in)
+{
+#if BITS_PER_ULONG > GMP_NUMB_BITS
+ mpz_sub_ui (r, r, in);
+#else
+ ASSERT (mpz_cmp_ui (r, in) >= 0);
+ MPN_DECR_U (PTR (r), SIZ (r), in);
+ SIZ (r) -= (PTR (r)[SIZ (r)-1] == 0);
+#endif
+}
+
+/* Equivalent to mpz_tdiv_q_2exp (r, r, 1), but faster when
+ 0 < SIZ (r) and we know in advance that the result is positive. */
+static void
+posmpz_rsh1 (mpz_ptr r)
+{
+ mp_ptr rp;
+ mp_size_t rn;
+
+ rn = SIZ (r);
+ rp = PTR (r);
+ ASSERT (rn > 0);
+ mpn_rshift (rp, rp, rn, 1);
+ SIZ (r) -= rp[rn - 1] == 0;
+}
+
+/* Computes r = n(n+(2*k-1))/2
+ It uses a sqare instead of a product, computing
+ r = ((n+k-1)^2 + n - (k-1)^2)/2
+ As a side effect, sets t = n+k-1
+ */
+static void
+mpz_hmul_nbnpk (mpz_ptr r, mpz_srcptr n, unsigned long int k, mpz_ptr t)
+{
+ ASSERT (k > 0 && SIZ(n) > 0);
+ --k;
+ mpz_add_ui (t, n, k);
+ mpz_mul (r, t, t);
+ mpz_add (r, r, n);
+ posmpz_rsh1 (r);
+ if (LIKELY (k <= (1UL << (BITS_PER_ULONG / 2))))
+ posmpz_dec_ui (r, (k + (k & 1))*(k >> 1));
+ else
+ {
+ mpz_t tmp;
+ mpz_init_set_ui (tmp, (k + (k & 1)));
+ mpz_mul_ui (tmp, tmp, k >> 1);
+ mpz_sub (r, r, tmp);
+ mpz_clear (tmp);
+ }
+}
+
+#if KVAROPE
+static void
+rek_raising_fac4 (mpz_ptr r, mpz_ptr p, mpz_ptr P, unsigned long int k, unsigned long int lk, mpz_ptr t)
+{
+ if (k - lk < 5)
+ {
+ do {
+ posmpz_inc_ui (p, 4*k+2);
+ mpz_addmul_ui (P, p, 4*k);
+ posmpz_dec_ui (P, k);
+ mpz_mul (r, r, P);
+ } while (--k > lk);
+ }
+ else
+ {
+ mpz_t lt;
+ unsigned long int m;
+
+ m = ((k + lk) >> 1) + 1;
+ rek_raising_fac4 (r, p, P, k, m, t);
+
+ posmpz_inc_ui (p, 4*m+2);
+ mpz_addmul_ui (P, p, 4*m);
+ posmpz_dec_ui (P, m);
+ if (t == NULL)
+ {
+ mpz_init_set (lt, P);
+ t = lt;
+ }
+ else
+ {
+ ALLOC (lt) = 0;
+ mpz_set (t, P);
+ }
+ rek_raising_fac4 (t, p, P, m - 1, lk, NULL);
+
+ mpz_mul (r, r, t);
+ mpz_clear (lt);
+ }
+}
+
+/* Computes (n+1)(n+2)...(n+k)/2^(k/2 +k/4) using the helper function
+ rek_raising_fac4, and exploiting an idea inspired by a piece of
+ code that Fredrik Johansson wrote and by a comment by Niels Möller.
+
+ Assume k = 4i then compute:
+ p = (n+1)(n+4i)/2 - i
+ (n+1+1)(n+4i)/2 = p + i + (n+4i)/2
+ (n+1+1)(n+4i-1)/2 = p + i + ((n+4i)-(n+1+1))/2 = p + i + (n-n+4i-2)/2 = p + 3i-1
+ P = (p + i)*(p+3i-1)/2 = (n+1)(n+2)(n+4i-1)(n+4i)/8
+ n' = n + 2
+ i' = i - 1
+ (n'-1)(n')(n'+4i'+1)(n'+4i'+2)/8 = P
+ (n'-1)(n'+4i'+2)/2 - i' - 1 = p
+ (n'-1+2)(n'+4i'+2)/2 - i' - 1 = p + (n'+4i'+2)
+ (n'-1+2)(n'+4i'+2-2)/2 - i' - 1 = p + (n'+4i'+2) - (n'-1+2) = p + 4i' + 1
+ (n'-1+2)(n'+4i'+2-2)/2 - i' = p + 4i' + 2
+ p' = p + 4i' + 2 = (n'+1)(n'+4i')/2 - i'
+ p' - 4i' - 2 = p
+ (p' - 4i' - 2 + i)*(p' - 4i' - 2+3i-1)/2 = P
+ (p' - 4i' - 2 + i' + 1)*(p' - 4i' - 2 + 3i' + 3 - 1)/2 = P
+ (p' - 3i' - 1)*(p' - i')/2 = P
+ (p' - 3i' - 1 + 4i' + 1)*(p' - i' + 4i' - 1)/2 = P + (4i' + 1)*(p' - i')/2 + (p' - 3i' - 1 + 4i' + 1)*(4i' - 1)/2
+ (p' + i')*(p' + 3i' - 1)/2 = P + (4i')*(p' + p')/2 + (p' - i' - (p' + i'))/2
+ (p' + i')*(p' + 3i' - 1)/2 = P + 4i'p' + (p' - i' - p' - i')/2
+ (p' + i')*(p' + 3i' - 1)/2 = P + 4i'p' - i'
+ P' = P + 4i'p' - i'
+
+ And compute the product P * P' * P" ...
+ */
+
+static void
+mpz_raising_fac4 (mpz_ptr r, mpz_ptr n, unsigned long int k, mpz_ptr t, mpz_ptr p)
+{
+ ASSERT ((k >= APARTAJ_KALKULOJ) && (APARTAJ_KALKULOJ > 0));
+ posmpz_init (n);
+ posmpz_inc_ui (n, 1);
+ SIZ (r) = 0;
+ if (k & 1)
+ {
+ mpz_set (r, n);
+ posmpz_inc_ui (n, 1);
+ }
+ k >>= 1;
+ if (APARTAJ_KALKULOJ < 2 && k == 0)
+ return;
+
+ mpz_hmul_nbnpk (p, n, k, t);
+ posmpz_init (p);
+
+ if (k & 1)
+ {
+ if (SIZ (r))
+ mpz_mul (r, r, p);
+ else
+ mpz_set (r, p);
+ posmpz_inc_ui (p, k - 1);
+ }
+ k >>= 1;
+ if (APARTAJ_KALKULOJ < 4 && k == 0)
+ return;
+
+ mpz_hmul_nbnpk (t, p, k, n);
+ if (SIZ (r))
+ mpz_mul (r, r, t);
+ else
+ mpz_set (r, t);
+
+ if (APARTAJ_KALKULOJ > 8 || k > 1)
+ {
+ posmpz_dec_ui (p, k);
+ rek_raising_fac4 (r, p, t, k - 1, 0, n);
+ }
+}
+
+#else /* KVAROPE */
+
+static void
+rek_raising_fac (mpz_ptr r, mpz_ptr n, unsigned long int k, unsigned long int lk, mpz_ptr t1, mpz_ptr t2)
+{
+ /* Should the threshold depend on SIZ (n) ? */
+ if (k - lk < 10)
+ {
+ do {
+ posmpz_inc_ui (n, k);
+ mpz_mul (r, r, n);
+ --k;
+ } while (k > lk);
+ }
+ else
+ {
+ mpz_t t3;
+ unsigned long int m;
+
+ m = ((k + lk) >> 1) + 1;
+ rek_raising_fac (r, n, k, m, t1, t2);
+
+ posmpz_inc_ui (n, m);
+ if (t1 == NULL)
+ {
+ mpz_init_set (t3, n);
+ t1 = t3;
+ }
+ else
+ {
+ ALLOC (t3) = 0;
+ mpz_set (t1, n);
+ }
+ rek_raising_fac (t1, n, m - 1, lk, t2, NULL);
+
+ mpz_mul (r, r, t1);
+ mpz_clear (t3);
+ }
+}
+
+/* Computes (n+1)(n+2)...(n+k)/2^(k/2) using the helper function
+ rek_raising_fac, and exploiting an idea inspired by a piece of
+ code that Fredrik Johansson wrote.
+
+ Force an even k = 2i then compute:
+ p = (n+1)(n+2i)/2
+ i' = i - 1
+ p == (n+1)(n+2i'+2)/2
+ p' = p + i' == (n+2)(n+2i'+1)/2
+ n' = n + 1
+ p'== (n'+1)(n'+2i')/2 == (n+1 +1)(n+2i -1)/2
+
+ And compute the product p * p' * p" ...
+*/
+
+static void
+mpz_raising_fac (mpz_ptr r, mpz_ptr n, unsigned long int k, mpz_ptr t, mpz_ptr p)
+{
+ unsigned long int hk;
+ ASSERT ((k >= APARTAJ_KALKULOJ) && (APARTAJ_KALKULOJ > 1));
+ mpz_add_ui (n, n, 1);
+ hk = k >> 1;
+ mpz_hmul_nbnpk (p, n, hk, t);
+
+ if ((k & 1) != 0)
+ {
+ mpz_add_ui (t, t, hk + 1);
+ mpz_mul (r, t, p);
+ }
+ else
+ {
+ mpz_set (r, p);
+ }
+
+ if ((APARTAJ_KALKULOJ > 3) || (hk > 1))
+ {
+ posmpz_init (p);
+ rek_raising_fac (r, p, hk - 1, 0, t, n);
+ }
+}
+#endif /* KVAROPE */
/* This is a poor implementation. Look at bin_uiui.c for improvement ideas.
In fact consider calling mpz_bin_uiui() when the arguments fit, leaving
@@ -40,21 +332,10 @@ see https://www.gnu.org/licenses/. */
The identity bin(n,k) = (-1)^k * bin(-n+k-1,k) can be found in Knuth vol
1 section 1.2.6 part G. */
-
-#define DIVIDE() \
- do { \
- ASSERT (SIZ(r) > 0); \
- MPN_DIVREM_OR_DIVEXACT_1 (PTR(r), PTR(r), (mp_size_t) SIZ(r), kacc); \
- SIZ(r) -= (PTR(r)[SIZ(r)-1] == 0); \
- } while (0)
-
void
mpz_bin_ui (mpz_ptr r, mpz_srcptr n, unsigned long int k)
{
mpz_t ni;
- mp_limb_t i;
- mpz_t nacc;
- mp_limb_t kacc;
mp_size_t negate;
if (SIZ (n) < 0)
@@ -83,7 +364,6 @@ mpz_bin_ui (mpz_ptr r, mpz_srcptr n, unsigned long int k)
/* Now wanting bin(ni+k,k), with ni positive, and "negate" is the sign (0
for positive, 1 for negative). */
- SIZ (r) = 1; PTR (r)[0] = 1;
/* Rewrite bin(n,k) as bin(n,n-k) if that is smaller. In this case it's
whether ni+k-k < k meaning ni<k, and if so change to denominator ni+k-k
@@ -96,48 +376,84 @@ mpz_bin_ui (mpz_ptr r, mpz_srcptr n, unsigned long int k)
mpz_set_ui (ni, tmp);
}
- kacc = 1;
- mpz_init_set_ui (nacc, 1L);
-
- for (i = 1; i <= k; i++)
+ if (k < APARTAJ_KALKULOJ)
{
- mp_limb_t k1, k0;
-
-#if 0
- mp_limb_t nacclow;
- int c;
-
- nacclow = PTR(nacc)[0];
- for (c = 0; (((kacc | nacclow) & 1) == 0); c++)
+ if (k == 0)
{
- kacc >>= 1;
- nacclow >>= 1;
+ SIZ (r) = 1;
+ MPZ_NEWALLOC (r, 1)[0] = 1;
}
- mpz_div_2exp (nacc, nacc, c);
-#endif
-
- mpz_add_ui (ni, ni, 1L);
- mpz_mul (nacc, nacc, ni);
- umul_ppmm (k1, k0, kacc, i << GMP_NAIL_BITS);
- if (k1 != 0)
+#if APARTAJ_KALKULOJ > 2
+ else if (k == 2)
{
- /* Accumulator overflow. Perform bignum step. */
- mpz_mul (r, r, nacc);
- SIZ (nacc) = 1; PTR (nacc)[0] = 1;
- DIVIDE ();
- kacc = i;
+ mpz_add_ui (ni, ni, 1);
+ mpz_mul (r, ni, ni);
+ mpz_add (r, r, ni);
+ posmpz_rsh1 (r);
+ }
+#endif
+#if APARTAJ_KALKULOJ > 3
+ else if (k > 2)
+ { /* k = 3, 4 */
+ mpz_add_ui (ni, ni, 2); /* n+1 */
+ mpz_mul (r, ni, ni); /* (n+1)^2 */
+ mpz_sub_ui (r, r, 1); /* (n+1)^2-1 */
+ if (k == 3)
+ {
+ mpz_mul (r, r, ni); /* ((n+1)^2-1)(n+1) = n(n+1)(n+2) */
+ /* mpz_divexact_ui (r, r, 6); /\* 6=3<<1; div_by3 ? *\/ */
+ mpn_pi1_bdiv_q_1 (PTR(r), PTR(r), SIZ(r), 3, GMP_NUMB_MASK/3*2+1, 1);
+ MPN_NORMALIZE_NOT_ZERO (PTR(r), SIZ(r));
+ }
+ else /* k = 4 */
+ {
+ mpz_add (ni, ni, r); /* (n+1)^2+n */
+ mpz_mul (r, ni, ni); /* ((n+1)^2+n)^2 */
+ mpz_sub_ui (r, r, 1); /* ((n+1)^2+n)^2-1 = n(n+1)(n+2)(n+3) */
+ /* mpz_divexact_ui (r, r, 24); /\* 24=3<<3; div_by3 ? *\/ */
+ mpn_pi1_bdiv_q_1 (PTR(r), PTR(r), SIZ(r), 3, GMP_NUMB_MASK/3*2+1, 3);
+ MPN_NORMALIZE_NOT_ZERO (PTR(r), SIZ(r));
+ }
}
+#endif
else
- {
- /* Save new products in accumulators to keep accumulating. */
- kacc = k0 >> GMP_NAIL_BITS;
+ { /* k = 1 */
+ mpz_add_ui (r, ni, 1);
}
}
+#if UZU_BIN_UIUI
+ else if (mpz_cmp_ui (ni, ULONG_MAX - k) <= 0)
+ {
+ mpz_bin_uiui (r, mpz_get_ui (ni) + k, k);
+ }
+#endif
+ else
+ {
+ mp_limb_t count;
+ mpz_t num, den;
- mpz_mul (r, r, nacc);
- DIVIDE ();
- SIZ(r) = (SIZ(r) ^ -negate) + negate;
+ mpz_init (num);
+ mpz_init (den);
+
+#if KVAROPE
+ mpz_raising_fac4 (num, ni, k, den, r);
+ popc_limb (count, k);
+ ASSERT (k - (k >> 1) - (k >> 2) - count >= 0);
+ mpz_tdiv_q_2exp (num, num, k - (k >> 1) - (k >> 2) - count);
+#else
+ mpz_raising_fac (num, ni, k, den, r);
+ popc_limb (count, k);
+ ASSERT (k - (k >> 1) - count >= 0);
+ mpz_tdiv_q_2exp (num, num, k - (k >> 1) - count);
+#endif
+
+ mpz_oddfac_1(den, k, 0);
- mpz_clear (nacc);
+ mpz_divexact(r, num, den);
+ mpz_clear (num);
+ mpz_clear (den);
+ }
mpz_clear (ni);
+
+ SIZ(r) = (SIZ(r) ^ -negate) + negate;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/bin_uiui.c b/Build/source/libs/gmp/gmp-src/mpz/bin_uiui.c
index 94a9dc5c75d..b77628fdfc2 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/bin_uiui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/bin_uiui.c
@@ -2,7 +2,7 @@
Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-Copyright 2010-2012 Free Software Foundation, Inc.
+Copyright 2010-2012, 2015-2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,12 +30,11 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
#ifndef BIN_GOETGHELUCK_THRESHOLD
-#define BIN_GOETGHELUCK_THRESHOLD 1000
+#define BIN_GOETGHELUCK_THRESHOLD 512
#endif
#ifndef BIN_UIUI_ENABLE_SMALLDC
#define BIN_UIUI_ENABLE_SMALLDC 1
@@ -110,58 +109,69 @@ mul3 (mp_limb_t m)
static mp_limb_t
mul4 (mp_limb_t m)
{
- mp_limb_t m01 = (m + 0) * (m + 1) >> 1;
- mp_limb_t m23 = (m + 2) * (m + 3) >> 1;
- return m01 * m23;
+ mp_limb_t m03 = (m + 0) * (m + 3) >> 1;
+ return m03 * (m03 + 1); /* mul2 (m03) ? */
}
static mp_limb_t
mul5 (mp_limb_t m)
{
- mp_limb_t m012 = (m + 0) * (m + 1) * (m + 2) >> 1;
- mp_limb_t m34 = (m + 3) * (m + 4) >> 1;
- return m012 * m34;
+ mp_limb_t m03 = (m + 0) * (m + 3) >> 1;
+ mp_limb_t m034 = m03 * (m + 4);
+ return (m03 + 1) * m034;
}
static mp_limb_t
mul6 (mp_limb_t m)
{
- mp_limb_t m01 = (m + 0) * (m + 1);
- mp_limb_t m23 = (m + 2) * (m + 3);
- mp_limb_t m45 = (m + 4) * (m + 5) >> 1;
- mp_limb_t m0123 = m01 * m23 >> 3;
- return m0123 * m45;
+ mp_limb_t m05 = (m + 0) * (m + 5);
+ mp_limb_t m1234 = (m05 + 5) * (m05 + 5) >> 3;
+ return m1234 * (m05 >> 1);
}
static mp_limb_t
mul7 (mp_limb_t m)
{
- mp_limb_t m01 = (m + 0) * (m + 1);
- mp_limb_t m23 = (m + 2) * (m + 3);
- mp_limb_t m456 = (m + 4) * (m + 5) * (m + 6) >> 1;
- mp_limb_t m0123 = m01 * m23 >> 3;
- return m0123 * m456;
+ mp_limb_t m05 = (m + 0) * (m + 5);
+ mp_limb_t m1234 = (m05 + 5) * (m05 + 5) >> 3;
+ mp_limb_t m056 = m05 * (m + 6) >> 1;
+ return m1234 * m056;
}
static mp_limb_t
mul8 (mp_limb_t m)
{
- mp_limb_t m01 = (m + 0) * (m + 1);
- mp_limb_t m23 = (m + 2) * (m + 3);
- mp_limb_t m45 = (m + 4) * (m + 5);
- mp_limb_t m67 = (m + 6) * (m + 7);
- mp_limb_t m0123 = m01 * m23 >> 3;
- mp_limb_t m4567 = m45 * m67 >> 3;
- return m0123 * m4567;
+ mp_limb_t m07 = (m + 0) * (m + 7);
+ mp_limb_t m0257 = m07 * (m07 + 10) >> 3;
+ mp_limb_t m1346 = m07 + 9 + m0257;
+ return m0257 * m1346;
+}
+
+/*
+static mp_limb_t
+mul9 (mp_limb_t m)
+{
+ return (m + 8) * mul8 (m) ;
}
+static mp_limb_t
+mul10 (mp_limb_t m)
+{
+ mp_limb_t m09 = (m + 0) * (m + 9);
+ mp_limb_t m18 = (m09 >> 1) + 4;
+ mp_limb_t m0369 = m09 * (m09 + 18) >> 3;
+ mp_limb_t m2457 = m09 * 2 + 35 + m0369;
+ return ((m0369 * m2457) >> 1) * m18;
+}
+*/
+
typedef mp_limb_t (* mulfunc_t) (mp_limb_t);
-static const mulfunc_t mulfunc[] = {mul1,mul2,mul3,mul4,mul5,mul6,mul7,mul8};
+static const mulfunc_t mulfunc[] = {mul1,mul2,mul3,mul4,mul5,mul6,mul7,mul8 /* ,mul9,mul10 */};
#define M (numberof(mulfunc))
/* Number of factors-of-2 removed by the corresponding mulN function. */
-static const unsigned char tcnttab[] = {0, 1, 1, 2, 2, 4, 4, 6};
+static const unsigned char tcnttab[] = {0, 1, 1, 2, 2, 4, 4, 6 /*,6,8*/};
#if 1
/* This variant is inaccurate but share the code with other functions. */
@@ -176,11 +186,11 @@ static const unsigned char tcnttab[] = {0, 1, 1, 2, 2, 4, 4, 6};
static const unsigned long ftab[] =
#if GMP_NUMB_BITS == 64
/* 1 to 8 factors per iteration */
- {CNST_LIMB(0xffffffffffffffff),CNST_LIMB(0x100000000),0x32cbfe,0x16a0b,0x24c4,0xa16,0x34b,0x1b2 /*,0xdf,0x8d */};
+ {CNST_LIMB(0xffffffffffffffff),CNST_LIMB(0x16a09e667),0x32cbfc,0x16a08,0x24c0,0xa11,0x345,0x1ab /*,0xe9,0x8e */};
#endif
#if GMP_NUMB_BITS == 32
/* 1 to 7 factors per iteration */
- {0xffffffff,0x10000,0x801,0x16b,0x71,0x42,0x26 /* ,0x1e */};
+ {0xffffffff,0x16a09,0x7ff,0x168,0x6f,0x3d,0x20 /* ,0x17 */};
#endif
#define MAXFACS(max,l) \
@@ -199,11 +209,10 @@ static const mp_limb_t facinv[] = { ONE_LIMB_ODD_FACTORIAL_INVERSES_TABLE };
static void
mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
{
- int nmax, kmax, nmaxnow, numfac;
+ unsigned nmax, kmax, nmaxnow, numfac;
mp_ptr np, kp;
mp_size_t nn, kn, alloc;
mp_limb_t i, j, t, iii, jjj, cy, dinv;
- mp_bitcnt_t i2cnt, j2cnt;
int cnt;
mp_size_t maxn;
TMP_DECL;
@@ -216,9 +225,8 @@ mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
/* FIXME: This allocation might be insufficient, but is usually way too
large. */
alloc = SOME_THRESHOLD - 1 + MAX (3 * maxn / 2, SOME_THRESHOLD);
- alloc = MIN (alloc, k) + 1;
- np = TMP_ALLOC_LIMBS (alloc);
- kp = TMP_ALLOC_LIMBS (SOME_THRESHOLD + 1);
+ alloc = MIN (alloc, (mp_size_t) k) + 1;
+ TMP_ALLOC_LIMBS_2 (np, alloc, kp, SOME_THRESHOLD + 1);
MAXFACS (nmax, n);
ASSERT (nmax <= M);
@@ -230,10 +238,6 @@ mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
np[0] = 1; nn = 1;
- i2cnt = 0; /* total low zeros in dividend */
- j2cnt = __gmp_fac2cnt_table[ODD_FACTORIAL_TABLE_LIMIT / 2 - 1];
- /* total low zeros in divisor */
-
numfac = 1;
j = ODD_FACTORIAL_TABLE_LIMIT + 1;
jjj = ODD_FACTORIAL_TABLE_MAX;
@@ -252,7 +256,6 @@ mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
j += kmax; /* number of factors used */
count_trailing_zeros (cnt, jjj); /* count low zeros */
jjj >>= cnt; /* remove remaining low zeros */
- j2cnt += tcnttab[kmax - 1] + cnt; /* update low zeros count */
cy = mpn_mul_1 (kp, kp, kn, jjj); /* accumulate new factors */
kp[kn] = cy;
kn += cy != 0;
@@ -268,7 +271,6 @@ mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
i += nmaxnow; /* number of factors used */
count_trailing_zeros (cnt, iii); /* count low zeros */
iii >>= cnt; /* remove remaining low zeros */
- i2cnt += tcnttab[nmaxnow - 1] + cnt; /* update low zeros count */
cy = mpn_mul_1 (np, np, nn, iii); /* accumulate new factors */
np[nn] = cy;
nn += cy != 0;
@@ -281,6 +283,7 @@ mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
nn += (np[nn - 1] >= kp[kn - 1]);
nn -= kn;
mpn_sbpi1_bdiv_q (np, np, nn, kp, MIN(kn,nn), -dinv);
+ mpn_neg (np, np, nn);
if (kmax == 0)
break;
@@ -290,11 +293,14 @@ mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
j += kmax; /* number of factors used */
count_trailing_zeros (cnt, jjj); /* count low zeros */
jjj >>= cnt; /* remove remaining low zeros */
- j2cnt += tcnttab[kmax - 1] + cnt; /* update low zeros count */
}
/* Put back the right number of factors of 2. */
- cnt = i2cnt - j2cnt;
+ popc_limb (cnt, n - k);
+ popc_limb (j, k);
+ cnt += j;
+ popc_limb (j, n);
+ cnt -= j;
if (cnt != 0)
{
ASSERT (cnt < GMP_NUMB_BITS); /* can happen, but not for intended use */
@@ -314,44 +320,51 @@ mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
static void
mpz_smallk_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
{
- int nmax, numfac;
+ unsigned nmax, numfac;
mp_ptr rp;
mp_size_t rn, alloc;
mp_limb_t i, iii, cy;
- mp_bitcnt_t i2cnt, cnt;
-
- count_leading_zeros (cnt, (mp_limb_t) n);
- cnt = GMP_LIMB_BITS - cnt;
- alloc = cnt * k / GMP_NUMB_BITS + 3; /* FIXME: ensure rounding is enough. */
- rp = MPZ_NEWALLOC (r, alloc);
+ unsigned i2cnt, cnt;
MAXFACS (nmax, n);
nmax = MIN (nmax, M);
i = n - k + 1;
- nmax = MIN (nmax, k);
+ i2cnt = __gmp_fac2cnt_table[k / 2 - 1]; /* low zeros count */
+ if (nmax >= k)
+ {
+ MPZ_NEWALLOC (r, 1) [0] = mulfunc[k - 1] (i) * facinv[k - 2] >>
+ (i2cnt - tcnttab[k - 1]);
+ SIZ(r) = 1;
+ return;
+ }
+
+ count_leading_zeros (cnt, (mp_limb_t) n);
+ cnt = GMP_LIMB_BITS - cnt;
+ alloc = cnt * k / GMP_NUMB_BITS + 3; /* FIXME: ensure rounding is enough. */
+ rp = MPZ_NEWALLOC (r, alloc);
+
rp[0] = mulfunc[nmax - 1] (i);
rn = 1;
i += nmax; /* number of factors used */
- i2cnt = tcnttab[nmax - 1]; /* low zeros count */
+ i2cnt -= tcnttab[nmax - 1]; /* low zeros count */
numfac = k - nmax;
- while (numfac != 0)
+ do
{
nmax = MIN (nmax, numfac);
iii = mulfunc[nmax - 1] (i);
i += nmax; /* number of factors used */
- i2cnt += tcnttab[nmax - 1]; /* update low zeros count */
+ i2cnt -= tcnttab[nmax - 1]; /* update low zeros count */
cy = mpn_mul_1 (rp, rp, rn, iii); /* accumulate new factors */
rp[rn] = cy;
rn += cy != 0;
numfac -= nmax;
- }
+ } while (numfac != 0);
ASSERT (rn < alloc);
- mpn_pi1_bdiv_q_1 (rp, rp, rn, __gmp_oddfac_table[k], facinv[k - 2],
- __gmp_fac2cnt_table[k / 2 - 1] - i2cnt);
+ mpn_pi1_bdiv_q_1 (rp, rp, rn, __gmp_oddfac_table[k], facinv[k - 2], i2cnt);
/* A two-fold, branch-free normalisation is possible :*/
/* rn -= rp[rn - 1] == 0; */
/* rn -= rp[rn - 1] == 0; */
@@ -485,7 +498,8 @@ mpz_smallkdc_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
++__i; \
if (((sieve)[__index] & __mask) == 0) \
{ \
- (prime) = id_to_n(__i)
+ mp_limb_t prime; \
+ prime = id_to_n(__i)
#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
do { \
@@ -502,7 +516,7 @@ mpz_smallkdc_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
} \
__mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
__index += __mask & 1; \
- } while (__i <= __max_i) \
+ } while (__i <= __max_i)
#define LOOP_ON_SIEVE_END \
LOOP_ON_SIEVE_STOP; \
@@ -556,24 +570,29 @@ primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
} \
} while (0)
-/* Returns an approximation of the sqare root of x. *
- * It gives: x <= limb_apprsqrt (x) ^ 2 < x * 9/4 */
+/* Returns an approximation of the sqare root of x.
+ * It gives:
+ * limb_apprsqrt (x) ^ 2 <= x < (limb_apprsqrt (x)+1) ^ 2
+ * or
+ * x <= limb_apprsqrt (x) ^ 2 <= x * 9/8
+ */
static mp_limb_t
limb_apprsqrt (mp_limb_t x)
{
int s;
ASSERT (x > 2);
- count_leading_zeros (s, x - 1);
- s = GMP_LIMB_BITS - 1 - s;
- return (CNST_LIMB(1) << (s >> 1)) + (CNST_LIMB(1) << ((s - 1) >> 1));
+ count_leading_zeros (s, x);
+ s = (GMP_LIMB_BITS - s) >> 1;
+ return ((CNST_LIMB(1) << s) + (x >> s)) >> 1;
}
static void
mpz_goetgheluck_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
{
mp_limb_t *sieve, *factors, count;
- mp_limb_t prod, max_prod, j;
+ mp_limb_t prod, max_prod;
+ mp_size_t j;
TMP_DECL;
ASSERT (BIN_GOETGHELUCK_THRESHOLD >= 13);
@@ -602,38 +621,30 @@ mpz_goetgheluck_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
{
mp_limb_t s;
- {
- mp_limb_t prime;
- s = limb_apprsqrt(n);
- s = n_to_bit (s);
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (5), s, 0,sieve);
- COUNT_A_PRIME (prime, n, k, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- s++;
- }
+ s = limb_apprsqrt(n);
+ s = n_to_bit (s);
+ ASSERT (bit_to_n (s+1) * bit_to_n (s+1) > n);
+ ASSERT (s <= n_to_bit (n >> 1));
+ LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (5), s, 0,sieve);
+ COUNT_A_PRIME (prime, n, k, prod, max_prod, factors, j);
+ LOOP_ON_SIEVE_STOP;
ASSERT (max_prod <= GMP_NUMB_MAX / 2);
max_prod <<= 1;
- ASSERT (bit_to_n (s) * bit_to_n (s) > n);
- ASSERT (s <= n_to_bit (n >> 1));
- {
- mp_limb_t prime;
- LOOP_ON_SIEVE_BEGIN (prime, s, n_to_bit (n >> 1), 0,sieve);
- SH_COUNT_A_PRIME (prime, n, k, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- }
+ LOOP_ON_SIEVE_CONTINUE (prime, n_to_bit (n >> 1),sieve);
+ SH_COUNT_A_PRIME (prime, n, k, prod, max_prod, factors, j);
+ LOOP_ON_SIEVE_END;
+
max_prod >>= 1;
}
/* Store primes from (n-k)+1 to n */
ASSERT (n_to_bit (n - k) < n_to_bit (n));
- {
- mp_limb_t prime;
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (n - k) + 1, n_to_bit (n), 0,sieve);
- FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- }
+
+ LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (n - k) + 1, n_to_bit (n), 0,sieve);
+ FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
+ LOOP_ON_SIEVE_END;
if (LIKELY (j != 0))
{
@@ -642,7 +653,7 @@ mpz_goetgheluck_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
}
else
{
- PTR (r)[0] = prod;
+ MPZ_NEWALLOC (r, 1)[0] = prod;
SIZ (r) = 1;
}
TMP_FREE;
@@ -677,10 +688,10 @@ mpz_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
/* Rewrite bin(n,k) as bin(n,n-k) if that is smaller. */
k = MIN (k, n - k);
if (k < 2) {
- PTR(r)[0] = k ? n : 1; /* 1 + ((-k) & (n-1)); */
+ MPZ_NEWALLOC (r, 1)[0] = k ? n : 1; /* 1 + ((-k) & (n-1)); */
SIZ(r) = 1;
} else if (n <= ODD_FACTORIAL_EXTTABLE_LIMIT) { /* k >= 2, n >= 4 */
- PTR(r)[0] = bc_bin_uiui (n, k);
+ MPZ_NEWALLOC (r, 1)[0] = bc_bin_uiui (n, k);
SIZ(r) = 1;
} else if (k <= ODD_FACTORIAL_TABLE_LIMIT)
mpz_smallk_bin_uiui (r, n, k);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cdiv_q.c b/Build/source/libs/gmp/gmp-src/mpz/cdiv_q.c
index 32e3200a8d5..f19eb74ab8e 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cdiv_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cdiv_q.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cdiv_q_ui.c b/Build/source/libs/gmp/gmp-src/mpz/cdiv_q_ui.c
index 63608c90438..269d9a3e988 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cdiv_q_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cdiv_q_ui.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cdiv_qr.c b/Build/source/libs/gmp/gmp-src/mpz/cdiv_qr.c
index 45e9a2774cc..bc9b8927320 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cdiv_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cdiv_qr.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cdiv_qr_ui.c b/Build/source/libs/gmp/gmp-src/mpz/cdiv_qr_ui.c
index 1ccfbbe7fd2..0c11fb636cf 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cdiv_qr_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cdiv_qr_ui.c
@@ -3,8 +3,8 @@
always fit into the return type, the negative of the true remainder is
returned.
-Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012 Free Software Foundation,
-Inc.
+Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
@@ -108,7 +107,7 @@ mpz_cdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
rl = divisor - rl;
}
- PTR(rem)[0] = rl;
+ MPZ_NEWALLOC (rem, 1)[0] = rl;
SIZ(rem) = -(rl != 0);
}
qn = nn - (qp[nn - 1] == 0);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cdiv_r.c b/Build/source/libs/gmp/gmp-src/mpz/cdiv_r.c
index 9cebab3e061..83c624a4de0 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cdiv_r.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cdiv_r.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cdiv_r_ui.c b/Build/source/libs/gmp/gmp-src/mpz/cdiv_r_ui.c
index 68fb149c461..84d51dba1ac 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cdiv_r_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cdiv_r_ui.c
@@ -3,8 +3,8 @@
always fit into the return type, the negative of the true remainder is
returned.
-Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 Free Software Foundation,
-Inc.
+Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
@@ -101,7 +100,7 @@ mpz_cdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
if (ns >= 0)
rl = divisor - rl;
- PTR(rem)[0] = rl;
+ MPZ_NEWALLOC (rem, 1)[0] = rl;
SIZ(rem) = -1;
}
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cdiv_ui.c b/Build/source/libs/gmp/gmp-src/mpz/cdiv_ui.c
index 1f7f6e3c1ba..e1a1c49b650 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cdiv_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cdiv_ui.c
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cfdiv_q_2exp.c b/Build/source/libs/gmp/gmp-src/mpz/cfdiv_q_2exp.c
index 366d6aa7046..413ea363d6a 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cfdiv_q_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cfdiv_q_2exp.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -53,7 +52,7 @@ cfdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
if (wsize <= 0)
{
/* u < 2**cnt, so result 1, 0 or -1 according to rounding */
- PTR(w)[0] = 1;
+ MPZ_NEWALLOC (w, 1)[0] = 1;
SIZ(w) = (usize == 0 || (usize ^ dir) < 0 ? 0 : dir);
return;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cfdiv_r_2exp.c b/Build/source/libs/gmp/gmp-src/mpz/cfdiv_r_2exp.c
index 4941822b285..fedb97dc5cc 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cfdiv_r_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cfdiv_r_2exp.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/clear.c b/Build/source/libs/gmp/gmp-src/mpz/clear.c
index d1541e91c95..f8c38a2e8b0 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/clear.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/clear.c
@@ -30,11 +30,11 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
mpz_clear (mpz_ptr x)
{
- __GMP_FREE_FUNC_LIMBS (PTR (x), ALLOC(x));
+ if (ALLOC (x))
+ __GMP_FREE_FUNC_LIMBS (PTR (x), ALLOC(x));
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/clears.c b/Build/source/libs/gmp/gmp-src/mpz/clears.c
index dac98873814..7ac257a1cc8 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/clears.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/clears.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdarg.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -39,11 +38,13 @@ mpz_clears (mpz_ptr x, ...)
va_start (ap, x);
- while (x != NULL)
+ do
{
- __GMP_FREE_FUNC_LIMBS (PTR (x), ALLOC(x));
+ if (ALLOC (x))
+ __GMP_FREE_FUNC_LIMBS (PTR (x), ALLOC (x));
x = va_arg (ap, mpz_ptr);
}
+ while (x != NULL);
va_end (ap);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/clrbit.c b/Build/source/libs/gmp/gmp-src/mpz/clrbit.c
index 2475efe1e5b..8b3c8549ee7 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/clrbit.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/clrbit.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cmp.c b/Build/source/libs/gmp/gmp-src/mpz/cmp.c
index b8a5eaa7657..a97b0043a3f 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cmp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cmp.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cmp_d.c b/Build/source/libs/gmp/gmp-src/mpz/cmp_d.c
index 45926d6d547..b5b5e8b77e4 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cmp_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cmp_d.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
#include <float.h> /* for DBL_MAX */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cmp_si.c b/Build/source/libs/gmp/gmp-src/mpz/cmp_si.c
index 86251f436ad..23296c863b4 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cmp_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cmp_si.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cmp_ui.c b/Build/source/libs/gmp/gmp-src/mpz/cmp_ui.c
index 46fdd4e8011..4b40ab7a0ad 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cmp_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cmp_ui.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cmpabs.c b/Build/source/libs/gmp/gmp-src/mpz/cmpabs.c
index 5685776abe9..14f0dc95c82 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cmpabs.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cmpabs.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cmpabs_d.c b/Build/source/libs/gmp/gmp-src/mpz/cmpabs_d.c
index a4b95d26aa3..d2431cc927d 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cmpabs_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cmpabs_d.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
#include <float.h> /* for DBL_MAX */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cmpabs_ui.c b/Build/source/libs/gmp/gmp-src/mpz/cmpabs_ui.c
index fceef6bbacc..6deffb3be5a 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cmpabs_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cmpabs_ui.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/com.c b/Build/source/libs/gmp/gmp-src/mpz/com.c
index 66d69ce8b24..c5d22b08b78 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/com.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/com.c
@@ -1,8 +1,8 @@
/* mpz_com(mpz_ptr dst, mpz_ptr src) -- Assign the bit-complemented value of
SRC to DST.
-Copyright 1991, 1993, 1994, 1996, 2001, 2003, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 2001, 2003, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -49,7 +48,7 @@ mpz_com (mpz_ptr dst, mpz_srcptr src)
if (UNLIKELY (size == 0))
{
/* special case, as mpn_add_1 wants size!=0 */
- PTR (dst)[0] = 1;
+ MPZ_NEWALLOC (dst, 1)[0] = 1;
SIZ (dst) = -1;
}
else
diff --git a/Build/source/libs/gmp/gmp-src/mpz/combit.c b/Build/source/libs/gmp/gmp-src/mpz/combit.c
index b6d1daa09ee..0a2987564a2 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/combit.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/combit.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cong.c b/Build/source/libs/gmp/gmp-src/mpz/cong.c
index 1855b5052ac..5d2d835f205 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cong.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cong.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cong_2exp.c b/Build/source/libs/gmp/gmp-src/mpz/cong_2exp.c
index 8e78b173787..9de9645d783 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cong_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cong_2exp.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/cong_ui.c b/Build/source/libs/gmp/gmp-src/mpz/cong_ui.c
index a9729d9a858..6f86c2327bc 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/cong_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/cong_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/dive_ui.c b/Build/source/libs/gmp/gmp-src/mpz/dive_ui.c
index 8a1b5a31ff8..c859b96197f 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/dive_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/dive_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/divegcd.c b/Build/source/libs/gmp/gmp-src/mpz/divegcd.c
index 3cb181c3195..dc236c3044a 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/divegcd.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/divegcd.c
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -98,10 +97,10 @@ mpz_divexact_limb (mpz_ptr q, mpz_srcptr a, mp_limb_t d)
qp = MPZ_REALLOC (q, abs_size);
- mpn_divexact_1 (qp, PTR(a), abs_size, d);
+ MPN_DIVREM_OR_DIVEXACT_1 (qp, PTR(a), abs_size, d);
abs_size -= (qp[abs_size-1] == 0);
- SIZ(q) = (size>0 ? abs_size : -abs_size);
+ SIZ(q) = (size > 0 ? abs_size : -abs_size);
}
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/divexact.c b/Build/source/libs/gmp/gmp-src/mpz/divexact.c
index e9354715299..83368192583 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/divexact.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/divexact.c
@@ -32,9 +32,7 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
void
mpz_divexact (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
@@ -74,7 +72,7 @@ mpz_divexact (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
if (quot == num || quot == den)
qp = TMP_ALLOC_LIMBS (qn);
else
- qp = MPZ_REALLOC (quot, qn);
+ qp = MPZ_NEWALLOC (quot, qn);
np = PTR(num);
dp = PTR(den);
@@ -83,7 +81,7 @@ mpz_divexact (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
MPN_NORMALIZE (qp, qn);
if (qp != PTR(quot))
- MPN_COPY (MPZ_REALLOC (quot, qn), qp, qn);
+ MPN_COPY (MPZ_NEWALLOC (quot, qn), qp, qn);
SIZ(quot) = (SIZ(num) ^ SIZ(den)) >= 0 ? qn : -qn;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/divis.c b/Build/source/libs/gmp/gmp-src/mpz/divis.c
index cd9d406846b..35429a750d7 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/divis.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/divis.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/divis_2exp.c b/Build/source/libs/gmp/gmp-src/mpz/divis_2exp.c
index db6cfa44339..4ecb0c013d3 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/divis_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/divis_2exp.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/divis_ui.c b/Build/source/libs/gmp/gmp-src/mpz/divis_ui.c
index 41ff5f0b84e..b24c7dc74b0 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/divis_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/divis_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/dump.c b/Build/source/libs/gmp/gmp-src/mpz/dump.c
index 282be34db70..6135ddd4efd 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/dump.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/dump.c
@@ -35,7 +35,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <string.h> /* for strlen */
-#include "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/export.c b/Build/source/libs/gmp/gmp-src/mpz/export.c
index bc4c4df976a..2dacd691b72 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/export.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/export.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fac_ui.c b/Build/source/libs/gmp/gmp-src/mpz/fac_ui.c
index e0932272ff6..db3cfeee33a 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fac_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fac_ui.c
@@ -2,7 +2,8 @@
Contributed to the GNU project by Marco Bodrato.
-Copyright 1991, 1993-1995, 2000-2003, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2003, 2011, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#define FACTOR_LIST_STORE(P, PR, MAX_PR, VEC, I) \
@@ -60,7 +60,7 @@ mpz_fac_ui (mpz_ptr x, unsigned long n)
if (n < numberof (table))
{
- PTR (x)[0] = table[n];
+ MPZ_NEWALLOC (x, 1)[0] = table[n];
SIZ (x) = 1;
}
else if (BELOW_THRESHOLD (n, FAC_ODD_THRESHOLD))
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fdiv_q.c b/Build/source/libs/gmp/gmp-src/mpz/fdiv_q.c
index 5713b905b2a..f17023e10ce 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fdiv_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fdiv_q.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fdiv_q_ui.c b/Build/source/libs/gmp/gmp-src/mpz/fdiv_q_ui.c
index 7899992d049..539f95183b9 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fdiv_q_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fdiv_q_ui.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fdiv_qr.c b/Build/source/libs/gmp/gmp-src/mpz/fdiv_qr.c
index 36cfd367add..a0a6166dd62 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fdiv_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fdiv_qr.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fdiv_qr_ui.c b/Build/source/libs/gmp/gmp-src/mpz/fdiv_qr_ui.c
index c8435a423c4..984ca1c7291 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fdiv_qr_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fdiv_qr_ui.c
@@ -1,8 +1,8 @@
/* mpz_fdiv_qr_ui -- Division rounding the quotient towards -infinity.
The remainder gets the same sign as the denominator.
-Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012 Free Software Foundation,
-Inc.
+Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
@@ -62,8 +61,7 @@ mpz_fdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
mp_ptr rp;
mp_size_t rn;
- MPZ_REALLOC (rem, 2);
- rp = PTR(rem);
+ rp = MPZ_REALLOC (rem, 2);
if (nn == 1) /* tdiv_qr requirements; tested above for 0 */
{
@@ -107,7 +105,7 @@ mpz_fdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
rl = divisor - rl;
}
- PTR(rem)[0] = rl;
+ MPZ_NEWALLOC (rem, 1)[0] = rl;
SIZ(rem) = rl != 0;
}
qn = nn - (qp[nn - 1] == 0);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fdiv_r.c b/Build/source/libs/gmp/gmp-src/mpz/fdiv_r.c
index 35f2789b14c..c7a3c8ea846 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fdiv_r.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fdiv_r.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fdiv_r_ui.c b/Build/source/libs/gmp/gmp-src/mpz/fdiv_r_ui.c
index 98dd56c6f22..f2df8a85d0b 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fdiv_r_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fdiv_r_ui.c
@@ -1,8 +1,8 @@
/* mpz_fdiv_r_ui -- Division rounding the quotient towards -infinity.
The remainder gets the same sign as the denominator.
-Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 Free Software Foundation,
-Inc.
+Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
@@ -99,7 +98,7 @@ mpz_fdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
if (ns < 0)
rl = divisor - rl;
- PTR(rem)[0] = rl;
+ MPZ_NEWALLOC (rem, 1)[0] = rl;
SIZ(rem) = 1;
}
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fdiv_ui.c b/Build/source/libs/gmp/gmp-src/mpz/fdiv_ui.c
index 532ee2cbec5..f0aacdb65bd 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fdiv_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fdiv_ui.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fib2_ui.c b/Build/source/libs/gmp/gmp-src/mpz/fib2_ui.c
index ddf456f5802..ea2622711e0 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fib2_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fib2_ui.c
@@ -1,6 +1,6 @@
/* mpz_fib2_ui -- calculate Fibonacci numbers.
-Copyright 2001, 2012, 2014 Free Software Foundation, Inc.
+Copyright 2001, 2012, 2014, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -41,9 +40,9 @@ mpz_fib2_ui (mpz_ptr fn, mpz_ptr fnsub1, unsigned long n)
if (n <= FIB_TABLE_LIMIT)
{
- PTR(fn)[0] = FIB_TABLE (n);
+ MPZ_NEWALLOC (fn, 1)[0] = FIB_TABLE (n);
SIZ(fn) = (n != 0); /* F[0]==0, others are !=0 */
- PTR(fnsub1)[0] = FIB_TABLE ((int) n - 1);
+ MPZ_NEWALLOC (fnsub1, 1)[0] = FIB_TABLE ((int) n - 1);
SIZ(fnsub1) = (n != 1); /* F[1-1]==0, others are !=0 */
return;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fib_ui.c b/Build/source/libs/gmp/gmp-src/mpz/fib_ui.c
index f591c08501f..a65f3c9e7a2 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fib_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fib_ui.c
@@ -1,6 +1,6 @@
/* mpz_fib_ui -- calculate Fibonacci numbers.
-Copyright 2000-2002, 2005, 2012, 2014 Free Software Foundation, Inc.
+Copyright 2000-2002, 2005, 2012, 2014, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -65,7 +64,7 @@ mpz_fib_ui (mpz_ptr fn, unsigned long n)
if (n <= FIB_TABLE_LIMIT)
{
- PTR(fn)[0] = FIB_TABLE (n);
+ MPZ_NEWALLOC (fn, 1)[0] = FIB_TABLE (n);
SIZ(fn) = (n != 0); /* F[0]==0, others are !=0 */
return;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fits_s.h b/Build/source/libs/gmp/gmp-src/mpz/fits_s.h
index e7f21d1b2bd..9fd6a0b633e 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fits_s.h
+++ b/Build/source/libs/gmp/gmp-src/mpz/fits_s.h
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fits_uint.c b/Build/source/libs/gmp/gmp-src/mpz/fits_uint.c
index a37e291b6ed..6becc8bf99d 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fits_uint.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fits_uint.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_fits_uint_p 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fits_ulong.c b/Build/source/libs/gmp/gmp-src/mpz/fits_ulong.c
index fa40eb56710..c70886bbbca 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fits_ulong.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fits_ulong.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_fits_ulong_p 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/fits_ushort.c b/Build/source/libs/gmp/gmp-src/mpz/fits_ushort.c
index 7f6f907821b..16873d61d62 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/fits_ushort.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/fits_ushort.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_fits_ushort_p 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/gcd.c b/Build/source/libs/gmp/gmp-src/mpz/gcd.c
index 87c6a8f17b7..9557155f9ab 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/gcd.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/gcd.c
@@ -1,7 +1,7 @@
/* mpz/gcd.c: Calculate the greatest common divisor of two integers.
-Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2010 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2010, 2015, 2016
+Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -57,8 +56,8 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
SIZ (g) = vsize;
if (g == v)
return;
- MPZ_REALLOC (g, vsize);
- MPN_COPY (PTR (g), vp, vsize);
+ tp = MPZ_NEWALLOC (g, vsize);
+ MPN_COPY (tp, vp, vsize);
return;
}
@@ -68,34 +67,34 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
SIZ (g) = usize;
if (g == u)
return;
- MPZ_REALLOC (g, usize);
- MPN_COPY (PTR (g), up, usize);
+ tp = MPZ_NEWALLOC (g, usize);
+ MPN_COPY (tp, up, usize);
return;
}
if (usize == 1)
{
SIZ (g) = 1;
- PTR (g)[0] = mpn_gcd_1 (vp, vsize, up[0]);
+ MPZ_NEWALLOC (g, 1)[0] = mpn_gcd_1 (vp, vsize, up[0]);
return;
}
if (vsize == 1)
{
SIZ(g) = 1;
- PTR (g)[0] = mpn_gcd_1 (up, usize, vp[0]);
+ MPZ_NEWALLOC (g, 1)[0] = mpn_gcd_1 (up, usize, vp[0]);
return;
}
TMP_MARK;
/* Eliminate low zero bits from U and V and move to temporary storage. */
- while (*up == 0)
- up++;
- u_zero_limbs = up - PTR(u);
- usize -= u_zero_limbs;
- count_trailing_zeros (u_zero_bits, *up);
tp = up;
+ while (*tp == 0)
+ tp++;
+ u_zero_limbs = tp - up;
+ usize -= u_zero_limbs;
+ count_trailing_zeros (u_zero_bits, *tp);
up = TMP_ALLOC_LIMBS (usize);
if (u_zero_bits != 0)
{
@@ -105,12 +104,12 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
else
MPN_COPY (up, tp, usize);
- while (*vp == 0)
- vp++;
- v_zero_limbs = vp - PTR (v);
- vsize -= v_zero_limbs;
- count_trailing_zeros (v_zero_bits, *vp);
tp = vp;
+ while (*tp == 0)
+ tp++;
+ v_zero_limbs = tp - vp;
+ vsize -= v_zero_limbs;
+ count_trailing_zeros (v_zero_bits, *tp);
vp = TMP_ALLOC_LIMBS (vsize);
if (v_zero_bits != 0)
{
@@ -125,15 +124,13 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
g_zero_limbs = v_zero_limbs;
g_zero_bits = v_zero_bits;
}
- else if (u_zero_limbs < v_zero_limbs)
- {
- g_zero_limbs = u_zero_limbs;
- g_zero_bits = u_zero_bits;
- }
- else /* Equal. */
+ else
{
g_zero_limbs = u_zero_limbs;
- g_zero_bits = MIN (u_zero_bits, v_zero_bits);
+ if (u_zero_limbs < v_zero_limbs)
+ g_zero_bits = u_zero_bits;
+ else /* Equal. */
+ g_zero_bits = MIN (u_zero_bits, v_zero_bits);
}
/* Call mpn_gcd. The 2nd argument must not have more bits than the 1st. */
@@ -147,19 +144,19 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
{
mp_limb_t cy_limb;
gsize += (vp[vsize - 1] >> (GMP_NUMB_BITS - g_zero_bits)) != 0;
- MPZ_REALLOC (g, gsize);
- MPN_ZERO (PTR (g), g_zero_limbs);
+ tp = MPZ_NEWALLOC (g, gsize);
+ MPN_ZERO (tp, g_zero_limbs);
- tp = PTR(g) + g_zero_limbs;
+ tp = tp + g_zero_limbs;
cy_limb = mpn_lshift (tp, vp, vsize, g_zero_bits);
if (cy_limb != 0)
tp[vsize] = cy_limb;
}
else
{
- MPZ_REALLOC (g, gsize);
- MPN_ZERO (PTR (g), g_zero_limbs);
- MPN_COPY (PTR (g) + g_zero_limbs, vp, vsize);
+ tp = MPZ_NEWALLOC (g, gsize);
+ MPN_ZERO (tp, g_zero_limbs);
+ MPN_COPY (tp + g_zero_limbs, vp, vsize);
}
SIZ (g) = gsize;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/gcd_ui.c b/Build/source/libs/gmp/gmp-src/mpz/gcd_ui.c
index e26d03f64a9..ee5bff81c57 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/gcd_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/gcd_ui.c
@@ -1,6 +1,6 @@
/* mpz_gcd_ui -- Calculate the greatest common divisor of two integers.
-Copyright 1994, 1996, 1999-2004 Free Software Foundation, Inc.
+Copyright 1994, 1996, 1999-2004, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
unsigned long int
@@ -64,7 +63,7 @@ mpz_gcd_ui (mpz_ptr w, mpz_srcptr u, unsigned long int v)
{
if (u != w)
{
- MPZ_REALLOC (w, un);
+ MPZ_NEWALLOC (w, un);
MPN_COPY (PTR(w), PTR(u), un);
}
SIZ(w) = un;
@@ -78,7 +77,7 @@ mpz_gcd_ui (mpz_ptr w, mpz_srcptr u, unsigned long int v)
if (w != NULL)
{
- PTR(w)[0] = res;
+ MPZ_NEWALLOC (w, 1)[0] = res;
SIZ(w) = res != 0;
}
return res;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/gcdext.c b/Build/source/libs/gmp/gmp-src/mpz/gcdext.c
index 01b1f8379ae..b1f73c255c0 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/gcdext.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/gcdext.c
@@ -1,8 +1,8 @@
/* mpz_gcdext(g, s, t, a, b) -- Set G to gcd(a, b), and S and T such that
g = as + bt.
-Copyright 1991, 1993-1997, 2000, 2001, 2005, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1997, 2000, 2001, 2005, 2011, 2012, 2015 Free
+Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,7 +31,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -51,6 +50,8 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b)
asize = ABSIZ (a);
bsize = ABSIZ (b);
+ ASSERT (s != NULL);
+
if (asize < bsize)
{
MPZ_SRCPTR_SWAP (a, b);
@@ -63,28 +64,32 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b)
/* g = |a|, s = sgn(a), t = 0. */
ssize = SIZ (a) >= 0 ? (asize != 0) : -1;
- gp = MPZ_REALLOC (g, asize);
- MPN_COPY (gp, PTR (a), asize);
- SIZ (g) = asize;
-
+ if (g != NULL)
+ {
+ /* If g == a, then ALLOC(g) == ALLOC(a) >= asize, i.e.
+ the next MPZ_NEWALLOC returns the old PTR(a) .*/
+ gp = MPZ_NEWALLOC (g, asize);
+ MPN_COPY (gp, PTR (a), asize);
+ SIZ (g) = asize;
+ }
if (t != NULL)
SIZ (t) = 0;
if (s != NULL)
{
SIZ (s) = ssize;
- PTR (s)[0] = 1;
+ MPZ_NEWALLOC (s, 1)[0] = 1;
}
return;
}
TMP_MARK;
- TMP_ALLOC_LIMBS_2 (tmp_ap, asize, tmp_bp, bsize);
+ TMP_ALLOC_LIMBS_2 (tmp_gp, bsize, tmp_sp, asize + bsize + bsize + 1);
+ tmp_bp = tmp_sp + bsize + 1;
+ tmp_ap = tmp_bp + bsize;
MPN_COPY (tmp_ap, PTR (a), asize);
MPN_COPY (tmp_bp, PTR (b), bsize);
- TMP_ALLOC_LIMBS_2 (tmp_gp, bsize, tmp_sp, bsize + 1);
-
gsize = mpn_gcdext (tmp_gp, tmp_sp, &tmp_ssize, tmp_ap, asize, tmp_bp, bsize);
ssize = ABS (tmp_ssize);
@@ -93,17 +98,20 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b)
if (t != NULL)
{
mpz_t x;
- __mpz_struct gtmp, stmp;
+ mpz_t gtmp, stmp;
+
+ PTR (gtmp) = tmp_gp;
+ SIZ (gtmp) = gsize;
- PTR (&gtmp) = tmp_gp;
- SIZ (&gtmp) = gsize;
+ PTR (stmp) = tmp_sp;
+ SIZ (stmp) = tmp_ssize;
- PTR (&stmp) = tmp_sp;
- SIZ (&stmp) = tmp_ssize;
+ ASSERT (ssize <= bsize); /* ssize*2 + asize + 1 <= asize + bsize*2 + 1 */
+ PTR (x) = tmp_sp + ssize;
+ ALLOC (x) = ssize + asize + 1;
- MPZ_TMP_INIT (x, ssize + asize + 1);
- mpz_mul (x, &stmp, a);
- mpz_sub (x, &gtmp, x);
+ mpz_mul (x, stmp, a);
+ mpz_sub (x, gtmp, x);
mpz_divexact (t, x, b);
}
@@ -111,14 +119,17 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b)
{
mp_ptr sp;
- sp = MPZ_REALLOC (s, ssize);
+ sp = MPZ_NEWALLOC (s, ssize);
MPN_COPY (sp, tmp_sp, ssize);
SIZ (s) = tmp_ssize;
}
- gp = MPZ_REALLOC (g, gsize);
- MPN_COPY (gp, tmp_gp, gsize);
- SIZ (g) = gsize;
+ if (g != NULL)
+ {
+ gp = MPZ_NEWALLOC (g, gsize);
+ MPN_COPY (gp, tmp_gp, gsize);
+ SIZ (g) = gsize;
+ }
TMP_FREE;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/get_d.c b/Build/source/libs/gmp/gmp-src/mpz/get_d.c
index ac653c5ba01..61d4e3612ed 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/get_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/get_d.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
double
diff --git a/Build/source/libs/gmp/gmp-src/mpz/get_d_2exp.c b/Build/source/libs/gmp/gmp-src/mpz/get_d_2exp.c
index 96314851bf8..beb364a5f37 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/get_d_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/get_d_2exp.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/get_si.c b/Build/source/libs/gmp/gmp-src/mpz/get_si.c
index 6e9752636b2..c65be2e0ae8 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/get_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/get_si.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
signed long int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/get_str.c b/Build/source/libs/gmp/gmp-src/mpz/get_str.c
index 08c7cd73710..c00a9a33d19 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/get_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/get_str.c
@@ -4,8 +4,8 @@
result. If STRING is not NULL, the caller must ensure enough space is
available to store the result.
-Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2012, 2017 Free
+Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,7 +34,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <string.h> /* for strlen */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -50,26 +49,23 @@ mpz_get_str (char *res_str, int base, mpz_srcptr x)
int i;
TMP_DECL;
- if (base >= 0)
+ num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ if (base > 1)
{
- num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
- if (base <= 1)
- base = 10;
- else if (base > 36)
- {
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- if (base > 62)
- return NULL;
- }
+ if (base <= 36)
+ num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
+ else if (UNLIKELY (base > 62))
+ return NULL;
+ }
+ else if (base > -2)
+ {
+ base = 10;
}
else
{
base = -base;
- if (base <= 1)
- base = 10;
- else if (base > 36)
+ if (UNLIKELY (base > 36))
return NULL;
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
/* allocate string for the user if necessary */
@@ -78,7 +74,7 @@ mpz_get_str (char *res_str, int base, mpz_srcptr x)
/* digits, null terminator, possible minus sign */
MPN_SIZEINBASE (alloc_size, PTR(x), ABS(x_size), base);
alloc_size += 1 + (x_size<0);
- res_str = (char *) (*__gmp_allocate_func) (alloc_size);
+ res_str = __GMP_ALLOCATE_FUNC_TYPE (alloc_size, char);
}
return_str = res_str;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/get_ui.c b/Build/source/libs/gmp/gmp-src/mpz/get_ui.c
index ca97788b745..2d7ea4e61d4 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/get_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/get_ui.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_get_ui 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/getlimbn.c b/Build/source/libs/gmp/gmp-src/mpz/getlimbn.c
index c531f7e61f6..d34d764d647 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/getlimbn.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/getlimbn.c
@@ -30,5 +30,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_getlimbn 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/hamdist.c b/Build/source/libs/gmp/gmp-src/mpz/hamdist.c
index 146769c3945..1dfb7b88ff3 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/hamdist.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/hamdist.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/import.c b/Build/source/libs/gmp/gmp-src/mpz/import.c
index 9072830afee..e40b5ed5779 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/import.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/import.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/init.c b/Build/source/libs/gmp/gmp-src/mpz/init.c
index addbdbdedbd..b85a2da2585 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/init.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/init.c
@@ -1,6 +1,7 @@
/* mpz_init() -- Make a new multiple precision number with value 0.
-Copyright 1991, 1993-1995, 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2002, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,18 +29,13 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
-mpz_init (mpz_ptr x)
+mpz_init (mpz_ptr x) __GMP_NOTHROW
{
- ALLOC (x) = 1;
- PTR (x) = __GMP_ALLOCATE_FUNC_LIMBS (1);
+ static const mp_limb_t dummy_limb=0xc1a0;
+ ALLOC (x) = 0;
+ PTR (x) = (mp_ptr) &dummy_limb;
SIZ (x) = 0;
-
-#ifdef __CHECKER__
- /* let the low limb look initialized, for the benefit of mpz_get_ui etc */
- PTR (x)[0] = 0;
-#endif
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/init2.c b/Build/source/libs/gmp/gmp-src/mpz/init2.c
index b942e499d62..fcbaa66dbf5 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/init2.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/init2.c
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#include <stdlib.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -53,9 +52,4 @@ mpz_init2 (mpz_ptr x, mp_bitcnt_t bits)
PTR(x) = __GMP_ALLOCATE_FUNC_LIMBS (new_alloc);
ALLOC(x) = new_alloc;
SIZ(x) = 0;
-
-#ifdef __CHECKER__
- /* let the low limb look initialized, for the benefit of mpz_get_ui etc */
- PTR(x)[0] = 0;
-#endif
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/inits.c b/Build/source/libs/gmp/gmp-src/mpz/inits.c
index 68457e0fb29..1660744e665 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/inits.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/inits.c
@@ -29,29 +29,25 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdarg.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
-mpz_inits (mpz_ptr x, ...)
+mpz_inits (mpz_ptr x, ...) __GMP_NOTHROW
{
+ static const mp_limb_t dummy_limb=0xc1a0;
va_list ap;
va_start (ap, x);
- while (x != NULL)
+ do
{
- ALLOC (x) = 1;
- PTR (x) = __GMP_ALLOCATE_FUNC_LIMBS (1);
+ ALLOC (x) = 0;
+ PTR (x) = (mp_ptr) &dummy_limb;
SIZ (x) = 0;
-#ifdef __CHECKER__
- /* let the low limb look initialized, for the benefit of mpz_get_ui etc */
- PTR (x)[0] = 0;
-#endif
-
x = va_arg (ap, mpz_ptr);
}
+ while (x != NULL);
va_end (ap);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/inp_raw.c b/Build/source/libs/gmp/gmp-src/mpz/inp_raw.c
index b7994a3604b..378c42bb4e7 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/inp_raw.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/inp_raw.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/inp_str.c b/Build/source/libs/gmp/gmp-src/mpz/inp_str.c
index 474bc68435f..0756055be02 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/inp_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/inp_str.c
@@ -36,7 +36,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <ctype.h>
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -84,7 +83,7 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
/* For bases > 36, use the collating sequence
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. */
digit_value += 208;
- if (base > 62)
+ if (UNLIKELY (base > 62))
return 0; /* too large base */
}
@@ -132,7 +131,7 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
}
alloc_size = 100;
- str = (char *) (*__gmp_allocate_func) (alloc_size);
+ str = __GMP_ALLOCATE_FUNC_TYPE (alloc_size, char);
str_size = 0;
while (c != EOF)
@@ -145,7 +144,7 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
{
size_t old_alloc_size = alloc_size;
alloc_size = alloc_size * 3 / 2;
- str = (char *) (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size);
+ str = __GMP_REALLOCATE_FUNC_TYPE (str, old_alloc_size, alloc_size, char);
}
str[str_size++] = dig;
c = getc (stream);
@@ -163,7 +162,7 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
else
{
LIMBS_PER_DIGIT_IN_BASE (xsize, str_size, base);
- MPZ_REALLOC (x, xsize);
+ MPZ_NEWALLOC (x, xsize);
/* Convert the byte array in base BASE to our bignum format. */
xsize = mpn_set_str (PTR (x), (unsigned char *) str, str_size, base);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/invert.c b/Build/source/libs/gmp/gmp-src/mpz/invert.c
index 09cdd9a121a..5532d137c72 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/invert.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/invert.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/ior.c b/Build/source/libs/gmp/gmp-src/mpz/ior.c
index 5c181f04c4c..32f304278c9 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/ior.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/ior.c
@@ -1,7 +1,7 @@
/* mpz_ior -- Logical inclusive or.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2005, 2012, 2013 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2005, 2012, 2013,
+2015-2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -40,76 +39,49 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
mp_ptr res_ptr;
mp_size_t res_size;
mp_size_t i;
- TMP_DECL;
- TMP_MARK;
op1_size = SIZ(op1);
op2_size = SIZ(op2);
+ if (op1_size < op2_size)
+ {
+ MPZ_SRCPTR_SWAP (op1, op2);
+ MP_SIZE_T_SWAP (op1_size, op2_size);
+ }
+
op1_ptr = PTR(op1);
- op2_ptr = PTR(op2);
res_ptr = PTR(res);
- if (op1_size >= 0)
+ if (op2_size >= 0)
{
- if (op2_size >= 0)
- {
- if (op1_size >= op2_size)
- {
- if (ALLOC(res) < op1_size)
- {
- res_ptr = MPZ_REALLOC (res, op1_size);
- /* No overlapping possible: op1_ptr = PTR(op1); */
- op2_ptr = PTR(op2);
- }
-
- if (res_ptr != op1_ptr)
- MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size,
- op1_size - op2_size);
- if (LIKELY (op2_size != 0))
- mpn_ior_n (res_ptr, op1_ptr, op2_ptr, op2_size);
- res_size = op1_size;
- }
- else
- {
- if (ALLOC(res) < op2_size)
- {
- res_ptr = MPZ_REALLOC (res, op2_size);
- op1_ptr = PTR(op1);
- /* No overlapping possible: op2_ptr = PTR(op2); */
- }
-
- if (res_ptr != op2_ptr)
- MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
- op2_size - op1_size);
- if (LIKELY (op1_size != 0))
- mpn_ior_n (res_ptr, op1_ptr, op2_ptr, op1_size);
- res_size = op2_size;
- }
-
- SIZ(res) = res_size;
- return;
- }
- else /* op2_size < 0 */
+ if (res_ptr != op1_ptr)
{
- /* Fall through to the code at the end of the function. */
+ res_ptr = MPZ_REALLOC (res, op1_size);
+ /* No overlapping possible: op1_ptr = PTR(op1); */
+ MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size,
+ op1_size - op2_size);
}
+ if (LIKELY (op2_size != 0))
+ mpn_ior_n (res_ptr, op1_ptr, PTR(op2), op2_size);
+
+ SIZ(res) = op1_size;
}
else
{
- if (op2_size < 0)
+ mp_ptr opx;
+ TMP_DECL;
+
+ TMP_MARK;
+ if (op1_size < 0)
{
- mp_ptr opx, opy;
+ mp_ptr opy;
/* Both operands are negative, so will be the result.
-((-OP1) | (-OP2)) = -(~(OP1 - 1) | ~(OP2 - 1)) =
= ~(~(OP1 - 1) | ~(OP2 - 1)) + 1 =
= ((OP1 - 1) & (OP2 - 1)) + 1 */
- op1_size = -op1_size;
- op2_size = -op2_size;
-
- res_size = MIN (op1_size, op2_size);
+ res_size = -op1_size;
/* Possible optimization: Decrease mpn_sub precision,
as we won't use the entire res of both. */
@@ -117,19 +89,19 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
mpn_sub_1 (opx, op1_ptr, res_size, (mp_limb_t) 1);
op1_ptr = opx;
- mpn_sub_1 (opy, op2_ptr, res_size, (mp_limb_t) 1);
+ mpn_sub_1 (opy, PTR(op2), res_size, (mp_limb_t) 1);
op2_ptr = opy;
/* First loop finds the size of the result. */
- for (i = res_size - 1; i >= 0; i--)
+ for (i = res_size; --i >= 0;)
if ((op1_ptr[i] & op2_ptr[i]) != 0)
break;
res_size = i + 1;
+ res_ptr = MPZ_NEWALLOC (res, res_size + 1);
+
if (res_size != 0)
{
- res_ptr = MPZ_NEWALLOC (res, res_size + 1);
-
/* Second loop computes the real result. */
mpn_and_n (res_ptr, op1_ptr, op2_ptr, res_size);
@@ -144,87 +116,69 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
}
SIZ(res) = -res_size;
- TMP_FREE;
- return;
}
else
{
- /* We should compute -OP1 | OP2. Swap OP1 and OP2 and fall
- through to the code that handles OP1 | -OP2. */
- MPZ_SRCPTR_SWAP (op1, op2);
- MPN_SRCPTR_SWAP (op1_ptr,op1_size, op2_ptr,op2_size);
+ mp_limb_t cy;
+ mp_size_t count;
+
+ /* Operand 2 negative, so will be the result.
+ -(OP1 | (-OP2)) = -(OP1 | ~(OP2 - 1)) =
+ = ~(OP1 | ~(OP2 - 1)) + 1 =
+ = (~OP1 & (OP2 - 1)) + 1 */
+
+ op2_size = -op2_size;
+
+ res_ptr = MPZ_REALLOC (res, op2_size);
+ op1_ptr = PTR(op1);
+
+ opx = TMP_ALLOC_LIMBS (op2_size);
+ mpn_sub_1 (opx, PTR(op2), op2_size, (mp_limb_t) 1);
+ op2_ptr = opx;
+ op2_size -= op2_ptr[op2_size - 1] == 0;
+
+ if (op1_size >= op2_size)
+ {
+ /* We can just ignore the part of OP1 that stretches above OP2,
+ because the result limbs are zero there. */
+
+ /* First loop finds the size of the result. */
+ for (i = op2_size; --i >= 0;)
+ if ((~op1_ptr[i] & op2_ptr[i]) != 0)
+ break;
+ res_size = i + 1;
+ count = res_size;
+ }
+ else
+ {
+ res_size = op2_size;
+
+ /* Copy the part of OP2 that stretches above OP1, to RES. */
+ MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size, op2_size - op1_size);
+ count = op1_size;
+ }
+
+ if (res_size != 0)
+ {
+ /* Second loop computes the real result. */
+ if (LIKELY (count != 0))
+ mpn_andn_n (res_ptr, op2_ptr, op1_ptr, count);
+
+ cy = mpn_add_1 (res_ptr, res_ptr, res_size, (mp_limb_t) 1);
+ if (cy)
+ {
+ res_ptr[res_size] = cy;
+ ++res_size;
+ }
+ }
+ else
+ {
+ res_ptr[0] = 1;
+ res_size = 1;
+ }
+
+ SIZ(res) = -res_size;
}
+ TMP_FREE;
}
-
- {
- mp_ptr opx;
- mp_limb_t cy;
- mp_size_t res_alloc;
- mp_size_t count;
-
- /* Operand 2 negative, so will be the result.
- -(OP1 | (-OP2)) = -(OP1 | ~(OP2 - 1)) =
- = ~(OP1 | ~(OP2 - 1)) + 1 =
- = (~OP1 & (OP2 - 1)) + 1 */
-
- op2_size = -op2_size;
-
- res_alloc = op2_size;
-
- opx = TMP_ALLOC_LIMBS (op2_size);
- mpn_sub_1 (opx, op2_ptr, op2_size, (mp_limb_t) 1);
- op2_ptr = opx;
- op2_size -= op2_ptr[op2_size - 1] == 0;
-
- if (ALLOC(res) < res_alloc)
- {
- _mpz_realloc (res, res_alloc);
- op1_ptr = PTR(op1);
- /* op2_ptr points to temporary space. */
- res_ptr = PTR(res);
- }
-
- if (op1_size >= op2_size)
- {
- /* We can just ignore the part of OP1 that stretches above OP2,
- because the result limbs are zero there. */
-
- /* First loop finds the size of the result. */
- for (i = op2_size - 1; i >= 0; i--)
- if ((~op1_ptr[i] & op2_ptr[i]) != 0)
- break;
- res_size = i + 1;
- count = res_size;
- }
- else
- {
- res_size = op2_size;
-
- /* Copy the part of OP2 that stretches above OP1, to RES. */
- MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size, op2_size - op1_size);
- count = op1_size;
- }
-
- if (res_size != 0)
- {
- /* Second loop computes the real result. */
- if (LIKELY (count != 0))
- mpn_andn_n (res_ptr, op2_ptr, op1_ptr, count);
-
- cy = mpn_add_1 (res_ptr, res_ptr, res_size, (mp_limb_t) 1);
- if (cy)
- {
- res_ptr[res_size] = cy;
- res_size++;
- }
- }
- else
- {
- res_ptr[0] = 1;
- res_size = 1;
- }
-
- SIZ(res) = -res_size;
- }
- TMP_FREE;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/iset.c b/Build/source/libs/gmp/gmp-src/mpz/iset.c
index 0fd6e8f9dd8..252cada2978 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/iset.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/iset.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -43,17 +42,11 @@ mpz_init_set (mpz_ptr w, mpz_srcptr u)
size = ABS (usize);
ALLOC (w) = MAX (size, 1);
- PTR (w) = __GMP_ALLOCATE_FUNC_LIMBS (ALLOC (w));
+ wp = __GMP_ALLOCATE_FUNC_LIMBS (ALLOC (w));
- wp = PTR (w);
+ PTR (w) = wp;
up = PTR (u);
MPN_COPY (wp, up, size);
SIZ (w) = usize;
-
-#ifdef __CHECKER__
- /* let the low limb look initialized, for the benefit of mpz_get_ui etc */
- if (size == 0)
- wp[0] = 0;
-#endif
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/iset_d.c b/Build/source/libs/gmp/gmp-src/mpz/iset_d.c
index 2c5b23ab9c9..5d04a6fd9e6 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/iset_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/iset_d.c
@@ -1,7 +1,7 @@
/* mpz_init_set_d(integer, val) -- Initialize and assign INTEGER with a double
value VAL.
-Copyright 1996, 2000, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1996, 2000, 2001, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,14 +29,15 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
mpz_init_set_d (mpz_ptr dest, double val)
{
- ALLOC (dest) = 1;
- PTR (dest) = __GMP_ALLOCATE_FUNC_LIMBS (1);
+ static const mp_limb_t dummy_limb=0xc1a0;
+
+ ALLOC (dest) = 0;
SIZ (dest) = 0;
+ PTR (dest) = (mp_ptr) &dummy_limb;
mpz_set_d (dest, val);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/iset_si.c b/Build/source/libs/gmp/gmp-src/mpz/iset_si.c
index 0844972280f..7179cb0ad12 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/iset_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/iset_si.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/iset_str.c b/Build/source/libs/gmp/gmp-src/mpz/iset_str.c
index 47798dd68b0..2df12f9a014 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/iset_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/iset_str.c
@@ -31,22 +31,17 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
mpz_init_set_str (mpz_ptr x, const char *str, int base)
{
- ALLOC (x) = 1;
- PTR (x) = __GMP_ALLOCATE_FUNC_LIMBS (1);
+ static const mp_limb_t dummy_limb=0xc1a0;
+ ALLOC (x) = 0;
+ PTR (x) = (mp_ptr) &dummy_limb;
/* if str has no digits mpz_set_str leaves x->_mp_size unset */
SIZ (x) = 0;
-#ifdef __CHECKER__
- /* let the low limb look initialized, for the benefit of mpz_get_ui etc */
- PTR (x)[0] = 0;
-#endif
-
return mpz_set_str (x, str, base);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/iset_ui.c b/Build/source/libs/gmp/gmp-src/mpz/iset_ui.c
index 55da84fcd44..22a8e151cbb 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/iset_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/iset_ui.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/jacobi.c b/Build/source/libs/gmp/gmp-src/mpz/jacobi.c
index 397fe11c9bb..cd556d78446 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/jacobi.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/jacobi.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/kronsz.c b/Build/source/libs/gmp/gmp-src/mpz/kronsz.c
index 1fb6e075b63..92cc971fedb 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/kronsz.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/kronsz.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/kronuz.c b/Build/source/libs/gmp/gmp-src/mpz/kronuz.c
index ca88250de59..ba5c6dd3137 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/kronuz.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/kronuz.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/kronzs.c b/Build/source/libs/gmp/gmp-src/mpz/kronzs.c
index 695cd0f283e..1f63f15bd2c 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/kronzs.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/kronzs.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/kronzu.c b/Build/source/libs/gmp/gmp-src/mpz/kronzu.c
index f57f92e8ba1..b4fbf791d8f 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/kronzu.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/kronzu.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/lcm.c b/Build/source/libs/gmp/gmp-src/mpz/lcm.c
index 805f6710775..2807ef7eb6b 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/lcm.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/lcm.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/lcm_ui.c b/Build/source/libs/gmp/gmp-src/mpz/lcm_ui.c
index 362d183b428..1f199b71ac5 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/lcm_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/lcm_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/limbs_finish.c b/Build/source/libs/gmp/gmp-src/mpz/limbs_finish.c
index ebf6dea2907..a02839d5cec 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/limbs_finish.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/limbs_finish.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/limbs_modify.c b/Build/source/libs/gmp/gmp-src/mpz/limbs_modify.c
index bafd7d88a0e..a778b6e6c9f 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/limbs_modify.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/limbs_modify.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mp_ptr
diff --git a/Build/source/libs/gmp/gmp-src/mpz/limbs_read.c b/Build/source/libs/gmp/gmp-src/mpz/limbs_read.c
index 6c14f18d459..705f0c1e187 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/limbs_read.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/limbs_read.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mp_srcptr
diff --git a/Build/source/libs/gmp/gmp-src/mpz/limbs_write.c b/Build/source/libs/gmp/gmp-src/mpz/limbs_write.c
index 605cb5e3a36..b116ad05dd3 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/limbs_write.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/limbs_write.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mp_ptr
diff --git a/Build/source/libs/gmp/gmp-src/mpz/lucmod.c b/Build/source/libs/gmp/gmp-src/mpz/lucmod.c
new file mode 100644
index 00000000000..0dad48cb09f
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpz/lucmod.c
@@ -0,0 +1,127 @@
+/* mpz_lucas_mod -- Helper function for the strong Lucas
+ primality test.
+
+ THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
+ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
+ FUTURE GNU MP RELEASES.
+
+Copyright 2018 Free Software Foundation, Inc.
+
+Contributed by Marco Bodrato.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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 "gmp-impl.h"
+
+/* Computes V_{k+1}, Q^{k+1} (mod n) for the Lucas' sequence */
+/* with P=1, Q=Q; k = n>>b0. */
+/* Requires n > 4; b0 > 0; -2*Q must not overflow a long. */
+/* If U_{k+1}==0 (mod n) or V_{k+1}==0 (mod n), it returns 1, */
+/* otherwise it returns 0 and sets V=V_{k+1} and Qk=Q^{k+1}. */
+/* V will never grow beyond SIZ(n), Qk not beyond 2*SIZ(n). */
+int
+mpz_lucas_mod (mpz_ptr V, mpz_ptr Qk, long Q,
+ mp_bitcnt_t b0, mpz_srcptr n, mpz_ptr T1, mpz_ptr T2)
+{
+ mp_bitcnt_t bs;
+ int res;
+
+ ASSERT (b0 > 0);
+ ASSERT (SIZ (n) > 1 || SIZ (n) > 0 && PTR (n) [0] > 4);
+
+ mpz_set_ui (V, 1); /* U1 = 1 */
+ bs = mpz_sizeinbase (n, 2) - 2;
+ if (UNLIKELY (bs < b0))
+ {
+ /* n = 2^b0 - 1, should we use Lucas-Lehmer instead? */
+ ASSERT (bs == b0 - 2);
+ mpz_set_si (Qk, Q);
+ return 0;
+ }
+ mpz_set_ui (Qk, 1); /* U2 = 1 */
+
+ do
+ {
+ /* We use the iteration suggested in "Elementary Number Theory" */
+ /* by Peter Hackman (November 1, 2009), section "L.XVII Scalar */
+ /* Formulas", from http://hackmat.se/kurser/TATM54/booktot.pdf */
+ /* U_{2k} = 2*U_{k+1}*U_k - P*U_k^2 */
+ /* U_{2k+1} = U_{k+1}^2 - Q*U_k^2 */
+ /* U_{2k+2} = P*U_{k+1}^2 - 2*Q*U_{k+1}*U_k */
+ /* We note that U_{2k+2} = P*U_{2k+1} - Q*U_{2k} */
+ /* The formulas are specialized for P=1, and only squares: */
+ /* U_{2k} = U_{k+1}^2 - |U_{k+1} - U_k|^2 */
+ /* U_{2k+1} = U_{k+1}^2 - Q*U_k^2 */
+ /* U_{2k+2} = U_{2k+1} - Q*U_{2k} */
+ mpz_mul (T1, Qk, Qk); /* U_{k+1}^2 */
+ mpz_sub (Qk, V, Qk); /* |U_{k+1} - U_k| */
+ mpz_mul (T2, Qk, Qk); /* |U_{k+1} - U_k|^2 */
+ mpz_mul (Qk, V, V); /* U_k^2 */
+ mpz_sub (T2, T1, T2); /* U_{k+1}^2 - (U_{k+1} - U_k)^2 */
+ if (Q > 0) /* U_{k+1}^2 - Q U_k^2 = U_{2k+1} */
+ mpz_submul_ui (T1, Qk, Q);
+ else
+ mpz_addmul_ui (T1, Qk, NEG_CAST (unsigned long, Q));
+
+ /* A step k->k+1 is performed if the bit in $n$ is 1 */
+ if (mpz_tstbit (n, bs))
+ {
+ /* U_{2k+2} = U_{2k+1} - Q*U_{2k} */
+ mpz_mul_si (T2, T2, Q);
+ mpz_sub (T2, T1, T2);
+ mpz_swap (T1, T2);
+ }
+ mpz_tdiv_r (Qk, T1, n);
+ mpz_tdiv_r (V, T2, n);
+ } while (--bs >= b0);
+
+ res = SIZ (Qk) == 0;
+ if (!res) {
+ mpz_mul_si (T1, V, -2*Q);
+ mpz_add (T1, Qk, T1); /* V_k = U_k - 2Q*U_{k-1} */
+ mpz_tdiv_r (V, T1, n);
+ res = SIZ (V) == 0;
+ if (!res && b0 > 1) {
+ /* V_k and Q^k will be needed for further check, compute them. */
+ /* FIXME: Here we compute V_k^2 and store V_k, but the former */
+ /* will be recomputed by the calling function, shoul we store */
+ /* that instead? */
+ mpz_mul (T2, T1, T1); /* V_k^2 */
+ mpz_mul (T1, Qk, Qk); /* P^2 U_k^2 = U_k^2 */
+ mpz_sub (T2, T2, T1);
+ ASSERT (SIZ (T2) == 0 || PTR (T2) [0] % 4 == 0);
+ mpz_tdiv_q_2exp (T2, T2, 2); /* (V_k^2 - P^2 U_k^2) / 4 */
+ if (Q > 0) /* (V_k^2 - (P^2 -4Q) U_k^2) / 4 = Q^k */
+ mpz_addmul_ui (T2, T1, Q);
+ else
+ mpz_submul_ui (T2, T1, NEG_CAST (unsigned long, Q));
+ mpz_tdiv_r (Qk, T2, n);
+ }
+ }
+
+ return res;
+}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/lucnum2_ui.c b/Build/source/libs/gmp/gmp-src/mpz/lucnum2_ui.c
index f8e4fb356f0..3cc3d7b758d 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/lucnum2_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/lucnum2_ui.c
@@ -1,6 +1,7 @@
/* mpz_lucnum2_ui -- calculate Lucas numbers.
-Copyright 2001, 2003, 2005, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2003, 2005, 2012, 2015, 2016, 2018 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +30,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -50,11 +50,11 @@ mpz_lucnum2_ui (mpz_ptr ln, mpz_ptr lnsub1, unsigned long n)
mp_limb_t f1 = FIB_TABLE ((int) n - 1);
/* L[n] = F[n] + 2F[n-1] */
- PTR(ln)[0] = f + 2*f1;
+ MPZ_NEWALLOC (ln, 1)[0] = f + 2*f1;
SIZ(ln) = 1;
/* L[n-1] = 2F[n] - F[n-1], but allow for L[-1]=-1 */
- PTR(lnsub1)[0] = (n == 0 ? 1 : 2*f - f1);
+ MPZ_NEWALLOC (lnsub1, 1)[0] = (n == 0 ? 1 : 2*f - f1);
SIZ(lnsub1) = (n == 0 ? -1 : 1);
return;
@@ -64,8 +64,8 @@ mpz_lucnum2_ui (mpz_ptr ln, mpz_ptr lnsub1, unsigned long n)
size = MPN_FIB2_SIZE (n);
f1p = TMP_ALLOC_LIMBS (size);
- lp = MPZ_REALLOC (ln, size+1);
- l1p = MPZ_REALLOC (lnsub1, size+1);
+ lp = MPZ_NEWALLOC (ln, size+1);
+ l1p = MPZ_NEWALLOC (lnsub1, size+1);
size = mpn_fib2_ui (l1p, f1p, n);
@@ -80,8 +80,12 @@ mpz_lucnum2_ui (mpz_ptr ln, mpz_ptr lnsub1, unsigned long n)
SIZ(ln) = size + (c != 0);
/* L[n-1] = 2F[n] - F[n-1] */
+#if HAVE_NATIVE_mpn_rsblsh1_n
+ c = mpn_rsblsh1_n (l1p, f1p, l1p, size);
+#else
c = mpn_lshift (l1p, l1p, size, 1);
c -= mpn_sub_n (l1p, l1p, f1p, size);
+#endif
ASSERT ((mp_limb_signed_t) c >= 0);
l1p[size] = c;
SIZ(lnsub1) = size + (c != 0);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/lucnum_ui.c b/Build/source/libs/gmp/gmp-src/mpz/lucnum_ui.c
index d1fe6b54cef..4213bb790c9 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/lucnum_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/lucnum_ui.c
@@ -1,6 +1,6 @@
/* mpz_lucnum_ui -- calculate Lucas number.
-Copyright 2001, 2003, 2005, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2003, 2005, 2011, 2012, 2015, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -68,7 +67,7 @@ mpz_lucnum_ui (mpz_ptr ln, unsigned long n)
if (n <= FIB_TABLE_LUCNUM_LIMIT)
{
/* L[n] = F[n] + 2F[n-1] */
- PTR(ln)[0] = FIB_TABLE(n) + 2 * FIB_TABLE ((int) n - 1);
+ MPZ_NEWALLOC (ln, 1)[0] = FIB_TABLE(n) + 2 * FIB_TABLE ((int) n - 1);
SIZ(ln) = 1;
return;
}
@@ -77,7 +76,7 @@ mpz_lucnum_ui (mpz_ptr ln, unsigned long n)
since square or mul used below might need an extra limb over the true
size */
lalloc = MPN_FIB2_SIZE (n) + 2;
- lp = MPZ_REALLOC (ln, lalloc);
+ lp = MPZ_NEWALLOC (ln, lalloc);
TMP_MARK;
xalloc = lalloc;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/mfac_uiui.c b/Build/source/libs/gmp/gmp-src/mpz/mfac_uiui.c
index 3ea36bce9d2..8595a9bc3b6 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/mfac_uiui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/mfac_uiui.c
@@ -2,7 +2,7 @@
Contributed to the GNU project by Marco Bodrato.
-Copyright 2012, 2013 Free Software Foundation, Inc.
+Copyright 2012, 2013, 2015, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/*************************************************************/
@@ -59,9 +58,9 @@ mpz_mfac_uiui (mpz_ptr x, unsigned long n, unsigned long m)
ASSERT (m != 0);
if ((n < 3) | (n - 3 < m - 1)) { /* (n < 3 || n - 1 <= m || m == 0) */
- PTR (x)[0] = n + (n == 0);
+ MPZ_NEWALLOC (x, 1)[0] = n + (n == 0);
SIZ (x) = 1;
- } else { /* m < n - 1 < GMP_NUMB_MAX */
+ } else { /* 0 < m < n - 1 < GMP_NUMB_MAX */
mp_limb_t g, sn;
mpz_t t;
@@ -94,7 +93,8 @@ mpz_mfac_uiui (mpz_ptr x, unsigned long n, unsigned long m)
}
} else { /* m >= 3, gcd(n,m) = 1 */
mp_limb_t *factors;
- mp_limb_t prod, max_prod, j;
+ mp_limb_t prod, max_prod;
+ mp_size_t j;
TMP_DECL;
sn = n / m + 1;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/millerrabin.c b/Build/source/libs/gmp/gmp-src/mpz/millerrabin.c
index 1dab971c1ab..1f5d482605b 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/millerrabin.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/millerrabin.c
@@ -5,12 +5,22 @@
reps is the number of internal passes of the probabilistic algorithm. Knuth
indicates that 25 passes are reasonable.
+ 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,
+ for smaller values no MR-test is performed, regardless of reps, and
+ 2 ("surely prime") is returned if the number was not proved composite.
+
+ If GMP_BPSW_NOFALSEPOSITIVES_UPTO_64BITS is defined as non-zero,
+ the code assumes that the Baillie-PSW test was checked up to 2^64.
+
THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 1991, 1993, 1994, 1996-2002, 2005, 2014 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996-2002, 2005, 2014, 2018, 2019 Free
+Software Foundation, Inc.
Contributed by John Amanatides.
@@ -40,83 +50,167 @@ 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 "gmp.h"
#include "gmp-impl.h"
-static int millerrabin (mpz_srcptr, mpz_srcptr,
+#ifndef GMP_BPSW_NOFALSEPOSITIVES_UPTO_64BITS
+#define GMP_BPSW_NOFALSEPOSITIVES_UPTO_64BITS 0
+#endif
+
+static int millerrabin (mpz_srcptr,
mpz_ptr, mpz_ptr,
mpz_srcptr, unsigned long int);
int
mpz_millerrabin (mpz_srcptr n, int reps)
{
- int r;
- mpz_t nm1, nm3, x, y, q;
+ mpz_t nm, x, y, q;
unsigned long int k;
gmp_randstate_t rstate;
int is_prime;
TMP_DECL;
TMP_MARK;
- MPZ_TMP_INIT (nm1, SIZ (n) + 1);
- mpz_sub_ui (nm1, n, 1L);
+ ASSERT (SIZ (n) > 0);
+ MPZ_TMP_INIT (nm, SIZ (n) + 1);
+ mpz_tdiv_q_2exp (nm, n, 1);
MPZ_TMP_INIT (x, SIZ (n) + 1);
MPZ_TMP_INIT (y, 2 * SIZ (n)); /* mpz_powm_ui needs excessive memory!!! */
+ MPZ_TMP_INIT (q, SIZ (n));
- /* Perform a Fermat test. */
- mpz_set_ui (x, 210L);
- mpz_powm (y, x, nm1, n);
- if (mpz_cmp_ui (y, 1L) != 0)
+ /* Find q and k, where q is odd and n = 1 + 2**k * q. */
+ k = mpz_scan1 (nm, 0L);
+ mpz_tdiv_q_2exp (q, nm, k);
+ ++k;
+
+ /* BPSW test */
+ mpz_set_ui (x, 2);
+ is_prime = millerrabin (n, x, y, q, k) && mpz_stronglucas (n, x, y);
+
+ if (is_prime)
{
- TMP_FREE;
- return 0;
+ if (
+#if GMP_BPSW_NOFALSEPOSITIVES_UPTO_64BITS
+ /* Consider numbers up to 2^64 that pass the BPSW test as primes. */
+#if GMP_NUMB_BITS <= 64
+ SIZ (n) <= 64 / GMP_NUMB_BITS
+#else
+ 0
+#endif
+#if 64 % GMP_NUMB_BITS != 0
+ || 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)
+#define GMP_BPSW_BITS_LIMIT (46 + GMP_BPSW_BITS_CONST)
+
+#define GMP_BPSW_LIMBS_LIMIT (GMP_BPSW_BITS_LIMIT / GMP_NUMB_BITS)
+#define GMP_BPSW_BITS_MOD (GMP_BPSW_BITS_LIMIT % GMP_NUMB_BITS)
+
+#if GMP_NUMB_BITS <= GMP_BPSW_BITS_LIMIT
+ SIZ (n) <= GMP_BPSW_LIMBS_LIMIT
+#else
+ 0
+#endif
+#if GMP_BPSW_BITS_MOD >= GMP_BPSW_BITS_CONST
+ || SIZ (n) - GMP_BPSW_LIMBS_LIMIT == (PTR (n) [GMP_BPSW_LIMBS_LIMIT] < GMP_BPSW_LIMB_CONST << (GMP_BPSW_BITS_MOD - GMP_BPSW_BITS_CONST))
+#else
+#if GMP_BPSW_BITS_MOD != 0
+ || SIZ (n) - GMP_BPSW_LIMBS_LIMIT == (PTR (n) [GMP_BPSW_LIMBS_LIMIT] < GMP_BPSW_LIMB_CONST >> (GMP_BPSW_BITS_CONST - GMP_BPSW_BITS_MOD))
+#else
+#if GMP_NUMB_BITS > GMP_BPSW_BITS_CONST
+ || SIZ (nm) - GMP_BPSW_LIMBS_LIMIT + 1 == (PTR (nm) [GMP_BPSW_LIMBS_LIMIT - 1] < GMP_BPSW_LIMB_CONST << (GMP_NUMB_BITS - 1 - GMP_BPSW_BITS_CONST))
+#endif
+#endif
+#endif
+
+#undef GMP_BPSW_BITS_LIMIT
+#undef GMP_BPSW_LIMB_CONST
+#undef GMP_BPSW_BITS_CONST
+#undef GMP_BPSW_LIMBS_LIMIT
+#undef GMP_BPSW_BITS_MOD
+
+#endif
+ )
+ is_prime = 2;
+ else
+ {
+ reps -= 24;
+ if (reps > 0)
+ {
+ /* (n-5)/2 */
+ mpz_sub_ui (nm, nm, 2L);
+ ASSERT (mpz_cmp_ui (nm, 1L) >= 0);
+
+ gmp_randinit_default (rstate);
+
+ do
+ {
+ /* 3 to (n-1)/2 inclusive, don't want 1, 0 or 2 */
+ mpz_urandomm (x, rstate, nm);
+ mpz_add_ui (x, x, 3L);
+
+ is_prime = millerrabin (n, x, y, q, k);
+ } while (--reps > 0 && is_prime);
+
+ gmp_randclear (rstate);
+ }
+ }
}
+ TMP_FREE;
+ return is_prime;
+}
- MPZ_TMP_INIT (q, SIZ (n));
-
- /* Find q and k, where q is odd and n = 1 + 2**k * q. */
- k = mpz_scan1 (nm1, 0L);
- mpz_tdiv_q_2exp (q, nm1, k);
+static int
+mod_eq_m1 (mpz_srcptr x, mpz_srcptr m)
+{
+ mp_size_t ms;
+ mp_srcptr mp, xp;
- /* n-3 */
- MPZ_TMP_INIT (nm3, SIZ (n) + 1);
- mpz_sub_ui (nm3, n, 3L);
- ASSERT (mpz_cmp_ui (nm3, 1L) >= 0);
+ ms = SIZ (m);
+ if (SIZ (x) != ms)
+ return 0;
+ ASSERT (ms > 0);
- gmp_randinit_default (rstate);
+ mp = PTR (m);
+ xp = PTR (x);
+ ASSERT ((mp[0] - 1) == (mp[0] ^ 1)); /* n is odd */
- is_prime = 1;
- for (r = 0; r < reps && is_prime; r++)
+ if ((*xp ^ CNST_LIMB(1) ^ *mp) != CNST_LIMB(0)) /* xp[0] != mp[0] - 1 */
+ return 0;
+ else
{
- /* 2 to n-2 inclusive, don't want 1, 0 or -1 */
- mpz_urandomm (x, rstate, nm3);
- mpz_add_ui (x, x, 2L);
+ int cmp;
- is_prime = millerrabin (n, nm1, x, y, q, k);
- }
+ --ms;
+ ++xp;
+ ++mp;
- gmp_randclear (rstate);
+ MPN_CMP (cmp, xp, mp, ms);
- TMP_FREE;
- return is_prime;
+ return cmp == 0;
+ }
}
static int
-millerrabin (mpz_srcptr n, mpz_srcptr nm1, mpz_ptr x, mpz_ptr y,
+millerrabin (mpz_srcptr n, mpz_ptr x, mpz_ptr y,
mpz_srcptr q, unsigned long int k)
{
unsigned long int i;
mpz_powm (y, x, q, n);
- if (mpz_cmp_ui (y, 1L) == 0 || mpz_cmp (y, nm1) == 0)
+ if (mpz_cmp_ui (y, 1L) == 0 || mod_eq_m1 (y, n))
return 1;
for (i = 1; i < k; i++)
{
mpz_powm_ui (y, y, 2L, n);
- if (mpz_cmp (y, nm1) == 0)
+ if (mod_eq_m1 (y, n))
return 1;
/* y == 1 means that the previous y was a non-trivial square root
of 1 (mod n). y == 0 means that n is a power of the base.
diff --git a/Build/source/libs/gmp/gmp-src/mpz/mod.c b/Build/source/libs/gmp/gmp-src/mpz/mod.c
index f2de0f97831..ab5cdb16df5 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/mod.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/mod.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/mul.c b/Build/source/libs/gmp/gmp-src/mpz/mul.c
index c4389158e29..d72c93e177d 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/mul.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/mul.c
@@ -1,7 +1,7 @@
/* mpz_mul -- Multiply two integers.
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2009, 2011, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2009, 2011, 2012,
+2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
@@ -104,13 +103,14 @@ mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
wsize = usize + vsize;
if (ALLOC (w) < wsize)
{
- 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 (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);
ALLOC (w) = wsize;
wp = __GMP_ALLOCATE_FUNC_LIMBS (wsize);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/mul_2exp.c b/Build/source/libs/gmp/gmp-src/mpz/mul_2exp.c
index f02fef7ee23..6144d0d19d1 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/mul_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/mul_2exp.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/mul_i.h b/Build/source/libs/gmp/gmp-src/mpz/mul_i.h
index 486a8fd63e6..65c9c2ffc3d 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/mul_i.h
+++ b/Build/source/libs/gmp/gmp-src/mpz/mul_i.h
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -97,7 +96,7 @@ FUNCTION (mpz_ptr prod, mpz_srcptr mult,
tp[size + 1] = cy;
size += 2;
MPN_NORMALIZE_NOT_ZERO (tp, size); /* too general, need to trim one or two limb */
- pp = MPZ_REALLOC (prod, size);
+ pp = MPZ_NEWALLOC (prod, size);
MPN_COPY (pp, tp, size);
TMP_FREE;
}
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 6c3febe2375..cf293f5405f 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 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2005, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +32,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -183,7 +182,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
/* b^0 == 1, including 0^0 == 1 */
if (e == 0)
{
- PTR(r)[0] = 1;
+ MPZ_NEWALLOC (r, 1)[0] = 1;
SIZ(r) = 1;
return;
}
@@ -372,7 +371,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
ralloc = (bsize*GMP_NUMB_BITS - cnt + GMP_NAIL_BITS) * e / GMP_NUMB_BITS + 5;
TRACE (printf ("ralloc %ld, from bsize=%ld blimb=0x%lX cnt=%d\n",
ralloc, bsize, blimb, cnt));
- rp = MPZ_REALLOC (r, ralloc + rtwos_limbs);
+ rp = MPZ_NEWALLOC (r, ralloc + rtwos_limbs);
/* Low zero limbs resulting from powers of 2. */
MPN_ZERO (rp, rtwos_limbs);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/neg.c b/Build/source/libs/gmp/gmp-src/mpz/neg.c
index eb46ab7f785..7f3fbcfa271 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/neg.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/neg.c
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_neg 1
-#include "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/nextprime.c b/Build/source/libs/gmp/gmp-src/mpz/nextprime.c
index 1493054695c..1a0b5b6b0b4 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/nextprime.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/nextprime.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -81,7 +80,7 @@ mpz_nextprime (mpz_ptr p, mpz_srcptr n)
TMP_SMARK;
/* Compute residues modulo small odd primes */
- moduli = TMP_SALLOC_TYPE (prime_limit * sizeof moduli[0], unsigned short);
+ moduli = TMP_SALLOC_TYPE (prime_limit, unsigned short);
for (;;)
{
@@ -89,7 +88,7 @@ mpz_nextprime (mpz_ptr p, mpz_srcptr n)
prime = 3;
for (i = 0; i < prime_limit; i++)
{
- moduli[i] = mpz_fdiv_ui (p, prime);
+ moduli[i] = mpz_tdiv_ui (p, prime);
prime += primegap[i];
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/oddfac_1.c b/Build/source/libs/gmp/gmp-src/mpz/oddfac_1.c
index cf0bff06505..9c99d1e494d 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/oddfac_1.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/oddfac_1.c
@@ -7,7 +7,7 @@ IT IS ONLY 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 2010-2012 Free Software Foundation, Inc.
+Copyright 2010-2012, 2015-2017 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -69,7 +68,8 @@ see https://www.gnu.org/licenses/. */
++__i; \
if (((sieve)[__index] & __mask) == 0) \
{ \
- (prime) = id_to_n(__i)
+ mp_limb_t prime; \
+ prime = id_to_n(__i)
#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
do { \
@@ -86,7 +86,7 @@ see https://www.gnu.org/licenses/. */
} \
__mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
__index += __mask & 1; \
- } while (__i <= __max_i) \
+ } while (__i <= __max_i)
#define LOOP_ON_SIEVE_END \
LOOP_ON_SIEVE_STOP; \
@@ -115,20 +115,24 @@ primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
#endif
/*********************************************************/
-/* Section mswing: 2-multiswing factorial */
+/* Section mswing: 2-multiswing factorial */
/*********************************************************/
-/* Returns an approximation of the sqare root of x. *
- * It gives: x <= limb_apprsqrt (x) ^ 2 < x * 9/4 */
+/* Returns an approximation of the sqare root of x.
+ * It gives:
+ * limb_apprsqrt (x) ^ 2 <= x < (limb_apprsqrt (x)+1) ^ 2
+ * or
+ * x <= limb_apprsqrt (x) ^ 2 <= x * 9/8
+ */
static mp_limb_t
limb_apprsqrt (mp_limb_t x)
{
int s;
ASSERT (x > 2);
- count_leading_zeros (s, x - 1);
- s = GMP_LIMB_BITS - 1 - s;
- return (CNST_LIMB(1) << (s >> 1)) + (CNST_LIMB(1) << ((s - 1) >> 1));
+ count_leading_zeros (s, x);
+ s = (GMP_LIMB_BITS - s) >> 1;
+ return ((CNST_LIMB(1) << s) + (x >> s)) >> 1;
}
#if 0
@@ -189,7 +193,7 @@ mpz_2multiswing_1 (mpz_ptr x, mp_limb_t n, mp_ptr sieve, mp_ptr factors)
mp_limb_t prod, max_prod;
mp_size_t j;
- ASSERT (n >= 26);
+ ASSERT (n > 25);
j = 0;
prod = -(n & 1);
@@ -203,41 +207,31 @@ mpz_2multiswing_1 (mpz_ptr x, mp_limb_t n, mp_ptr sieve, mp_ptr factors)
/* Swing primes from 5 to n/3 */
{
- mp_limb_t s;
+ mp_limb_t s, l_max_prod;
- {
- mp_limb_t prime;
-
- s = limb_apprsqrt(n);
- ASSERT (s >= 5);
- s = n_to_bit (s);
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (5), s, 0,sieve);
- SWING_A_PRIME (prime, n, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- s++;
- }
+ s = limb_apprsqrt(n);
+ ASSERT (s >= 5);
+ s = n_to_bit (s);
+ ASSERT (bit_to_n (s+1) * bit_to_n (s+1) > n);
+ ASSERT (s < n_to_bit (n / 3));
+ LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (5), s, 0,sieve);
+ SWING_A_PRIME (prime, n, prod, max_prod, factors, j);
+ LOOP_ON_SIEVE_STOP;
ASSERT (max_prod <= GMP_NUMB_MAX / 3);
- ASSERT (bit_to_n (s) * bit_to_n (s) > n);
- ASSERT (s <= n_to_bit (n / 3));
- {
- mp_limb_t prime;
- mp_limb_t l_max_prod = max_prod * 3;
- LOOP_ON_SIEVE_BEGIN (prime, s, n_to_bit (n/3), 0, sieve);
- SH_SWING_A_PRIME (prime, n, prod, l_max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- }
- }
+ l_max_prod = max_prod * 3;
- /* Store primes from (n+1)/2 to n */
- {
- mp_limb_t prime;
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (n >> 1) + 1, n_to_bit (n), 0,sieve);
- FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
+ LOOP_ON_SIEVE_CONTINUE (prime, n_to_bit (n/3), sieve);
+ SH_SWING_A_PRIME (prime, n, prod, l_max_prod, factors, j);
LOOP_ON_SIEVE_END;
}
+ /* Store primes from (n+1)/2 to n */
+ LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (n >> 1) + 1, n_to_bit (n), 0,sieve);
+ FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
+ LOOP_ON_SIEVE_END;
+
if (LIKELY (j != 0))
{
factors[j++] = prod;
@@ -245,6 +239,7 @@ mpz_2multiswing_1 (mpz_ptr x, mp_limb_t n, mp_ptr sieve, mp_ptr factors)
}
else
{
+ ASSERT (ALLOC (x) > 0);
PTR (x)[0] = prod;
SIZ (x) = 1;
}
@@ -286,11 +281,11 @@ void
mpz_oddfac_1 (mpz_ptr x, mp_limb_t n, unsigned flag)
{
ASSERT (n <= GMP_NUMB_MAX);
- ASSERT (flag == 0 || (flag == 1 && n > ODD_FACTORIAL_TABLE_LIMIT && ABOVE_THRESHOLD (n, FAC_DSC_THRESHOLD)));
+ ASSERT (flag == 0 || (flag == 1 && n > ODD_DOUBLEFACTORIAL_TABLE_LIMIT + 1 && ABOVE_THRESHOLD (n, FAC_DSC_THRESHOLD)));
if (n <= ODD_FACTORIAL_TABLE_LIMIT)
{
- PTR (x)[0] = __gmp_oddfac_table[n];
+ MPZ_NEWALLOC (x, 1)[0] = __gmp_oddfac_table[n];
SIZ (x) = 1;
}
else if (n <= ODD_DOUBLEFACTORIAL_TABLE_LIMIT + 1)
@@ -415,8 +410,8 @@ mpz_oddfac_1 (mpz_ptr x, mp_limb_t n, unsigned flag)
ASSERT (ns <= size);
cy = mpn_mul (px, square, size, PTR(mswing), ns); /* n!= n$ * floor(n/2)!^2 */
- TMP_FREE;
SIZ(x) = nx - (cy == 0);
+ TMP_FREE;
} while (s != 0);
TMP_FREE;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/out_raw.c b/Build/source/libs/gmp/gmp-src/mpz/out_raw.c
index 3b6b0b7cb5d..b9fd086d20e 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/out_raw.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/out_raw.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/out_str.c b/Build/source/libs/gmp/gmp-src/mpz/out_str.c
index 6c97039c64b..b1d8ae86b77 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/out_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/out_str.c
@@ -1,8 +1,8 @@
/* mpz_out_str(stream, base, integer) -- Output to STREAM the multi prec.
integer INTEGER in base BASE.
-Copyright 1991, 1993, 1994, 1996, 2001, 2005, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2001, 2005, 2011, 2012, 2017 Free
+Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,7 +31,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -50,26 +49,23 @@ mpz_out_str (FILE *stream, int base, mpz_srcptr x)
if (stream == 0)
stream = stdout;
- if (base >= 0)
+ num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ if (base > 1)
{
- num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
- if (base <= 1)
- base = 10;
- else if (base > 36)
- {
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- if (base > 62)
+ if (base <= 36)
+ num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
+ else if (UNLIKELY (base > 62))
return 0;
- }
+ }
+ else if (base > -2)
+ {
+ base = 10;
}
else
{
base = -base;
- if (base <= 1)
- base = 10;
- else if (base > 36)
+ if (UNLIKELY (base > 36))
return 0;
- num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
written = 0;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/perfpow.c b/Build/source/libs/gmp/gmp-src/mpz/perfpow.c
index 72ff3c89ac4..9bbb497b119 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/perfpow.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/perfpow.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/perfsqr.c b/Build/source/libs/gmp/gmp-src/mpz/perfsqr.c
index 534f10ff563..c2ac924a870 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/perfsqr.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/perfsqr.c
@@ -31,5 +31,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_perfect_square_p 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/popcount.c b/Build/source/libs/gmp/gmp-src/mpz/popcount.c
index 06f0f0b3a26..e9a85bbd981 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/popcount.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/popcount.c
@@ -31,5 +31,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_popcount 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/pow_ui.c b/Build/source/libs/gmp/gmp-src/mpz/pow_ui.c
index 4891e978774..8bafaa73b05 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/pow_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/pow_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/powm.c b/Build/source/libs/gmp/gmp-src/mpz/powm.c
index 4d13da7396f..f1bf8e36472 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/powm.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/powm.c
@@ -2,8 +2,8 @@
Contributed to the GNU project by Torbjorn Granlund.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009,
+2011, 2012, 2015, 2019 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +32,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -86,7 +85,7 @@ mpz_powm (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
/* b^0 mod m, b is anything and m is non-zero.
Result is 1 mod m, i.e., 1 or 0 depending on if m = 1. */
SIZ(r) = n != 1 || mp[0] != 1;
- PTR(r)[0] = 1;
+ MPZ_NEWALLOC (r, 1)[0] = 1;
TMP_FREE; /* we haven't really allocated anything here */
return;
}
@@ -126,11 +125,11 @@ mpz_powm (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
rn = n;
MPN_NORMALIZE (rp, rn);
- if (SIZ(b) < 0 && rn != 0)
+ if (rn != 0 && SIZ(b) < 0)
{
mpn_sub (rp, mp, n, rp, rn);
rn = n;
- MPN_NORMALIZE (rp, rn);
+ MPN_NORMALIZE_NOT_ZERO (rp, rn);
}
}
else
@@ -139,7 +138,7 @@ mpz_powm (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
{
mpn_sub (rp, mp, n, bp, bn);
rn = n;
- rn -= (rp[rn - 1] == 0);
+ MPN_NORMALIZE_NOT_ZERO (rp, rn);
}
else
{
@@ -275,7 +274,7 @@ mpz_powm (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
}
ret:
- MPZ_REALLOC (r, rn);
+ MPZ_NEWALLOC (r, rn);
SIZ(r) = rn;
MPN_COPY (PTR(r), rp, rn);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/powm_sec.c b/Build/source/libs/gmp/gmp-src/mpz/powm_sec.c
index 98644ca4963..a2581a8a48b 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/powm_sec.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/powm_sec.c
@@ -2,8 +2,8 @@
Contributed to the GNU project by Torbjorn Granlund.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009,
+2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +32,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
@@ -60,7 +59,7 @@ mpz_powm_sec (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
/* b^0 mod m, b is anything and m is non-zero.
Result is 1 mod m, i.e., 1 or 0 depending on if m = 1. */
SIZ(r) = n != 1 || mp[0] != 1;
- PTR(r)[0] = 1;
+ MPZ_NEWALLOC (r, 1)[0] = 1;
return;
}
DIVIDE_BY_ZERO;
@@ -76,9 +75,8 @@ mpz_powm_sec (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
}
TMP_MARK;
- tp = TMP_ALLOC_LIMBS (n + mpn_sec_powm_itch (bn, en * GMP_NUMB_BITS, n));
-
- rp = tp; tp += n;
+ TMP_ALLOC_LIMBS_2 (rp, n,
+ tp, mpn_sec_powm_itch (bn, en * GMP_NUMB_BITS, n));
bp = PTR(b);
ep = PTR(e);
@@ -96,7 +94,7 @@ mpz_powm_sec (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
MPN_NORMALIZE (rp, rn);
}
- MPZ_REALLOC (r, rn);
+ MPZ_NEWALLOC (r, rn);
SIZ(r) = rn;
MPN_COPY (PTR(r), rp, rn);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/powm_ui.c b/Build/source/libs/gmp/gmp-src/mpz/powm_ui.c
index e04bb0ad711..23d3ed8b163 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/powm_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/powm_ui.c
@@ -2,8 +2,8 @@
Contributed to the GNU project by Torbjörn Granlund.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009, 2011-2013
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009,
+2011-2013, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,7 +32,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -59,11 +58,7 @@ see https://www.gnu.org/licenses/. */
static void
mod (mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, gmp_pi1_t *dinv, mp_ptr tp)
{
- mp_ptr qp;
- TMP_DECL;
- TMP_MARK;
-
- qp = tp;
+ mp_ptr qp = tp;
if (dn == 1)
{
@@ -90,14 +85,20 @@ mod (mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, gmp_pi1_t *dinv, mp_pt
/* We need to allocate separate remainder area, since mpn_mu_div_qr does
not handle overlap between the numerator and remainder areas.
FIXME: Make it handle such overlap. */
- mp_ptr rp = TMP_BALLOC_LIMBS (dn);
- mp_size_t itch = mpn_mu_div_qr_itch (nn, dn, 0);
- mp_ptr scratch = TMP_BALLOC_LIMBS (itch);
+ mp_ptr rp, scratch;
+ mp_size_t itch;
+ TMP_DECL;
+ TMP_MARK;
+
+ itch = mpn_mu_div_qr_itch (nn, dn, 0);
+ rp = TMP_BALLOC_LIMBS (dn);
+ scratch = TMP_BALLOC_LIMBS (itch);
+
mpn_mu_div_qr (qp, rp, np, nn, dp, dn, scratch);
MPN_COPY (np, rp, dn);
- }
- TMP_FREE;
+ TMP_FREE;
+ }
}
/* Compute t = a mod m, a is defined by (ap,an), m is defined by (mp,mn), and
@@ -109,8 +110,7 @@ reduce (mp_ptr tp, mp_srcptr ap, mp_size_t an, mp_srcptr mp, mp_size_t mn, gmp_p
TMP_DECL;
TMP_MARK;
- rp = TMP_ALLOC_LIMBS (an);
- scratch = TMP_ALLOC_LIMBS (an - mn + 1);
+ TMP_ALLOC_LIMBS_2 (rp, an, scratch, an - mn + 1);
MPN_COPY (rp, ap, an);
mod (rp, an, mp, mn, dinv, scratch);
MPN_COPY (tp, rp, mn);
@@ -136,12 +136,17 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m)
if (UNLIKELY (mn == 0))
DIVIDE_BY_ZERO;
- if (el == 0)
+ if (el <= 1)
{
+ if (el == 1)
+ {
+ mpz_mod (r, b, m);
+ return;
+ }
/* Exponent is zero, result is 1 mod M, i.e., 1 or 0 depending on if
M equals 1. */
- SIZ(r) = (mn == 1 && mp[0] == 1) ? 0 : 1;
- PTR(r)[0] = 1;
+ SIZ(r) = mn != 1 || mp[0] != 1;
+ MPZ_NEWALLOC (r, 1)[0] = 1;
return;
}
@@ -183,9 +188,7 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m)
return;
}
- tp = TMP_ALLOC_LIMBS (2 * mn + 1);
- xp = TMP_ALLOC_LIMBS (mn);
- scratch = TMP_ALLOC_LIMBS (mn + 1);
+ TMP_ALLOC_LIMBS_3 (xp, mn, scratch, mn + 1, tp, 2 * mn + 1);
MPN_COPY (xp, bp, bn);
xn = bn;
@@ -195,16 +198,7 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m)
e = (e << c) << 1; /* shift the exp bits to the left, lose msb */
c = GMP_LIMB_BITS - 1 - c;
- if (c == 0)
- {
- /* If m is already normalized (high bit of high limb set), and b is
- the same size, but a bigger value, and e==1, then there's no
- modular reductions done and we can end up with a result out of
- range at the end. */
- if (xn == mn && mpn_cmp (xp, mp, mn) >= 0)
- mpn_sub_n (xp, xp, mp, mn);
- }
- else
+ ASSERT (c != 0); /* el > 1 */
{
/* Main loop. */
do
@@ -253,17 +247,12 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m)
cy = mpn_lshift (tp, xp, xn, m_zero_cnt);
tp[xn] = cy; xn += cy != 0;
- if (xn < mn)
- {
- MPN_COPY (xp, tp, xn);
- }
- else
+ if (xn >= mn)
{
mod (tp, xn, mp, mn, &dinv, scratch);
- MPN_COPY (xp, tp, mn);
xn = mn;
}
- mpn_rshift (xp, xp, xn, m_zero_cnt);
+ mpn_rshift (xp, tp, xn, m_zero_cnt);
}
MPN_NORMALIZE (xp, xn);
@@ -274,7 +263,7 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m)
xn = mn;
MPN_NORMALIZE (xp, xn);
}
- MPZ_REALLOC (r, xn);
+ MPZ_NEWALLOC (r, xn);
SIZ (r) = xn;
MPN_COPY (PTR(r), xp, xn);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/pprime_p.c b/Build/source/libs/gmp/gmp-src/mpz/pprime_p.c
index f3d38a08210..b8a21c2e270 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/pprime_p.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/pprime_p.c
@@ -6,7 +6,8 @@
positive is (1/4)**reps, where reps is the number of internal passes of the
probabilistic algorithm. Knuth indicates that 25 passes are reasonable.
-Copyright 1991, 1993, 1994, 1996-2002, 2005 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996-2002, 2005, 2015, 2016 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -55,10 +55,12 @@ mpz_probab_prime_p (mpz_srcptr n, int reps)
/* Handle small and negative n. */
if (mpz_cmp_ui (n, 1000000L) <= 0)
{
- int is_prime;
if (mpz_cmpabs_ui (n, 1000000L) <= 0)
{
- is_prime = isprime (mpz_get_ui (n));
+ int is_prime;
+ unsigned long n0;
+ n0 = mpz_get_ui (n);
+ is_prime = n0 & (n0 > 1) ? isprime (n0) : n0 == 2;
return is_prime ? 2 : 0;
}
/* Negative number. Negate and fall out. */
@@ -68,7 +70,7 @@ mpz_probab_prime_p (mpz_srcptr n, int reps)
}
/* If n is now even, it is not a prime. */
- if ((mpz_get_ui (n) & 1) == 0)
+ if (mpz_even_p (n))
return 0;
#if defined (PP)
@@ -150,15 +152,15 @@ isprime (unsigned long int t)
{
unsigned long int q, r, d;
- if (t < 3 || (t & 1) == 0)
- return t == 2;
+ ASSERT (t >= 3 && (t & 1) != 0);
- for (d = 3, r = 1; r != 0; d += 2)
- {
+ d = 3;
+ do {
q = t / d;
r = t - q * d;
if (q < d)
return 1;
- }
+ d += 2;
+ } while (r != 0);
return 0;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/primorial_ui.c b/Build/source/libs/gmp/gmp-src/mpz/primorial_ui.c
index 7a964a1f19b..27039198cdc 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/primorial_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/primorial_ui.c
@@ -2,7 +2,7 @@
Contributed to the GNU project by Marco Bodrato.
-Copyright 2012 Free Software Foundation, Inc.
+Copyright 2012, 2015, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/* TODO: Remove duplicated constants / macros / static functions...
@@ -56,7 +55,8 @@ see https://www.gnu.org/licenses/. */
++__i; \
if (((sieve)[__index] & __mask) == 0) \
{ \
- (prime) = id_to_n(__i)
+ mp_limb_t prime; \
+ prime = id_to_n(__i)
#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
do { \
@@ -73,7 +73,7 @@ see https://www.gnu.org/licenses/. */
} \
__mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
__index += __mask & 1; \
- } while (__i <= __max_i) \
+ } while (__i <= __max_i)
#define LOOP_ON_SIEVE_END \
LOOP_ON_SIEVE_STOP; \
@@ -108,24 +108,22 @@ primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
void
mpz_primorial_ui (mpz_ptr x, unsigned long n)
{
- static const mp_limb_t table[] = { 1, 1, 2, 6, 6 };
-
ASSERT (n <= GMP_NUMB_MAX);
- if (n < numberof (table))
+ if (n < 5)
{
- PTR (x)[0] = table[n];
+ MPZ_NEWALLOC (x, 1)[0] = (066211 >> (n*3)) & 7;
SIZ (x) = 1;
}
else
{
mp_limb_t *sieve, *factors;
- mp_size_t size;
+ mp_size_t size, j;
mp_limb_t prod;
- mp_limb_t j;
TMP_DECL;
- size = 1 + n / GMP_NUMB_BITS + n / (2*GMP_NUMB_BITS);
+ size = n / GMP_NUMB_BITS;
+ size = size + (size >> 1) + 1;
ASSERT (size >= primesieve_size (n));
sieve = MPZ_NEWALLOC (x, size);
size = (gmp_primesieve (sieve, n) + 1) / log_n_max (n) + 1;
@@ -135,20 +133,20 @@ mpz_primorial_ui (mpz_ptr x, unsigned long n)
j = 0;
- prod = table[numberof (table)-1];
+ prod = 6;
/* Store primes from 5 to n */
{
- mp_limb_t prime, max_prod;
+ mp_limb_t max_prod;
max_prod = GMP_NUMB_MAX / n;
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit(numberof (table)), n_to_bit (n), 0, sieve);
+ LOOP_ON_SIEVE_BEGIN (prime, n_to_bit(5), n_to_bit (n), 0, sieve);
FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
LOOP_ON_SIEVE_END;
}
- if (LIKELY (j != 0))
+ if (j != 0)
{
factors[j++] = prod;
mpz_prodlimbs (x, factors, j);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/prodlimbs.c b/Build/source/libs/gmp/gmp-src/mpz/prodlimbs.c
index 8d84bcb4353..23f06a15b51 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/prodlimbs.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/prodlimbs.c
@@ -35,7 +35,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
/*********************************************************/
diff --git a/Build/source/libs/gmp/gmp-src/mpz/random.c b/Build/source/libs/gmp/gmp-src/mpz/random.c
index 1dca3a93cdd..1a1e5157b4b 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/random.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/random.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/random2.c b/Build/source/libs/gmp/gmp-src/mpz/random2.c
index 7f9e5f28e8b..2c72540c1c3 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/random2.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/random2.c
@@ -2,7 +2,8 @@
long runs of consecutive ones and zeros in the binary representation.
Meant for testing of other MP routines.
-Copyright 1991, 1993, 1994, 1996, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2001, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -42,7 +42,7 @@ mpz_random2 (mpz_ptr x, mp_size_t size)
abs_size = ABS (size);
if (abs_size != 0)
{
- xp = MPZ_REALLOC (x, abs_size);
+ xp = MPZ_NEWALLOC (x, abs_size);
mpn_random2 (xp, abs_size);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/realloc.c b/Build/source/libs/gmp/gmp-src/mpz/realloc.c
index 3d2755ca0a1..bb55bf6834a 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/realloc.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/realloc.c
@@ -1,6 +1,7 @@
/* _mpz_realloc -- make the mpz_t have NEW_ALLOC digits allocated.
-Copyright 1991, 1993-1995, 2000, 2001, 2008 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2000, 2001, 2008, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdlib.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
void *
@@ -58,14 +58,21 @@ _mpz_realloc (mpz_ptr m, mp_size_t new_alloc)
}
}
- mp = __GMP_REALLOCATE_FUNC_LIMBS (PTR(m), ALLOC(m), new_alloc);
- PTR(m) = mp;
- ALLOC(m) = new_alloc;
+ if (ALLOC (m) == 0)
+ {
+ mp = __GMP_ALLOCATE_FUNC_LIMBS (new_alloc);
+ }
+ else
+ {
+ mp = __GMP_REALLOCATE_FUNC_LIMBS (PTR (m), ALLOC (m), new_alloc);
- /* Don't create an invalid number; if the current value doesn't fit after
- reallocation, clear it to 0. */
- if (ABSIZ(m) > new_alloc)
- SIZ(m) = 0;
+ /* Don't create an invalid number; if the current value doesn't fit after
+ reallocation, clear it to 0. */
+ if (UNLIKELY (ABSIZ (m) > new_alloc))
+ SIZ (m) = 0;
+ }
+ PTR (m) = mp;
+ ALLOC(m) = new_alloc;
return (void *) mp;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/realloc2.c b/Build/source/libs/gmp/gmp-src/mpz/realloc2.c
index 3ccfaab1f06..53503394255 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/realloc2.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/realloc2.c
@@ -1,6 +1,6 @@
/* mpz_realloc2 -- change allocated data size.
-Copyright 2001, 2002, 2008 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2008, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#include <stdlib.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -50,11 +49,19 @@ mpz_realloc2 (mpz_ptr m, mp_bitcnt_t bits)
}
}
- PTR(m) = __GMP_REALLOCATE_FUNC_LIMBS (PTR(m), ALLOC(m), new_alloc);
- ALLOC(m) = new_alloc;
+ if (ALLOC (m) == 0)
+ {
+ PTR (m) = __GMP_ALLOCATE_FUNC_LIMBS (new_alloc);
+ }
+ else
+ {
+ PTR (m) = __GMP_REALLOCATE_FUNC_LIMBS (PTR(m), ALLOC(m), new_alloc);
- /* Don't create an invalid number; if the current value doesn't fit after
- reallocation, clear it to 0. */
- if (ABSIZ(m) > new_alloc)
- SIZ(m) = 0;
+ /* Don't create an invalid number; if the current value doesn't fit after
+ reallocation, clear it to 0. */
+ if (ABSIZ(m) > new_alloc)
+ SIZ(m) = 0;
+ }
+
+ ALLOC(m) = new_alloc;
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/remove.c b/Build/source/libs/gmp/gmp-src/mpz/remove.c
index 3d293587383..a6551214d96 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/remove.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/remove.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mp_bitcnt_t
diff --git a/Build/source/libs/gmp/gmp-src/mpz/roinit_n.c b/Build/source/libs/gmp/gmp-src/mpz/roinit_n.c
index 137dbda83c6..91254663490 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/roinit_n.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/roinit_n.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
mpz_srcptr
diff --git a/Build/source/libs/gmp/gmp-src/mpz/root.c b/Build/source/libs/gmp/gmp-src/mpz/root.c
index 31eb440b4f2..7119bbc3a57 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/root.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/root.c
@@ -30,7 +30,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
int
@@ -65,7 +64,7 @@ mpz_root (mpz_ptr root, mpz_srcptr u, unsigned long int nth)
/* FIXME: Perhaps disallow root == NULL */
if (root != NULL && u != root)
- rootp = MPZ_REALLOC (root, rootn);
+ rootp = MPZ_NEWALLOC (root, rootn);
else
rootp = TMP_ALLOC_LIMBS (rootn);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/rootrem.c b/Build/source/libs/gmp/gmp-src/mpz/rootrem.c
index ac4a1e030af..67953dbe650 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/rootrem.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/rootrem.c
@@ -30,7 +30,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -66,12 +65,12 @@ mpz_rootrem (mpz_ptr root, mpz_ptr rem, mpz_srcptr u, unsigned long int nth)
/* FIXME: Perhaps disallow root == NULL */
if (root != NULL && u != root)
- rootp = MPZ_REALLOC (root, rootn);
+ rootp = MPZ_NEWALLOC (root, rootn);
else
rootp = TMP_ALLOC_LIMBS (rootn);
if (u != rem)
- remp = MPZ_REALLOC (rem, un);
+ remp = MPZ_NEWALLOC (rem, un);
else
remp = TMP_ALLOC_LIMBS (un);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/rrandomb.c b/Build/source/libs/gmp/gmp-src/mpz/rrandomb.c
index 8b1803c6baa..39546a6bcd4 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/rrandomb.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/rrandomb.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
static void gmp_rrandomb (mp_ptr, gmp_randstate_t, mp_bitcnt_t);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/scan0.c b/Build/source/libs/gmp/gmp-src/mpz/scan0.c
index de24595cfe9..4b0f1ef2b44 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/scan0.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/scan0.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/scan1.c b/Build/source/libs/gmp/gmp-src/mpz/scan1.c
index e6b759e2beb..d09614701c9 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/scan1.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/scan1.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/set.c b/Build/source/libs/gmp/gmp-src/mpz/set.c
index 9d7d58c8d03..7789af37793 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/set.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/set.c
@@ -1,6 +1,6 @@
/* mpz_set (dest_integer, src_integer) -- Assign DEST_INTEGER from SRC_INTEGER.
-Copyright 1991, 1993-1995, 2000, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2000, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -41,7 +40,7 @@ mpz_set (mpz_ptr w, mpz_srcptr u)
usize = SIZ(u);
size = ABS (usize);
- wp = MPZ_REALLOC (w, size);
+ wp = MPZ_NEWALLOC (w, size);
up = PTR(u);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/set_d.c b/Build/source/libs/gmp/gmp-src/mpz/set_d.c
index d40ee726d23..8cbda1164ed 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/set_d.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/set_d.c
@@ -1,6 +1,6 @@
/* mpz_set_d(integer, val) -- Assign INTEGER with a double value VAL.
-Copyright 1995, 1996, 2000-2003, 2006 Free Software Foundation, Inc.
+Copyright 1995, 1996, 2000-2003, 2006, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
#include <float.h> /* for DBL_MAX */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
@@ -62,13 +61,10 @@ mpz_set_d (mpz_ptr r, double d)
rn = __gmp_extract_double (tp, d);
- if (ALLOC(r) < rn)
- _mpz_realloc (r, rn);
-
if (rn <= 0)
rn = 0;
- rp = PTR (r);
+ rp = MPZ_NEWALLOC (r, rn);
switch (rn)
{
diff --git a/Build/source/libs/gmp/gmp-src/mpz/set_f.c b/Build/source/libs/gmp/gmp-src/mpz/set_f.c
index 4eb98198371..b3ecc0be056 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/set_f.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/set_f.c
@@ -1,6 +1,6 @@
/* mpz_set_f (dest_integer, src_float) -- Assign DEST_INTEGER from SRC_FLOAT.
-Copyright 1996, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1996, 2001, 2012, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -47,7 +46,7 @@ mpz_set_f (mpz_ptr w, mpf_srcptr u)
return;
}
- wp = MPZ_REALLOC (w, exp);
+ wp = MPZ_NEWALLOC (w, exp);
up = PTR(u);
size = SIZ (u);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/set_q.c b/Build/source/libs/gmp/gmp-src/mpz/set_q.c
index 2627e822980..2280247bf72 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/set_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/set_q.c
@@ -31,5 +31,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_set_q 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/set_si.c b/Build/source/libs/gmp/gmp-src/mpz/set_si.c
index 1370368332e..973aef8ba5a 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/set_si.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/set_si.c
@@ -1,6 +1,7 @@
/* mpz_set_si(dest,val) -- Assign DEST with a small value VAL.
-Copyright 1991, 1993-1995, 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2002, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -39,7 +39,7 @@ mpz_set_si (mpz_ptr dest, signed long int val)
vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
- PTR (dest)[0] = vl & GMP_NUMB_MASK;
+ MPZ_NEWALLOC (dest, 1)[0] = vl & GMP_NUMB_MASK;
size = vl != 0;
#if GMP_NAIL_BITS != 0
diff --git a/Build/source/libs/gmp/gmp-src/mpz/set_str.c b/Build/source/libs/gmp/gmp-src/mpz/set_str.c
index 848d2136a0a..26c102b460e 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/set_str.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/set_str.c
@@ -35,7 +35,6 @@ see https://www.gnu.org/licenses/. */
#include <string.h>
#include <ctype.h>
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -59,7 +58,7 @@ mpz_set_str (mpz_ptr x, const char *str, int base)
/* For bases > 36, use the collating sequence
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. */
digit_value += 208;
- if (base > 62)
+ if (UNLIKELY (base > 62))
return -1; /* too large base */
}
@@ -121,7 +120,7 @@ mpz_set_str (mpz_ptr x, const char *str, int base)
if (!isspace (c))
{
int dig = digit_value[c];
- if (dig >= base)
+ if (UNLIKELY (dig >= base))
{
TMP_FREE;
return -1;
@@ -134,7 +133,7 @@ mpz_set_str (mpz_ptr x, const char *str, int base)
str_size = s - begs;
LIMBS_PER_DIGIT_IN_BASE (xsize, str_size, base);
- MPZ_REALLOC (x, xsize);
+ MPZ_NEWALLOC (x, xsize);
/* Convert the byte array in base BASE to our bignum format. */
xsize = mpn_set_str (PTR (x), (unsigned char *) begs, str_size, base);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/set_ui.c b/Build/source/libs/gmp/gmp-src/mpz/set_ui.c
index f36754cd59b..12e95d170f8 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/set_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/set_ui.c
@@ -1,7 +1,7 @@
/* mpz_set_ui(integer, val) -- Assign INTEGER with a small value VAL.
-Copyright 1991, 1993-1995, 2001, 2002, 2004, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993-1995, 2001, 2002, 2004, 2012, 2015 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -37,7 +36,7 @@ mpz_set_ui (mpz_ptr dest, unsigned long int val)
{
mp_size_t size;
- PTR (dest)[0] = val & GMP_NUMB_MASK;
+ MPZ_NEWALLOC (dest, 1)[0] = val & GMP_NUMB_MASK;
size = val != 0;
#if BITS_PER_ULONG > GMP_NUMB_BITS /* avoid warnings about shift amount */
diff --git a/Build/source/libs/gmp/gmp-src/mpz/setbit.c b/Build/source/libs/gmp/gmp-src/mpz/setbit.c
index 3c2c139f987..228a564b2b2 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/setbit.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/setbit.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/size.c b/Build/source/libs/gmp/gmp-src/mpz/size.c
index 2b324c34230..b8aa59ec2af 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/size.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/size.c
@@ -31,5 +31,4 @@ see https://www.gnu.org/licenses/. */
#define __GMP_FORCE_mpz_size 1
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/sizeinbase.c b/Build/source/libs/gmp/gmp-src/mpz/sizeinbase.c
index 0f3851ea861..7a1bd016124 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/sizeinbase.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/sizeinbase.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/sqrt.c b/Build/source/libs/gmp/gmp-src/mpz/sqrt.c
index 0272319b3c9..74d2f757884 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/sqrt.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/sqrt.c
@@ -1,7 +1,7 @@
/* mpz_sqrt(root, u) -- Set ROOT to floor(sqrt(U)).
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2012, 2015 Free
+Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
void
@@ -42,7 +41,7 @@ mpz_sqrt (mpz_ptr root, mpz_srcptr op)
op_size = SIZ (op);
if (UNLIKELY (op_size <= 0))
{
- if (op_size < 0)
+ if (UNLIKELY (op_size < 0))
SQRT_OF_NEGATIVE;
SIZ(root) = 0;
return;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/sqrtrem.c b/Build/source/libs/gmp/gmp-src/mpz/sqrtrem.c
index 63a06eb0b7b..a580d95910d 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/sqrtrem.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/sqrtrem.c
@@ -1,8 +1,8 @@
/* mpz_sqrtrem(root,rem,x) -- Set ROOT to floor(sqrt(X)) and REM
to the remainder, i.e. X - ROOT**2.
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2011, 2012, 2015 Free
+Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -42,14 +41,15 @@ mpz_sqrtrem (mpz_ptr root, mpz_ptr rem, mpz_srcptr op)
op_size = SIZ (op);
if (UNLIKELY (op_size <= 0))
{
- if (op_size < 0)
+ if (UNLIKELY (op_size < 0))
SQRT_OF_NEGATIVE;
SIZ(root) = 0;
SIZ(rem) = 0;
return;
}
- rem_ptr = MPZ_REALLOC (rem, op_size);
+ /* No-op if rem == op */
+ rem_ptr = MPZ_NEWALLOC (rem, op_size);
/* The size of the root is accurate after this simple calculation. */
root_size = (op_size + 1) / 2;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/stronglucas.c b/Build/source/libs/gmp/gmp-src/mpz/stronglucas.c
new file mode 100644
index 00000000000..350dd2a48e9
--- /dev/null
+++ b/Build/source/libs/gmp/gmp-src/mpz/stronglucas.c
@@ -0,0 +1,178 @@
+/* mpz_stronglucas(n, t1, t2) -- An implementation of the strong Lucas
+ primality test on n, using parameters as suggested by the BPSW test.
+
+ THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
+ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
+ FUTURE GNU MP RELEASES.
+
+Copyright 2018 Free Software Foundation, Inc.
+
+Contributed by Marco Bodrato.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+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 "gmp-impl.h"
+#include "longlong.h"
+
+/* Returns an approximation of the sqare root of x.
+ * It gives:
+ * limb_apprsqrt (x) ^ 2 <= x < (limb_apprsqrt (x)+1) ^ 2
+ * or
+ * x <= limb_apprsqrt (x) ^ 2 <= x * 9/8
+ */
+static mp_limb_t
+limb_apprsqrt (mp_limb_t x)
+{
+ int s;
+
+ ASSERT (x > 2);
+ count_leading_zeros (s, x);
+ s = (GMP_LIMB_BITS - s) >> 1;
+ return ((CNST_LIMB(1) << s) + (x >> s)) >> 1;
+}
+
+/* Performs strong Lucas' test on x, with parameters suggested */
+/* for the BPSW test. Qk and V are passed to recycle variables. */
+/* Requires GCD (x,6) = 1.*/
+int
+mpz_stronglucas (mpz_srcptr x, mpz_ptr V, mpz_ptr Qk)
+{
+ mp_bitcnt_t b0;
+ mpz_t n;
+ mp_limb_t D; /* The absolute value is stored. */
+ long Q;
+ mpz_t T1, T2;
+
+ /* Test on the absolute value. */
+ mpz_roinit_n (n, PTR (x), ABSIZ (x));
+
+ ASSERT (mpz_odd_p (n));
+ /* ASSERT (mpz_gcd_ui (NULL, n, 6) == 1); */
+#if GMP_NUMB_BITS % 16 == 0
+ /* (2^12 - 1) | (2^{GMP_NUMB_BITS*3/4} - 1) */
+ D = mpn_mod_34lsub1 (PTR (n), SIZ (n));
+ /* (2^12 - 1) = 3^2 * 5 * 7 * 13 */
+ ASSERT (D % 3 != 0 && D % 5 != 0 && D % 7 != 0);
+ if ((D % 5 & 2) != 0)
+ /* (5/n) = -1, iff n = 2 or 3 (mod 5) */
+ /* D = 5; Q = -1 */
+ return mpn_strongfibo (PTR (n), SIZ (n), PTR (V));
+ else if (! POW2_P (D % 7))
+ /* (-7/n) = -1, iff n = 3,5 or 6 (mod 7) */
+ D = 7; /* Q = 2 */
+ /* (9/n) = -1, never: 9 = 3^2 */
+ else if (mpz_kronecker_ui (n, 11) == -1)
+ /* (-11/n) = (n/11) */
+ D = 11; /* Q = 3 */
+ else if ((((D % 13 - (D % 13 >> 3)) & 7) > 4) ||
+ (((D % 13 - (D % 13 >> 3)) & 7) == 2))
+ /* (13/n) = -1, iff n = 2,5,6,7,8 or 11 (mod 13) */
+ D = 13; /* Q = -3 */
+ else if (D % 3 == 2)
+ /* (-15/n) = (n/15) = (n/5)*(n/3) */
+ /* Here, (n/5) = 1, and */
+ /* (n/3) = -1, iff n = 2 (mod 3) */
+ D = 15; /* Q = 4 */
+#if GMP_NUMB_BITS % 32 == 0
+ /* (2^24 - 1) | (2^{GMP_NUMB_BITS*3/4} - 1) */
+ /* (2^24 - 1) = (2^12 - 1) * 17 * 241 */
+ else if (! POW2_P (D % 17) && ! POW2_P (17 - D % 17))
+ D = 17; /* Q = -4 */
+#endif
+#else
+ if (mpz_kronecker_ui (n, 5) == -1)
+ return mpn_strongfibo (PTR (n), SIZ (n), PTR (V));
+#endif
+ else
+ {
+ mp_limb_t tl;
+ mp_limb_t maxD;
+ int jac_bit1;
+
+ if (UNLIKELY (mpz_perfect_square_p (n)))
+ return 0; /* A square is composite. */
+
+ /* Check Ds up to square root (in case, n is prime)
+ or avoid overflows */
+ if (SIZ (n) == 1)
+ maxD = limb_apprsqrt (* PTR (n));
+ else if (BITS_PER_ULONG >= GMP_NUMB_BITS && SIZ (n) == 2)
+ mpn_sqrtrem (&maxD, (mp_ptr) NULL, PTR (n), 2);
+ else
+ maxD = GMP_NUMB_MAX;
+ maxD = MIN (maxD, ULONG_MAX);
+
+ D = GMP_NUMB_BITS % 16 == 0 ? (GMP_NUMB_BITS % 32 == 0 ? 17 : 15) : 5;
+
+ /* Search a D such that (D/n) = -1 in the sequence 5,-7,9,-11,.. */
+ /* For those Ds we have (D/n) = (n/|D|) */
+ /* FIXME: Should we loop only on prime Ds? */
+ /* The only interesting composite D is 15. */
+ do
+ {
+ if (UNLIKELY (D >= maxD))
+ return 1;
+ D += 2;
+ jac_bit1 = 0;
+ JACOBI_MOD_OR_MODEXACT_1_ODD (jac_bit1, tl, PTR (n), SIZ (n), D);
+ if (UNLIKELY (tl == 0))
+ return 0;
+ }
+ while (mpn_jacobi_base (tl, D, jac_bit1) == 1);
+ }
+
+ /* D= P^2 - 4Q; P = 1; Q = (1-D)/4 */
+ Q = (D & 2) ? (D >> 2) + 1 : -(long) (D >> 2);
+ /* ASSERT (mpz_si_kronecker ((D & 2) ? NEG_CAST (long, D) : D, n) == -1); */
+
+ /* n-(D/n) = n+1 = d*2^{b0}, with d = (n>>b0) | 1 */
+ b0 = mpz_scan0 (n, 0);
+
+ mpz_init (T1);
+ mpz_init (T2);
+
+ /* If Ud != 0 && Vd != 0 */
+ if (mpz_lucas_mod (V, Qk, Q, b0, n, T1, T2) == 0)
+ if (LIKELY (--b0 != 0))
+ do
+ {
+ /* V_{2k} <- V_k ^ 2 - 2Q^k */
+ mpz_mul (T2, V, V);
+ mpz_submul_ui (T2, Qk, 2);
+ mpz_tdiv_r (V, T2, n);
+ if (SIZ (V) == 0 || UNLIKELY (--b0 == 0))
+ break;
+ /* Q^{2k} = (Q^k)^2 */
+ mpz_mul (T2, Qk, Qk);
+ mpz_tdiv_r (Qk, T2, n);
+ } while (1);
+
+ mpz_clear (T1);
+ mpz_clear (T2);
+
+ return (b0 != 0);
+}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/swap.c b/Build/source/libs/gmp/gmp-src/mpz/swap.c
index e5ef2673f38..255fac0823c 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/swap.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/swap.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tdiv_q.c b/Build/source/libs/gmp/gmp-src/mpz/tdiv_q.c
index 38528f35bfb..8c5001df155 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tdiv_q.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tdiv_q.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -38,7 +37,7 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
{
mp_size_t ql;
mp_size_t ns, ds, nl, dl;
- mp_ptr np, dp, qp;
+ mp_ptr np, dp, qp, tp;
TMP_DECL;
ns = SIZ (num);
@@ -59,7 +58,6 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
qp = MPZ_REALLOC (quot, ql);
TMP_MARK;
- np = PTR (num);
dp = PTR (den);
/* Copy denominator to temporary space if it overlaps with the quotient. */
@@ -70,21 +68,17 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
MPN_COPY (tp, dp, dl);
dp = tp;
}
+
+ tp = TMP_ALLOC_LIMBS (nl + 1);
+ np = PTR (num);
/* Copy numerator to temporary space if it overlaps with the quotient. */
if (np == qp)
{
- mp_ptr tp;
- tp = TMP_ALLOC_LIMBS (nl + 1);
MPN_COPY (tp, np, nl);
/* Overlap dividend and scratch. */
- mpn_div_q (qp, tp, nl, dp, dl, tp);
- }
- else
- {
- mp_ptr tp;
- tp = TMP_ALLOC_LIMBS (nl + 1);
- mpn_div_q (qp, np, nl, dp, dl, tp);
+ np = tp;
}
+ mpn_div_q (qp, np, nl, dp, dl, tp);
ql -= qp[ql - 1] == 0;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tdiv_q_2exp.c b/Build/source/libs/gmp/gmp-src/mpz/tdiv_q_2exp.c
index 9ffcaf2bbbe..c6b9bd0244f 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tdiv_q_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tdiv_q_2exp.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tdiv_q_ui.c b/Build/source/libs/gmp/gmp-src/mpz/tdiv_q_ui.c
index 88e90825290..a11c51efb63 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tdiv_q_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tdiv_q_ui.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tdiv_qr.c b/Build/source/libs/gmp/gmp-src/mpz/tdiv_qr.c
index ab9a37dae9c..eda95010363 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tdiv_qr.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tdiv_qr.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tdiv_qr_ui.c b/Build/source/libs/gmp/gmp-src/mpz/tdiv_qr_ui.c
index 4f667abe07d..4e1c9fa0ac4 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tdiv_qr_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tdiv_qr_ui.c
@@ -2,8 +2,8 @@
Set QUOT to DIVIDEND / SHORT_DIVISOR
and REM to DIVIDEND mod SHORT_DIVISOR.
-Copyright 1991, 1993, 1994, 1996, 1998, 2001, 2002, 2004, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1998, 2001, 2002, 2004, 2012, 2015
+Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,7 +31,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
@@ -68,7 +67,7 @@ mpz_tdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
SIZ(quot) = 0;
rl = np[0];
SIZ(rem) = ns >= 0 ? 1 : -1;
- PTR(rem)[0] = rl;
+ MPZ_NEWALLOC (rem, 1)[0] = rl;
return rl;
}
@@ -90,10 +89,8 @@ mpz_tdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
SIZ(rem) = 0;
else
{
- /* Store the single-limb remainder. We don't check if there's space
- for just one limb, since no function ever makes zero space. */
SIZ(rem) = ns >= 0 ? 1 : -1;
- PTR(rem)[0] = rl;
+ MPZ_NEWALLOC (rem, 1)[0] = rl;
}
qn = nn - (qp[nn - 1] == 0);
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tdiv_r.c b/Build/source/libs/gmp/gmp-src/mpz/tdiv_r.c
index d9cb38c3232..c76275e53a4 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tdiv_r.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tdiv_r.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -37,32 +36,32 @@ void
mpz_tdiv_r (mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
{
mp_size_t ql;
- mp_size_t ns, ds, nl, dl;
+ mp_size_t ns, nl, dl;
mp_ptr np, dp, qp, rp;
TMP_DECL;
ns = SIZ (num);
- ds = SIZ (den);
nl = ABS (ns);
- dl = ABS (ds);
+ dl = ABSIZ (den);
ql = nl - dl + 1;
if (UNLIKELY (dl == 0))
DIVIDE_BY_ZERO;
- rp = MPZ_REALLOC (rem, dl);
-
if (ql <= 0)
{
if (num != rem)
{
+ SIZ (rem) = ns;
+ rp = MPZ_NEWALLOC (rem, nl);
np = PTR (num);
MPN_COPY (rp, np, nl);
- SIZ (rem) = SIZ (num);
}
return;
}
+ rp = MPZ_REALLOC (rem, dl);
+
TMP_MARK;
qp = TMP_ALLOC_LIMBS (ql);
np = PTR (num);
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tdiv_r_2exp.c b/Build/source/libs/gmp/gmp-src/mpz/tdiv_r_2exp.c
index e21d90fecd5..96a81f7fc49 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tdiv_r_2exp.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tdiv_r_2exp.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -54,22 +53,21 @@ mpz_tdiv_r_2exp (mpz_ptr res, mpz_srcptr in, mp_bitcnt_t cnt)
}
else
{
- res_size = limb_cnt;
- MPN_NORMALIZE (in_ptr, res_size);
+ MPN_NORMALIZE (in_ptr, limb_cnt);
- MPZ_REALLOC (res, res_size);
+ MPZ_REALLOC (res, limb_cnt);
- limb_cnt = res_size;
+ res_size = limb_cnt;
}
}
else
{
/* The input operand is smaller than 2**CNT. We perform a no-op,
apart from that we might need to copy IN to RES. */
- res_size = in_size;
- MPZ_REALLOC (res, res_size);
+ limb_cnt = in_size;
+ MPZ_REALLOC (res, limb_cnt);
- limb_cnt = res_size;
+ res_size = limb_cnt;
}
if (res != in)
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tdiv_r_ui.c b/Build/source/libs/gmp/gmp-src/mpz/tdiv_r_ui.c
index 30addd6db79..f3da8efae85 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tdiv_r_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tdiv_r_ui.c
@@ -1,8 +1,8 @@
/* mpz_tdiv_r_ui(rem, dividend, divisor_limb)
-- Set REM to DIVDEND mod DIVISOR_LIMB.
-Copyright 1991, 1993, 1994, 1996, 1998, 2001, 2002, 2004, 2005, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1998, 2001, 2002, 2004, 2005, 2012,
+2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
unsigned long int
@@ -64,11 +63,11 @@ mpz_tdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
{
rl = np[0];
SIZ(rem) = ns >= 0 ? 1 : -1;
- PTR(rem)[0] = rl;
+ MPZ_NEWALLOC (rem, 1)[0] = rl;
return rl;
}
- rp = MPZ_REALLOC (rem, 2);
+ rp = MPZ_NEWALLOC (rem, 2);
TMP_MARK;
dp[0] = divisor & GMP_NUMB_MASK;
@@ -88,10 +87,8 @@ mpz_tdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
SIZ(rem) = 0;
else
{
- /* Store the single-limb remainder. We don't check if there's space
- for just one limb, since no function ever makes zero space. */
SIZ(rem) = ns >= 0 ? 1 : -1;
- PTR(rem)[0] = rl;
+ MPZ_NEWALLOC (rem, 1)[0] = rl;
}
}
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tdiv_ui.c b/Build/source/libs/gmp/gmp-src/mpz/tdiv_ui.c
index 328d67fdf88..4618599d8ff 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tdiv_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tdiv_ui.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/tstbit.c b/Build/source/libs/gmp/gmp-src/mpz/tstbit.c
index db3d75a64f9..48725d45e6f 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/tstbit.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/tstbit.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/ui_pow_ui.c b/Build/source/libs/gmp/gmp-src/mpz/ui_pow_ui.c
index a4f23c56555..87f2d3a762b 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/ui_pow_ui.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/ui_pow_ui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/mpz/ui_sub.c b/Build/source/libs/gmp/gmp-src/mpz/ui_sub.c
index 579a3007954..1d0edb9372b 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/ui_sub.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/ui_sub.c
@@ -1,6 +1,6 @@
/* mpz_ui_sub -- Subtract an unsigned one-word integer and an mpz_t.
-Copyright 2002, 2004 Free Software Foundation, Inc.
+Copyright 2002, 2004, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -52,11 +51,8 @@ mpz_ui_sub (mpz_ptr w, unsigned long int uval, mpz_srcptr v)
}
#endif
- vp = PTR(v);
vn = SIZ(v);
- wp = PTR(w);
-
if (vn > 1)
{
wp = MPZ_REALLOC (w, vn);
@@ -64,24 +60,22 @@ mpz_ui_sub (mpz_ptr w, unsigned long int uval, mpz_srcptr v)
mpn_sub_1 (wp, vp, vn, (mp_limb_t) uval);
wn = -(vn - (wp[vn - 1] == 0));
}
- else if (vn == 1)
+ else if (vn >= 0)
{
- if (uval >= vp[0])
+ mp_limb_t vp0;
+ vp0 = PTR (v)[0] & - (mp_limb_t) vn;
+ wp = MPZ_NEWALLOC (w, 1);
+ if (uval >= vp0)
{
- wp[0] = uval - vp[0];
+ wp[0] = uval - vp0;
wn = wp[0] != 0;
}
else
{
- wp[0] = vp[0] - uval;
+ wp[0] = vp0 - uval;
wn = -1;
}
}
- else if (vn == 0)
- {
- wp[0] = uval;
- wn = uval != 0;
- }
else /* (vn < 0) */
{
vn = -vn;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/urandomb.c b/Build/source/libs/gmp/gmp-src/mpz/urandomb.c
index f1295699b3f..fcaea218859 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/urandomb.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/urandomb.c
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/mpz/urandomm.c b/Build/source/libs/gmp/gmp-src/mpz/urandomm.c
index 434359cdd76..df73935d2e1 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/urandomm.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/urandomm.c
@@ -2,7 +2,7 @@
integer in the range 0 to N-1, using STATE as the random state
previously initialized by a call to gmp_randinit().
-Copyright 2000, 2002, 2012 Free Software Foundation, Inc.
+Copyright 2000, 2002, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,7 +30,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h" /* for count_leading_zeros */
@@ -40,8 +39,9 @@ see https://www.gnu.org/licenses/. */
void
mpz_urandomm (mpz_ptr rop, gmp_randstate_t rstate, mpz_srcptr n)
{
- mp_ptr rp, np, nlast;
+ mp_ptr rp, np;
mp_size_t nbits, size;
+ mp_limb_t nh;
int count;
int pow2;
int cmp;
@@ -51,19 +51,13 @@ mpz_urandomm (mpz_ptr rop, gmp_randstate_t rstate, mpz_srcptr n)
if (UNLIKELY (size == 0))
DIVIDE_BY_ZERO;
- nlast = &PTR (n)[size - 1];
+ np = PTR (n);
+ nh = np[size - 1];
/* Detect whether n is a power of 2. */
- pow2 = POW2_P (*nlast);
- if (pow2 != 0)
- for (np = PTR (n); np < nlast; np++)
- if (*np != 0)
- {
- pow2 = 0; /* Mark n as `not a power of two'. */
- break;
- }
-
- count_leading_zeros (count, *nlast);
+ pow2 = POW2_P (nh) && (size == 1 || mpn_zero_p (np, size - 1));
+
+ count_leading_zeros (count, nh);
nbits = size * GMP_NUMB_BITS - (count - GMP_NAIL_BITS) - pow2;
if (nbits == 0) /* nbits == 0 means that n was == 1. */
{
@@ -72,7 +66,6 @@ mpz_urandomm (mpz_ptr rop, gmp_randstate_t rstate, mpz_srcptr n)
}
TMP_MARK;
- np = PTR (n);
if (rop == n)
{
mp_ptr tp;
@@ -83,7 +76,7 @@ mpz_urandomm (mpz_ptr rop, gmp_randstate_t rstate, mpz_srcptr n)
/* Here the allocated size can be one too much if n is a power of
(2^GMP_NUMB_BITS) but it's convenient for using mpn_cmp below. */
- rp = MPZ_REALLOC (rop, size);
+ rp = MPZ_NEWALLOC (rop, size);
/* Clear last limb to prevent the case in which size is one too much. */
rp[size - 1] = 0;
diff --git a/Build/source/libs/gmp/gmp-src/mpz/xor.c b/Build/source/libs/gmp/gmp-src/mpz/xor.c
index cd701000d56..5ec657a5227 100644
--- a/Build/source/libs/gmp/gmp-src/mpz/xor.c
+++ b/Build/source/libs/gmp/gmp-src/mpz/xor.c
@@ -1,7 +1,7 @@
/* mpz_xor -- Logical xor.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2005, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2005, 2012,
+2015-2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
@@ -38,70 +37,45 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
mp_srcptr op1_ptr, op2_ptr;
mp_size_t op1_size, op2_size;
mp_ptr res_ptr;
- mp_size_t res_size, res_alloc;
- TMP_DECL;
+ mp_size_t res_size;
- TMP_MARK;
op1_size = SIZ(op1);
op2_size = SIZ(op2);
+ if (op1_size < op2_size)
+ {
+ MPZ_SRCPTR_SWAP (op1, op2);
+ MP_SIZE_T_SWAP (op1_size, op2_size);
+ }
+
op1_ptr = PTR(op1);
- op2_ptr = PTR(op2);
res_ptr = PTR(res);
- if (op1_size >= 0)
+ if (op2_size >= 0)
{
- if (op2_size >= 0)
- {
- if (op1_size >= op2_size)
- {
- if (ALLOC(res) < op1_size)
- {
- _mpz_realloc (res, op1_size);
- /* No overlapping possible: op1_ptr = PTR(op1); */
- op2_ptr = PTR(op2);
- res_ptr = PTR(res);
- }
-
- if (res_ptr != op1_ptr)
- MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size,
- op1_size - op2_size);
- if (LIKELY (op2_size != 0))
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op2_size);
- res_size = op1_size;
- }
- else
- {
- if (ALLOC(res) < op2_size)
- {
- _mpz_realloc (res, op2_size);
- op1_ptr = PTR(op1);
- /* No overlapping possible: op2_ptr = PTR(op2); */
- res_ptr = PTR(res);
- }
-
- if (res_ptr != op2_ptr)
- MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
- op2_size - op1_size);
- if (LIKELY (op1_size != 0))
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op1_size);
- res_size = op2_size;
- }
-
- MPN_NORMALIZE (res_ptr, res_size);
- SIZ(res) = res_size;
- return;
- }
- else /* op2_size < 0 */
+ if (res_ptr != op1_ptr)
{
- /* Fall through to the code at the end of the function. */
+ res_ptr = MPZ_REALLOC (res, op1_size);
+ MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size,
+ op1_size - op2_size);
}
+ if (LIKELY (op2_size != 0))
+ mpn_xor_n (res_ptr, op1_ptr, PTR(op2), op2_size);
+ res_size = op1_size;
+
+ MPN_NORMALIZE (res_ptr, res_size);
+ SIZ(res) = res_size;
}
else
{
- if (op2_size < 0)
+ mp_ptr opx;
+ TMP_DECL;
+
+ op2_size = -op2_size;
+ TMP_MARK;
+ if (op1_size < 0)
{
- mp_ptr opx, opy;
+ mp_ptr opy;
/* Both operands are negative, the result will be positive.
(-OP1) ^ (-OP2) =
@@ -109,7 +83,6 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
= (OP1 - 1) ^ (OP2 - 1) */
op1_size = -op1_size;
- op2_size = -op2_size;
/* Possible optimization: Decrease mpn_sub precision,
as we won't use the entire res of both. */
@@ -117,78 +90,57 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
mpn_sub_1 (opx, op1_ptr, op1_size, (mp_limb_t) 1);
op1_ptr = opx;
- mpn_sub_1 (opy, op2_ptr, op2_size, (mp_limb_t) 1);
+ mpn_sub_1 (opy, PTR(op2), op2_size, (mp_limb_t) 1);
op2_ptr = opy;
- if (op1_size > op2_size)
- MPN_SRCPTR_SWAP (op1_ptr,op1_size, op2_ptr,op2_size);
-
- res_alloc = op2_size;
- res_ptr = MPZ_REALLOC (res, res_alloc);
+ res_ptr = MPZ_NEWALLOC (res, op2_size);
+ /* Don't re-read OP1_PTR and OP2_PTR. They point to temporary
+ space--never to the space PTR(res) used to point to before
+ reallocation. */
MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
op2_size - op1_size);
mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op1_size);
+ TMP_FREE;
res_size = op2_size;
MPN_NORMALIZE (res_ptr, res_size);
SIZ(res) = res_size;
- TMP_FREE;
- return;
}
else
{
- /* We should compute -OP1 ^ OP2. Swap OP1 and OP2 and fall
- through to the code that handles OP1 ^ -OP2. */
- MPZ_SRCPTR_SWAP (op1, op2);
- MPN_SRCPTR_SWAP (op1_ptr,op1_size, op2_ptr,op2_size);
- }
- }
+ /* Operand 2 negative, so will be the result.
+ -(OP1 ^ (-OP2)) = -(OP1 ^ ~(OP2 - 1)) =
+ = ~(OP1 ^ ~(OP2 - 1)) + 1 =
+ = (OP1 ^ (OP2 - 1)) + 1 */
- {
- mp_ptr opx;
- mp_limb_t cy;
-
- /* Operand 2 negative, so will be the result.
- -(OP1 ^ (-OP2)) = -(OP1 ^ ~(OP2 - 1)) =
- = ~(OP1 ^ ~(OP2 - 1)) + 1 =
- = (OP1 ^ (OP2 - 1)) + 1 */
-
- op2_size = -op2_size;
-
- opx = TMP_ALLOC_LIMBS (op2_size);
- mpn_sub_1 (opx, op2_ptr, op2_size, (mp_limb_t) 1);
- op2_ptr = opx;
-
- res_alloc = MAX (op1_size, op2_size) + 1;
- if (ALLOC(res) < res_alloc)
- {
- _mpz_realloc (res, res_alloc);
- op1_ptr = PTR(op1);
- /* op2_ptr points to temporary space. */
- res_ptr = PTR(res);
- }
-
- if (op1_size > op2_size)
- {
- MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, op1_size - op2_size);
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op2_size);
- res_size = op1_size;
- }
- else
- {
- MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size, op2_size - op1_size);
- if (LIKELY (op1_size != 0))
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op1_size);
- res_size = op2_size;
- }
+ res_size = MAX (op1_size, op2_size);
+ res_ptr = MPZ_REALLOC (res, res_size + 1);
+ op1_ptr = PTR(op1);
- cy = mpn_add_1 (res_ptr, res_ptr, res_size, (mp_limb_t) 1);
- res_ptr[res_size] = cy;
- res_size += (cy != 0);
+ opx = TMP_ALLOC_LIMBS (op2_size);
+ mpn_sub_1 (opx, PTR(op2), op2_size, (mp_limb_t) 1);
+ op2_ptr = opx;
- MPN_NORMALIZE (res_ptr, res_size);
- SIZ(res) = -res_size;
- TMP_FREE;
- }
+ if (res_size == op1_size)
+ {
+ MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, op1_size - op2_size);
+ mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op2_size);
+ }
+ else
+ {
+ MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size, op2_size - op1_size);
+ if (LIKELY (op1_size != 0))
+ mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op1_size);
+ }
+ TMP_FREE;
+
+ res_ptr[res_size] = 0;
+ MPN_INCR_U (res_ptr, res_size + 1, (mp_limb_t) 1);
+ res_size += res_ptr[res_size];
+
+ MPN_NORMALIZE_NOT_ZERO (res_ptr, res_size);
+ SIZ(res) = -res_size;
+ }
+ }
}
diff --git a/Build/source/libs/gmp/gmp-src/nextprime.c b/Build/source/libs/gmp/gmp-src/nextprime.c
index dd9ded58739..e8e60dd3cb7 100644
--- a/Build/source/libs/gmp/gmp-src/nextprime.c
+++ b/Build/source/libs/gmp/gmp-src/nextprime.c
@@ -52,7 +52,6 @@ see https://www.gnu.org/licenses/. */
division.
*/
-#include "gmp.h"
#include "gmp-impl.h"
#include <string.h> /* for memset */
diff --git a/Build/source/libs/gmp/gmp-src/primesieve.c b/Build/source/libs/gmp/gmp-src/primesieve.c
index 569e4cecea9..f6cdf36f2ee 100644
--- a/Build/source/libs/gmp/gmp-src/primesieve.c
+++ b/Build/source/libs/gmp/gmp-src/primesieve.c
@@ -7,7 +7,7 @@ IT IS ONLY 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 2010-2012 Free Software Foundation, Inc.
+Copyright 2010-2012, 2015, 2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,47 +35,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 "gmp.h"
#include "gmp-impl.h"
-/**************************************************************/
-/* Section macros: common macros, for mswing/fac/bin (&sieve) */
-/**************************************************************/
-
-#define LOOP_ON_SIEVE_CONTINUE(prime,end,sieve) \
- __max_i = (end); \
- \
- do { \
- ++__i; \
- if (((sieve)[__index] & __mask) == 0) \
- { \
- (prime) = id_to_n(__i)
-
-#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
- do { \
- mp_limb_t __mask, __index, __max_i, __i; \
- \
- __i = (start)-(off); \
- __index = __i / GMP_LIMB_BITS; \
- __mask = CNST_LIMB(1) << (__i % GMP_LIMB_BITS); \
- __i += (off); \
- \
- LOOP_ON_SIEVE_CONTINUE(prime,end,sieve)
-
-#define LOOP_ON_SIEVE_STOP \
- } \
- __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
- __index += __mask & 1; \
- } while (__i <= __max_i) \
-
-#define LOOP_ON_SIEVE_END \
- LOOP_ON_SIEVE_STOP; \
- } while (0)
-
-/*********************************************************/
-/* Section sieve: sieving functions and tools for primes */
-/*********************************************************/
-
#if 0
static mp_limb_t
bit_to_n (mp_limb_t bit) { return (bit*3+4)|1; }
@@ -96,11 +57,30 @@ primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
#if GMP_LIMB_BITS > 61
#define SIEVE_SEED CNST_LIMB(0x3294C9E069128480)
+#if GMP_LIMB_BITS == 64
+/* 110bits pre-sieved mask for primes 5, 11*/
+#define SIEVE_MASK1 CNST_LIMB(0x81214a1204892058)
+#define SIEVE_MASKT CNST_LIMB(0xc8130681244)
+/* 182bits pre-sieved mask for primes 7, 13*/
+#define SIEVE_2MSK1 CNST_LIMB(0x9402180c40230184)
+#define SIEVE_2MSK2 CNST_LIMB(0x0285021088402120)
+#define SIEVE_2MSKT CNST_LIMB(0xa41210084421)
+#define SEED_LIMIT 210
+#else
#define SEED_LIMIT 202
+#endif
#else
#if GMP_LIMB_BITS > 30
#define SIEVE_SEED CNST_LIMB(0x69128480)
+#if GMP_LIMB_BITS == 32
+/* 70bits pre-sieved mask for primes 5, 7*/
+#define SIEVE_MASK1 CNST_LIMB(0x12148960)
+#define SIEVE_MASK2 CNST_LIMB(0x44a120cc)
+#define SIEVE_MASKT CNST_LIMB(0x1a)
+#define SEED_LIMIT 120
+#else
#define SEED_LIMIT 114
+#endif
#else
#if GMP_LIMB_BITS > 15
#define SIEVE_SEED CNST_LIMB(0x8480)
@@ -117,32 +97,179 @@ primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
#endif /* 30 */
#endif /* 61 */
+#define SET_OFF1(m1, m2, M1, M2, off, BITS) \
+ if (off) { \
+ if (off < GMP_LIMB_BITS) { \
+ m1 = (M1 >> off) | (M2 << (GMP_LIMB_BITS - off)); \
+ if (off <= BITS - GMP_LIMB_BITS) { \
+ m2 = M1 << (BITS - GMP_LIMB_BITS - off) \
+ | M2 >> off; \
+ } else { \
+ m1 |= M1 << (BITS - off); \
+ m2 = M1 >> (off + GMP_LIMB_BITS - BITS); \
+ } \
+ } else { \
+ m1 = M1 << (BITS - off) \
+ | M2 >> (off - GMP_LIMB_BITS); \
+ m2 = M2 << (BITS - off) \
+ | M1 >> (off + GMP_LIMB_BITS - BITS); \
+ } \
+ } else { \
+ m1 = M1; m2 = M2; \
+ }
+
+#define SET_OFF2(m1, m2, m3, M1, M2, M3, off, BITS) \
+ if (off) { \
+ if (off <= GMP_LIMB_BITS) { \
+ m1 = M2 << (GMP_LIMB_BITS - off); \
+ m2 = M3 << (GMP_LIMB_BITS - off); \
+ if (off != GMP_LIMB_BITS) { \
+ m1 |= (M1 >> off); \
+ m2 |= (M2 >> off); \
+ } \
+ if (off <= BITS - 2 * GMP_LIMB_BITS) { \
+ m3 = M1 << (BITS - 2 * GMP_LIMB_BITS - off) \
+ | M3 >> off; \
+ } else { \
+ m2 |= M1 << (BITS - GMP_LIMB_BITS - off); \
+ m3 = M1 >> (off + 2 * GMP_LIMB_BITS - BITS); \
+ } \
+ } else if (off < 2 *GMP_LIMB_BITS) { \
+ m1 = M2 >> (off - GMP_LIMB_BITS) \
+ | M3 << (2 * GMP_LIMB_BITS - off); \
+ if (off <= BITS - GMP_LIMB_BITS) { \
+ m2 = M3 >> (off - GMP_LIMB_BITS) \
+ | M1 << (BITS - GMP_LIMB_BITS - off); \
+ m3 = M2 << (BITS - GMP_LIMB_BITS - off); \
+ if (off != BITS - GMP_LIMB_BITS) { \
+ m3 |= M1 >> (off + 2 * GMP_LIMB_BITS - BITS); \
+ } \
+ } else { \
+ m1 |= M1 << (BITS - off); \
+ m2 = M2 << (BITS - off) \
+ | M1 >> (GMP_LIMB_BITS - BITS + off); \
+ m3 = M2 >> (GMP_LIMB_BITS - BITS + off); \
+ } \
+ } else { \
+ m1 = M1 << (BITS - off) \
+ | M3 >> (off - 2 * GMP_LIMB_BITS); \
+ m2 = M2 << (BITS - off) \
+ | M1 >> (off + GMP_LIMB_BITS - BITS); \
+ m3 = M3 << (BITS - off) \
+ | M2 >> (off + GMP_LIMB_BITS - BITS); \
+ } \
+ } else { \
+ m1 = M1; m2 = M2; m3 = M3; \
+ }
+
+#define ROTATE1(m1, m2, BITS) \
+ do { \
+ mp_limb_t __tmp; \
+ __tmp = m1 >> (2 * GMP_LIMB_BITS - BITS); \
+ m1 = (m1 << (BITS - GMP_LIMB_BITS)) | m2; \
+ m2 = __tmp; \
+ } while (0)
+
+#define ROTATE2(m1, m2, m3, BITS) \
+ do { \
+ mp_limb_t __tmp; \
+ __tmp = m2 >> (3 * GMP_LIMB_BITS - BITS); \
+ m2 = m2 << (BITS - GMP_LIMB_BITS * 2) \
+ | m1 >> (3 * GMP_LIMB_BITS - BITS); \
+ m1 = m1 << (BITS - GMP_LIMB_BITS * 2) | m3; \
+ m3 = __tmp; \
+ } while (0)
+
+static mp_limb_t
+fill_bitpattern (mp_ptr bit_array, mp_size_t limbs, mp_limb_t offset)
+{
+#ifdef SIEVE_2MSK2
+ mp_limb_t m11, m12, m21, m22, m23;
+
+ if (offset == 0) { /* This branch is not needed. */
+ m11 = SIEVE_MASK1;
+ m12 = SIEVE_MASKT;
+ m21 = SIEVE_2MSK1;
+ m22 = SIEVE_2MSK2;
+ m23 = SIEVE_2MSKT;
+ } else { /* correctly handle offset == 0... */
+ m21 = offset % 110;
+ SET_OFF1 (m11, m12, SIEVE_MASK1, SIEVE_MASKT, m21, 110);
+ offset %= 182;
+ SET_OFF2 (m21, m22, m23, SIEVE_2MSK1, SIEVE_2MSK2, SIEVE_2MSKT, offset, 182);
+ }
+ /* THINK: Consider handling odd values of 'limbs' outside the loop,
+ to have a single exit condition. */
+ do {
+ bit_array[0] = m11 | m21;
+ if (--limbs == 0)
+ break;
+ ROTATE1 (m11, m12, 110);
+ bit_array[1] = m11 | m22;
+ bit_array += 2;
+ ROTATE1 (m11, m12, 110);
+ ROTATE2 (m21, m22, m23, 182);
+ } while (--limbs != 0);
+ return 4;
+#else
+#ifdef SIEVE_MASK2
+ mp_limb_t mask, mask2, tail;
+
+ if (offset == 0) { /* This branch is not needed. */
+ mask = SIEVE_MASK1;
+ mask2 = SIEVE_MASK2;
+ tail = SIEVE_MASKT;
+ } else { /* correctly handle offset == 0... */
+ offset %= 70;
+ SET_OFF2 (mask, mask2, tail, SIEVE_MASK1, SIEVE_MASK2, SIEVE_MASKT, offset, 70);
+ }
+ /* THINK: Consider handling odd values of 'limbs' outside the loop,
+ to have a single exit condition. */
+ do {
+ bit_array[0] = mask;
+ if (--limbs == 0)
+ break;
+ bit_array[1] = mask2;
+ bit_array += 2;
+ ROTATE2 (mask, mask2, tail, 70);
+ } while (--limbs != 0);
+ return 2;
+#else
+ MPN_FILL (bit_array, limbs, CNST_LIMB(0));
+ return 0;
+#endif
+#endif
+}
+
static void
first_block_primesieve (mp_ptr bit_array, mp_limb_t n)
{
mp_size_t bits, limbs;
+ mp_limb_t i;
ASSERT (n > 4);
bits = n_to_bit(n);
- limbs = bits / GMP_LIMB_BITS + 1;
+ limbs = bits / GMP_LIMB_BITS;
- /* FIXME: We can skip 5 too, filling with a 5-part pattern. */
- MPN_ZERO (bit_array, limbs);
+ if (limbs != 0)
+ i = fill_bitpattern (bit_array + 1, limbs, 0);
bit_array[0] = SIEVE_SEED;
if ((bits + 1) % GMP_LIMB_BITS != 0)
- bit_array[limbs-1] |= MP_LIMB_T_MAX << ((bits + 1) % GMP_LIMB_BITS);
+ bit_array[limbs] |= MP_LIMB_T_MAX << ((bits + 1) % GMP_LIMB_BITS);
if (n > SEED_LIMIT) {
- mp_limb_t mask, index, i;
+ mp_limb_t mask, index;
- ASSERT (n > 49);
+ ASSERT (i < GMP_LIMB_BITS);
- mask = 1;
+ if (n_to_bit (SEED_LIMIT + 1) < GMP_LIMB_BITS)
+ i = 0;
+ mask = CNST_LIMB(1) << i;
index = 0;
- i = 1;
do {
+ ++i;
if ((bit_array[index] & mask) == 0)
{
mp_size_t step, lindex;
@@ -177,67 +304,75 @@ first_block_primesieve (mp_ptr bit_array, mp_limb_t n)
}
mask = mask << 1 | mask >> (GMP_LIMB_BITS-1);
index += mask & 1;
- i++;
} while (1);
}
}
static void
block_resieve (mp_ptr bit_array, mp_size_t limbs, mp_limb_t offset,
- mp_srcptr sieve, mp_limb_t sieve_bits)
+ mp_srcptr sieve)
{
- mp_size_t bits, step;
+ mp_size_t bits, off = offset;
+ mp_limb_t mask, index, i;
ASSERT (limbs > 0);
+ ASSERT (offset >= GMP_LIMB_BITS);
bits = limbs * GMP_LIMB_BITS - 1;
- /* FIXME: We can skip 5 too, filling with a 5-part pattern. */
- MPN_ZERO (bit_array, limbs);
+ i = fill_bitpattern (bit_array, limbs, offset - GMP_LIMB_BITS);
- LOOP_ON_SIEVE_BEGIN(step,0,sieve_bits,0,sieve);
- {
- mp_size_t lindex;
- mp_limb_t lmask;
- unsigned maskrot;
+ ASSERT (i < GMP_LIMB_BITS);
-/* lindex = n_to_bit(id_to_n(i)*id_to_n(i)); */
- lindex = __i*(step+1)-1+(-(__i&1)&(__i+1));
-/* lindex = __i*(step+1+(__i&1))-1+(__i&1); */
- if (lindex > bits + offset)
- break;
+ mask = CNST_LIMB(1) << i;
+ index = 0;
+ do {
+ ++i;
+ if ((sieve[index] & mask) == 0)
+ {
+ mp_size_t step, lindex;
+ mp_limb_t lmask;
+ unsigned maskrot;
- step <<= 1;
- maskrot = step % GMP_LIMB_BITS;
+ step = id_to_n(i);
- if (lindex < offset)
- lindex += step * ((offset - lindex - 1) / step + 1);
+/* lindex = n_to_bit(id_to_n(i)*id_to_n(i)); */
+ lindex = i*(step+1)-1+(-(i&1)&(i+1));
+/* lindex = i*(step+1+(i&1))-1+(i&1); */
+ if (lindex > bits + off)
+ break;
- lindex -= offset;
+ step <<= 1;
+ maskrot = step % GMP_LIMB_BITS;
- lmask = CNST_LIMB(1) << (lindex % GMP_LIMB_BITS);
- for ( ; lindex <= bits; lindex += step) {
- bit_array[lindex / GMP_LIMB_BITS] |= lmask;
- lmask = lmask << maskrot | lmask >> (GMP_LIMB_BITS - maskrot);
- };
+ if (lindex < off)
+ lindex += step * ((off - lindex - 1) / step + 1);
-/* lindex = n_to_bit(id_to_n(i)*bit_to_n(i)); */
- lindex = __i*(__i*3+6)+(__i&1);
- if (lindex > bits + offset)
- continue;
+ lindex -= off;
- if (lindex < offset)
- lindex += step * ((offset - lindex - 1) / step + 1);
+ lmask = CNST_LIMB(1) << (lindex % GMP_LIMB_BITS);
+ for ( ; lindex <= bits; lindex += step) {
+ bit_array[lindex / GMP_LIMB_BITS] |= lmask;
+ lmask = lmask << maskrot | lmask >> (GMP_LIMB_BITS - maskrot);
+ };
- lindex -= offset;
+/* lindex = n_to_bit(id_to_n(i)*bit_to_n(i)); */
+ lindex = i*(i*3+6)+(i&1);
- lmask = CNST_LIMB(1) << (lindex % GMP_LIMB_BITS);
- for ( ; lindex <= bits; lindex += step) {
- bit_array[lindex / GMP_LIMB_BITS] |= lmask;
- lmask = lmask << maskrot | lmask >> (GMP_LIMB_BITS - maskrot);
- };
- }
- LOOP_ON_SIEVE_END;
+ if (lindex < off)
+ lindex += step * ((off - lindex - 1) / step + 1);
+
+ lindex -= off;
+
+ lmask = CNST_LIMB(1) << (lindex % GMP_LIMB_BITS);
+ for ( ; lindex <= bits; lindex += step) {
+ bit_array[lindex / GMP_LIMB_BITS] |= lmask;
+ lmask = lmask << maskrot | lmask >> (GMP_LIMB_BITS - maskrot);
+ };
+ }
+ mask = mask << 1 | mask >> (GMP_LIMB_BITS-1);
+ index += mask & 1;
+ } while (1);
}
#define BLOCK_SIZE 2048
@@ -273,8 +408,9 @@ gmp_primesieve (mp_ptr bit_array, mp_limb_t n)
mp_size_t off;
off = BLOCK_SIZE + (size % BLOCK_SIZE);
first_block_primesieve (bit_array, id_to_n (off * GMP_LIMB_BITS));
- for ( ; off < size; off += BLOCK_SIZE)
- block_resieve (bit_array + off, BLOCK_SIZE, off * GMP_LIMB_BITS, bit_array, off * GMP_LIMB_BITS - 1);
+ do {
+ block_resieve (bit_array + off, BLOCK_SIZE, off * GMP_LIMB_BITS, bit_array);
+ } while ((off += BLOCK_SIZE) < size);
} else {
first_block_primesieve (bit_array, n);
}
@@ -282,14 +418,19 @@ gmp_primesieve (mp_ptr bit_array, mp_limb_t n)
if ((bits + 1) % GMP_LIMB_BITS != 0)
bit_array[size-1] |= MP_LIMB_T_MAX << ((bits + 1) % GMP_LIMB_BITS);
-
return size * GMP_LIMB_BITS - mpn_popcount (bit_array, size);
}
#undef BLOCK_SIZE
#undef SEED_LIMIT
#undef SIEVE_SEED
-#undef LOOP_ON_SIEVE_END
-#undef LOOP_ON_SIEVE_STOP
-#undef LOOP_ON_SIEVE_BEGIN
-#undef LOOP_ON_SIEVE_CONTINUE
+#undef SIEVE_MASK1
+#undef SIEVE_MASK2
+#undef SIEVE_MASKT
+#undef SIEVE_2MSK1
+#undef SIEVE_2MSK2
+#undef SIEVE_2MSKT
+#undef SET_OFF1
+#undef SET_OFF2
+#undef ROTATE1
+#undef ROTATE2
diff --git a/Build/source/libs/gmp/gmp-src/printf/asprintf.c b/Build/source/libs/gmp/gmp-src/printf/asprintf.c
index b35d9b10c82..da87b755dd0 100644
--- a/Build/source/libs/gmp/gmp-src/printf/asprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/asprintf.c
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/asprntffuns.c b/Build/source/libs/gmp/gmp-src/printf/asprntffuns.c
index c141b7a99e0..022a80ca772 100644
--- a/Build/source/libs/gmp/gmp-src/printf/asprntffuns.c
+++ b/Build/source/libs/gmp/gmp-src/printf/asprntffuns.c
@@ -38,7 +38,6 @@ see https://www.gnu.org/licenses/. */
#include <stdlib.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/doprnt.c b/Build/source/libs/gmp/gmp-src/printf/doprnt.c
index f3e3e4e1b7c..fa3f3029f95 100644
--- a/Build/source/libs/gmp/gmp-src/printf/doprnt.c
+++ b/Build/source/libs/gmp/gmp-src/printf/doprnt.c
@@ -63,7 +63,6 @@ see https://www.gnu.org/licenses/. */
#include <sys/types.h> /* for quad_t */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
@@ -340,7 +339,7 @@ __gmp_doprnt (const struct doprnt_funs_t *funs, void *data,
va_arg (ap, mpz_srcptr));
gmp_integer:
ret = __gmp_doprnt_integer (funs, data, &param, gmp_str);
- (*__gmp_free_func) (gmp_str, strlen(gmp_str)+1);
+ __GMP_FREE_FUNC_TYPE (gmp_str, strlen(gmp_str)+1, char);
DOPRNT_ACCUMULATE (ret);
va_copy (last_ap, ap);
last_fmt = fmt;
@@ -618,7 +617,7 @@ __gmp_doprnt (const struct doprnt_funs_t *funs, void *data,
goto error;
done:
- (*__gmp_free_func) (alloc_fmt, alloc_fmt_size);
+ __GMP_FREE_FUNC_TYPE (alloc_fmt, alloc_fmt_size, char);
return retval;
error:
diff --git a/Build/source/libs/gmp/gmp-src/printf/doprntf.c b/Build/source/libs/gmp/gmp-src/printf/doprntf.c
index c501e8d06b2..2a7e0d234fc 100644
--- a/Build/source/libs/gmp/gmp-src/printf/doprntf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/doprntf.c
@@ -38,7 +38,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <stdlib.h>
-#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -381,7 +380,7 @@ __gmp_doprnt_mpf (const struct doprnt_funs_t *funs,
DOPRNT_REPS (p->fill, justlen);
done:
- (*__gmp_free_func) (free_ptr, free_size);
+ __GMP_FREE_FUNC_TYPE (free_ptr, free_size, char);
return retval;
error:
diff --git a/Build/source/libs/gmp/gmp-src/printf/doprnti.c b/Build/source/libs/gmp/gmp-src/printf/doprnti.c
index c4cb9c8da8d..61ff64326eb 100644
--- a/Build/source/libs/gmp/gmp-src/printf/doprnti.c
+++ b/Build/source/libs/gmp/gmp-src/printf/doprnti.c
@@ -37,7 +37,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <stdlib.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/fprintf.c b/Build/source/libs/gmp/gmp-src/printf/fprintf.c
index 2d8187d7cfc..0008b3b6dcc 100644
--- a/Build/source/libs/gmp/gmp-src/printf/fprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/fprintf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/obprintf.c b/Build/source/libs/gmp/gmp-src/printf/obprintf.c
index fbf3ea768f7..c12d6de6c94 100644
--- a/Build/source/libs/gmp/gmp-src/printf/obprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/obprintf.c
@@ -1,6 +1,6 @@
/* gmp_obstack_printf -- formatted output to an obstack.
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -36,7 +36,6 @@ see https://www.gnu.org/licenses/. */
#include <obstack.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -56,4 +55,6 @@ gmp_obstack_printf (struct obstack *ob, const char *fmt, ...)
return ret;
}
+#else
+typedef int __gmp_dummy_typedef;
#endif /* HAVE_OBSTACK_VPRINTF */
diff --git a/Build/source/libs/gmp/gmp-src/printf/obprntffuns.c b/Build/source/libs/gmp/gmp-src/printf/obprntffuns.c
index 4cd1a91dec5..a23e4e85f3c 100644
--- a/Build/source/libs/gmp/gmp-src/printf/obprntffuns.c
+++ b/Build/source/libs/gmp/gmp-src/printf/obprntffuns.c
@@ -5,7 +5,7 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001 Free Software Foundation, Inc.
+Copyright 2001, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -44,7 +44,6 @@ see https://www.gnu.org/licenses/. */
#include <string.h>
#include <obstack.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -69,4 +68,6 @@ const struct doprnt_funs_t __gmp_obstack_printf_funs = {
(doprnt_reps_t) gmp_obstack_reps
};
+#else
+typedef int __gmp_dummy_typedef;
#endif /* HAVE_OBSTACK_VPRINTF */
diff --git a/Build/source/libs/gmp/gmp-src/printf/obvprintf.c b/Build/source/libs/gmp/gmp-src/printf/obvprintf.c
index 31eddbdf2a6..7563c111e7c 100644
--- a/Build/source/libs/gmp/gmp-src/printf/obvprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/obvprintf.c
@@ -1,6 +1,6 @@
/* gmp_obstack_vprintf -- formatted output to an obstack.
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -36,7 +36,6 @@ see https://www.gnu.org/licenses/. */
#include <obstack.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -49,4 +48,6 @@ gmp_obstack_vprintf (struct obstack *ob, const char *fmt, va_list ap)
return __gmp_doprnt (&__gmp_obstack_printf_funs, ob, fmt, ap);
}
+#else
+typedef int __gmp_dummy_typedef;
#endif /* HAVE_OBSTACK_VPRINTF */
diff --git a/Build/source/libs/gmp/gmp-src/printf/printf.c b/Build/source/libs/gmp/gmp-src/printf/printf.c
index 7ac7b62faea..4becb0b21c6 100644
--- a/Build/source/libs/gmp/gmp-src/printf/printf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/printf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/printffuns.c b/Build/source/libs/gmp/gmp-src/printf/printffuns.c
index 058c6b9d8bc..957381d4c25 100644
--- a/Build/source/libs/gmp/gmp-src/printf/printffuns.c
+++ b/Build/source/libs/gmp/gmp-src/printf/printffuns.c
@@ -36,7 +36,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
/* SunOS 4 stdio.h doesn't provide a prototype for this */
diff --git a/Build/source/libs/gmp/gmp-src/printf/repl-vsnprintf.c b/Build/source/libs/gmp/gmp-src/printf/repl-vsnprintf.c
index a95003baa62..d2286712218 100644
--- a/Build/source/libs/gmp/gmp-src/printf/repl-vsnprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/repl-vsnprintf.c
@@ -5,7 +5,7 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -35,9 +35,6 @@ see https://www.gnu.org/licenses/. */
#include "config.h"
-#if ! HAVE_VSNPRINTF /* only need this file if we don't have vsnprintf */
-
-
#define _GNU_SOURCE /* for strnlen prototype */
#include <stdarg.h>
@@ -63,10 +60,11 @@ see https://www.gnu.org/licenses/. */
#include <sys/types.h> /* for quad_t */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
+#if ! HAVE_VSNPRINTF /* only need this file if we don't have vsnprintf */
+
/* Autoconf notes that AIX 4.3 has a broken strnlen, but fortunately it
doesn't affect us since __gmp_replacement_vsnprintf is not required on
that system. */
@@ -244,7 +242,7 @@ __gmp_replacement_vsnprintf (char *buf, size_t buf_size,
}
else
(void) va_arg (ap, double);
- break;
+ goto next;
case 'f':
/* Requested decimals, sign and point, and a margin for error,
@@ -265,7 +263,7 @@ __gmp_replacement_vsnprintf (char *buf, size_t buf_size,
(void) va_arg (ap, double);
total_width += double_digits;
}
- break;
+ goto next;
case 'h': /* short or char */
case 'j': /* intmax_t */
@@ -383,7 +381,7 @@ __gmp_replacement_vsnprintf (char *buf, size_t buf_size,
memcpy (buf, s, copylen);
buf[copylen] = '\0';
}
- (*__gmp_free_func) (s, total_width);
+ __GMP_FREE_FUNC_TYPE (s, total_width, char);
}
/* If total_width was somehow wrong then chances are we've already
diff --git a/Build/source/libs/gmp/gmp-src/printf/snprintf.c b/Build/source/libs/gmp/gmp-src/printf/snprintf.c
index fde5c806ebe..8da33f81c85 100644
--- a/Build/source/libs/gmp/gmp-src/printf/snprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/snprintf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <string.h> /* for strlen */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/snprntffuns.c b/Build/source/libs/gmp/gmp-src/printf/snprntffuns.c
index 41a7670c6da..885c7ab57e9 100644
--- a/Build/source/libs/gmp/gmp-src/printf/snprntffuns.c
+++ b/Build/source/libs/gmp/gmp-src/printf/snprntffuns.c
@@ -4,7 +4,7 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -36,7 +36,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -63,7 +62,8 @@ static int
gmp_snprintf_format (struct gmp_snprintf_t *d, const char *fmt,
va_list orig_ap)
{
- int ret, step, alloc, avail;
+ int ret;
+ size_t step, alloc, avail;
va_list ap;
char *p;
@@ -75,10 +75,7 @@ gmp_snprintf_format (struct gmp_snprintf_t *d, const char *fmt,
va_copy (ap, orig_ap);
ret = vsnprintf (d->buf, avail, fmt, ap);
if (ret == -1)
- {
- ASSERT (strlen (d->buf) == avail-1);
- ret = avail-1;
- }
+ return ret;
step = MIN (ret, avail-1);
d->size -= step;
@@ -102,9 +99,9 @@ gmp_snprintf_format (struct gmp_snprintf_t *d, const char *fmt,
p = __GMP_ALLOCATE_FUNC_TYPE (alloc, char);
va_copy (ap, orig_ap);
ret = vsnprintf (p, alloc, fmt, ap);
- (*__gmp_free_func) (p, alloc);
+ __GMP_FREE_FUNC_TYPE (p, alloc, char);
}
- while (ret == alloc-1 || ret == -1);
+ while (ret == alloc-1);
return ret;
}
diff --git a/Build/source/libs/gmp/gmp-src/printf/sprintf.c b/Build/source/libs/gmp/gmp-src/printf/sprintf.c
index 052a2655c9e..0952a5334ce 100644
--- a/Build/source/libs/gmp/gmp-src/printf/sprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/sprintf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <string.h> /* for strlen */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/sprintffuns.c b/Build/source/libs/gmp/gmp-src/printf/sprintffuns.c
index 97969cdb50c..6781f258286 100644
--- a/Build/source/libs/gmp/gmp-src/printf/sprintffuns.c
+++ b/Build/source/libs/gmp/gmp-src/printf/sprintffuns.c
@@ -37,7 +37,6 @@ see https://www.gnu.org/licenses/. */
#include <stdlib.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/vasprintf.c b/Build/source/libs/gmp/gmp-src/printf/vasprintf.c
index 44785dae2a7..8a29a123400 100644
--- a/Build/source/libs/gmp/gmp-src/printf/vasprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/vasprintf.c
@@ -33,7 +33,6 @@ see https://www.gnu.org/licenses/. */
#include <stdlib.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
#if ! HAVE_VSNPRINTF
diff --git a/Build/source/libs/gmp/gmp-src/printf/vfprintf.c b/Build/source/libs/gmp/gmp-src/printf/vfprintf.c
index 839f133d9db..b2d190667fa 100644
--- a/Build/source/libs/gmp/gmp-src/printf/vfprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/vfprintf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/vprintf.c b/Build/source/libs/gmp/gmp-src/printf/vprintf.c
index 8e768978f56..60a22339654 100644
--- a/Build/source/libs/gmp/gmp-src/printf/vprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/vprintf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/vsnprintf.c b/Build/source/libs/gmp/gmp-src/printf/vsnprintf.c
index ed6f99885dd..2432f5d921f 100644
--- a/Build/source/libs/gmp/gmp-src/printf/vsnprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/vsnprintf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <string.h> /* for strlen */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/printf/vsprintf.c b/Build/source/libs/gmp/gmp-src/printf/vsprintf.c
index 099455d3254..26de193f122 100644
--- a/Build/source/libs/gmp/gmp-src/printf/vsprintf.c
+++ b/Build/source/libs/gmp/gmp-src/printf/vsprintf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <string.h> /* for strlen */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/rand/rand.c b/Build/source/libs/gmp/gmp-src/rand/rand.c
index 09e3b765bcd..418b3dec7d8 100644
--- a/Build/source/libs/gmp/gmp-src/rand/rand.c
+++ b/Build/source/libs/gmp/gmp-src/rand/rand.c
@@ -30,7 +30,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
-#include "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/rand/randbui.c b/Build/source/libs/gmp/gmp-src/rand/randbui.c
index 619ab91bd15..de9e95b9a55 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randbui.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randbui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/rand/randclr.c b/Build/source/libs/gmp/gmp-src/rand/randclr.c
index fb3798b73de..5603ed7e75d 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randclr.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randclr.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/rand/randdef.c b/Build/source/libs/gmp/gmp-src/rand/randdef.c
index 7d173f9364c..a8a1792ec56 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randdef.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randdef.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/rand/randiset.c b/Build/source/libs/gmp/gmp-src/rand/randiset.c
index 66f4bc49033..11b5b971efb 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randiset.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randiset.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/rand/randlc2s.c b/Build/source/libs/gmp/gmp-src/rand/randlc2s.c
index 013e877286d..42ed8c45057 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randlc2s.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randlc2s.c
@@ -30,7 +30,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/rand/randlc2x.c b/Build/source/libs/gmp/gmp-src/rand/randlc2x.c
index 195f759327a..4c03eb46f55 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randlc2x.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randlc2x.c
@@ -1,6 +1,6 @@
/* Linear Congruential pseudo-random number generator functions.
-Copyright 1999-2003, 2005 Free Software Foundation, Inc.
+Copyright 1999-2003, 2005, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
@@ -319,7 +318,7 @@ gmp_randinit_lc_2exp (gmp_randstate_t rstate,
if (SIZ (p->_mp_a) == 0)
{
SIZ (p->_mp_a) = 1;
- PTR (p->_mp_a)[0] = CNST_LIMB (0);
+ MPZ_NEWALLOC (p->_mp_a, 1)[0] = CNST_LIMB (0);
}
MPN_SET_UI (p->_cp, p->_cn, c);
diff --git a/Build/source/libs/gmp/gmp-src/rand/randmt.c b/Build/source/libs/gmp/gmp-src/rand/randmt.c
index f3cdc666626..a05e76a44f2 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randmt.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randmt.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h> /* for NULL */
-#include "gmp.h"
#include "gmp-impl.h"
#include "randmt.h"
@@ -378,7 +377,7 @@ __gmp_randiset_mt (gmp_randstate_ptr dst, gmp_randstate_srcptr src)
mp_size_t i;
/* Set the generator functions. */
- RNG_FNPTR (dst) = (void *) &Mersenne_Twister_Generator_Noseed;
+ RNG_FNPTR (dst) = RNG_FNPTR(src);
/* Allocate the MT-specific state. */
dstp = (gmp_rand_mt_struct *) __GMP_ALLOCATE_FUNC_LIMBS (sz);
diff --git a/Build/source/libs/gmp/gmp-src/rand/randmts.c b/Build/source/libs/gmp/gmp-src/rand/randmts.c
index 7c1c262f5c4..2c3fc099108 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randmts.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randmts.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "randmt.h"
diff --git a/Build/source/libs/gmp/gmp-src/rand/randmui.c b/Build/source/libs/gmp/gmp-src/rand/randmui.c
index 2d4ef86aa32..d3292db1bd1 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randmui.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randmui.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
diff --git a/Build/source/libs/gmp/gmp-src/rand/rands.c b/Build/source/libs/gmp/gmp-src/rand/rands.c
index 1701da7a2c0..af436a479b6 100644
--- a/Build/source/libs/gmp/gmp-src/rand/rands.c
+++ b/Build/source/libs/gmp/gmp-src/rand/rands.c
@@ -33,7 +33,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/rand/randsd.c b/Build/source/libs/gmp/gmp-src/rand/randsd.c
index 1214d000d53..b0e3dd65ed3 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randsd.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randsd.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/rand/randsdui.c b/Build/source/libs/gmp/gmp-src/rand/randsdui.c
index 1c97232e30e..46d80ad4c21 100644
--- a/Build/source/libs/gmp/gmp-src/rand/randsdui.c
+++ b/Build/source/libs/gmp/gmp-src/rand/randsdui.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
void
diff --git a/Build/source/libs/gmp/gmp-src/scanf/doscan.c b/Build/source/libs/gmp/gmp-src/scanf/doscan.c
index 47b22706ced..8d9c1bbf2fe 100644
--- a/Build/source/libs/gmp/gmp-src/scanf/doscan.c
+++ b/Build/source/libs/gmp/gmp-src/scanf/doscan.c
@@ -63,7 +63,6 @@ see https://www.gnu.org/licenses/. */
#include <sys/types.h> /* for quad_t */
#endif
-#include "gmp.h"
#include "gmp-impl.h"
@@ -402,7 +401,7 @@ gmpscan (const struct gmp_doscan_funs_t *funs, void *data,
if (exp >= 0)
mpf_mul_2exp (f, f, (unsigned long) exp);
else
- mpf_div_2exp (f, f, - (unsigned long) exp);
+ mpf_div_2exp (f, f, NEG_CAST (unsigned long, exp));
}
}
break;
diff --git a/Build/source/libs/gmp/gmp-src/scanf/fscanf.c b/Build/source/libs/gmp/gmp-src/scanf/fscanf.c
index 83f46169eda..ce74aa4e0fe 100644
--- a/Build/source/libs/gmp/gmp-src/scanf/fscanf.c
+++ b/Build/source/libs/gmp/gmp-src/scanf/fscanf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/scanf/fscanffuns.c b/Build/source/libs/gmp/gmp-src/scanf/fscanffuns.c
index 396e9a175f7..f2d2939dbdf 100644
--- a/Build/source/libs/gmp/gmp-src/scanf/fscanffuns.c
+++ b/Build/source/libs/gmp/gmp-src/scanf/fscanffuns.c
@@ -33,7 +33,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/scanf/scanf.c b/Build/source/libs/gmp/gmp-src/scanf/scanf.c
index a944a7c029c..645188cf780 100644
--- a/Build/source/libs/gmp/gmp-src/scanf/scanf.c
+++ b/Build/source/libs/gmp/gmp-src/scanf/scanf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/scanf/sscanf.c b/Build/source/libs/gmp/gmp-src/scanf/sscanf.c
index b3d12dcda64..4486b835fdf 100644
--- a/Build/source/libs/gmp/gmp-src/scanf/sscanf.c
+++ b/Build/source/libs/gmp/gmp-src/scanf/sscanf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/scanf/sscanffuns.c b/Build/source/libs/gmp/gmp-src/scanf/sscanffuns.c
index ed5bdf57d34..3ee6b63d52e 100644
--- a/Build/source/libs/gmp/gmp-src/scanf/sscanffuns.c
+++ b/Build/source/libs/gmp/gmp-src/scanf/sscanffuns.c
@@ -34,7 +34,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <stdarg.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/scanf/vfscanf.c b/Build/source/libs/gmp/gmp-src/scanf/vfscanf.c
index 8011b557549..98b810a9610 100644
--- a/Build/source/libs/gmp/gmp-src/scanf/vfscanf.c
+++ b/Build/source/libs/gmp/gmp-src/scanf/vfscanf.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdarg.h>
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/scanf/vscanf.c b/Build/source/libs/gmp/gmp-src/scanf/vscanf.c
index 51feebf72ef..2a8cfc1ca7e 100644
--- a/Build/source/libs/gmp/gmp-src/scanf/vscanf.c
+++ b/Build/source/libs/gmp/gmp-src/scanf/vscanf.c
@@ -32,7 +32,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/scanf/vsscanf.c b/Build/source/libs/gmp/gmp-src/scanf/vsscanf.c
index 6fb043dce25..7c7b98a0e68 100644
--- a/Build/source/libs/gmp/gmp-src/scanf/vsscanf.c
+++ b/Build/source/libs/gmp/gmp-src/scanf/vsscanf.c
@@ -32,7 +32,6 @@ see https://www.gnu.org/licenses/. */
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -48,7 +47,7 @@ gmp_vsscanf (const char *s, const char *fmt, va_list ap)
char *alloc;
int ret;
size = strlen (s) + 1;
- alloc = (char *) (*__gmp_allocate_func) (size);
+ alloc = __GMP_ALLOCATE_FUNC_TYPE (size, char);
memcpy (alloc, s, size);
s = alloc;
ret = __gmp_doscan (&__gmp_sscanf_funs, (void *) &s, fmt, ap);
diff --git a/Build/source/libs/gmp/gmp-src/tal-debug.c b/Build/source/libs/gmp/gmp-src/tal-debug.c
index 35912af360c..38c27aa25ff 100644
--- a/Build/source/libs/gmp/gmp-src/tal-debug.c
+++ b/Build/source/libs/gmp/gmp-src/tal-debug.c
@@ -31,7 +31,6 @@ see https://www.gnu.org/licenses/. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/tal-notreent.c b/Build/source/libs/gmp/gmp-src/tal-notreent.c
index ed162e552b3..083fa842feb 100644
--- a/Build/source/libs/gmp/gmp-src/tal-notreent.c
+++ b/Build/source/libs/gmp/gmp-src/tal-notreent.c
@@ -29,7 +29,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
diff --git a/Build/source/libs/gmp/gmp-src/tal-reent.c b/Build/source/libs/gmp/gmp-src/tal-reent.c
index 92f516b5ff3..fb43e060095 100644
--- a/Build/source/libs/gmp/gmp-src/tal-reent.c
+++ b/Build/source/libs/gmp/gmp-src/tal-reent.c
@@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include <stdio.h>
-#include "gmp.h"
#include "gmp-impl.h"
@@ -61,7 +60,7 @@ __gmp_tmp_reentrant_alloc (struct tmp_reentrant_t **markp, size_t size)
#define P ((struct tmp_reentrant_t *) p)
total_size = size + HSIZ;
- p = (char *) (*__gmp_allocate_func) (total_size);
+ p = __GMP_ALLOCATE_FUNC_TYPE (total_size, char);
P->size = total_size;
P->next = *markp;
*markp = P;
diff --git a/Build/source/libs/gmp/gmp-src/version.c b/Build/source/libs/gmp/gmp-src/version.c
index b75a3389e0e..ee7c32a54b7 100644
--- a/Build/source/libs/gmp/gmp-src/version.c
+++ b/Build/source/libs/gmp/gmp-src/version.c
@@ -28,7 +28,6 @@ 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 "gmp.h"
#include "gmp-impl.h"
const char * const gmp_version = VERSION;
diff --git a/Build/source/libs/gmp/version.ac b/Build/source/libs/gmp/version.ac
index 7a1c20f9da0..a4b4c605ab7 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.1.2])
+m4_define([gmp_version], [6.2.0])